diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml new file mode 100644 index 000000000..e05ba06c1 --- /dev/null +++ b/.github/workflows/packages.yml @@ -0,0 +1,103 @@ +name: Packages + +on: + #push: + # branches: [ master ] + + #pull_request: + # branches: [ master ] + + workflow_dispatch: + +jobs: + linux: + name: Linux AppImages + runs-on: ubuntu-20.04 + steps: + - name: Clone Repository + uses: actions/checkout@v3 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y scons libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libphysfs-dev + + - name: Configure and build + run: scons -j`nproc` opengl=1 sdl2=1 sdlmixer=1 + + - name: Package AppImage + run: ./contrib/packaging/linux/build_package.sh + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: linux + path: '*.AppImage' + + macos: + name: macOS Apps + runs-on: macos-10.15 + steps: + - name: Clone repository + uses: actions/checkout@v3 + + - name: Prepare environment + run: export MACOSX_DEPLOYMENT_TARGET=10.14 + + - name: Install dependencies + run: | + brew install scons sdl2 sdl2_image sdl2_mixer physfs pkg-config + + - name: Configure and build + run: scons -j2 opengl=1 sdl2=1 sdlmixer=1 macos_add_frameworks=0 + + - name: Package + run: ./contrib/packaging/macos/build_package.sh + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: macos + path: '*.zip' + + windows: + name: Windows + runs-on: windows-2019 + + defaults: + run: + shell: msys2 {0} + + steps: + - name: Setup MSYS2 + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + git + zip + base-devel + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-scons + mingw-w64-x86_64-pkgconf + mingw-w64-x86_64-SDL2 + mingw-w64-x86_64-SDL2_image + mingw-w64-x86_64-SDL2_mixer + mingw-w64-x86_64-physfs + + - name: Clone repository + uses: actions/checkout@v3 + + - name: Configure and build + run: scons -j2 sdl2=1 sdlmixer=1 + + - name: Package + run: ./contrib/packaging/windows/build_package.sh + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: windows + path: '*.zip' + diff --git a/contrib/packaging/linux/build_package.sh b/contrib/packaging/linux/build_package.sh new file mode 100755 index 000000000..5cc2a4dfe --- /dev/null +++ b/contrib/packaging/linux/build_package.sh @@ -0,0 +1,61 @@ +#!/bin/bash +set -x + +GIT_HASH=$(git rev-parse --short HEAD) + +#ARCH=x86_64 + + +# Grab latest AppImage package +curl -s -L -O https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage || exit 3 +chmod a+x appimagetool-x86_64.AppImage + +# And the AppRun +curl -s -L -O https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-x86_64 || exit 3 +chmod a+x AppRun-x86_64 + + +build_appimage() { + name="$1" + prettyname="$2" + + appdir="${name}.appdir" + appimagename="${prettyname}-${GIT_HASH}.AppImage" + + ## Install + # Copy resources into package dir + mkdir "${appdir}" + + # Executable + mkdir -p ${appdir}/usr/bin + cp build/${name}/${name} ${appdir}/usr/bin + + # Icons + mkdir -p ${appdir}/usr/share/pixmaps + cp ${name}/${name}.xpm ${appdir}/usr/share/pixmaps + cp ${name}/${name}.xpm ${appdir}/ + + mkdir -p ${appdir}/usr/share/icons/hicolor/128x128/apps/ + cp ${name}/${name}.png ${appdir}/usr/share/icons/hicolor/128x128/apps/ + cp ${name}/${name}.png ${appdir}/ + + # Menu item + mkdir -p ${appdir}/usr/share/applications + cp ${name}/${name}.desktop ${appdir}/usr/share/applications + cp ${name}/${name}.desktop ${appdir}/ + + ## Package + cp AppRun-x86_64 ${appdir}/AppRun + + # Package! + ./appimagetool-x86_64.AppImage --no-appstream --verbose "${appdir}" "${appimagename}" + + rm -rf ${appdir} +} + +# Build each subunit +build_appimage "d1x-rebirth" "d1x-rebirth" +build_appimage "d2x-rebirth" "d2x-rebirth" + +# Clean +rm -f appimagetool* AppRun* diff --git a/contrib/packaging/macos/build_package.sh b/contrib/packaging/macos/build_package.sh new file mode 100755 index 000000000..c577de1e9 --- /dev/null +++ b/contrib/packaging/macos/build_package.sh @@ -0,0 +1,37 @@ +#!/bin/bash +set -x + +export MACOSX_DEPLOYMENT_TARGET=10.14 + +GIT_HASH=$(git rev-parse --short HEAD) + +# Get utils +git clone https://github.com/auriamg/macdylibbundler.git +cd macdylibbundler +make +cd .. + +find ./ -name '*.app' + +build_app() { + name="$1" + prettyname="$2" + + zipfilename="${prettyname}-${GIT_HASH}.app.zip" + + cd build + + # Bundle resources + ../macdylibbundler/dylibbundler -od -b -x ${prettyname}.app/Contents/MacOS/${name} -d ${prettyname}.app/Contents/libs + + # zip up and output to top level dir + zip -r -X ../${zipfilename} ${prettyname}.app + + cd .. +} + +build_app "d1x-rebirth" "D1X-Rebirth" +build_app "d2x-rebirth" "D2X-Rebirth" + +# Clean up +rm -rf macdylibbundler diff --git a/contrib/packaging/windows/build_package.sh b/contrib/packaging/windows/build_package.sh new file mode 100755 index 000000000..0c616bdf4 --- /dev/null +++ b/contrib/packaging/windows/build_package.sh @@ -0,0 +1,49 @@ +#!/bin/bash +set -x + +GIT_HASH=$(git rev-parse --short HEAD) + +build_app() { + name="$1" + prettyname="$2" + + zipfilename="${prettyname}-win-${GIT_HASH}.zip" + outdir="${prettyname}" + tmpdir="packagetemp" + + # Have to bundle in separate directory because of case-insensitivity clashes + mkdir ${tmpdir} + cd ${tmpdir} + + mkdir ${outdir} + mkdir ${outdir}/Demos + mkdir ${outdir}/Missions + mkdir ${outdir}/Screenshots + + # Copy executable and libraris + cp ../build/${name}/${name}.exe ${outdir}/ + + # Copy in .dlls the old fashioned way. This assumes all the needed DLLs are + # ones from the mingw64 installation + ldd ${outdir}/${name}.exe |grep mingw64 |sort |cut -d' ' -f3 |while read dll; do cp "${dll}" ${outdir}/; done + + # Copy in other resources + cp ../${name}/*.ini ${outdir}/ + cp ../COPYING.txt ${outdir}/ + cp ../GPL-3.txt ${outdir}/ + cp ../README.md ${outdir}/ + cp ../INSTALL.markdown ${outdir}/ + + # zip up and output to top level dir + zip -r -X ../${zipfilename} ${outdir} + + cd .. + + rm -rf ${tmpdir} +} + +build_app "d1x-rebirth" "D1X-Rebirth" +build_app "d2x-rebirth" "D2X-Rebirth" + +# Clean up + diff --git a/d1x-rebirth/d1x-rebirth.png b/d1x-rebirth/d1x-rebirth.png new file mode 100644 index 000000000..e79162542 Binary files /dev/null and b/d1x-rebirth/d1x-rebirth.png differ diff --git a/d2x-rebirth/d2x-rebirth.png b/d2x-rebirth/d2x-rebirth.png new file mode 100644 index 000000000..8018e8ecc Binary files /dev/null and b/d2x-rebirth/d2x-rebirth.png differ