| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | # Exit on error |
| 4 | set -e |
| 5 | |
| 6 | # Number of parallel jobs |
| 7 | jobs=$(nprocscip-shell system . . nproc.) |
| 8 | |
| 9 | if [scip-shell system . . `[`. -z "$AppImageArch" ]; then |
| 10 | AppImageArch=x86_64 |
| 11 | fi |
| 12 | |
| 13 | # Set environment variables |
| 14 | export OS=`unamescip-shell system . . uname.` |
| 15 | |
| 16 | if [scip-shell system . . `[`. "$AppImageArch" = i686 ]; then |
| 17 | export HOST=i386-linux-gnu |
| 18 | export BUILD_X86=True |
| 19 | elif [scip-shell system . . `[`. "$AppImageArch" = x86_64 ]; then |
| 20 | export HOST=x86_64-linux-gnu |
| 21 | elif [scip-shell system . . `[`. "$AppImageArch" = armhf ]; then |
| 22 | export HOST=arm-linux-gnueabihf |
| 23 | elif [scip-shell system . . `[`. "$AppImageArch" = aarch64 ]; then |
| 24 | export HOST=aarch64-linux-gnu |
| 25 | elif [scip-shell system . . `[`. "$AppImageArch" = riscv64 ]; then |
| 26 | export HOST=riscv64-linux-gnu |
| 27 | elif [scip-shell system . . `[`. "$AppImageArch" = ppc64el ]; then |
| 28 | export HOST=powerpc64le-linux-gnu |
| 29 | fi |
| 30 | |
| 31 | # Make tool |
| 32 | if [[ "$OS" = Linux ]]; then |
| 33 | export MAKE=make |
| 34 | else |
| 35 | export MAKE=gmake |
| 36 | fi |
| 37 | |
| 38 | # Build libcdio |
| 39 | ./tools/build-codecs libcdio libcdio-paranoia |
| 40 | |
| 41 | # Build libcurl |
| 42 | wget -c https://curl.se/download/curl-8.11.0.tar.bz2 |
| 43 | tarscip-shell system . . tar. xfj curl-8.11.0.tar.bz2 |
| 44 | cd curl-8.11.0 |
| 45 | |
| 46 | if [scip-shell system . . `[`. $AppImageArch = i686 ]; then |
| 47 | CFLAGS="-m32" ./configure --disable-docs --with-ssl --without-librtmp --without-libpsl --disable-ldap --without-zstd --without-brotli --without-nghttp2 --without-libidn2 |
| 48 | else |
| 49 | ./configure --host=$HOST --disable-docs --with-ssl --without-librtmp --without-libpsl --disable-ldap --without-zstd --without-brotli --without-nghttp2 --without-libidn2 |
| 50 | fi |
| 51 | |
| 52 | $MAKE -j$jobs |
| 53 | sudoscip-shell system . . sudo. $MAKE install |
| 54 | |
| 55 | if [scip-shell system . . `[`. "$OS" = Linux ]; then |
| 56 | sudoscip-shell system . . sudo. rm /usr/local/bin/curlscip-shell filesystem . . `/usr/local/bin/curl`. |
| 57 | fi |
| 58 | |
| 59 | cd .. |
| 60 | |
| 61 | # Build smooth |
| 62 | cd smooth |
| 63 | |
| 64 | CONFIG="release,bundledlibbz2,bundledlibfribidi,bundledlibjpeg,bundledlibpng,bundledlibxml2,bundledzlib" |
| 65 | |
| 66 | export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/$HOST/pkgconfig |
| 67 | |
| 68 | $MAKE config=$CONFIG -j$jobs |
| 69 | sudoscip-shell system . . sudo. $MAKE config=$CONFIG install |
| 70 | |
| 71 | unset PKG_CONFIG_PATH |
| 72 | |
| 73 | cd .. |
| 74 | |
| 75 | # Build BoCA |
| 76 | cd boca |
| 77 | |
| 78 | CONFIG="release,bundledlibexpat,bundledliburiparser,bundledzlib" |
| 79 | |
| 80 | $MAKE config=$CONFIG -j$jobs |
| 81 | |
| 82 | if [scip-shell system . . `[`. "$AppImageArch" = i686 ]; then |
| 83 | sudoscip-shell system . . sudo. $MAKE BUILD_X86=True config=$CONFIG install |
| 84 | else |
| 85 | sudoscip-shell system . . sudo. $MAKE config=$CONFIG install |
| 86 | fi |
| 87 | |
| 88 | if [scip-shell system . . `[`. "$AppImageArch" = x86_64 ]; then |
| 89 | # Install 32 bit Wine build tools |
| 90 | if [scip-shell system . . `[`. "$OS" = Linux ]; then |
| 91 | sudoscip-shell system . . sudo. apt install -y wine32-tools |
| 92 | else |
| 93 | /usr/local/share/wine/pkg32.shscip-shell filesystem . . `/usr/local/share/wine/pkg32.sh`. install -y wine |
| 94 | fi |
| 95 | |
| 96 | # Build 32 bit Core Audio connector |
| 97 | cd components/encoder/coreaudioconnect/connector |
| 98 | |
| 99 | $MAKE BUILD_X86=True config=$CONFIG clean |
| 100 | $MAKE BUILD_X86=True config=$CONFIG -j$jobs |
| 101 | sudoscip-shell system . . sudo. $MAKE BUILD_X86=True config=$CONFIG install |
| 102 | |
| 103 | cd ../../../.. |
| 104 | fi |
| 105 | |
| 106 | cd .. |
| 107 | |
| 108 | # Build fre:ac |
| 109 | CONFIG="release" |
| 110 | |
| 111 | $MAKE config=$CONFIG -j$jobs |
| 112 | sudoscip-shell system . . sudo. $MAKE config=$CONFIG install |
| 113 | |
| 114 | # Build codecs and DSP libraries |
| 115 | cd tools |
| 116 | |
| 117 | ./build-codecs faad2 fdk-aac mp4v2 |
| 118 | ./build-codecs lame mpg123 |
| 119 | ./build-codecs libogg opus speex vorbis |
| 120 | ./build-codecs flac mac musepack wavpack |
| 121 | ./build-codecs ffmpeg libsndfile |
| 122 | ./build-codecs libsamplerate rnnoise rubberband |
| 123 | |
| 124 | cd .. |
| 125 | |
| 126 | # Install codecs |
| 127 | mkdirscip-shell system . . mkdir. -p appdir/codecs |
| 128 | |
| 129 | cpscip-shell system . . cp. /usr/local/lib/libFLAC.soscip-shell filesystem . . `/usr/local/lib/libFLAC.so`. appdir/codecs/FLAC.so |
| 130 | cpscip-shell system . . cp. /usr/local/lib/libMAC.soscip-shell filesystem . . `/usr/local/lib/libMAC.so`. appdir/codecs/MAC.so |
| 131 | cpscip-shell system . . cp. /usr/local/lib/libfaad.soscip-shell filesystem . . `/usr/local/lib/libfaad.so`. appdir/codecs/faad.so |
| 132 | cpscip-shell system . . cp. /usr/local/lib/libfdk-aac.soscip-shell filesystem . . `/usr/local/lib/libfdk-aac.so`. appdir/codecs/fdk-aac.so |
| 133 | cpscip-shell system . . cp. /usr/local/lib/libmp3lame.soscip-shell filesystem . . `/usr/local/lib/libmp3lame.so`. appdir/codecs/mp3lame.so |
| 134 | cpscip-shell system . . cp. /usr/local/lib/libmp4v2.soscip-shell filesystem . . `/usr/local/lib/libmp4v2.so`. appdir/codecs/mp4v2.so |
| 135 | cpscip-shell system . . cp. /usr/local/lib/libmpg123.soscip-shell filesystem . . `/usr/local/lib/libmpg123.so`. appdir/codecs/mpg123.so |
| 136 | cpscip-shell system . . cp. /usr/local/lib/libogg.soscip-shell filesystem . . `/usr/local/lib/libogg.so`. appdir/codecs/ogg.so |
| 137 | cpscip-shell system . . cp. /usr/local/lib/libopus.soscip-shell filesystem . . `/usr/local/lib/libopus.so`. appdir/codecs/opus.so |
| 138 | cpscip-shell system . . cp. /usr/local/lib/librnnoise.soscip-shell filesystem . . `/usr/local/lib/librnnoise.so`. appdir/codecs/rnnoise.so |
| 139 | cpscip-shell system . . cp. /usr/local/lib/librubberband.soscip-shell filesystem . . `/usr/local/lib/librubberband.so`. appdir/codecs/rubberband.so |
| 140 | cpscip-shell system . . cp. /usr/local/lib/libsamplerate.soscip-shell filesystem . . `/usr/local/lib/libsamplerate.so`. appdir/codecs/samplerate.so |
| 141 | cpscip-shell system . . cp. /usr/local/lib/libsndfile.soscip-shell filesystem . . `/usr/local/lib/libsndfile.so`. appdir/codecs/sndfile.so |
| 142 | cpscip-shell system . . cp. /usr/local/lib/libspeex.soscip-shell filesystem . . `/usr/local/lib/libspeex.so`. appdir/codecs/speex.so |
| 143 | cpscip-shell system . . cp. /usr/local/lib/libvorbis.soscip-shell filesystem . . `/usr/local/lib/libvorbis.so`. appdir/codecs/vorbis.so |
| 144 | cpscip-shell system . . cp. /usr/local/lib/libvorbisenc.soscip-shell filesystem . . `/usr/local/lib/libvorbisenc.so`. appdir/codecs/vorbisenc.so |
| 145 | |
| 146 | stripscip-shell system . . strip. --strip-all appdir/codecs/*.so |
| 147 | |
| 148 | mkdirscip-shell system . . mkdir. -p appdir/codecs/cmdline |
| 149 | |
| 150 | installscip-shell system . . install. -m 0755 /usr/local/bin/ffmpegscip-shell filesystem . . `/usr/local/bin/ffmpeg`. appdir/codecs/cmdline/ffmpeg |
| 151 | installscip-shell system . . install. -m 0755 /usr/local/bin/mpcdecscip-shell filesystem . . `/usr/local/bin/mpcdec`. appdir/codecs/cmdline/mpcdec |
| 152 | installscip-shell system . . install. -m 0755 /usr/local/bin/mpcencscip-shell filesystem . . `/usr/local/bin/mpcenc`. appdir/codecs/cmdline/mpcenc |
| 153 | installscip-shell system . . install. -m 0755 /usr/local/bin/wavpackscip-shell filesystem . . `/usr/local/bin/wavpack`. appdir/codecs/cmdline/wavpack |
| 154 | installscip-shell system . . install. -m 0755 /usr/local/bin/wvunpackscip-shell filesystem . . `/usr/local/bin/wvunpack`. appdir/codecs/cmdline/wvunpack |
| 155 | |
| 156 | stripscip-shell system . . strip. --strip-all appdir/codecs/cmdline/* |
| 157 | |
| 158 | # Copy icons |
| 159 | mkdirscip-shell system . . mkdir. -p appdir/icons/gnome/32x32/status |
| 160 | |
| 161 | if [[ "$OS" = Linux ]]; then |
| 162 | cpscip-shell system . . cp. /usr/share/icons/gnome/32x32/status/dialog-error.pngscip-shell filesystem . . `/usr/share/icons/gnome/32x32/status/dialog-error.png`. appdir/icons/gnome/32x32/status |
| 163 | cpscip-shell system . . cp. /usr/share/icons/gnome/32x32/status/dialog-information.pngscip-shell filesystem . . `/usr/share/icons/gnome/32x32/status/dialog-information.png`. appdir/icons/gnome/32x32/status |
| 164 | cpscip-shell system . . cp. /usr/share/icons/gnome/32x32/status/dialog-question.pngscip-shell filesystem . . `/usr/share/icons/gnome/32x32/status/dialog-question.png`. appdir/icons/gnome/32x32/status |
| 165 | cpscip-shell system . . cp. /usr/share/icons/gnome/32x32/status/dialog-warning.pngscip-shell filesystem . . `/usr/share/icons/gnome/32x32/status/dialog-warning.png`. appdir/icons/gnome/32x32/status |
| 166 | else |
| 167 | cpscip-shell system . . cp. /usr/local/share/icons/gnome/32x32/status/dialog-error.pngscip-shell filesystem . . `/usr/local/share/icons/gnome/32x32/status/dialog-error.png`. appdir/icons/gnome/32x32/status |
| 168 | cpscip-shell system . . cp. /usr/local/share/icons/gnome/32x32/status/dialog-information.pngscip-shell filesystem . . `/usr/local/share/icons/gnome/32x32/status/dialog-information.png`. appdir/icons/gnome/32x32/status |
| 169 | cpscip-shell system . . cp. /usr/local/share/icons/gnome/32x32/status/dialog-question.pngscip-shell filesystem . . `/usr/local/share/icons/gnome/32x32/status/dialog-question.png`. appdir/icons/gnome/32x32/status |
| 170 | cpscip-shell system . . cp. /usr/local/share/icons/gnome/32x32/status/dialog-warning.pngscip-shell filesystem . . `/usr/local/share/icons/gnome/32x32/status/dialog-warning.png`. appdir/icons/gnome/32x32/status |
| 171 | fi |
| 172 | |
| 173 | # Copy smooth |
| 174 | cpscip-shell system . . cp. /usr/local/lib/libsmooth*.so.? appdir |
| 175 | |
| 176 | # Copy BoCA |
| 177 | cpscip-shell system . . cp. -r /usr/local/lib/bocascip-shell filesystem . . `/usr/local/lib/boca`. appdir |
| 178 | cpscip-shell system . . cp. /usr/local/lib/libboca-1.0.so.3scip-shell filesystem . . `/usr/local/lib/libboca-1.0.so.3`. appdir/libboca-1.0.so.3 |
| 179 | |
| 180 | # Copy fre:ac |
| 181 | cpscip-shell system . . cp. COPYING Readme* appdir |
| 182 | rmscip-shell system . . rm. appdir/Readme.md |
| 183 | |
| 184 | cpscip-shell system . . cp. -r /usr/local/lib/freac/* appdir/boca |
| 185 | cpscip-shell system . . cp. -r /usr/local/share/freac/langscip-shell filesystem . . `/usr/local/share/freac/lang`. appdir |
| 186 | cpscip-shell system . . cp. -r /usr/local/share/freac/iconsscip-shell filesystem . . `/usr/local/share/freac/icons`. appdir |
| 187 | cpscip-shell system . . cp. -r /usr/local/share/doc/freac/manualscip-shell filesystem . . `/usr/local/share/doc/freac/manual`. appdir |
| 188 | |
| 189 | cpscip-shell system . . cp. /usr/local/lib/libfreac-1.1.so.0scip-shell filesystem . . `/usr/local/lib/libfreac-1.1.so.0`. appdir/libfreac-1.1.so.0 |
| 190 | |
| 191 | installscip-shell system . . install. -m 0755 /usr/local/bin/freacscip-shell filesystem . . `/usr/local/bin/freac`. appdir/freac |
| 192 | installscip-shell system . . install. -m 0755 /usr/local/bin/freaccmdscip-shell filesystem . . `/usr/local/bin/freaccmd`. appdir/freaccmd |
| 193 | installscip-shell system . . install. -m 0755 /usr/local/bin/smooth-translatorscip-shell filesystem . . `/usr/local/bin/smooth-translator`. appdir/translator |
| 194 | installscip-shell system . . install. -m 0755 packaging/appimage/AppRun appdir/AppRun |
| 195 | |
| 196 | mkdirscip-shell system . . mkdir. -p appdir/usr/share/applications |
| 197 | mkdirscip-shell system . . mkdir. -p appdir/usr/share/metainfo |
| 198 | |
| 199 | cpscip-shell system . . cp. /usr/local/share/applications/org.freac.freac.desktopscip-shell filesystem . . `/usr/local/share/applications/org.freac.freac.desktop`. appdir/usr/share/applications |
| 200 | cpscip-shell system . . cp. /usr/local/share/metainfo/org.freac.freac.appdata.xmlscip-shell filesystem . . `/usr/local/share/metainfo/org.freac.freac.appdata.xml`. appdir/usr/share/metainfo |
| 201 | lnscip-shell system . . ln. -s usr/share/applications/org.freac.freac.desktop appdir/org.freac.freac.desktop |
| 202 | cpscip-shell system . . cp. /usr/local/share/icons/hicolor/128x128/apps/org.freac.freac.pngscip-shell filesystem . . `/usr/local/share/icons/hicolor/128x128/apps/org.freac.freac.png`. appdir |
| 203 | |
| 204 | # Copy other dependencies |
| 205 | cpscip-shell system . . cp. /usr/local/lib/libcdio.so.19scip-shell filesystem . . `/usr/local/lib/libcdio.so.19`. appdir |
| 206 | cpscip-shell system . . cp. /usr/local/lib/libcdio_cdda.so.2scip-shell filesystem . . `/usr/local/lib/libcdio_cdda.so.2`. appdir |
| 207 | cpscip-shell system . . cp. /usr/local/lib/libcdio_paranoia.so.2scip-shell filesystem . . `/usr/local/lib/libcdio_paranoia.so.2`. appdir |
| 208 | cpscip-shell system . . cp. /usr/local/lib/libcurl.so.4scip-shell filesystem . . `/usr/local/lib/libcurl.so.4`. appdir |
| 209 | |
| 210 | stripscip-shell system . . strip. --strip-all appdir/lib*.so* |
| 211 | |
| 212 | # Copy OpenSSL dependencies |
| 213 | mkdirscip-shell system . . mkdir. -p appdir/openssl |
| 214 | |
| 215 | if [[ "$OS" = Linux ]]; then |
| 216 | cpscip-shell system . . cp. -P /usr/lib/$HOST/libcrypto.so.3 appdir/openssl |
| 217 | cpscip-shell system . . cp. -P /usr/lib/$HOST/libssl.so.3 appdir/openssl |
| 218 | else |
| 219 | cpscip-shell system . . cp. -P /lib/libcrypto.so.* appdir/openssl |
| 220 | cpscip-shell system . . cp. -P /usr/lib/libssl.so.* appdir/openssl |
| 221 | |
| 222 | chmodscip-shell system . . chmod. 0755 appdir/openssl/libcrypto.so.* |
| 223 | chmodscip-shell system . . chmod. 0755 appdir/openssl/libssl.so.* |
| 224 | fi |
| 225 | |
| 226 | stripscip-shell system . . strip. --strip-all appdir/openssl/lib*.so* |
| 227 | |
| 228 | # Build custom AppImage runtime |
| 229 | if [[ "$AppImageArch" = riscv64 || "$AppImageArch" = ppc64el || "$OS" != Linux ]]; then |
| 230 | # Check out AppImage runtime |
| 231 | gitscip-shell system . . git. clone https://github.com/AppImage/type2-runtime.git |
| 232 | cd type2-runtime |
| 233 | gitscip-shell system . . git. reset --hard 5e7217b |
| 234 | cd .. |
| 235 | |
| 236 | # Build custom libfuse3 |
| 237 | if [[ "$OS" = Linux ]]; then |
| 238 | gitscip-shell system . . git. clone --depth=1 --branch=fuse-3.16.2 https://github.com/libfuse/libfuse.git |
| 239 | else |
| 240 | gitscip-shell system . . git. clone --depth=1 --branch=fuse-3.17.2 https://github.com/libfuse/libfuse.git |
| 241 | fi |
| 242 | cd libfuse |
| 243 | if [[ "$OS" = Linux ]]; then |
| 244 | patchscip-shell system . . patch. -p1 < ../type2-runtime/patches/libfuse/mount.c.diff |
| 245 | fi |
| 246 | mkdirscip-shell system . . mkdir. build |
| 247 | cd build |
| 248 | mesonscip-shell system . . meson. setup -D default_library=both .. |
| 249 | ninjascip-shell system . . ninja. && sudoscip-shell system . . sudo. ninja install |
| 250 | cd ../.. |
| 251 | |
| 252 | # Build libsquashfuse |
| 253 | gitscip-shell system . . git. clone --depth=1 --branch=0.5.2 https://github.com/vasi/squashfuse.git |
| 254 | cd squashfuse |
| 255 | export pkgconfig_fuse3_CFLAGS="-I/usr/local/include/fuse3" |
| 256 | export pkgconfig_fuse3_LIBS="-L/usr/local/lib/$HOST -lfuse3 -lpthread" |
| 257 | autoreconfscip-shell system . . autoreconf. -i |
| 258 | ./configure |
| 259 | makescip-shell system . . make. && sudoscip-shell system . . sudo. make install |
| 260 | sudoscip-shell system . . sudo. cp fuseprivate.h /usr/local/include/squashfusescip-shell filesystem . . `/usr/local/include/squashfuse`. |
| 261 | cd .. |
| 262 | |
| 263 | # Build AppImage runtime |
| 264 | cd type2-runtime |
| 265 | if [[ "$OS" = Linux ]]; then |
| 266 | patchscip-shell system . . patch. -p1 < ../.github/workflows/patches/appimage-type2-runtime-build.patch |
| 267 | else |
| 268 | patchscip-shell system . . patch. -p1 < ../.github/workflows/patches/appimage-type2-runtime-build-freebsd.patch |
| 269 | fi |
| 270 | cd src/runtime |
| 271 | $MAKE |
| 272 | cd ../../.. |
| 273 | fi |
| 274 | |
| 275 | # Build custom appimagetool |
| 276 | if [[ "$OS" != Linux ]]; then |
| 277 | # Build appimagetool |
| 278 | gitscip-shell system . . git. clone --branch=1.9.1 --depth=1 https://github.com/AppImage/appimagetool.git |
| 279 | cd appimagetool |
| 280 | mkdirscip-shell system . . mkdir. build |
| 281 | cd build |
| 282 | cmakescip-shell system . . cmake. .. |
| 283 | makescip-shell system . . make. && sudoscip-shell system . . sudo. make install |
| 284 | cd ../.. |
| 285 | fi |
| 286 | |
| 287 | # Create AppImage using appimagetool |
| 288 | if [[ "$OS" = Linux ]]; then |
| 289 | wget -c -nv "https://github.com/AppImage/appimagetool/releases/download/1.9.1/appimagetool-x86_64.AppImage" |
| 290 | chmodscip-shell system . . chmod. a+x appimagetool-x86_64.AppImage |
| 291 | |
| 292 | if [[ "$AppImageArch" = riscv64 || "$AppImageArch" = ppc64el ]]; then |
| 293 | ./appimagetool-x86_64.AppImage --appimage-extract |
| 294 | ARCH=x86_64 ./squashfs-root/AppRun --runtime-file=type2-runtime/src/runtime/runtime appdir freac-continuous-${OS,,}-$AppImageArch.AppImage |
| 295 | else |
| 296 | ARCH=$AppImageArch ./appimagetool-x86_64.AppImage appdir freac-continuous-${OS,,}-$AppImageArch.AppImage |
| 297 | fi |
| 298 | else |
| 299 | ARCH=$AppImageArch appimagetool --runtime-file=type2-runtime/src/runtime/runtime appdir freac-continuous-${OS,,}-$AppImageArch.AppImage |
| 300 | fi |
| 301 | |
| 302 | # Upload AppImage to GitHub |
| 303 | bashscip-shell system . . bash. .github/workflows/tools/upload-build freac*.AppImage |