| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # Script to make AppImage (all-included binary) for 64 bit linux |
| 4 | # ecperimental |
| 5 | # option to include Also Csound and Csound manual |
| 6 | |
| 7 | |
| 8 | # change according to your own sysem |
| 9 | # constants |
| 10 | |
| 11 | |
| 12 | BINARY="CsoundQt-d-cs6" |
| 13 | BUILD_DIR="../../build-qcs-Desktop-Release" |
| 14 | # EXECUTABLE="$BUILD_DIR/bin/$BINARY" |
| 15 | EXECUTABLE="../bin/$BINARY" |
| 16 | VERSION="1.1.0" |
| 17 | CSOUND_VERSION="6.17.0" |
| 18 | CSOUND_PREFIX="/usr/localscip-shell filesystem . . `/usr/local`." |
| 19 | CSOUND_PLUGINS_DIR="$CSOUND_PREFIX/lib/csound/plugins64-6.0" |
| 20 | CSOUND_MANUAL_HTML_DIR="$HOME/src/csound-manual/html" |
| 21 | BUNDLE_CSOUND=true # for now: always bundle Csound |
| 22 | SRC_DIR=".." #CsoundQt root |
| 23 | LIB_DIR="/usr/libscip-shell filesystem . . `/usr/lib`." |
| 24 | APP_DIR="AppDir" # "$BUILD_DIR/AppDir" |
| 25 | |
| 26 | |
| 27 | # download linuxdeploy and its Qt plugin |
| 28 | #in my case they are installed in path already |
| 29 | #wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage |
| 30 | #wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage |
| 31 | |
| 32 | |
| 33 | # LINUXDEPLOY="$HOME/bin/linuxdeploy-x86_64.AppImage" |
| 34 | LINUXDEPLOY=$(whichscip-shell system . . which. linuxdeploy-x86_64.AppImage) |
| 35 | |
| 36 | #1 export necessary environment variables |
| 37 | export VERSION=$VERSION |
| 38 | export QML_SOURCES_PATHS="$SRC_DIR/src/QML"; |
| 39 | |
| 40 | |
| 41 | # correct desktop file - instead of csoundqt as command use the actual binary name |
| 42 | sedscip-shell system . . sed. "s/Exec=csoundqt/Exec=$BINARY/g" $SRC_DIR/csoundqt.desktop > csoundqt.desktop |
| 43 | |
| 44 | # 2 create initial AppDir with linuxdeploy |
| 45 | # TODO: cannot blacklist csound libs.blacklist nor -blacklist flag work... |
| 46 | LIBPORTMIDI=$(locate --limit 1 libportmidi.so) |
| 47 | |
| 48 | |
| 49 | $LINUXDEPLOY --appdir $APP_DIR --executable=$EXECUTABLE --desktop-file=csoundqt.desktop --icon-file=$SRC_DIR/images/csoundqt.svg --library=$LIBPORTMIDI --library=$LIB_DIR/x86_64-linux-gnu/liblo.so --library=$LIB_DIR/x86_64-linux-gnu/libstk.so --plugin=qt |
| 50 | |
| 51 | |
| 52 | #libraries still missing: libstk-4.5.0.so libfltk.so.1.1 |
| 53 | |
| 54 | |
| 55 | # copy Examples and templates |
| 56 | mkdirscip-shell system . . mkdir. -p $APP_DIR/usr/share/csoundqt/ |
| 57 | cpscip-shell system . . cp. -r $SRC_DIR/src/Examples $APP_DIR/usr/share/csoundqt |
| 58 | cpscip-shell system . . cp. -r $SRC_DIR/templates $APP_DIR/usr/share/csoundqt |
| 59 | |
| 60 | |
| 61 | # copy Csound binary, plugins and and Csound Manual |
| 62 | mkdirscip-shell system . . mkdir. -p $APP_DIR/usr/lib/csound |
| 63 | cpscip-shell system . . cp. -r $CSOUND_PLUGINS_DIR $APP_DIR/usr/lib/csound |
| 64 | mkdirscip-shell system . . mkdir. -p $APP_DIR/usr/share/doc/csound-doc/ |
| 65 | cpscip-shell system . . cp. -r $CSOUND_MANUAL_HTML_DIR $APP_DIR/usr/share/doc/csound-doc/ |
| 66 | cpscip-shell system . . cp. "$CSOUND_PREFIX/bin/csound" $APP_DIR/usr/bin |
| 67 | #what about other utilities? Should they be accessible? I think no, then user has to install csound separately. NB! Try to match the Csound version! |
| 68 | |
| 69 | #create hook to set Csound Plugins Dir environment |
| 70 | |
| 71 | mkdirscip-shell system . . mkdir. -p $APP_DIR/apprun-hooks |
| 72 | echoscip-shell system . . echo. 'export OPCODE6DIR64="${APPDIR}/usr/lib/csound/plugins64-6.0/"' > $APP_DIR/apprun-hooks/csound-plugins-hook.sh |
| 73 | |
| 74 | # and create final AppImage |
| 75 | $LINUXDEPLOY --appdir $APP_DIR --executable=$EXECUTABLE --desktop-file=csoundqt.desktop --icon-file=$SRC_DIR/images/csoundqt.svg --plugin=qt --output appimage |
| 76 | |
| 77 |