Skip to content

Commit

Permalink
build: add linux builds (#984)
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- authored Sep 20, 2023
1 parent 0df2faa commit 2e685dd
Show file tree
Hide file tree
Showing 12 changed files with 347 additions and 126 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
- workflow_dispatch

jobs:
publish_docker_image:
name: Build Docker toolchain
publish_docker_image_win:
name: Build Windows Docker toolchain
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
Expand All @@ -20,7 +20,28 @@ jobs:
path: .
fetch-depth: 0

- name: Build Docker image
- name: Build Docker image (Windows)
run: |
docker build -t "rrdash/tomb1main:latest" . -f docker/game/Dockerfile
docker build -t "rrdash/tomb1main:latest" . -f docker/game/win/Dockerfile
docker push "rrdash/tomb1main:latest"
publish_docker_image_linux:
name: Build Linux Docker toolchain
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Checkout code
uses: actions/checkout@v2
with:
path: .
fetch-depth: 0

- name: Build Docker image (Linux)
run: |
docker build -t "rrdash/tomb1main-linux:latest" . -f docker/game/linux/Dockerfile
docker push "rrdash/tomb1main-linux:latest"
101 changes: 83 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
publish_release:
name: Create a GitHub release
runs-on: ubuntu-latest
needs: [build_game, build_installer]
needs: [build_game_win, build_installer]
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -48,7 +48,13 @@ jobs:
uses: actions/download-artifact@v1
with:
path: artifacts/
name: game_all
name: game-win-all

- name: Download built game asset
uses: actions/download-artifact@v1
with:
path: artifacts/
name: game-linux-all

- name: Download built installer asset
uses: actions/download-artifact@v1
Expand All @@ -62,7 +68,8 @@ jobs:

- name: Rename assets
run: |
mv artifacts/game.zip artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}.zip
mv artifacts/game-win.zip artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}-Windows.zip
mv artifacts/game-linux.zip artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}-Linux.zip
mv artifacts/Tomb1Main_Installer.exe artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}-Installer.exe
- name: Generate Changelog
Expand All @@ -84,7 +91,8 @@ jobs:
prerelease: ${{ inputs.prerelease }}
fail_on_unmatched_files: true
files: |
artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}.zip
artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}-Windows.zip
artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}-Linux.zip
artifacts/Tomb1Main-${{ steps.get_version.outputs.VERSION }}-Installer.exe
build_configurator:
Expand Down Expand Up @@ -114,8 +122,8 @@ jobs:
name: configtool
path: tools/config/out/Tomb1Main_ConfigTool.exe

