Skip to content

Commit

Permalink
Fix 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Dadoum committed May 18, 2024
1 parent bc3dd80 commit 80211ba
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 48 deletions.
31 changes: 31 additions & 0 deletions .github/actions/rename-files/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Rename files
description: Move files around in the output folder with consistent naming schemes.

inputs:
build-tag:
description: Tag to put in the file name

runs:
using: composite
steps:
- if: ${{ matrix.target == 'linux' }}
name: (Linux) Install dependencies
run: sudo apt-get install -y libz-dev elfutils

- if: ${{ matrix.target == 'macos' }}
name: (macOS) Rename files
run: mv "${{github.workspace}}/bin/sideloader" "${{github.workspace}}/bin/sideloader-${{ inputs.build-tag }}" # TODO make an app bundle

- if: ${{ matrix.target == 'windows' }}
name: (Windows) Rename files
run: |
mv "${{github.workspace}}/bin/sideloader.exe" "${{github.workspace}}/bin/sideloader-${{ inputs.build-tag }}.exe"
mv "${{github.workspace}}/bin/sideloader.pdb" "${{github.workspace}}/bin/sideloader-${{ inputs.build-tag }}.pdb"
- if: ${{ matrix.target == 'linux' }}
name: (Linux) Rename files
run: mv "${{github.workspace}}/bin/sideloader" "${{github.workspace}}/bin/sideloader-${{ inputs.build-tag }}"

- if: ${{ matrix.target == 'linux' }}
name: (Linux) Put debug symbols in a separate file
run: eu-strip --strip-debug -f "${{github.workspace}}/bin/sideloader-${{ inputs.build-tag }}.dbg" "${{github.workspace}}/bin/sideloader-${{ inputs.build-tag }}"
34 changes: 7 additions & 27 deletions .github/actions/target-aarch64-linux-gnu/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,24 @@ runs:
shell: bash
run: sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Set-up macOS cross-compilation
shell: bash
- name: Set-up aarch64 cross-compilation
run: |
mkdir -p $HOME/.ldc/
LDC_VERSION=$(ldc2 --version | head -n 1 | grep -oE "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
curl -LO https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz
tar -xf ./MacOSX11.0.sdk.tar.xz -C $HOME
cp $(dirname $(which ldc2))/../etc/ldc2.conf $HOME/.ldc/ldc2.conf
cat << EOF | tee $HOME/.ldc/ldc2.conf
"arm64-apple-macos":
"aarch64-.*-linux-gnu":
{
// default switches injected before all explicit command-line switches
switches = [
"-gcc=clang",
"-linker=lld-15",
"-Xcc=-target",
"-Xcc=arm64-apple-macos",
"-Xcc=-isysroot",
"-Xcc=$HOME/MacOSX11.0.sdk",
"-Xcc=-F",
"-Xcc=$HOME/ldc2-$LDC_VERSION-osx-arm64/lib",
"-Xcc=-mmacosx-version-min=12.6",
"-L=-platform_version",
"-L=macos",
"-L=12.6.0",
"-L=0.0.0",
"-defaultlib=phobos2-ldc,druntime-ldc",
"-gcc=aarch64-linux-gnu-gcc",
];
// default switches appended after all explicit command-line switches
post-switches = [
"-I$HOME/ldc2-$LDC_VERSION-osx-arm64/import",
"-I$HOME/ldc2-$LDC_VERSION-linux-aarch64/import",
];
// default directories to be searched for libraries when linking
lib-dirs = [
"$HOME/ldc2-$LDC_VERSION-osx-arm64/lib",
"$HOME/ldc2-$LDC_VERSION-linux-aarch64/lib",
];
};
EOF
mkdir $HOME/ldc-macos
curl -LO https://github.com/ldc-developers/ldc/releases/download/v$LDC_VERSION/ldc2-$LDC_VERSION-osx-arm64.tar.xz
tar -xf ./ldc2-$LDC_VERSION-osx-arm64.tar.xz -C $HOME
curl -LO https://github.com/ldc-developers/ldc/releases/download/v$LDC_VERSION/ldc2-$LDC_VERSION-linux-aarch64.tar.xz
tar -xf ./ldc2-$LDC_VERSION-linux-aarch64.tar.xz -C $HOME
25 changes: 4 additions & 21 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,16 @@ jobs:
with:
target-triple: ${{ matrix.triple }}

- if: ${{ matrix.target == 'linux' }}
name: (Linux) Install dependencies
run: sudo apt-get install -y libz-dev elfutils

- name: Write version file
uses: ./.github/actions/write-version-file

- name: Build
run: dub build -b release-debug --compiler=ldc2 --arch ${{ matrix.triple }} :cli-frontend

- if: ${{ matrix.target == 'macos' }}
name: (macOS) Rename
run: mv "${{github.workspace}}/bin/sideloader" "${{github.workspace}}/bin/sideloader-cli-${{ matrix.triple }}" # TODO make an app bundle

- if: ${{ matrix.target == 'windows' }}
name: (Windows) Rename
run: |
mv "${{github.workspace}}/bin/sideloader.exe" "${{github.workspace}}/bin/sideloader-cli-${{ matrix.triple }}.exe"
mv "${{github.workspace}}/bin/sideloader.pdb" "${{github.workspace}}/bin/sideloader-cli-${{ matrix.triple }}.pdb"
- if: ${{ matrix.target == 'linux' }}
name: (Linux) Rename
run: mv "${{github.workspace}}/bin/sideloader" "${{github.workspace}}/bin/sideloader-cli-${{ matrix.triple }}"

- if: ${{ matrix.target == 'linux' }}
name: (Linux) Put debug symbols in a separate file
run: eu-strip --strip-debug -f "${{github.workspace}}/bin/sideloader-cli-${{ matrix.triple }}.dbg" "${{github.workspace}}/bin/sideloader-cli-${{ matrix.triple }}"
- name: Move files around for artifcation
uses: ./.github/actions/rename-files
with:
build-tag: cli-${{ matrix.triple }}

- uses: actions/upload-artifact@v3
with:
Expand Down

0 comments on commit 80211ba

Please sign in to comment.