Add linux pack and run scripts.

This commit is contained in:
Krad
2021-10-19 14:09:58 +08:00
parent c432bc5b0c
commit 62d608d0be
2 changed files with 24 additions and 0 deletions

15
scripts/GUI.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
# 获取应用名称(如应用名称为app那么脚本为app.sh
appname=`basename $0 | sed s,\.sh$,,`
# 获取应用当前目录
dirname=`dirname $0`
tmp="${dirname#?}"
# 判断目录是不是根目录
if [ "${dirname%$tmp}" != "/" ];
then
dirname=$PWD/$dirname
fi
# 将当前目录(库所在目录)加入环境变量
LD_LIBRARY_PATH=$dirname
export LD_LIBRARY_PATH
# 运行

9
scripts/pack.sh Normal file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
# 发布程序的名称参数1执行脚本时输入
exe=$1
# 修改输出可执行文件路径(当前路径)
destDir=`pwd`
# ldd将所有依赖库生成字符串组(#注意if后的空格只有一个
dependenLibsList=$(ldd $exe | awk '{if (match($3,"/")){ printf("%s "),$3 } }')
# 将字符串组里面的库拷贝到目标文件夹
cp $dependenLibsList $destDir