build_game:
name: Build the game
build_game_win:
name: Build the game (Windows)
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -134,18 +142,18 @@ jobs:
run: |
make clean release
mkdir out/
cp build/*.exe out/
cp build/win/*.exe out/
cp -r bin/* out/
- name: Upload the artifact
uses: actions/upload-artifact@v1
with:
name: game
name: game-win
path: out/

package_game:
name: Package the game
needs: [build_game, build_configurator]
package_game_win:
name: Package the game (Windows)
needs: [build_game_win, build_configurator]
runs-on: ubuntu-latest
steps:
- name: Download built config tool assets
Expand All @@ -158,7 +166,64 @@ jobs:
uses: actions/download-artifact@v1
with:
path: artifacts/
name: game
name: game-win

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make p7zip-full
- name: Package the game
run: |
mkdir out
cd artifacts
7z a ../out/game-win.zip *
- name: Upload the artifact
uses: actions/upload-artifact@v1
with:
name: game-win-all
path: out/game-win.zip

build_game_linux:
name: Build the game (Linux)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: .
fetch-depth: 0

- name: Install dependencies
run: |
echo "$GITHUB_CONTEXT"
sudo apt-get update
sudo apt-get install -y make moby-engine moby-cli
- name: Build the game
run: |
make clean release-linux
mkdir out/
cp build/linux/Tomb1Main out/
cp -r bin/* out/
- name: Upload the artifact
uses: actions/upload-artifact@v1
with:
name: game-linux
path: out/

package_game_linux:
name: Package the game (Linux)
needs: [build_game_linux]
runs-on: ubuntu-latest
steps:
- name: Download built game assets
uses: actions/download-artifact@v1
with:
path: artifacts/
name: game-linux

- name: Install dependencies
run: |
Expand All @@ -169,17 +234,17 @@ jobs:
run: |
mkdir out
cd artifacts
7z a ../out/game.zip *
7z a ../out/game-linux.zip *
- name: Upload the artifact
uses: actions/upload-artifact@v1
with:
name: game_all
path: out/game.zip
name: game-linux-all
path: out/game-linux.zip

build_installer:
name: Build the installer
needs: [package_game]
needs: [package_game_win]
runs-on: windows-latest # https://github.com/dotnet/runtime/issues/3828
steps:
- name: Checkout code
Expand All @@ -192,7 +257,7 @@ jobs:
uses: actions/download-artifact@v1
with:
path: artifacts/
name: game_all
name: game-win-all

- name: Setup dependencies
uses: actions/setup-dotnet@v2
Expand All @@ -201,7 +266,7 @@ jobs:

- name: Build
run: |
cp artifacts/game.zip tools/installer/Installer/Resources/release.zip
cp artifacts/game-win.zip tools/installer/Installer/Resources/release.zip
cd tools/installer
dotnet restore
dotnet publish -c Release -o out
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## [Unreleased](https://github.com/rr-/Tomb1Main/compare/stable...develop) - ××××-××-××
- added Linux builds and toolchain

## [2.16](https://github.com/rr-/Tomb1Main/compare/2.15.3...2.16) - 2023-09-20
- added a new rendering mode called "framebuffer" that lets the game to run at lower resolutions (#114)
Expand Down
36 changes: 22 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@ define build
mkdir -p build
docker run --rm \
--user $(HOST_USER_UID):$(HOST_USER_GID) \
--entrypoint /app/docker/game/entrypoint.sh \
--entrypoint /app/docker/game-win/entrypoint.sh \
-e TARGET="$(TARGET)" \
-v $(CWD):/app/ \
rrdash/tomb1main:latest
endef

define build-linux
$(eval TARGET := $(1))
mkdir -p build
docker run --rm \
--user $(HOST_USER_UID):$(HOST_USER_GID) \
--entrypoint /app/docker/game-linux/entrypoint.sh \
-e TARGET="$(TARGET)" \
-v $(CWD):/app/ \
rrdash/tomb1main-linux:latest
endef

debug:
$(call build,debug)

Expand All @@ -22,6 +33,15 @@ debugopt:
release:
$(call build,release)

debug-linux:
$(call build-linux,debug)

debugopt-linux:
$(call build-linux,debugoptimized)

release-linux:
$(call build-linux,release)

clean:
-find build/ -type f -delete
-find build/ -mindepth 1 -empty -type d -delete
Expand All @@ -32,18 +52,6 @@ imports:
lint:
bash -c 'shopt -s globstar; clang-format -i **/*.c **/*.h'

test_base:
cp build/*.exe test/

test_bin:
rsync -r bin/ test/

test: build test_base
WINEARCH=win32 MESA_GL_VERSION_OVERRIDE=3.3 wine test/Tomb1Main.exe

test_gold: build test_base
WINEARCH=win32 MESA_GL_VERSION_OVERRIDE=3.3 wine test/Tomb1Main.exe -gold

installer:
docker build . -f docker/installer/Dockerfile -t rrdash/tomb1main_installer
docker run --rm \
Expand All @@ -60,4 +68,4 @@ config:
-v $(CWD):/app/ \
rrdash/tomb1main_config

.PHONY: debug debugopt release clean imports lint test_base test_bin test test_gold installer config
.PHONY: debug debugopt release clean imports lint installer config
31 changes: 4 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ Not all options are turned on by default. Refer to `Tomb1Main_ConfigTool.exe` fo
- added per-level customizable fog distance

#### Miscellaneous
- added Linux builds
- added .jpeg/.png screenshots
- added an option to pause sound in the inventory screen
- added ability to skip FMVs with the Action key
Expand Down Expand Up @@ -454,33 +455,9 @@ Not all options are turned on by default. Refer to `Tomb1Main_ConfigTool.exe` fo

4. **Can I play this on Mac, Linux, Android...?**

We'd like to eventually have only SDL dependency.

## Road map

Note: this section may be subject to change.

- [x] Reverse engineer the main game module
- [x] Integrate the glrage patch
- [x] Replace the proprietary music player with libavcodec and SDL
- [x] Replace the proprietary FMV player with libavcodec and SDL
- [x] Break off TombATI, ship our own .EXE rather than a .DLL
- [x] Add an installer
- [x] Add a config tool
- [ ] Work on cross platform builds
- [x] Port DirectSound to libavcodec and SDL
- [x] Port WinMM to libavcodec and SDL
- [x] Port DirectInput to SDL
- [ ] Replace wgl_ext.h with cross platform variant
- [ ] Remove HWND and HINSTANCE usages
- [ ] ...
- [ ] Test for performance and crash resilience
- [ ] 3.0
- [ ] Work on data injection and other features
- [x] Add Lara's braid to each level
- [x] Fix texture/face issues
- [x] Fix floor data issues
- [ ] ...
Currently supported platforms include Windows and Linux. In the future, it
might be possible to run the game on Macs as well – contributions are
welcome!

## License

Expand Down
Loading

0 comments on commit 2e685dd

Please sign in to comment.