Skip to content

Commit f2bac4a

Browse files
committed
prepackage llvm into linux distributables
1 parent da84839 commit f2bac4a

3 files changed

Lines changed: 33 additions & 16 deletions

File tree

.github/workflows/build-emerge.yaml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ env:
2828
GCC_GIT_REF: "releases/gcc-14.1.0"
2929
LIBUNWIND_GIT_REF: "v1.8.1"
3030
LLVM_MAJOR_VERSION: "20"
31+
LLVM_MINOR_VERSION: "1"
3132
ZULU_JRE_URL: https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jre21.0.4-win_x64.zip
3233

3334
jobs:
@@ -138,6 +139,8 @@ jobs:
138139
- name: mvn clean verify
139140
if: steps.cache-emerge-toolchain-maven.outputs.cache-hit != 'true'
140141
run: mvn "-Demerge.llvm-tests.llvm-install-dir=/usr/lib/llvm-20" -B clean verify
142+
llvm-build-for-linux:
143+
uses: ./.github/workflows/build-llvm-linux.yaml
141144
linux-distributables:
142145
name: Linux distributable archives
143146
runs-on: ubuntu-22.04
@@ -148,11 +151,18 @@ jobs:
148151
- build-glibc-x86_64
149152
- build-libunwind-x86_64
150153
- emerge-toolchain-maven
154+
- llvm-build-for-linux
151155
steps:
152156
- name: checkout
153157
uses: actions/checkout@v4
154158
with:
155159
ref: "${{ inputs.ref || github.sha }}"
160+
- name: get LLVM binaries
161+
uses: actions/download-artifact@v4.1.8
162+
with:
163+
run-id: "${{ needs.llvm-build-for-linux.run-id }}"
164+
name: llvm-linux-gnu-x86_64
165+
path: ${{ github.workspace }}/llvm-install
156166
- name: get C-runtime binaries from glibc
157167
uses: actions/cache/restore@v4.2.2
158168
with:
@@ -192,6 +202,20 @@ jobs:
192202
193203
mkdir bin && pushd $_
194204
cp "${{ github.workspace }}/toolchain/target/toolchain.jar" .
205+
mkdir -p llvm/bin && pushd $_
206+
cp "${{ github.workspace }}/llvm-install/bin/lld" l.
207+
popd
208+
mkdir llvm/lib && pushd $_
209+
cp "${{ github.workspace }}/llvm-install/lib/libLLVM.so.$LLVM_MAJOR_VERSION.$LLVM_MINOR_VERSION" .
210+
ln -s "libLLVM.so.$LLVM_MAJOR_VERSION.$LLVM_MINOR_VERSION" "libLLVM-$LLVM_MAJOR_VERSION.so"
211+
ln -s "libLLVM.so.$LLVM_MAJOR_VERSION.$LLVM_MINOR_VERSION" "libLLVM.so"
212+
cp "${{ github.workspace }}/llvm-install/lib/libLTO.so.$LLVM_MAJOR_VERSION.$LLVM_MINOR_VERSION" .
213+
ln -s "libLTO.so.$LLVM_MAJOR_VERSION.$LLVM_MINOR_VERSION" "libLTO-$LLVM_MAJOR_VERSION.so"
214+
ln -s "libLTO.so.$LLVM_MAJOR_VERSION.$LLVM_MINOR_VERSION" "libLTO.so"
215+
cp "${{ github.workspace }}/llvm-install/lib/libRemarks.so.$LLVM_MAJOR_VERSION.$LLVM_MINOR_VERSION" .
216+
ln -s "libRemarks.so.$LLVM_MAJOR_VERSION.$LLVM_MINOR_VERSION" "libRemarks.so"
217+
popd
218+
cp -r "${{ github.workspace }}/llvm-install/share" llvm/share
195219
popd
196220
cp -r "${{ github.workspace }}/stdlib" .
197221
cp -ar "${{ github.workspace }}/dist/linux/all/." .
@@ -217,7 +241,7 @@ jobs:
217241
cp "${{ github.workspace }}/glibc-build/csu/Scrt1.o" .
218242
cp "${{ github.workspace }}/glibc-build/libc.so" .
219243
popd
220-
popd
244+
popd
221245
popd
222246
tar --create \
223247
--directory=tarball-root \
@@ -238,8 +262,6 @@ jobs:
238262
path: "${{ steps.tarball.outputs.tarball_path }}"
239263
llvm-build-for-windows:
240264
uses: ./.github/workflows/build-llvm-windows.yaml
241-
llvm-build-for-linux:
242-
uses: ./.github/workflows/build-llvm-linux.yaml
243265
windows-distributables:
244266
name: Windows distributable archive
245267
runs-on: windows-2022
@@ -271,15 +293,19 @@ jobs:
271293
run-id: "${{ needs.llvm-build-for-windows.run-id }}"
272294
name: llvm-windows-x86_64
273295
path: ${{ github.workspace }}/llvm-install
274-
- name: prepare zip
296+
- name: build distributable archive
297+
id: pack-zip
275298
shell: pwsh
276299
run: |
277300
New-Item -Type Directory -Name "archive-root"
278301
279302
# first extract the linux tarball. It doesn't come with much linux-specific stuff, so we can reuse all the
280303
# code for building it
281-
tar --directory archive-root -xf "${{ needs.linux-distributables.outputs.tarball-filename }}"
304+
tar --no-same-owner --no-same-permissions --directory archive-root -xf "${{ needs.linux-distributables.outputs.tarball-filename }}"
305+
chown -R archive-root
306+
chmod -R u+w archive-root
282307
Remove-Item "archive-root/configure.sh" # this one is linux specific
308+
Remove-Item "archive-root/bin/llvm" -Recurse # this one is linux specific
283309
284310
New-Item -Type Directory -Path "archive-root/llvm" -Name "bin"
285311
# the LLVM distribution for windows builds THE WHOLE thing. This is needed for development.
@@ -293,10 +319,7 @@ jobs:
293319
294320
# redistribute JRE
295321
Move-Item -Path "zulu-jre/jre" "archive-root/jre"
296-
- name: pack zip
297-
id: pack-zip
298-
shell: pwsh
299-
run: |
322+
300323
Get-ChildItem -Path "archive-root" | Compress-Archive -DestinationPath "emerge-toolchain.zip"
301324
$hash = (Get-FileHash -Algorithm SHA256 "emerge-toolchain.zip").Hash
302325
Add-Content -Path "$Env:GITHUB_OUTPUT" -Value "sha256=$hash"

