-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathpack_app2.sh
executable file
·157 lines (126 loc) · 4.04 KB
/
pack_app2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/bin/bash
#./pack_app2.sh polyvr && ./appimagetool-x86_64.AppImage -n packages/polyvr
#./pack_app2.sh PoscarViewer poscarImport.pvr /c/Users/Victor/Projects/surfacechemistry
appName=$1
appProject=$2
appFolder=$3
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pckFolder="packages/"$appName
if [ ! -e $pckFolder ]; then
mkdir -p $pckFolder
fi
rm -rf $pckFolder/*
if [ -n "$appFolder" ]; then # check is appFolder given
echo " copy app data"
cp -r $appFolder/* $pckFolder/
fi
engFolder=$pckFolder"/engine"
engFolder=$pckFolder
if [ ! -e $engFolder ]; then
mkdir -p $engFolder
fi
echo " copy polyvr"
mkdir $engFolder/src
cp -r bin/Debug/VRFramework $engFolder/
cp -r bin/Debug/*.bin $engFolder/
cp -r bin/Debug/*.dat $engFolder/
cp -r src/cluster $engFolder/src/cluster
cp -r ressources $engFolder/ressources
cp -r setup $engFolder/setup
cp -r shader $engFolder/shader
cp -r examples $engFolder/examples
mkdir -p $engFolder/bin/Debug
cp bin/Debug/*.so $engFolder/bin/Debug/
echo " copy libs"
mkdir -p $engFolder/libs
cp -r /usr/lib/opensg/* $engFolder/libs/
cp -r /usr/lib/CEF/* $engFolder/libs/
cp -r /usr/lib/1.4/* $engFolder/libs/
cp -r /usr/lib/virtuose/* $engFolder/libs/
cp -r /usr/lib/STEPcode/* $engFolder/libs/
cp -r /usr/lib/OCE/* $engFolder/libs/
cp -r /usr/lib/OPCUA/* $engFolder/libs/
cp -r /usr/lib/DWG/* $engFolder/libs/
cp -r /usr/lib/x86_64-linux-gnu/nss/* $engFolder/libs/
echo " copy system libs"
syslibs=$(ldd bin/Debug/VRFramework | awk 'NF == 4 {print $3}; NF == 2 {print $1}');
syslibs_paths=()
while IFS= read -r line; do
syslibs_paths+=("$line")
done <<< "$syslibs"
syslibs_cp_paths=()
for i in "${syslibs_paths[@]}"; do
if [[ "$i" == "not"* ]]; then continue; fi
if [[ "$i" == *"libstdc++.so"* ]]; then continue; fi
if [[ "$i" == *"libgcc_s.so"* ]]; then continue; fi
if [[ "$i" == *"libc.so"* ]]; then continue; fi
if [[ "$i" == *"libz.so"* ]]; then continue; fi
if [[ "$i" == *"libm.so"* ]]; then continue; fi
if [[ "$i" == *"libX11.so"* ]]; then continue; fi
if [[ "$i" == *"libGL.so"* ]]; then continue; fi
if [[ "$i" == *"libxcb.so"* ]]; then continue; fi
if [[ "$i" == *"libgmp.so"* ]]; then continue; fi
if [[ "$i" == *"libGLU.so"* ]]; then continue; fi
if [[ "$i" == *"libglib-2.0.so"* ]]; then continue; fi
if [[ "$i" == *"libGLdispatch.so"* ]]; then continue; fi
if [[ "$i" == *"libGLX.so"* ]]; then continue; fi
if [[ "$i" == *"libOpenGL.so"* ]]; then continue; fi
if [[ "$i" == *"ld-linux-x86-64.so"* ]]; then continue; fi
if [[ "$i" == "/usr/lib/OCE"* ]]; then continue; fi
if [[ "$i" == "/lib"* ]]; then syslibs_cp_paths+=("$i"); fi
if [[ "$i" == "/usr"* ]]; then syslibs_cp_paths+=("$i"); fi
done
for path in "${syslibs_cp_paths[@]}"; do
cp "$path" $engFolder/libs/
done
cp /usr/lib/x86_64-linux-gnu/libglut.so.3 $engFolder/libs/
cp /usr/lib/x86_64-linux-gnu/nss/* $engFolder/libs/
cp /usr/lib/x86_64-linux-gnu/libboost_thread* $engFolder/libs/
rm -rf $engFolder/libs/CMakeFiles
if [ -e $pckFolder/deploy/cleanup.sh ]; then
/bin/bash $pckFolder/deploy/cleanup.sh
fi
if [ -n "$appProject" ]; then # check is appProject given
cat <<EOT >> $pckFolder/AppRun
#!/bin/sh
HERE="\$(dirname "\$(readlink -f "\${0}")")"
echo "AppRun PolyVR"
echo "work dir: '\$HERE'"
cd \$HERE
ls
export LD_LIBRARY_PATH="\${HERE}/libs:\${LD_LIBRARY_PATH}"
exec ./VRFramework --dofailcheck=0 --maximized=1 --application $appProject "\$@"
EOT
else
cat <<EOT >> $pckFolder/AppRun
#!/bin/sh
HERE="\$(dirname "\$(readlink -f "\${0}")")"
echo "AppRun PolyVR"
echo "work dir: '\$HERE'"
cd \$HERE
ls
export LD_LIBRARY_PATH="\${HERE}/libs:\${LD_LIBRARY_PATH}"
exec ./VRFramework "\$@"
EOT
fi
chmod +x $pckFolder/AppRun
cat <<EOT >> $pckFolder/appimage.yml
app:
name: $appName
version: 1.0
exec: PolyVR.sh
icon: logo_icon.png
EOT
cat <<EOT >> $pckFolder/PolyVR.desktop
[Desktop Entry]
Type=Application
Name=$appName
Terminal=true
MimeType=application/x-polyvr
Categories=Development
Path=$DIR/$engFolder
Icon=logo_icon
EOT
#Icon=$DIR/$engFolder/ressources/gui/logo_icon
cp $engFolder/ressources/gui/logo_icon.png $pckFolder/logo_icon.png
echo " done"