diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 7d7ad8d..0000000 --- a/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -*AppImage* -*tar* diff --git a/.env b/.env new file mode 100644 index 0000000..370b68e --- /dev/null +++ b/.env @@ -0,0 +1,10 @@ +# These variables can be overridden by exporting them from the +# command line when running `docker compose` +# +# Your numeric uid and gid +HOSTUID= +HOSTGID= + +# When run from the root of your project directory, this will be +# the location in the container +WORKSPACE="/workspace" diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 575325d..cd22bd0 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -7,20 +7,16 @@ on: workflow_dispatch: push: branches: [ "trunk" ] - paths: - - '.github/workflows/appimage.yml' - - 'AppRun' - - 'version' - - 'workflow.sh' - - '!**/docker.yml' - - '!Dockerfile*' + paths-ignore: + - '.gitignore' + - 'LICENSE' + - 'README.md' pull_request: branches: [ "trunk" ] - paths: - - '.github/workflows/appimage.yml' - - 'AppRun' - - 'version' - - 'workflow.sh' + paths-ignore: + - '.gitignore' + - 'LICENSE' + - 'README.md' jobs: # Label of the container job @@ -28,20 +24,28 @@ jobs: strategy: fail-fast: false matrix: - ubuntu_codename: ['focal', 'jammy'] - container: andy5995/0ad-build-env:${{ matrix.ubuntu_codename }} - runs-on: ubuntu-22.04 + os: + - ubuntu-24.04-arm + - ubuntu-24.04 + + runs-on: ubuntu-latest env: - ARCH: x86_64 - WORKSPACE: ${{ github.workspace }} - VERSION: 0.0.27-rc1-27645-alpha - UBUNTU_CODENAME: ${{ matrix.ubuntu_codename }} + VERSION: 0.27.0 + MINISIGN_KEY: RWTWLbO12+ig3lUExIor3xd6DdZaYFEozn8Bu8nIzY3ImuRYQszIQyyy steps: - uses: actions/checkout@v4 - - name: Run Workflow script + + - name: Build AppImage + run: | + export HOSTUID=$(id -u) HOSTGID=$(id -g) + docker compose -f ./docker-compose.yml run --rm build + + - name: Create sha256sum run: | - chmod 1777 "$WORKSPACE" - su 0adbuilder --command "GITHUB_ACTIONS=${GITHUB_ACTIONS} $WORKSPACE/workflow.sh" + IMAGE_FILENAME=$(basename `find out/*AppImage`) + echo "IMAGE_FILENAME=$IMAGE_FILENAME" >> $GITHUB_ENV + cd out + sha256sum "$IMAGE_FILENAME" > "$IMAGE_FILENAME.sha256sum" - name: Release AppImage if: ${{ github.ref == 'refs/heads/trunk' }} @@ -49,19 +53,16 @@ jobs: with: name: 0ad-${{ env.VERSION }} AppImage allowUpdates: True - prerelease: ${{ contains(env.VERSION, 'svn') || contains(env.VERSION, 'rc') }} - artifacts: "${{ env.WORKSPACE }}/0ad*.AppImage*" + prerelease: ${{ contains(env.VERSION, 'rc') }} + artifacts: ./out/0ad*.AppImage* token: ${{ secrets.GITHUB_TOKEN }} omitNameDuringUpdate: True omitBodyDuringUpdate: True tag: v${{ env.VERSION }} - replacesArtifacts: true + replacesArtifacts: false - name: Upload Artifacts if: ${{ github.ref != 'refs/heads/trunk' }} uses: actions/upload-artifact@v4 with: - name: AppImage - path: ${{ env.WORKSPACE }}/0ad*.AppImage* - - - + name: AppImage-${{ matrix.os }} + path: ./out/0ad*.AppImage* diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 683a517..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Docker Image - -on: - workflow_dispatch: - push: - branches: - - 'trunk' - paths: - - '.github/workflows/docker.yml' - - 'Dockerfile*' - -jobs: - build: - strategy: - fail-fast: false - matrix: - ubuntu_codename: ['focal', 'jammy'] - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: . - file: ./Dockerfile-${{ matrix.ubuntu_codename }} - push: true - tags: ${{ secrets.DOCKER_HUB_USERNAME }}/0ad-build-env:${{ matrix.ubuntu_codename }} - cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/0ad-build-env:buildcache - cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/0ad-build-env:buildcache,mode=max diff --git a/.gitignore b/.gitignore index d0fd3a0..2f34245 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,7 @@ /tools/ /linuxdeploy-plugin-gtk.sh /*.AppImage* -/0ad-svn +/0ad-* /minisign*linux.tar.gz* +/out +/premake*tar.gz diff --git a/AppRun b/AppRun index 93d079f..9c96996 100644 --- a/AppRun +++ b/AppRun @@ -8,9 +8,14 @@ set -e HERE="$(readlink -f "$(dirname "$0")")" -BINARY_NAME=$(basename "$ARGV0") -if [ "$BINARY_NAME" = "pyrogenesis" -o "$BINARY_NAME" = "0ad" ] ; then +BINARY_NAME=${BINARY_NAME:-"pyrogenesis"} + +echo "To invoke the Actor editor:" +echo "BINARY_NAME=ActorEditor $0" +echo "" + +if [ "$BINARY_NAME" = "pyrogenesis" ] || [ "$BINARY_NAME" = "0ad" ]; then exec "$HERE/usr/bin/pyrogenesis" "$@" elif [ "$BINARY_NAME" = "ActorEditor" ]; then exec "$HERE/usr/bin/ActorEditor" "$@" diff --git a/Dockerfile-focal b/Dockerfile-focal deleted file mode 100644 index f1c1ea2..0000000 --- a/Dockerfile-focal +++ /dev/null @@ -1,69 +0,0 @@ -FROM ubuntu:focal -ARG DEBIAN_FRONTEND=noninteractive -RUN apt update && \ - apt -y upgrade && \ - apt install -y \ - build-essential \ - cargo \ - cmake \ - libboost-dev \ - libboost-filesystem-dev \ - libboost-system-dev \ - libcurl4-gnutls-dev \ - libenet-dev \ - libfmt-dev \ - libfreetype6-dev \ - libgloox-dev \ - libicu-dev \ - libminiupnpc-dev \ - libogg-dev \ - libopenal-dev \ - libpng-dev \ - libsdl2-dev \ - libsodium-dev \ - libvorbis-dev \ - libvulkan-dev \ - libwxgtk3.0-gtk3-dev \ - libxml2-dev \ - m4 \ - python3 \ - subversion \ - rustc \ - zlib1g-dev && \ - apt install -y \ - curl \ - patchelf \ - wget && \ - rm -rf /var/lib/apt/lists - -ENV TOOLS_DIR="/tools" -RUN mkdir -p $TOOLS_DIR -ARG ARCH=x86_64 -RUN /bin/bash -c 'cd $TOOLS_DIR \ - && curl -LO https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20220822-1/linuxdeploy-${ARCH}.AppImage \ - && chmod +x linuxdeploy-${ARCH}.AppImage \ - && ./linuxdeploy-${ARCH}.AppImage --appimage-extract \ - && rm ./linuxdeploy-${ARCH}.AppImage \ - && cd -' - -ARG MINISIGN_VERSION="0.11" -ENV MINISIGN_PATH=${TOOLS_DIR}/minisign -ARG MINISIGN_URL=https://github.com/jedisct1/minisign/releases/download/${MINISIGN_VERSION} -RUN /bin/bash -c 'curl -LO ${MINISIGN_URL}/minisign-${MINISIGN_VERSION}-linux.tar.gz \ - && curl -LO ${MINISIGN_URL}/minisign-${MINISIGN_VERSION}-linux.tar.gz.minisig \ - && tar xf minisign-${MINISIGN_VERSION}-linux.tar.gz -C ${TOOLS_DIR} \ - && mv ${TOOLS_DIR}/minisign-linux/${ARCH}/minisign ${TOOLS_DIR} \ - && $MINISIGN_PATH -Vm minisign-$MINISIGN_VERSION-linux.tar.gz -P RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3 \ - && rm -rf ${TOOLS_DIR}/minisign-linux minisign-${MINISIGN_VERSION}-linux.tar.gz*' - -# For some reason, if '/home/0adbuilder' exists, -# ./updateworkspaces.sh fails after the Collada -# build, when the python virtual environment is created. -# Using '-M' here so the home dir doesn't get created -RUN useradd -M 0adbuilder && passwd -d 0adbuilder - -ENV DOCKER_0AD_BUILD=TRUE -# needed for spidermonkey build -ENV SHELL=/bin/bash - -CMD ["/bin/bash","-l"] diff --git a/Dockerfile-jammy b/Dockerfile-jammy deleted file mode 100644 index dcd33b0..0000000 --- a/Dockerfile-jammy +++ /dev/null @@ -1,70 +0,0 @@ -FROM ubuntu:jammy -ARG DEBIAN_FRONTEND=noninteractive -RUN apt update && \ - apt -y upgrade && \ - apt install -y \ - build-essential \ - cargo \ - cmake \ - file \ - libboost-dev \ - libboost-filesystem-dev \ - libboost-system-dev \ - libcurl4-gnutls-dev \ - libenet-dev \ - libfmt-dev \ - libfreetype6-dev \ - libgloox-dev \ - libicu-dev \ - libminiupnpc-dev \ - libogg-dev \ - libopenal-dev \ - libpng-dev \ - libsdl2-dev \ - libsodium-dev \ - libvorbis-dev \ - libvulkan-dev \ - libwxgtk3.0-gtk3-dev \ - libxml2-dev \ - m4 \ - python3 \ - subversion \ - rustc \ - zlib1g-dev && \ - apt install -y \ - curl \ - patchelf \ - wget && \ - rm -rf /var/lib/apt/lists - -ENV TOOLS_DIR="/tools" -RUN mkdir -p $TOOLS_DIR -ARG ARCH=x86_64 -RUN /bin/bash -c 'cd $TOOLS_DIR \ - && curl -LO https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20220822-1/linuxdeploy-${ARCH}.AppImage \ - && chmod +x linuxdeploy-${ARCH}.AppImage \ - && ./linuxdeploy-${ARCH}.AppImage --appimage-extract \ - && rm ./linuxdeploy-${ARCH}.AppImage \ - && cd -' - -ARG MINISIGN_VERSION="0.11" -ENV MINISIGN_PATH=${TOOLS_DIR}/minisign -ARG MINISIGN_URL=https://github.com/jedisct1/minisign/releases/download/${MINISIGN_VERSION} -RUN /bin/bash -c 'curl -LO ${MINISIGN_URL}/minisign-${MINISIGN_VERSION}-linux.tar.gz \ - && curl -LO ${MINISIGN_URL}/minisign-${MINISIGN_VERSION}-linux.tar.gz.minisig \ - && tar xf minisign-${MINISIGN_VERSION}-linux.tar.gz -C ${TOOLS_DIR} \ - && mv ${TOOLS_DIR}/minisign-linux/${ARCH}/minisign ${TOOLS_DIR} \ - && $MINISIGN_PATH -Vm minisign-$MINISIGN_VERSION-linux.tar.gz -P RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3 \ - && rm -rf ${TOOLS_DIR}/minisign-linux minisign-${MINISIGN_VERSION}-linux.tar.gz*' - -# For some reason, if '/home/0adbuilder' exists, -# ./updateworkspaces.sh fails after the Collada -# build, when the python virtual environment is created. -# Using '-M' here so the home dir doesn't get created -RUN useradd -M 0adbuilder && passwd -d 0adbuilder - -ENV DOCKER_0AD_BUILD=TRUE -# needed for spidermonkey build -ENV SHELL=/bin/bash - -CMD ["/bin/bash","-l"] diff --git a/README.md b/README.md index fe9d79f..fc83d9c 100644 --- a/README.md +++ b/README.md @@ -8,62 +8,14 @@ Click on the [releases link](https://github.com/0ad-matters/0ad-appimage/releases) to view available appimages. -To access the `ActorEditor`, you'll need to create a [symbolic -link](https://devdojo.com/devdojo/what-is-a-symlink): +To invoke the `ActorEditor`: - cd /path/to/ - ln -s ActorEditor - -You can optionally create symbolic links for `0ad` and `pyrogenesis` -if desired: - - ln -s 0ad - ln -s pyrogenesis + BINARY_NAME=ActorEditor ## Build locally You can build the appimage locally if you have docker installed. While in the -repo root, to build the latest stable version, run: - - ./make-appimage.sh - -or to build an svn snapshot: - - VERSION=0.0.27-svn-unstable ./make-appimage.sh - -Version strings for stable releases are typically in the format: - - 0.0.26-alpha - 0.0.25b-alpha - 0.0.27-rc1-xxxxx-alpha (for release candidates) - -To build on a different version of Ubuntu, precede the script with the -codename, e.g. - - UBUNTU_CODENAME=jammy ./make_appimage.sh - -(valid values are bionic, focal, or jammy) - -To speed up the process, prior to running the above script, copy the source -and data archives (e.g., 0ad-0.0.26-alpha-unix-{build,data}.tar.xz) to the -repo root (otherwise they'll be downloaded during the script execution). - -If choosing the svn version, the svn repository will be checked out, unless -you aleady have it in the repo root. - -## HOWTO change versions after a 0 A.D. release - -When running from the GitHub CI, change the VERSION string near the top of -appimage.yml. - -If running the `make-appimage.sh` script locally, change the default VERSION -string near the top of `make-appimage.sh`. - -In either case, you may also need to change the minisign key near the top of -`workflow.sh`. - -To customize and publish the docker image (see the Dockerfile in this repo) to -your own Docker Hub account, you'll need to add a couple secrets to your -repository. See https://docs.github.com/en/actions/publishing-packages/publishing-docker-images - +repo root, to build the latest stable version: + export HOSTUID=$(id -u) HOSTGID=$(id -g) VERSION=0.27.0 + docker compose -f ./docker-compose.yml run --rm build diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e93d4ab --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +services: + build: + environment: + HOSTUID: ${HOSTUID} + HOSTGID: ${HOSTGID} + VERSION: ${VERSION} + WORKSPACE: ${WORKSPACE} + CC: "${CC:-gcc}" + CXX: "${CXX:-g++}" + image: andy5995/linuxdeploy:v3-jammy + platform: ${PLATFORM} + volumes: + - ${PWD}:${WORKSPACE} + working_dir: ${WORKSPACE} + + # Note that SCRIPT is not used by the container, therefore + # is not included within the 'environment' section above + # + # Absolute path or Relative to workspace + # e.g. $WORKSPACE/path/to/script + command: "${SCRIPT:-./make-appimage.sh}" diff --git a/make-appimage.sh b/make-appimage.sh index 8fcda0a..ac97b9e 100755 --- a/make-appimage.sh +++ b/make-appimage.sh @@ -1,30 +1,221 @@ -#!/bin/sh +#!/bin/bash -if [ -z "$UID" ]; then - echo "Could not detect UID." +set -ev + +if [ -z "$VERSION" ]; then + echo "VERSION must be set" + exit 1 +fi + +if [[ "$WORKSPACE" != /* ]]; then + echo "The workspace path must be absolute" exit 1 fi +test -d "$WORKSPACE" -# valid values are bionic, focal, or jammy -UBUNTU_CODENAME=${UBUNTU_CODENAME:-"focal"} +SOURCE_ROOT="$WORKSPACE/0ad-$VERSION" +if [[ "$SOURCE_ROOT" != /* ]]; then + echo "The source root path must be absolute" + exit 1 +fi -export WORKSPACE="/0ad" -export VERSION=${VERSION:-"0.0.27-rc1-27645-alpha"} +APPDIR=${APPDIR:-"/tmp/$USER-AppDir"} +if [ -d "$APPDIR" ]; then + rm -rf "$APPDIR" +else + mkdir -v -p "$APPDIR" +fi -echo "Version is set to '$VERSION'" -echo "use 'VERSION= $0' to change it." -echo "Waiting 10 seconds to start, hit CTRL-C now to cancel..." +env +export -p -read -t 10 +URI="https://releases.wildfiregames.com" -set -ev +cd $WORKSPACE +if [ ! -e "AppRun" ]; then + echo "You must be in the same directory where the AppRun file resides" + exit 1 +fi + +cd "$WORKSPACE" + +sudo DEBIAN_FRONTEND=noninteractive -i sh -c "apt update && apt -y upgrade && \ + apt install -y \ + cargo \ + cmake \ + curl \ + $CC \ + libboost-dev \ + libboost-filesystem-dev \ + libboost-system-dev \ + libcurl4-gnutls-dev \ + libenet-dev \ + libfmt-dev \ + libfreetype6-dev \ + libgloox-dev \ + libicu-dev \ + libminiupnpc-dev \ + libogg-dev \ + libopenal-dev \ + libpng-dev \ + libsdl2-dev \ + libsodium-dev \ + libvorbis-dev \ + libwxgtk3.0-gtk3-dev \ + libxml2-dev \ + llvm \ + m4 \ + patchelf \ + python3 \ + rustc \ + zlib1g-dev" + +# needed for spidermonkey build +#export SHELL=/bin/bash +PREMAKE="premake-5.0.0-beta4-linux.tar.gz" +if [ ! -f "$PREMAKE" ]; then + wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta4/$PREMAKE + tar -xvf "$PREMAKE" + sudo mv premake5 /usr/bin +fi + +source=0ad-$VERSION-unix-build.tar.xz +source_sum=$source.sha1sum +for file in $source $source_sum; do + if [ ! -f "$file" ]; then + curl -LO "$URI/$file" + fi +done +sha1sum -c $source_sum + +if [ ! -r "$SOURCE_ROOT/source/main.cpp" ]; then + tar -xJf $source +fi + #cd "$SOURCE_ROOT" + #build/workspaces/clean-workspaces.sh + ## Clean up some extra cruft not picked up by clean-workspaces.sh + #find binaries/system/ -type f ! -name readme.txt -delete + #rm -f libraries/fcollada/lib/*.a + #rm -f build/premake/.*.tmp + #rm -rf libraries/source/spidermonkey/lib + #rm -f libraries/source/cxxtest-4.4/python/cxxtest/*.pyc + #rm -f libraries/source/fcollada/lib/* + #rm -rf libraries/source/spidermonkey/include-unix-* + #rm -rf libraries/source/spidermonkey/mozjs-78.6.0 + #rm -f libraries/source/nvtt/lib/*.so + #rm -f source/ps/tests/stub_impl_hack.cpp +#fi + +# Spidermonkey build fails with 7, 8, 9, and 10 on Ubuntu focal? +cd "$SOURCE_ROOT/libraries" +/bin/bash -c 'JOBS=$(nproc) ./build-source-libs.sh \ + -j$(nproc)' + +cd "$SOURCE_ROOT/build/workspaces" +/bin/bash -c './update-workspaces.sh \ + --without-pch \ + -j$(nproc) && \ + make config=release -C gcc -j$(nproc)' + +cd $WORKSPACE +data=0ad-$VERSION-unix-data.tar.xz +data_sum=$data.sha1sum +for file in $data $data_sum; do + if [ ! -f "$file" ]; then + curl -LO "$URI/$file" + fi +done +sha1sum -c $data_sum + +cd "$WORKSPACE" +if [ ! -f "$SOURCE_ROOT/binaries/data/config/default.cfg" ]; then + echo "Extracting data" + tar -xJf $data +fi + +# name: prepare AppDir + + #if [ -n "${URI##*/rc*}" ] && [ ! -r $URI/$data.minisig ]; then + #curl -LO $URI/$data.minisig + #fi + + #$MINISIGN_PATH -Vm $data -P $MINISIGN_KEY + +cd "$SOURCE_ROOT" +install -s binaries/system/pyrogenesis -Dt $APPDIR/usr/bin +install -s binaries/system/ActorEditor -Dt $APPDIR/usr/bin +cd $APPDIR/usr/bin +ln -s pyrogenesis 0ad +for lib in libmozjs78-ps-release.so \ + libnvcore.so \ + libnvimage.so \ + libnvmath.so \ + libnvtt.so +do + patchelf --set-rpath $lib:$SOURCE_ROOT/binaries/system pyrogenesis +done +patchelf --set-rpath libthai.so.0:$APPDIR/usr/lib ActorEditor +patchelf --set-rpath libAtlasUI.so:$SOURCE_ROOT/binaries/system ActorEditor +# Note that binaries/system{libmoz*.so, libnv*.so, libAtlasUI.so} will be copied into +# the $APPDIR folder automatically when linuxdeploy is run below. +cd $SOURCE_ROOT +install binaries/system/libCollada.so -Dt $APPDIR/usr/lib +install build/resources/0ad.appdata.xml -Dt $APPDIR/usr/share/metainfo +install build/resources/0ad.png -Dt $APPDIR/usr/share/pixmaps +mkdir -p "$APPDIR/usr/data/config" +cp -a binaries/data/config/default.cfg $APPDIR/usr/data/config +cp -a binaries/data/l10n $APPDIR/usr/data +cp -a binaries/data/tools $APPDIR/usr/data # for Atlas +mkdir -p $APPDIR/usr/data/mods +cp -a binaries/data/mods/mod $APPDIR/usr/data/mods + +## Hopefully prevent out-of-space failure when running on a GitHub hosted runner +#if [ -n "$ACTION_WORKSPACE" ]; then + #cd "$SOURCE_ROOT/build/workspaces" + #./clean-workspaces.sh +#fi + +cd $SOURCE_ROOT +cp -a binaries/data/mods/public $APPDIR/usr/data/mods + +cd "$WORKSPACE" + +## Hopefully prevent out-of-space failure when running on a GitHub hosted runner +#echo "Removing data from source tree (already copied to ${APPDIR})..." +#if [ -n "$ACTION_WORKSPACE" ]; then + #rm -rf "$SOURCE_ROOT/binaries/data" +#fi + +# Set up output directory +OUT_DIR="$WORKSPACE/out" +if [ ! -d "$OUT_DIR" ]; then + mkdir "$OUT_DIR" +fi +cd "$OUT_DIR" + +# Set LinuxDeploy output version +export LINUXDEPLOY_OUTPUT_VERSION="$VERSION" + +# Create the image +if [ -z "$ACTION_WORKSPACE" ]; then +export DEPLOY_GTK_VERSION=3 +# Variable used by gtk plugin +linuxdeploy \ + -d $SOURCE_ROOT/build/resources/0ad.desktop \ + --icon-file=$SOURCE_ROOT/build/resources/0ad.png \ + --icon-filename=0ad \ + --executable $APPDIR/usr/bin/pyrogenesis \ + --library=/usr/lib/x86_64-linux-gnu/libthai.so.0 \ + --custom-apprun=$WORKSPACE/AppRun \ + --appdir $APPDIR \ + --output appimage \ + --plugin gtk +fi + +DATE_STR=$(date +%y%m%d%H%M) +OUT_APPIMAGE="0ad-$VERSION-$DATE_STR-$(uname -m).AppImage" +mv 0_A.D.-$VERSION-$(uname -m).AppImage $OUT_APPIMAGE +sha1sum $OUT_APPIMAGE > "$OUT_APPIMAGE.sha1sum" +cat "$OUT_APPIMAGE.sha1sum" -docker run -it --rm \ - -e VERSION=$VERSION \ - -e ARCH=x86_64 \ - -e WORKSPACE \ - -e HOSTUID=$UID \ - -v $PWD:$WORKSPACE \ - andy5995/0ad-build-env:$UBUNTU_CODENAME \ - /bin/bash -c 'usermod -u $HOSTUID 0adbuilder \ - && su 0adbuilder --command "$WORKSPACE/workflow.sh"' +exit 0 diff --git a/workflow.sh b/workflow.sh deleted file mode 100755 index 39ff4a9..0000000 --- a/workflow.sh +++ /dev/null @@ -1,213 +0,0 @@ -#!/bin/bash - -cmp_substr () { - if [ -z "$1" -o -z "$2" ]; then - return 1 - fi - [ -z "${1##*$2*}" ] - return $? -} - -# 0ad signing keys -# key for a26 -MINISIGN_KEY=RWTWLbO12+ig3lUExIor3xd6DdZaYFEozn8Bu8nIzY3ImuRYQszIQyyy -# key for a25 -# MINISIGN_KEY=RWT0hFWv57I2RFoJwLVjxEr44JOq/RkEx1oT0IA3PPPICnSF7HFKW1CT - -export -p - -# This var is set in the the docker container -if [ -z "DOCKER_0AD_BUILD" ]; then - echo "This script is intended to be run inside a docker container." - echo "(hint: andy5995/0ad-build-env:focal)" - exit 1 -fi - -set -ev - -test -n "$VERSION" -test -n "$WORKSPACE" -APPDIR="$WORKSPACE/AppDir" -URI=https://releases.wildfiregames.com/rc - -svn=1 -cmp_substr "$VERSION" "svn" || svn=0 - -cd $WORKSPACE -if [ ! -e "AppRun" ]; then - echo "You must be in the same directory where the AppRun file resides" - exit 1 -fi - -if [ -d "$APPDIR" ]; then - rm -rf "$APPDIR" -else - mkdir -v -p "$APPDIR" -fi - -if [ $svn -ne 1 ]; then - ABS_PATH_SRC_ROOT="$WORKSPACE/0ad-$VERSION" -else - ABS_PATH_SRC_ROOT="$WORKSPACE/0ad-svn" -fi - -cd "$WORKSPACE" - -# The gtk plugin is placed in this directory because this is where linuxdeploy -# is run from later to create the AppImage. In this location, the plugin will -# be visible to linuxdeploy when the AppImage is created -if [ ! -r linuxdeploy-plugin-gtk.sh ]; then - curl -LO https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh - chmod +x linuxdeploy-plugin-gtk.sh -fi - -if [ $svn -ne 1 ]; then - # Get, check, and extract source - source=0ad-$VERSION-unix-build.tar.xz - source_sum=$source.sha1sum - - for file in $source $source_sum; do - if [ ! -r "$file" ]; then - curl -LO "$URI/$file" - fi - done - - #if [ -n "${URI##*/rc*}" ]; then - #if [ ! -r $URI/$source.minisig ]; then - #curl -LO $URI/$source.minisig - #fi - #$MINISIGN_PATH -Vm $source -P $MINISIGN_KEY - #fi - sha1sum -c $source_sum - tar xJf $WORKSPACE/$source -else - if [ ! -r "0ad-svn" ]; then - svn --quiet co https://svn.wildfiregames.com/public/ps/trunk/ 0ad-svn - cd 0ad-svn - else - cd "$WORKSPACE/0ad-svn" - svn --quiet up - fi - VERSION="$VERSION-r$(svn info --show-item revision)" -fi - -# name: build -if [ ! -r "$ABS_PATH_SRC_ROOT/source/main.cpp" ]; then - echo "set the source root!" - exit 1 -fi -cd "$ABS_PATH_SRC_ROOT/build/workspaces" - -/bin/bash -c 'ionice -c3 nice -n 19 \ - ./update-workspaces.sh \ - -j$(nproc) && \ - make config=release -C gcc -j$(nproc)' - -# name: prepare AppDir -cd $WORKSPACE -if [ $svn -ne 1 ]; then - # Get, check, and extract data - data=0ad-$VERSION-unix-data.tar.xz - data_sum=$data.sha1sum - echo "Getting data and extracting archive..." - for file in $data $data_sum; do - if [ ! -r "$file" ]; then - curl -LO "$URI/$file" - fi - done - - #if [ -n "${URI##*/rc*}" ] && [ ! -r $URI/$data.minisig ]; then - #curl -LO $URI/$data.minisig - #fi - - #$MINISIGN_PATH -Vm $data -P $MINISIGN_KEY - sha1sum -c $data_sum - tar xJf $data -fi - -cd "$ABS_PATH_SRC_ROOT" -install -s binaries/system/pyrogenesis -Dt $APPDIR/usr/bin -install -s binaries/system/ActorEditor -Dt $APPDIR/usr/bin -cd $APPDIR/usr/bin -ln -s pyrogenesis 0ad -for lib in libmozjs78-ps-release.so \ - libnvcore.so \ - libnvimage.so \ - libnvmath.so \ - libnvtt.so -do - patchelf --set-rpath $lib:$ABS_PATH_SRC_ROOT/binaries/system pyrogenesis -done -patchelf --set-rpath libthai.so.0:$APPDIR/usr/lib ActorEditor -patchelf --set-rpath libAtlasUI.so:$ABS_PATH_SRC_ROOT/binaries/system ActorEditor -# Note that binaries/system{libmoz*.so, libnv*.so, libAtlasUI.so} will be copied into -# the $APPDIR folder automatically when linuxdeploy is run below. -cd $ABS_PATH_SRC_ROOT -install binaries/system/libCollada.so -Dt $APPDIR/usr/lib -install build/resources/0ad.appdata.xml -Dt $APPDIR/usr/share/metainfo -install build/resources/0ad.desktop -Dt $APPDIR/usr/share/applications -install build/resources/0ad.png -Dt $APPDIR/usr/share/pixmaps -mkdir -p "$APPDIR/usr/data/config" -cp -a binaries/data/config/default.cfg $APPDIR/usr/data/config -cp -a binaries/data/l10n $APPDIR/usr/data -cp -a binaries/data/tools $APPDIR/usr/data # for Atlas -mkdir -p $APPDIR/usr/data/mods -cp -a binaries/data/mods/mod $APPDIR/usr/data/mods - -# Hopefully prevent out-of-space failure when running on a GitHub hosted runner -if [ -n "${GITHUB_ACTIONS}" ]; then - cd "${ABS_PATH_SRC_ROOT}/build/workspaces" - ./clean-workspaces.sh -fi - -cd $ABS_PATH_SRC_ROOT -if [ $svn -eq 1 ]; then - mkdir -p $APPDIR/usr/data/mods/public - binaries/system/pyrogenesis -writableRoot \ - -mod=mod \ - -archivebuild=binaries/data/mods/public \ - -archivebuild-output=$APPDIR/usr/data/mods/public/public.zip \ - -archivebuild-compress \ - && test -f "$APPDIR/usr/data/mods/public/public.zip" - cp -a binaries/data/mods/public/mod.json $APPDIR/usr/data/mods/public -else - cp -a binaries/data/mods/public $APPDIR/usr/data/mods -fi - -# spirv. See https://wildfiregames.com/forum/topic/104382-vulkan-new-graphics-api/ -mkdir $APPDIR/usr/data/mods/0ad-spirv -cd $APPDIR/usr/data/mods/0ad-spirv -curl -LO https://releases.wildfiregames.com/rc/0ad-spirv.zip -curl -LO https://releases.wildfiregames.com/rc/0ad-spirv.zip.sha1sum -sha1sum -c 0ad-spirv.zip.sha1sum -rm 0ad-spirv.zip.sha1sum -unzip 0ad-spirv.zip mod.json - -cd "$WORKSPACE" - -# Hopefully prevent out-of-space failure when running on a GitHub hosted runner -echo "Removing data from source tree (already copied to ${APPDIR})..." -if [ -n "${GITHUB_ACTIONS}" ]; then - rm -rf "${ABS_PATH_SRC_ROOT}/binaries/data" -fi - -# Create the image -DEPLOY_GTK_VERSION=3 # Variable used by gtk plugin -ionice -c3 $TOOLS_DIR/squashfs-root/AppRun -d $APPDIR/usr/share/applications/0ad.desktop \ - --icon-file=$APPDIR/usr/share/pixmaps/0ad.png \ - --icon-filename=0ad \ - --executable $APPDIR/usr/bin/pyrogenesis \ - --library=/usr/lib/x86_64-linux-gnu/libthai.so.0 \ - --custom-apprun=$WORKSPACE/AppRun \ - --appdir $APPDIR \ - --output appimage \ - --plugin gtk - -DATE_STR=$(date +%y%m%d%H%M) -OUT_APPIMAGE="0ad-$VERSION-$DATE_STR-$UBUNTU_CODENAME-$ARCH.AppImage" -mv 0_A.D.-$VERSION-$ARCH.AppImage $OUT_APPIMAGE -echo "Generating sha1sum..." -sha1sum $OUT_APPIMAGE > "$OUT_APPIMAGE.sha1sum" -cat "$OUT_APPIMAGE.sha1sum" - -exit 0