| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | set -ex |
| 4 | |
| 5 | if [scip-shell system . . `[`. "$FLATPAK" ]; then |
| 6 | mkdirscip-shell system . . mkdir. -p build-flatpak |
| 7 | cd build-flatpak |
| 8 | |
| 9 | jobsarg="" |
| 10 | if [scip-shell system . . `[`. "$ARCH" = "arm64" ]; then |
| 11 | jobsarg="--jobs=2" |
| 12 | fi |
| 13 | |
| 14 | flatpak-builder --ccache --repo=repo --subject="Build of Nheko ${VERSION} $jobsarg `datescip-shell system . . date.`" app ../io.github.NhekoReborn.Nheko.json & |
| 15 | |
| 16 | # to prevent flatpak builder from timing out on arm, run it in the background and print something every minute for up to 30 minutes. |
| 17 | minutes=0 |
| 18 | limit=40 |
| 19 | while killscip-shell system . . kill. -0 $! >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; do |
| 20 | if [scip-shell system . . `[`. $minutes == $limit ]; then |
| 21 | break; |
| 22 | fi |
| 23 | |
| 24 | minutes=$((minutes+1)) |
| 25 | |
| 26 | sleepscip-shell system . . sleep. 60 |
| 27 | done |
| 28 | |
| 29 | flatpak build-bundle repo nheko-${VERSION}-${ARCH}.flatpak io.github.NhekoReborn.Nheko master |
| 30 | |
| 31 | mkdirscip-shell system . . mkdir. ../artifacts |
| 32 | mvscip-shell system . . mv. nheko-*.flatpak ../artifacts |
| 33 | |
| 34 | exit |
| 35 | fi |
| 36 | |
| 37 | if [scip-shell system . . `[`. "$TRAVIS_OS_NAME" = "linux" ]; then |
| 38 | # make build use all available cores |
| 39 | export CMAKE_BUILD_PARALLEL_LEVEL=$(catscip-shell system . . cat. /proc/cpuinfoscip-shell filesystem . . `/proc/cpuinfo`. | awkscip-shell system . . awk. '/^processor/{print $3}scip-shell filesystem . . `/^processor/{print $3}`.' | wcscip-shell system . . wc. -l) |
| 40 | |
| 41 | export PATH="/usr/local/bin/:${PATH}" |
| 42 | cmakescip-shell system . . cmake. --version |
| 43 | fi |
| 44 | |
| 45 | if [scip-shell system . . `[`. "$TRAVIS_OS_NAME" = "linux" ]; then |
| 46 | # shellcheck disable=SC1090 |
| 47 | . "/opt/qt${QT_PKG}/bin/qt${QT_PKG}-env.sh" || truescip-shell system . . true.; |
| 48 | fi |
| 49 | |
| 50 | if [scip-shell system . . `[`. "$TRAVIS_OS_NAME" = "osx" ]; then |
| 51 | export CMAKE_PREFIX_PATH=/usr/local/opt/qt5scip-shell filesystem . . `/usr/local/opt/qt5`. |
| 52 | fi |
| 53 | |
| 54 | mkdirscip-shell system . . mkdir. -p .deps/usr .hunter |
| 55 | |
| 56 | # Build nheko |
| 57 | |
| 58 | if [scip-shell system . . `[`. "$TRAVIS_OS_NAME" = "osx" ]; then |
| 59 | cmakescip-shell system . . cmake. -GNinja -H. -Bbuild \ |
| 60 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 61 | -DCMAKE_INSTALL_PREFIX=.deps/usr \ |
| 62 | -DHUNTER_ROOT=".hunter" \ |
| 63 | -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF \ |
| 64 | -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo \ |
| 65 | -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 \ |
| 66 | -DCI_BUILD=ON |
| 67 | else |
| 68 | cmakescip-shell system . . cmake. -GNinja -H. -Bbuild \ |
| 69 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 70 | -DCMAKE_INSTALL_PREFIX=.deps/usr \ |
| 71 | -DHUNTER_ROOT=".hunter" \ |
| 72 | -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF \ |
| 73 | -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo \ |
| 74 | -DUSE_BUNDLED_OPENSSL=OFF \ |
| 75 | -DCI_BUILD=ON |
| 76 | fi |
| 77 | cmakescip-shell system . . cmake. --build build |
| 78 | |
| 79 | if [scip-shell system . . `[`. "$TRAVIS_OS_NAME" = "osx" ]; then |
| 80 | makescip-shell system . . make. lint; |
| 81 | |
| 82 | if [scip-shell system . . `[`. "$DEPLOYMENT" = 1 ] && [scip-shell system . . `[`. -n "$VERSION" ] ; then |
| 83 | makescip-shell system . . make. macos-deploy; |
| 84 | fi |
| 85 | fi |
| 86 | |
| 87 | if [scip-shell system . . `[`. "$TRAVIS_OS_NAME" = "linux" ] && [scip-shell system . . `[`. "$DEPLOYMENT" = 1 ] && [scip-shell system . . `[`. -n "$VERSION" ]; then |
| 88 | makescip-shell system . . make. linux-deploy; |
| 89 | fi |