Skip to content

Commit

Permalink
try s390x build
Browse files Browse the repository at this point in the history
  • Loading branch information
slavek-kucera committed Mar 19, 2024
1 parent 7708446 commit cfaf645
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 2 deletions.
37 changes: 35 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
- master
- development
- release-next
- ci_s390x_build
pull_request:
branches:
- master
Expand Down Expand Up @@ -183,14 +184,32 @@ jobs:
path: toolchain.tar.gz
key: ${{ hashFiles('scripts/toolchain.linux_arm64.sh') }}
lookup-only: true
- name: Build image
- name: Build toolchain
if: steps.cache.outputs.cache-hit != 'true'
run: ./scripts/toolchain.linux_arm64.sh

s390x-linux-musl:
name: Build Linux S390X toolchain
runs-on: ubuntu-22.04
container: alpine:3.19
steps:
- uses: actions/checkout@v4
- name: Install TAR
run: apk add tar
- uses: actions/cache@v4
id: cache
with:
path: toolchain.tar.gz
key: ${{ hashFiles('scripts/toolchain.linux_s390x.sh') }}
lookup-only: true
- name: Build toolchain
if: steps.cache.outputs.cache-hit != 'true'
run: ./scripts/toolchain.linux_s390x.sh

build-matrix:
name: Build
runs-on: ${{ matrix.os }}
needs: [generate_grammar, aarch64-linux-musl]
needs: [generate_grammar, aarch64-linux-musl, s390x-linux-musl]
strategy:
matrix:
include:
Expand All @@ -204,6 +223,11 @@ jobs:
container: alpine:3.19
dbg-strip: aarch64-linux-musl-objcopy --only-keep-debug language_server language_server.dbg && aarch64-linux-musl-objcopy --strip-unneeded language_server && aarch64-linux-musl-objcopy --add-gnu-debuglink=language_server.dbg language_server
dbg-pattern: build/bin/language_server.dbg
- os: ubuntu-22.04
native: linux_s390x
container: alpine:3.19
dbg-strip: s390x-linux-musl-objcopy --only-keep-debug language_server language_server.dbg && s390x-linux-musl-objcopy --strip-unneeded language_server && s390x-linux-musl-objcopy --add-gnu-debuglink=language_server.dbg language_server
dbg-pattern: build/bin/language_server.dbg
- os: ubuntu-22.04
native: wasm
container: emscripten/emsdk:3.1.46
Expand Down Expand Up @@ -299,6 +323,9 @@ jobs:
- os: ubuntu-22.04
native: linux_arm64
chmod: true
- os: ubuntu-22.04
native: linux_s390x
chmod: true
- os: windows-2022
native: win32_x64
chmod: false
Expand Down Expand Up @@ -407,6 +434,11 @@ jobs:
with:
name: language_server_linux_arm64
path: ${{ env.CLIENT_DIR }}/bin/linux_arm64/
- name: Download linux language server (s390x)
uses: actions/download-artifact@v4
with:
name: language_server_linux_s390x
path: ${{ env.CLIENT_DIR }}/bin/linux_s390x/
- name: Download wasm language server
uses: actions/download-artifact@v4
with:
Expand All @@ -432,6 +464,7 @@ jobs:
chmod +x ${{ env.CLIENT_DIR }}/bin/darwin_arm64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux_x64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux_arm64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux_s390x/language_server
- name: NPM CI
run: npm ci
working-directory: ${{ env.CLIENT_DIR }}
Expand Down
1 change: 1 addition & 0 deletions clients/vscode-hlasmplugin/src/serverFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const supportedNativePlatforms: Readonly<{ [key: string]: string }> = Object.fre
'win32.arm64': 'win32_arm64',
'linux.x64': 'linux_x64',
'linux.arm64': 'linux_arm64',
'linux.s390x': 'linux_s390x',
'darwin.x64': 'darwin_x64',
'darwin.arm64': 'darwin_arm64',
});
Expand Down
3 changes: 3 additions & 0 deletions scripts/config.linux_s390x.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
set -e
cmake -G Ninja -DCMAKE_SYSTEM_NAME="Linux" -DCMAKE_C_COMPILER="s390x-linux-musl-gcc" -DCMAKE_CXX_COMPILER="s390x-linux-musl-g++" -DCMAKE_BUILD_TYPE=Release -DDISCOVER_TESTS=Off -DCMAKE_EXE_LINKER_FLAGS="-static -Wl,--gc-sections" -DBUILD_VSIX=Off -DUSE_PRE_GENERATED_GRAMMAR="generated_parser" ../
14 changes: 14 additions & 0 deletions scripts/emulation.linux_s390x.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env sh

set -e

sudo apt-get update
sudo apt-get install -y qemu-user

mkdir -p bin/linux_x64
cd bin/linux_x64

echo '#!/usr/bin/env sh' > language_server
echo 'qemu-s390x "$(dirname "$0")/../linux_arm64/language_server" "$@"' >> language_server

chmod +x language_server
3 changes: 3 additions & 0 deletions scripts/prereq.linux_s390x.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
set -e
apk update && apk add --no-cache git cmake ninja qemu-s390x tar
3 changes: 3 additions & 0 deletions scripts/test-runner.linux_s390x.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
set -e
qemu-s390x $1
36 changes: 36 additions & 0 deletions scripts/toolchain.linux_s390x.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env sh

set -e

apk update
apk add git curl g++ bison make patch tar xz

mkdir /toolchain

git clone https://github.com/richfelker/musl-cross-make.git

cd musl-cross-make

git checkout -f e149c31c48b4f4a4c9349ddf7bc0027b90245afc

echo "TARGET = s390x-linux-musl" >> config.mak
echo "OUTPUT = /toolchain/" >> config.mak
echo "BINUTILS_VER = 2.41" >> config.mak
echo "GCC_VER = 12.3.0" >> config.mak
echo "DL_CMD = curl -C - -L -o" >> config.mak
echo "COMMON_CONFIG += CFLAGS=\"-fdata-sections -ffunction-sections -O2 -g0\" CXXFLAGS=\"-fdata-sections -ffunction-sections -O2 -g0\"" >> config.mak
echo "BINUTILS_CONFIG = --enable-gprofng=no" >> config.mak

echo "85d66f058688db1e18545b6c4cf67ecc83d3b7eb *gcc-12.3.0.tar.xz" > hashes/gcc-12.3.0.tar.xz.sha1
echo "0e008260a958bbd10182ee3384672ae0a310eece *binutils-2.41.tar.xz" > hashes/binutils-2.41.tar.xz.sha1

mkdir patches/gcc-12.3.0
cp patches/gcc-11.2.0/0002-posix_memalign.diff patches/gcc-12.3.0/

make -j 8
make install

cd ..

tar czvf toolchain.tar.gz /toolchain

0 comments on commit cfaf645

Please sign in to comment.