2024-08-25 18:49:34 +08:00
|
|
|
name: "Emu third-party dependencies (Linux)"
|
2024-05-11 06:20:33 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
# needed since it allows this to become a reusable workflow
|
|
|
|
workflow_dispatch:
|
|
|
|
# allows manual trigger
|
|
|
|
|
|
|
|
permissions:
|
2024-08-25 18:49:34 +08:00
|
|
|
contents: "write"
|
2024-05-11 06:20:33 +08:00
|
|
|
|
|
|
|
env:
|
2024-08-25 18:49:34 +08:00
|
|
|
PREMAKE_ACTION: "gmake2"
|
|
|
|
DEPS_CACHE_KEY: "emu-deps-linux"
|
|
|
|
DEPS_CACHE_DIR: "build/deps/linux"
|
2024-05-11 06:20:33 +08:00
|
|
|
|
2024-05-11 20:18:05 +08:00
|
|
|
PACKAGE_BASE_DIR: "build/package/linux"
|
2024-08-25 18:49:34 +08:00
|
|
|
THIRD_PARTY_BASE_DIR: "third-party"
|
|
|
|
|
2024-05-11 06:20:33 +08:00
|
|
|
jobs:
|
2024-05-11 09:54:56 +08:00
|
|
|
deps-build:
|
2024-09-06 01:40:37 +08:00
|
|
|
runs-on: "ubuntu-20.04"
|
2024-05-11 07:01:35 +08:00
|
|
|
if: ${{ !cancelled() }}
|
2024-05-11 06:20:33 +08:00
|
|
|
|
2024-05-11 20:18:05 +08:00
|
|
|
steps:
|
2024-08-25 18:49:34 +08:00
|
|
|
- name: "Lookup cache for deps"
|
|
|
|
id: "emu-deps-cache-step"
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
key: "${{ env.DEPS_CACHE_KEY }}-${{ env.PREMAKE_ACTION }}"
|
|
|
|
path: "${{ env.DEPS_CACHE_DIR }}/${{ env.PREMAKE_ACTION }}"
|
2024-05-11 06:20:33 +08:00
|
|
|
|
2024-08-25 18:49:34 +08:00
|
|
|
# we need branch because it has build scripts
|
|
|
|
- name: "Checkout branch"
|
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
|
|
uses: actions/checkout@v4
|
2024-05-11 06:20:33 +08:00
|
|
|
|
2024-08-25 18:49:34 +08:00
|
|
|
- name: "Clone third-party deps (common/linux)"
|
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: "third-party/common/linux"
|
|
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/common/linux"
|
2024-05-31 17:36:49 +08:00
|
|
|
|
2024-08-25 18:49:34 +08:00
|
|
|
- name: "Clone third-party deps (deps/linux)"
|
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: "third-party/deps/linux"
|
|
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/linux"
|
2024-05-11 06:20:33 +08:00
|
|
|
|
2024-08-25 18:49:34 +08:00
|
|
|
- name: "Clone third-party deps (deps/common)"
|
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: "third-party/deps/common"
|
|
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/common"
|
2024-05-11 06:20:33 +08:00
|
|
|
|
2024-08-25 18:49:34 +08:00
|
|
|
# fix folder permissions! not sure why this fails
|
|
|
|
# nested subdirs "build/linux/release" cause permission problems
|
|
|
|
- name: "Give all permissions to repo folder"
|
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
|
|
shell: "bash"
|
|
|
|
working-directory: "${{ github.workspace }}"
|
|
|
|
run: sudo chmod -R 777 "${{ github.workspace }}"
|
2024-05-11 06:20:33 +08:00
|
|
|
|
2024-08-25 18:49:34 +08:00
|
|
|
# mandatory Linux packages
|
|
|
|
- name: "Install required packages"
|
|
|
|
shell: "bash"
|
|
|
|
run: |
|
|
|
|
sudo apt update -y
|
|
|
|
sudo apt install -y coreutils # echo, printf, etc...
|
|
|
|
sudo apt install -y build-essential
|
|
|
|
sudo apt install -y gcc-multilib # needed for 32-bit builds
|
|
|
|
sudo apt install -y g++-multilib
|
|
|
|
# sudo apt install -y clang
|
|
|
|
sudo apt install -y libglx-dev # needed for overlay build (header files such as GL/glx.h)
|
|
|
|
sudo apt install -y libgl-dev # needed for overlay build (header files such as GL/gl.h)
|
|
|
|
# sudo apt install -y binutils # (optional) contains the tool 'readelf' mainly, and other usefull binary stuff
|
2024-05-31 17:24:38 +08:00
|
|
|
|
2024-08-25 18:49:34 +08:00
|
|
|
- name: "Build deps"
|
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
|
|
shell: "bash"
|
|
|
|
working-directory: "${{ github.workspace }}"
|
|
|
|
run: |
|
|
|
|
export CMAKE_GENERATOR="Unix Makefiles"
|
|
|
|
sudo chmod 777 ./${{env.THIRD_PARTY_BASE_DIR}}/common/linux/premake/premake5
|
|
|
|
./${{env.THIRD_PARTY_BASE_DIR}}/common/linux/premake/premake5 --file=premake5-deps.lua --64-build --32-build --all-ext --all-build --j=2 --verbose --clean --os=linux gmake2
|