adjust static thing #264
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build hUGETracker | |
on: | |
- push | |
- pull_request | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- macos-12 | |
# - windows-2019 | |
include: | |
- os: ubuntu-20.04 | |
name: Linux | |
- os: macos-12 | |
name: Mac | |
# - os: windows-2019 | |
# name: Windows | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Ubuntu dependencies | |
if: matrix.name == 'Linux' | |
run: | | |
sudo apt -qq update | |
sudo apt install -yq libsdl2-dev bison nasm | |
curl -Lo rgbds.tar.gz 'https://github.com/gbdev/rgbds/releases/download/v0.6.1/rgbds-0.6.1.tar.gz' | |
tar xvf rgbds.tar.gz rgbds/{include,src,Makefile} | |
cd rgbds | |
make -j4 rgbasm rgblink rgbfix Q= | |
wget https://tenet.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.6/lazarus-project_2.2.6-0_amd64.deb | |
wget https://tenet.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.6/fpc-laz_3.2.2-210709_amd64.deb | |
wget https://tenet.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.6/fpc-src_3.2.2-210709_amd64.deb | |
sudo apt install -yq ./fpc-laz_3.2.2-210709_amd64.deb ./fpc-src_3.2.2-210709_amd64.deb ./lazarus-project_2.2.6-0_amd64.deb | |
- name: Install macOS dependencies | |
if: matrix.name == 'Mac' | |
run: | | |
brew install --cask lazarus | |
brew install rgbds | |
brew install automake fdk-aac git lame libass libtool libvorbis libvpx \ | |
opus shtool texi2html theora wget x264 x265 xvid nasm | |
curl -Lo 'sdl2.tgz' https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.28.5.tar.gz | |
tar xzf sdl2.tgz | |
pushd SDL-release-2.28.5 | |
./configure --disable-video --disable-render --disable-haptic --disable-joystick \ | |
--disable-power --disable-hidapi --disable-sensor --disable-filesystem \ | |
--disable-timers --disable-atomic --disable-file --disable-misc \ | |
--disable-locale --disable-loadso --disable-cpuinfo | |
make | |
cp build/.libs/libSDL2.a /usr/local/lib | |
popd | |
mkdir rgbds | |
for f in asm link fix; do ln -s `which rgb$f` rgbds/rgb$f; done | |
- name: Install Windows dependencies | |
if: matrix.name == 'Windows' | |
shell: bash | |
run: | | |
choco install lazarus | |
curl -Lo 'sdl2.zip' 'https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-2.28.5-win32-x64.zip' | |
curl -Lo 'rgbds.zip' 'https://github.com/gbdev/rgbds/releases/download/v0.6.1/rgbds-0.6.1-win64.zip' | |
unzip -d rgbds rgbds.zip rgb{asm,link,fix}.exe | |
- name: Set up MSYS2 | |
if: matrix.name == 'Windows' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
path-type: strict | |
release: false | |
update: false | |
install: >- | |
base-devel | |
mingw-w64-x86_64-toolchain | |
yasm | |
- name: Compile FFmpeg | |
if: matrix.name != 'Windows' | |
shell: bash | |
run: | | |
# HACK: MacOS 12 doesn't have realpath. 13 does, but GH Actions don't have it in non-beta yet. | |
_realpath() { | |
cd "$(dirname "$0")" ; pwd -P | |
} | |
set -x | |
curl -Lo lame.tar.gz 'https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz' | |
tar xf lame.tar.gz | |
pushd lame-3.100 | |
./configure --prefix="`_realpath ..`/lame-install" --disable-dependency-tracking --disable-shared --enable-nasm --disable-gtktest --disable-decoder --disable-frontend | |
make | |
make install | |
popd | |
curl -Lo ffmpeg.tar.xz 'http://ffmpeg.org/releases/ffmpeg-4.4.tar.xz' | |
tar xf ffmpeg.tar.xz | |
cd ffmpeg-4.4 | |
echo ./configure --pkg-config-flags=--static --disable-debug --enable-lto --disable-programs --enable-ffmpeg --disable-doc --disable-everything --enable-protocol=pipe --enable-protocol=file --enable-filter=aresample --enable-decoder=pcm_f32le --enable-demuxer=pcm_f32le --enable-encoder=flac --enable-muxer=ogg --enable-muxer=flac --enable-encoder=pcm_s16le --enable-muxer=wav --enable-libmp3lame --enable-encoder=libmp3lame --enable-muxer=mp3 --extra-cflags="-I`_realpath ../lame-install/include`" --extra-ldflags="-L`_realpath ../lame-install/lib`" | |
./configure --pkg-config-flags=--static --disable-debug --enable-lto --disable-programs --enable-ffmpeg --disable-doc --disable-everything --enable-protocol=pipe --enable-protocol=file --enable-filter=aresample --enable-decoder=pcm_f32le --enable-demuxer=pcm_f32le --enable-encoder=flac --enable-muxer=ogg --enable-muxer=flac --enable-encoder=pcm_s16le --enable-muxer=wav --enable-libmp3lame --enable-encoder=libmp3lame --enable-muxer=mp3 --extra-cflags="-I`_realpath ../lame-install/include`" --extra-ldflags="-L`_realpath ../lame-install/lib`" || cat ffbuild/config.log | |
make | |
- name: Compile FFmpeg | |
if: matrix.name == 'Windows' | |
shell: msys2 {0} | |
run: | | |
# HACK: MacOS 12 doesn't have realpath. 13 does, but GH Actions don't have it in non-beta yet. | |
_realpath() { | |
cd "$(dirname "$0")" ; pwd -P | |
} | |
curl -Lo lame.tar.gz 'https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz' | |
tar xf lame.tar.gz | |
pushd lame-3.100 | |
./configure --prefix="`_realpath ..`/lame-install" --disable-dependency-tracking --disable-shared --enable-nasm --disable-gtktest --disable-decoder --disable-frontend | |
make | |
make install | |
popd | |
curl -Lo ffmpeg.tar.xz 'http://ffmpeg.org/releases/ffmpeg-4.4.tar.xz' | |
tar xf ffmpeg.tar.xz | |
cd ffmpeg-4.4 | |
./configure --extra-ldflags="-static" --disable-debug --enable-lto --disable-programs --enable-ffmpeg --disable-doc --disable-everything --enable-protocol=pipe --enable-protocol=file --enable-filter=aresample --enable-decoder=pcm_f32le --enable-demuxer=pcm_f32le --enable-encoder=flac --enable-muxer=ogg --enable-muxer=flac --enable-encoder=pcm_s16le --enable-muxer=wav --enable-libmp3lame --enable-encoder=libmp3lame --enable-muxer=mp3 --extra-cflags="-I`_realpath ../lame-install/include`" --extra-ldflags="-L`_realpath ../lame-install/lib`" | |
make | |
- name: Check out hUGETracker | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
path: hUGETracker | |
submodules: true # This is intentionally not "recursive", change if needed | |
- name: Build release | |
shell: bash | |
working-directory: hUGETracker | |
run: | # The PATH manipulation is because the macOS and Windows installs do NOT put it in the PATH >_< | |
export PATH="$PATH":/Applications/Lazarus:/c/lazarus | |
export VERSION_STRING=`git describe --tags --dirty --always` | |
lazbuild --add-package-link src/rackctls/RackCtlsPkg.lpk | |
lazbuild --add-package-link src/bgrabitmap/bgrabitmap/bgrabitmappack.lpk | |
lazbuild src/hUGETracker.lpi --build-mode="Production ${{ matrix.name }}" | |
lazbuild src/uge2source/uge2source.lpi --build-mode=Release | |
- name: Package build | |
shell: bash | |
run: | # macOS does NOT have `realpath` :) | |
mkdir packaging | |
for f in hUGETracker/{sample-songs,src/hUGEDriver,fonts/PixeliteTTF.ttf,keymaps}; do ln -sv "$PWD/$f" packaging; done | |
OBJ=`mktemp` | |
HDOBJ=`mktemp` | |
rgbds/rgbasm -E -i hUGETracker/src/hUGEDriver -o "$HDOBJ" hUGETracker/src/hUGEDriver/hUGEDriver.asm | |
rgbds/rgbasm -i hUGETracker/src/hUGEDriver/include -o "$OBJ" hUGETracker/src/halt.asm | |
rgbds/rgblink -o packaging/halt.gb -n packaging/halt.sym "$OBJ" "$HDOBJ" | |
rgbds/rgbfix -vp0xFF packaging/halt.gb | |
rm "$OBJ" "$HDOBJ" | |
cp -v hUGETracker/src/Release/hUGETracker hUGETracker/src/uge2source/Release/uge2source packaging | |
mv packaging/sample-songs "packaging/Sample Songs" | |
mv packaging/keymaps "packaging/Keymaps" | |
- name: Extra Windows packaging | |
if: matrix.name == 'Windows' | |
shell: bash | |
run: | | |
unzip -d packaging sdl2.zip SDL2.dll | |
cp -v ffmpeg-4.4/ffmpeg.exe rgbds/* packaging | |
- name: Extra Mac packaging | |
if: matrix.name == 'Mac' | |
shell: bash | |
run: | | |
cp -Rpv hUGETracker/src/Release/hUGETracker.app packaging | |
cp -v hUGETracker/graphics/hUGETracker.icns packaging/hUGETracker.app/Contents/Resources | |
mv packaging/{halt.gb,halt.sym,hUGEDriver,PixeliteTTF.ttf} packaging/hUGETracker.app/Contents/Resources | |
for f in asm link fix; do ln -s `which rgb$f` packaging/hUGETracker.app/Contents/MacOS/rgb$f; done | |
cp -v ffmpeg-4.4/ffmpeg packaging/hUGETracker.app/Contents/MacOS | |
# Hacky, but unlikely to break any time soon. | |
ed packaging/hUGETracker.app/Contents/Info.plist << END | |
5i | |
<key>CFBundleIconFile</key> | |
<string>hUGETracker.icns</string> | |
. | |
w | |
q | |
END | |
- name: Zip files (preserving permissions) | |
shell: bash | |
run: zip -r build.zip packaging/* | |
- name: Store build | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.name }} build | |
path: build.zip |