Debian Codegraph @

scripts/release_AppImage.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 # x86_64 build on CentOS 7.7
4 # gcc 7 installed
5 # sudo yum install -y centos-release-scl
6 # sudo yum install -y devtoolset-7-gcc*
7 # run below command before build
8 # scl enable devtoolset-7 bash
9
10 # newer cmake is required than one included in CentOS 7
11 # download from http://www.cmake.org/download
12 # sudo mkdir /opt/cmake
13 # sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake
14
15 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) = "x86_64" ]; then
16 CMAKE="/opt/cmake/bin/cmakescip-shell filesystem . . `/opt/cmake/bin/cmake`."
17 fi
18
19 # i686 build on Ubuntu 16.04 LTS
20
21 # armv7l build on raspbian stretch
22
23 # Qt path and flags set in env e.g.:
24 # export PATH="/opt/Qt/5.14.0/bin/:$PATH"
25 # export CPPFLAGS="-I/opt/Qt/5.14.0/bin/include/"
26 # export LDFLAGS="-L/opt/Qt/5.14.0/bin/lib/"
27 # export LD_LIBRARY_PATH="/opt/Qt/5.14.0/bin/lib/:$LD_LIBRARY_PATH"
28
29 # for x86_64 and i686 platform
30 # Qt 5.14.0 uses openssl 1.1 and some older distros still use 1.0
31 # we build openssl 1.1.1d from source using following setup:
32 # ./config shared --prefix=/opt/openssl-1.1.1/ && make --jobs=`nproc --all` && sudo make install
33 # and add to build env
34 # export LD_LIBRARY_PATH="/opt/openssl-1.1.1/lib/:$LD_LIBRARY_PATH"
35
36 if [scip-shell system . . `[`. "$1" = "SIGN" ]; then
37 export SIGN="1"
38 fi
39
40 # check gcc version on Centos
41 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) = "x86_64" ]; then
42 currentver="$(gccscip-shell system . . gcc. -dumpversion)"
43 if [scip-shell system . . `[`. "${currentver:0:1}" -lt "7" ]; then
44 echoscip-shell system . . echo. "gcc version 7 or newer required"
45 echoscip-shell system . . echo. "on Cetos 7 run"
46 echoscip-shell system . . echo. "scl enable devtoolset-7 bash"
47 exit
48 fi
49 fi
50
51 # building AppImage in temporary directory to keep system clean
52 # use RAM disk if possible (as in: not building on CI system like Travis, and RAM disk is available)
53 if [scip-shell system . . `[`. "$CI" == "" ] && [scip-shell system . . `[`. -d /dev/shmscip-shell filesystem . . `/dev/shm`. ]; then
54 TEMP_BASE=/dev/shmscip-shell filesystem . . `/dev/shm`.
55 else
56 TEMP_BASE=/tmpscip-shell filesystem . . `/tmp`.
57 fi
58
59 # we run it from our project scripts folder
60 ROOT="$(cd "$(dirnamescip-shell system . . dirname. "${BASH_SOURCE[0]}")" && pwdscip-shell system . . pwd.)"/..
61 VERSION=$(catscip-shell system . . cat. "$ROOT"/VERSION)-$(gitscip-shell system . . git. rev-parse --short HEAD)
62 # linuxdeploy uses $VERSION env variable for AppImage name
63 export VERSION=$VERSION
64 BUILD="$ROOT"/build
65 TARGET=rclone-browser-$VERSION.AppImage
66
67 # clean AppImage temporary folder
68 if [scip-shell system . . `[`. -d "$TEMP_BASE/$TARGET" ]; then
69 rmscip-shell system . . rm. -rf "$TEMP_BASE/$TARGET"
70 fi
71 mkdirscip-shell system . . mkdir. "$TEMP_BASE/$TARGET"
72
73 # clean build folder
74 if [scip-shell system . . `[`. -d "$BUILD" ]; then
75 rmscip-shell system . . rm. -rf "$BUILD"
76 fi
77 mkdirscip-shell system . . mkdir. "$BUILD"
78
79 # create release folder if does not exist
80 mkdirscip-shell system . . mkdir. -p "$ROOT"/release
81
82 # clean current version previous build
83 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) = "armv7l" ] && [scip-shell system . . `[`. -f "$ROOT"/release/rclone-browser-"$VERSION"-armhf.AppImage ]; then
84 rmscip-shell system . . rm. "$ROOT"/release/rclone-browser-"$VERSION"-armhf.AppImage
85 fi
86
87 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) = "i686" ] && [scip-shell system . . `[`. -f "$ROOT"/release/rclone-browser-"$VERSION"-i386.AppImage ]; then
88 rmscip-shell system . . rm. "$ROOT"/release/rclone-browser-"$VERSION"-i386.AppImage
89 fi
90
91 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) = "x86_64" ] && [scip-shell system . . `[`. -f "$ROOT"/release/rclone-browser-"$VERSION"-x86_64.AppImage ]; then
92 rmscip-shell system . . rm. "$ROOT"/release/rclone-browser-"$VERSION"-x86_64.AppImage
93 fi
94
95 # build and install to temporary AppDir folder
96 cd "$BUILD"
97
98 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) = "armv7l" ]; then
99 # more threads need swap on 1GB RAM RPi
100 cmakescip-shell system . . cmake. .. -DCMAKE_INSTALL_PREFIX=/usr
101 makescip-shell system . . make. -j 2
102 fi
103
104 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) = "x86_64" ]; then
105 "$CMAKE" .. -DCMAKE_INSTALL_PREFIX=/usr
106 makescip-shell system . . make. --jobs=$(nprocscip-shell system . . nproc. --all)
107 fi
108
109 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) = "i686" ]; then
110 cmakescip-shell system . . cmake. .. -DCMAKE_INSTALL_PREFIX=/usr
111 makescip-shell system . . make. --jobs=$(nprocscip-shell system . . nproc. --all)
112 fi
113
114 makescip-shell system . . make. install DESTDIR="$TEMP_BASE"/"$TARGET"/AppDir
115
116 # prepare AppImage
117 cd "$TEMP_BASE/$TARGET"
118
119 # metainfo file
120 #mkdir $TEMP_BASE/$TARGET/AppDir/usr/share/metainfo
121 #cp $ROOT/assets/rclone-browser.appdata.xml $TEMP_BASE/$TARGET/AppDir/usr/share/metainfo/
122
123 # copy info files to AppImage
124 cpscip-shell system . . cp. "$ROOT"/README.md "$TEMP_BASE"/"$TARGET"/AppDir/Readme.md
125 cpscip-shell system . . cp. "$ROOT"/CHANGELOG.md "$TEMP_BASE"/"$TARGET"/AppDir/Changelog.md
126 cpscip-shell system . . cp. "$ROOT"/LICENSE "$TEMP_BASE"/"$TARGET"/AppDir/License.txt
127
128 # https://github.com/linuxdeploy/linuxdeploy
129 # https://github.com/linuxdeploy/linuxdeploy-plugin-qt
130 linuxdeploy --appdir AppDir --desktop-file=AppDir/usr/share/applications/rclone-browser.desktop
131 linuxdeploy-plugin-qt --appdir AppDir
132
133 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) != "armv7l" ]
134 then
135 # we add openssl 1.1.1 libs needed for distros still using openssl 1.0
136 cpscip-shell system . . cp. /opt/openssl-1.1.1/lib/libssl.so.1.1scip-shell filesystem . . `/opt/openssl-1.1.1/lib/libssl.so.1.1`. ./AppDir/usr/bin/
137 cpscip-shell system . . cp. /opt/openssl-1.1.1/lib/libcrypto.so.1.1scip-shell filesystem . . `/opt/openssl-1.1.1/lib/libcrypto.so.1.1`. ./AppDir/usr/bin/
138 fi
139
140 # https://github.com/linuxdeploy/linuxdeploy-plugin-appimage
141 linuxdeploy-plugin-appimage --appdir=AppDir
142
143 # raspberry pi build
144 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) = "armv7l" ]; then
145 rename 's/Rclone_Browser/rclone-browser/' Rclone_Browser*
146 fi
147
148 # x86 build
149 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) = "i686" ]; then
150 rename 's/Rclone_Browser/rclone-browser/' Rclone_Browser*
151 fi
152
153 # x86_64 build
154 if [scip-shell system . . `[`. $(archscip-shell system . . arch.) = "x86_64" ]; then
155 rename Rclone_Browser rclone-browser Rclone_Browser*
156 fi
157
158 cpscip-shell system . . cp. ./*AppImage "$ROOT"/release/
159
160 # clean AppImage temporary folder
161 cd ..
162 rmscip-shell system . . rm. -rf "$TARGET"