Skip to content

Commit

Permalink
gha: pack linux libs into macos universal package
Browse files Browse the repository at this point in the history
and add corresponding config sections
  • Loading branch information
yanok committed Jan 17, 2025
1 parent e3f3da2 commit 5024127
Showing 1 changed file with 44 additions and 8 deletions.
52 changes: 44 additions & 8 deletions .github/actions/merge-macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,42 @@ name: Merge x86_64 & arm64 packages to universal one
runs:
using: composite
steps:

- name: Download x86_64 artifact
- name: Download OSX x86_64 artifact
uses: actions/download-artifact@v4
with:
name: osx-x86_64
path: artifacts/
- name: Download arm64 artifact
- name: Download OSX arm64 artifact
uses: actions/download-artifact@v4
with:
name: osx-arm64
path: artifacts/
- name: Download Linux x86_64 artifact
uses: actions/download-artifact@v4
with:
name: linux-x86_64
path: artifacts/

- name: Extract & merge artifacts
shell: bash
run: |
set -euxo pipefail
mkdir ldc2-{x86_64,arm64}
tar -xf artifacts/ldc2-*-x86_64.tar.xz --strip 1 -C ldc2-x86_64
tar -xf artifacts/ldc2-*-arm64.tar.xz --strip 1 -C ldc2-arm64
mkdir ldc2-osx-{x86_64,arm64}
mkdir ldc2-linux-x86_64
tar -xf artifacts/ldc2-*-osx-x86_64.tar.xz --strip 1 -C ldc2-osx-x86_64
tar -xf artifacts/ldc2-*-osx-arm64.tar.xz --strip 1 -C ldc2-osx-arm64
tar -xf artifacts/ldc2-*-linux-x86_64.tar.xz --strip 1 -C ldc2-linux-x86_64
cp -R ldc2-x86_64 ldc2-universal
cp -R ldc2-osx-x86_64 ldc2-universal
cd ldc2-universal
# rename/copy lib dirs
mv lib lib-x86_64
cp -R ../ldc2-arm64/lib lib-arm64
cp -R ../ldc2-osx-arm64/lib lib-arm64
# cp -R ../ldc2-arm64/lib-ios-arm64 ./
cp -R ../ldc2-linux-x86_64/lib lib-linux-x86_64
cp -R ../ldc2-linux-x86_64/lib-aarch64 lib-linux-arm64
# merge executables to universal ones
for exe in bin/*; do
Expand Down Expand Up @@ -83,6 +91,34 @@ runs:
\"%%ldcbinarypath%%/../lib-arm64\",
];
rpath = \"%%ldcbinarypath%%/../lib-arm64\";
};
\"(aarch64\\|arm64).\\*-linux-gnu\":
{
switches = [
\"-defaultlib=phobos2-ldc,druntime-ldc\",
\"--mpcu=neoverse-n1\",
\"-mattr=+crc\",
\"-gcc=aarch64-linux-gnu-gcc\",
\"-linker=gold\",
];
lib-dirs = [
\"%%ldcbinarypath%%/../lib-linux-arm64\",
];
rpath = \"%%ldcbinarypath%%/../lib-linux-arm64\";
};
\"(x86_64\\|amd64).\\*-linux-gnu\":
{
switches = [
\"-defaultlib=phobos2-ldc,druntime-ldc\",
\"-gcc=x86_64-linux-gnu-gcc\",
\"-linker=gold\",
];
lib-dirs = [
\"%%ldcbinarypath%%/../lib-linux-x86_64\",
];
rpath = \"%%ldcbinarypath%%/../lib-linux-x86_64\";
};"
perl -0777 -pi -e "s|\\ndefault:\\n.+?\\n\\};|$sections|s" etc/ldc2.conf
Expand Down

0 comments on commit 5024127

Please sign in to comment.