dist/linux/all/configure.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
#!/bin/bash
22
set -e
33
SELFDIR="$( realpath "$( dirname "${BASH_SOURCE[0]}" )" )"
4-
LLC="$(realpath "$(which llc-20)")"
5-
LLVM_DIR="${LLC%/bin/llc}"
6-
echo "Using LLVM installation in $LLVM_DIR"
7-
LLVM_DIR_FOR_SED=$(echo "$LLVM_DIR" | sed 's/\//\\\//g')
8-
9-
sed --regexp-extended --in-place 's/llvm-installation-directory: \~/llvm-installation-directory: "'$LLVM_DIR_FOR_SED'"/' "$SELFDIR/toolchain-config.yml"
104

115
jre_link="$SELFDIR/jre"
126
if [[ ! -e "$jre_link" ]]

dist/linux/all/toolchain-config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ backends:
88
ffi-c-sources: backends/native/emerge-ffi-c
99
libc-sources: backends/linux-gnu/emerge-linux-libc
1010
platform-sources: backends/linux-gnu/emerge-platform-linux
11-
llvm-installation-directory: ~
11+
llvm-installation-directory: bin/llvm
1212
static-libs:
1313
crtbeginS: backends/x86_64-pc-linux-gnu/lib/crtbeginS.o
1414
crtendS: backends/x86_64-pc-linux-gnu/lib/crtendS.o

0 commit comments

Comments
 (0)