Unverified Commit 49fea5b9 authored by Ivan Matkov's avatar Ivan Matkov Committed by GitHub

Fix glibc compatibility (#1130)

[SKIKO-1066](https://youtrack.jetbrains.com/issue/SKIKO-1066) Support
glibc 2.27
[CMP-9307](https://youtrack.jetbrains.com/issue/CMP-9307) Support glibc
2.27

- Added `linux-compat` docker image based on #1123. It works on both x64
and arm64 architectures
- `multistrap` tool was replaced by installing required packages inside
`linux-compat` and `linux-amd64` docker images
- `linux-arm64` uses GCC instead of clang (aligning between
distributions)
- GitHub checks now use precompiled docker images to reuse the same
environment
- `ci.yml` and `web.yml` were combined into `tests.yml`
- `publishToMavenLocal` checks are moved to `publish-dry-run.yml`
- Add building an Android sample as part of CI checks

---------
Co-authored-by: 's avatarVladislav.Ertel <vladislav.ertel@jetbrains.com>
parent fbb08087
name: 'Setup Prerequisites'
runs:
using: "composite"
steps:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
# Only save Gradle User Home state for builds on the 'master' branch.
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/master' }}
# Limit the size of the cache entry.
# These directories contain instrumented/transformed dependency jars which can be reconstructed relatively quickly.
gradle-home-cache-excludes: |
caches/jars-9
caches/transforms-3
name: Skiko Publish Dry Run
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
jobs:
Android:
runs-on: ubuntu-24.04
container:
image: registry.jetbrains.team/p/ui/skiko-docker/skiko-build-linux-android-amd64:ubuntu-2004
credentials:
username: ${{ secrets.SPACE_DOCKER_REGISTRY_USER }}
password: ${{ secrets.SPACE_DOCKER_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: ./.github/actions/setup-prerequisites
name: 'Setup Prerequisites'
- shell: bash
name: 'Publish Maven Local'
run: |
./gradlew --no-daemon --stacktrace \
-Pskiko.android.enabled=true \
:skiko:publishToMavenLocal
- shell: bash
name: 'Check Android Sample'
working-directory: samples/SkiaAndroidSample
run: |
./gradlew --no-daemon --stacktrace \
packageRelease
Web:
runs-on: ubuntu-24.04
container:
image: registry.jetbrains.team/p/ui/skiko-docker/skiko-build-linux-emscripten-amd64:ubuntu-2004
credentials:
username: ${{ secrets.SPACE_DOCKER_REGISTRY_USER }}
password: ${{ secrets.SPACE_DOCKER_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: ./.github/actions/setup-prerequisites
name: 'Setup Prerequisites'
- shell: bash
name: 'Publish Maven Local'
run: |
./gradlew --no-daemon --stacktrace \
-Pskiko.wasm.enabled=true \
:skiko:publishToMavenLocal
Linux:
runs-on: ubuntu-24.04
container:
image: registry.jetbrains.team/p/ui/skiko-docker/skiko-build-linux-amd64:ubuntu-2004
credentials:
username: ${{ secrets.SPACE_DOCKER_REGISTRY_USER }}
password: ${{ secrets.SPACE_DOCKER_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: ./.github/actions/setup-prerequisites
name: 'Setup Prerequisites'
- shell: bash
name: 'Publish Maven Local'
run: |
./gradlew --no-daemon --stacktrace \
-Pskiko.native.enabled=true \
:skiko:publishToMavenLocal
- shell: bash
name: 'Check AWT Sample'
run: |
./gradlew --no-daemon --stacktrace \
:SkiaAwtSample:installDist
macOS:
runs-on: macos-15
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: actions/setup-java@v4
name: 'Setup JDK 21'
with:
java-version: '21'
distribution: 'corretto'
- uses: ./.github/actions/setup-prerequisites
name: 'Setup Prerequisites'
- shell: bash
name: 'Publish Maven Local'
run: |
./gradlew --no-daemon --stacktrace \
-Pskiko.native.enabled=true \
:skiko:publishToMavenLocal
- shell: bash
name: 'Check AWT Sample'
run: |
./gradlew --no-daemon --stacktrace \
:SkiaAwtSample:installDist
Windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: microsoft/setup-msbuild@v1
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/setup-java@v4
name: 'Setup JDK 21'
with:
java-version: '21'
distribution: 'corretto'
- uses: ./.github/actions/setup-prerequisites
name: 'Setup Prerequisites'
- shell: bash
name: 'Publish Maven Local'
run: |
./gradlew --no-daemon --stacktrace \
-Pskiko.native.enabled=true \
:skiko:publishToMavenLocal
- shell: bash
name: 'Check AWT Sample'
run: |
./gradlew --no-daemon --stacktrace \
:SkiaAwtSample:installDist
# Default Skiko CI name: Skiko Tests
name: CI
on: on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch: workflow_dispatch:
pull_request:
push:
branches:
- master
jobs: jobs:
macOS: macos:
name: 'macOS'
# On `macos-15` UI tests blocked by a system popup with # On `macos-15` UI tests blocked by a system popup with
# "bash" is requesting to bypass the system private window picker and directly access your screen and audio. # "bash" is requesting to bypass the system private window picker and directly access your screen and audio.
# TODO: Update once resolved # TODO: Update once resolved
...@@ -19,34 +17,35 @@ jobs: ...@@ -19,34 +17,35 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
name: 'Check out code' name: 'Check out code'
- uses: actions/setup-java@v3 - uses: actions/setup-java@v4
name: 'Set up JDK 21' name: 'Setup JDK 21'
with: with:
distribution: 'adopt'
java-version: '21' java-version: '21'
cache: 'gradle' distribution: 'corretto'
- shell: bash - uses: ./.github/actions/setup-prerequisites
name: 'Compile and run AWT tests' name: 'Setup Prerequisites'
run: ./gradlew --stacktrace --info -Pskiko.native.enabled=true -Dskiko.test.onci=true -Dskiko.test.performance.enabled=false :skiko:awtTest
- shell: bash
name: 'Compile and run macOS x64 tests'
run: ./gradlew --stacktrace --info -Pskiko.native.enabled=true -Dskiko.test.onci=true -Dskiko.test.performance.enabled=false :skiko:macosX64Test
- shell: bash - shell: bash
name: 'Publish to Maven Local, check AWT sample' name: 'Run AWT Tests'
run: | run: |
./gradlew --stacktrace --info -Pskiko.native.enabled=true :skiko:publishToMavenLocal ./gradlew --no-daemon --stacktrace \
./gradlew --stacktrace --info :SkiaAwtSample:installDist -Pskiko.native.enabled=true \
-Dskiko.test.onci=true \
-Dskiko.test.performance.enabled=false \
:skiko:awtTest
- shell: bash - shell: bash
name: 'Publish Debug to Maven Local' name: 'Run macOS Tests'
run: | run: |
./gradlew --stacktrace --info -Pskiko.native.enabled=true :skiko:publishToMavenLocal -Pskiko.debug=true ./gradlew --no-daemon --stacktrace \
-Pskiko.native.enabled=true \
-Dskiko.test.onci=true \
-Dskiko.test.performance.enabled=false \
:skiko:macosArm64Test
- name: Upload Test Results - uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v4 name: 'Upload Test Results'
if: failure() if: failure()
with: with:
name: test-reports-macos name: test-reports-macos
...@@ -55,54 +54,61 @@ jobs: ...@@ -55,54 +54,61 @@ jobs:
./skiko/src/jvmTest/screenshots/*_actual.png ./skiko/src/jvmTest/screenshots/*_actual.png
retention-days: 5 retention-days: 5
- name: Test Summary - uses: test-summary/action@v2
uses: test-summary/action@v2 name: 'Test Summary'
with: with:
paths: "./skiko/build/test-results/**/TEST-*.xml" paths: "./skiko/build/test-results/**/TEST-*.xml"
if: always() if: always()
iOS: ios:
name: 'iOS'
runs-on: macos-15 runs-on: macos-15
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
name: 'Check out code' name: 'Check out code'
- uses: actions/setup-java@v3 - uses: actions/setup-java@v4
name: 'Set up JDK 21' name: 'Setup JDK 21'
with: with:
distribution: 'adopt'
java-version: '21' java-version: '21'
cache: 'gradle' distribution: 'corretto'
- name: 'Print the devices list' - uses: ./.github/actions/setup-prerequisites
run: xcrun simctl list devices available --json name: 'Setup Prerequisites'
# retrieve the device .udid to use in tests and store it in env var # Retrieve the device .udid to use in tests and store it in env var
- name: 'Set Up Simulator UUID' - shell: bash
name: 'Set Up Simulator UUID'
run: | run: |
IOS_SIM_UUID=$(xcrun simctl list devices available --json | jq -r '.devices."com.apple.CoreSimulator.SimRuntime.iOS-18-4"[] | select(.name == "iPhone 16") | .udid') && IOS_SIM_LIST=$(xcrun simctl list devices available --json)
IOS_SIM_UUID=$(echo $IOS_SIM_LIST | jq -r '.devices."com.apple.CoreSimulator.SimRuntime.iOS-18-4"[] | select(.name == "iPhone 16") | .udid')
echo "IOS_SIM_UUID=$IOS_SIM_UUID" >> $GITHUB_ENV echo "IOS_SIM_UUID=$IOS_SIM_UUID" >> $GITHUB_ENV
- name: 'Print Selected UUID' - uses: nick-fields/retry@v2
run: echo $IOS_SIM_UUID name: 'Run iOS (x64) tests'
- name: 'Compile and run iOS x64 tests'
uses: nick-fields/retry@v2
with: with:
max_attempts: 10 max_attempts: 10
timeout_minutes: 60 timeout_minutes: 60
shell: bash shell: bash
command: ./gradlew --stacktrace --info -Pskiko.native.enabled=true -Dskiko.test.onci=true -Dskiko.test.performance.enabled=false -Pskiko.iosSimulatorUUID="${{ env.IOS_SIM_UUID }}" :skiko:iosX64TestWithMetal command: |
./gradlew --no-daemon --stacktrace \
-Pskiko.native.enabled=true \
-Dskiko.test.onci=true \
-Dskiko.test.performance.enabled=false \
-Pskiko.iosSimulatorUUID="${{ env.IOS_SIM_UUID }}" \
:skiko:iosX64TestWithMetal
# iosSimulatorArm64Test will build the binary but the tests will be skipped due to X64 host machine # iosSimulatorArm64Test will build the binary but the tests will be skipped due to X64 host machine
- shell: bash - shell: bash
name: 'Compile iOS arm64 tests' name: 'Compile iOS (arm64) tests'
run: ./gradlew --stacktrace --info -Pskiko.native.enabled=true -Dskiko.test.onci=true -Dskiko.test.performance.enabled=false :skiko:iosSimulatorArm64Test run: |
./gradlew --no-daemon --stacktrace \
-Pskiko.native.enabled=true \
-Dskiko.test.onci=true \
-Dskiko.test.performance.enabled=false \
:skiko:iosSimulatorArm64Test
# TODO run iOS specific tests on iPhone simulator # TODO run iOS specific tests on iPhone simulator
- shell: bash
name: 'Publish to Maven Local'
run: ./gradlew --stacktrace --info -Pskiko.native.enabled=true :skiko:publishToMavenLocal
- name: Upload Test Results - name: Upload Test Results
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
...@@ -112,121 +118,88 @@ jobs: ...@@ -112,121 +118,88 @@ jobs:
path: ./skiko/build/reports/tests path: ./skiko/build/reports/tests
retention-days: 5 retention-days: 5
tvOS: tvos:
name: 'tvOS'
runs-on: macos-15 runs-on: macos-15
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
name: 'Check out code' name: 'Check out code'
- uses: actions/setup-java@v3 - uses: actions/setup-java@v4
name: 'Set up JDK 21' name: 'Setup JDK 21'
with: with:
distribution: 'adopt'
java-version: '21' java-version: '21'
cache: 'gradle' distribution: 'corretto'
- uses: ./.github/actions/setup-prerequisites
name: 'Setup Prerequisites'
- shell: bash - shell: bash
name: 'Run tvOS Tests'
run: | run: |
./gradlew --stacktrace --info -Pskiko.native.enabled=true -Dskiko.test.onci=true -Dskiko.test.performance.enabled=false :skiko:tvosX64Test ./gradlew --no-daemon --stacktrace \
-Pskiko.native.enabled=true \
-Dskiko.test.onci=true \
-Dskiko.test.performance.enabled=false \
:skiko:tvosX64Test
# tvosSimulatorArm64Test will build the binary but the tests will be skipped due to X64 host machine # tvosSimulatorArm64Test will build the binary but the tests will be skipped due to X64 host machine
./gradlew --stacktrace --info -Pskiko.native.enabled=true -Dskiko.test.onci=true -Dskiko.test.performance.enabled=false :skiko:tvosSimulatorArm64Test ./gradlew --no-daemon --stacktrace \
-Pskiko.native.enabled=true \
-Dskiko.test.onci=true \
-Dskiko.test.performance.enabled=false \
:skiko:tvosSimulatorArm64Test
- name: Upload Test Results - uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v4 name: 'Upload Test Results'
if: failure() if: failure()
with: with:
name: test-reports-tvos name: test-reports-tvos
path: ./skiko/build/reports/tests path: ./skiko/build/reports/tests
retention-days: 5 retention-days: 5
linux: linux-amd64:
runs-on: ubuntu-22.04 name: 'Linux (x64)'
runs-on: ubuntu-24.04
container:
image: registry.jetbrains.team/p/ui/skiko-docker/skiko-build-linux-amd64:ubuntu-2004
credentials:
username: ${{ secrets.SPACE_DOCKER_REGISTRY_USER }}
password: ${{ secrets.SPACE_DOCKER_REGISTRY_TOKEN }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
name: 'Check out code' name: 'Check out code'
- uses: actions/setup-java@v3 - uses: ./.github/actions/setup-prerequisites
name: 'Set up JDK 21' name: 'Setup Prerequisites'
with:
distribution: 'adopt'
java-version: '21'
cache: 'gradle'
- uses: nttld/setup-ndk@v1
name: 'Set up Android NDK'
id: setup-ndk
with:
ndk-version: r29
- uses: android-actions/setup-android@v2
name: 'Set up Android SDK'
- shell: bash
name: 'Set up Linux build environment'
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
sudo apt-get update -y
sudo apt-get install libglu1-mesa-dev libxrandr-dev libdbus-1-dev multistrap -y
sudo apt-get install gcc-9 g++-9 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9
sudo update-alternatives --config gcc
sudo apt-get install gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu -y
sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-9 60 --slave /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-9
sudo update-alternatives --config aarch64-linux-gnu-gcc
sudo Xvfb :0 -screen 0 1280x720x24 +extension GLX &
# We have only ~4.5G left after installing everything required, and sometimes it's not enough to correctly run
# skiko compilation and publishing. Removing unused software from the agent to free up space.
# (it gives us ~13G)
- name: Free up space on GitHub image
run: |
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo docker builder prune -a
df -h
- shell: bash - shell: bash
name: 'Compile and run Linux x64 tests' name: 'Start X Server'
run: | run: |
export DISPLAY=:0 Xvfb :1 -screen 0 1920x1080x24 -extension RANDR +extension GLX &
./gradlew --no-daemon --stacktrace --info -Pskiko.native.enabled=true -Pkotlin.native.cacheKind.linuxX64=none -Dskiko.test.onci=true -Dskiko.test.performance.enabled=false :skiko:linuxX64Test echo "DISPLAY=:1.0" >> $GITHUB_ENV
# Linux arm64 tests are executed on a separate runner
- shell: bash - shell: bash
name: 'Compile Linux arm64 tests' name: 'Run Linux (x64) Tests'
run: | run: |
./gradlew --no-daemon --stacktrace --info -Pskiko.native.enabled=true -Dskiko.test.onci=true -Dskiko.test.performance.enabled=false :skiko:linkDebugTestLinuxArm64 ./gradlew --no-daemon --stacktrace \
-Pskiko.native.enabled=true \
-Dskiko.test.onci=true \
-Dskiko.test.performance.enabled=false \
:skiko:linuxX64Test
- shell: bash - shell: bash
name: 'Compile and run AWT tests' name: 'Run AWT Tests'
run: |
export DISPLAY=:0
./gradlew --no-daemon --stacktrace --info -Pskiko.native.enabled=true -Pkotlin.native.cacheKind.linuxX64=none -Dskiko.test.onci=true -Dskiko.test.performance.enabled=false :skiko:awtTest
timeout-minutes: 25 timeout-minutes: 25
- shell: bash
name: 'Publish to Maven Local, check AWT sample'
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: | run: |
./gradlew --no-daemon --stacktrace --info -Pkotlin.native.cacheKind.linuxX64=none :skiko:publishToMavenLocal ./gradlew --no-daemon --stacktrace \
./gradlew --no-daemon --stacktrace --info :SkiaAwtSample:installDist -Pskiko.native.enabled=true \
./gradlew --no-daemon -Pskiko.android.enabled=true :skiko:publishSkikoJvmRuntimeAndroidX64PublicationToMavenLocal :skiko:publishSkikoJvmRuntimeAndroidArm64PublicationToMavenLocal :skiko:publishAndroidReleasePublicationToMavenLocal -Dskiko.test.onci=true \
-Dskiko.test.performance.enabled=false \
:skiko:awtTest
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
name: 'Save linuxArm64 test binary as artifact' name: 'Upload Test Results'
with:
name: test-binary-linuxArm64
path: ./skiko/build/bin/linuxArm64
if-no-files-found: error
retention-days: 5
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: failure() if: failure()
with: with:
name: test-reports-linux name: test-reports-linux
...@@ -234,60 +207,87 @@ jobs: ...@@ -234,60 +207,87 @@ jobs:
./skiko/build/reports/tests ./skiko/build/reports/tests
./skiko/src/jvmTest/screenshots/*_actual.png ./skiko/src/jvmTest/screenshots/*_actual.png
- name: Test Summary - uses: test-summary/action@v2
uses: test-summary/action@v2 name: 'Test Summary'
with: with:
paths: "./skiko/build/test-results/**/TEST-*.xml" paths: "./skiko/build/test-results/**/TEST-*.xml"
if: always() if: always()
linux-arm: linux-cross-compile:
needs: linux name: 'Cross-compile Linux (arm) on x64'
runs-on: ubuntu-22.04-arm runs-on: ubuntu-24.04
container:
image: registry.jetbrains.team/p/ui/skiko-docker/skiko-build-linux-amd64:ubuntu-2004
credentials:
username: ${{ secrets.SPACE_DOCKER_REGISTRY_USER }}
password: ${{ secrets.SPACE_DOCKER_REGISTRY_TOKEN }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
name: 'Check out code' name: 'Check out code'
- uses: actions/setup-java@v3 - uses: ./.github/actions/setup-prerequisites
name: 'Set up JDK 21' name: 'Setup Prerequisites'
with:
distribution: 'adopt'
java-version: '21'
cache: 'gradle'
- uses: actions/download-artifact@v4 - shell: bash
name: 'Compile Linux (arm64) Tests'
run: |
./gradlew --no-daemon --stacktrace \
-Pskiko.arch=x64 \
-Pskiko.native.linux.enabled=true \
:skiko:linkDebugTestLinuxArm64
- uses: actions/upload-artifact@v4
name: 'Upload linuxArm64 test binary as artifact'
with: with:
name: test-binary-linuxArm64 name: test-binary-linuxArm64
path: ./skiko/build/bin/linuxArm64 path: ./skiko/build/bin/linuxArm64
if-no-files-found: error
retention-days: 5
linux-arm:
name: 'Linux (arm64)'
needs: linux-cross-compile
runs-on: ubuntu-24.04-arm
container:
image: registry.jetbrains.team/p/ui/skiko-docker/skiko-build-linux-arm64:ubuntu-2004
credentials:
username: ${{ secrets.SPACE_DOCKER_REGISTRY_USER }}
password: ${{ secrets.SPACE_DOCKER_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: ./.github/actions/setup-prerequisites
name: 'Setup Prerequisites'
- shell: bash - shell: bash
name: 'Set up Linux build environment' name: 'Start X Server'
run: | run: |
sudo apt-get update -y Xvfb :1 -screen 0 1920x1080x24 -extension RANDR +extension GLX &
sudo apt-get install libglu1-mesa-dev libxrandr-dev libdbus-1-dev -y echo "DISPLAY=:1.0" >> $GITHUB_ENV
sudo apt-get install clang -y
sudo apt-get remove g++ -y - uses: actions/download-artifact@v4
sudo Xvfb :0 -screen 0 1280x720x24 +extension GLX & name: 'Download precompiled linuxArm64 test binary'
with:
name: test-binary-linuxArm64
path: ./skiko/build/bin/linuxArm64
- shell: bash - shell: bash
name: 'Run Linux arm64 tests' name: 'Run Linux (arm64) Tests'
working-directory: ./skiko working-directory: skiko
run: | run: |
export DISPLAY=:0
chmod +x ./build/bin/linuxArm64/debugTest/test.kexe chmod +x ./build/bin/linuxArm64/debugTest/test.kexe
./build/bin/linuxArm64/debugTest/test.kexe ./build/bin/linuxArm64/debugTest/test.kexe
- shell: bash - shell: bash
name: 'Compile and run AWT tests' name: 'Run AWT Tests'
run: |
export DISPLAY=:0
./gradlew --no-daemon --stacktrace --info -Dskiko.test.onci=true -Dskiko.test.performance.enabled=false :skiko:awtTest
timeout-minutes: 25 timeout-minutes: 25
- shell: bash
name: 'Publish to Maven Local, check AWT sample'
run: | run: |
./gradlew --no-daemon --stacktrace --info :skiko:publishToMavenLocal ./gradlew --no-daemon --stacktrace \
./gradlew --no-daemon --stacktrace --info :SkiaAwtSample:installDist -Pskiko.native.enabled=true \
-Dskiko.test.onci=true \
-Dskiko.test.performance.enabled=false \
:skiko:awtTest
- name: Upload Test Results - name: Upload Test Results
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
...@@ -306,6 +306,7 @@ jobs: ...@@ -306,6 +306,7 @@ jobs:
if: always() if: always()
windows: windows:
name: 'Windows'
runs-on: windows-2022 runs-on: windows-2022
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
...@@ -315,26 +316,27 @@ jobs: ...@@ -315,26 +316,27 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
- uses: actions/setup-java@v3 - uses: actions/setup-java@v4
name: 'Set up JDK 21' name: 'Setup JDK 21'
with: with:
distribution: 'adopt'
java-version: '21' java-version: '21'
cache: 'gradle' distribution: 'corretto'
# OPENGL is ignored as it doesn't exist on the Windows GitHub agent - uses: ./.github/actions/setup-prerequisites
- shell: bash name: 'Setup Prerequisites'
name: 'Compile and run AWT tests'
run: ./gradlew --stacktrace --info -Dskiko.test.onci=true -Dskiko.test.performance.enabled=false -Dskiko.test.ui.renderApi.ignoreAssertsFor=OPENGL :skiko:awtTest
# OPENGL is ignored as it doesn't exist on the Windows GitHub agent
- shell: bash - shell: bash
name: 'Publish to Maven Local, check AWT sample' name: 'Run AWT tests'
run: | run: |
./gradlew --stacktrace --info :skiko:publishToMavenLocal ./gradlew --no-daemon --stacktrace \
./gradlew --stacktrace --info :SkiaAwtSample:installDist -Dskiko.test.onci=true \
-Dskiko.test.performance.enabled=false \
-Dskiko.test.ui.renderApi.ignoreAssertsFor=OPENGL \
:skiko:awtTest
- name: Upload Test Results - uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v4 name: 'Upload Test Results'
if: failure() if: failure()
with: with:
name: test-reports-windows name: test-reports-windows
...@@ -343,8 +345,78 @@ jobs: ...@@ -343,8 +345,78 @@ jobs:
./skiko/src/jvmTest/screenshots/*_actual.png ./skiko/src/jvmTest/screenshots/*_actual.png
retention-days: 5 retention-days: 5
- name: Test Summary - uses: test-summary/action@v2
uses: test-summary/action@v2 name: 'Test Summary'
with:
paths: "./skiko/build/test-results/**/TEST-*.xml"
if: always()
web-wasm:
name: 'Web'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: actions/setup-java@v3
name: 'Setup JDK 21'
with:
java-version: '21'
distribution: 'adopt'
cache: 'gradle'
- uses: browser-actions/setup-chrome@v1
name: 'Setup Google Chrome'
with:
chrome-version: stable
- name: 'Install emscripten'
shell: bash
working-directory: skiko
run: |
sudo apt-get update -y
sudo apt-get install libdbus-1-dev
if [ -d ./emsdk ]; then
cd ./emsdk
git pull
else
git clone https://github.com/emscripten-core/emsdk.git
cd ./emsdk
fi
./emsdk install 3.1.50
./emsdk activate 3.1.50
- shell: bash
name: 'Run WASM Tests'
working-directory: skiko
run: |
source ./emsdk/emsdk_env.sh
./gradlew --no-daemon --stacktrace \
-Pskiko.wasm.enabled=true \
-Pskiko.js.enabled=true \
-Pskiko.test.onci=true \
wasmJsTest
- shell: bash
name: 'Run JS Tests'
working-directory: skiko
run: |
source ./emsdk/emsdk_env.sh
./gradlew --no-daemon --stacktrace \
-Pskiko.wasm.enabled=true \
-Pskiko.js.enabled=true \
-Pskiko.test.onci=true \
jsTest
- uses: actions/upload-artifact@v4
if: failure()
with:
name: test-reports-web
path: ./skiko/build/reports/tests
retention-days: 5
- uses: test-summary/action@v2
name: 'Test Summary'
with: with:
paths: "./skiko/build/test-results/**/TEST-*.xml" paths: "./skiko/build/test-results/**/TEST-*.xml"
if: always() if: always()
name: WebTarget
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
web:
runs-on: ubuntu-22.04
steps:
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
id: setup-chrome
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
name: 'Set up JDK 21'
with:
distribution: 'adopt'
java-version: '21'
cache: 'gradle'
- name: 'Install dependencies'
run: |
sudo apt-get update
sudo apt-get install libdbus-1-dev
- name: 'Install emscripten'
shell: bash
run: |
cd ./skiko
sudo apt-get update -y
sudo apt-get install binutils build-essential -y
sudo apt-get install software-properties-common -y
sudo apt-get install python-is-python3 git curl wget -y
if [ -d ./emsdk ]; then
cd ./emsdk
git pull
else
git clone https://github.com/emscripten-core/emsdk.git
cd ./emsdk
fi
./emsdk install 3.1.50
./emsdk activate 3.1.50
source ./emsdk_env.sh
- name: 'Run WASM tests'
shell: bash
run: |
cd ./skiko
source ./emsdk/emsdk_env.sh
./gradlew --stacktrace --info -Pskiko.wasm.enabled=true -Pskiko.js.enabled=true -Pskiko.test.onci=true wasmJsTest
./gradlew --stacktrace --info -Pskiko.wasm.enabled=true -Pskiko.js.enabled=true publishSkikoWasmRuntimePublicationToMavenLocal
- name: 'Run JS tests'
shell: bash
run: |
cd ./skiko
source ./emsdk/emsdk_env.sh
./gradlew --stacktrace --info -Pskiko.wasm.enabled=true -Pskiko.js.enabled=true -Pskiko.test.onci=true jsTest
- uses: actions/upload-artifact@v4
if: always()
with:
name: test-reports-wasm
path: ./skiko/build/reports/tests
retention-days: 5
import com.android.build.gradle.tasks.MergeSourceSetFolders
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
buildscript { buildscript {
repositories { repositories {
google() google()
...@@ -38,10 +42,6 @@ val unzipTaskArm64 = tasks.register("unzipNativeArm64", Copy::class) { ...@@ -38,10 +42,6 @@ val unzipTaskArm64 = tasks.register("unzipNativeArm64", Copy::class) {
from(skikoNativeArm64.map { zipTree(it) }) from(skikoNativeArm64.map { zipTree(it) })
} }
kotlin {
jvmToolchain(11)
}
android { android {
compileSdk = 35 compileSdk = 35
namespace = "org.jetbrains.skiko.sample" namespace = "org.jetbrains.skiko.sample"
...@@ -76,10 +76,6 @@ var version = if (project.hasProperty("skiko.version")) { ...@@ -76,10 +76,6 @@ var version = if (project.hasProperty("skiko.version")) {
"0.0.0-SNAPSHOT" "0.0.0-SNAPSHOT"
} }
// ./gradlew -Pskiko.android.enabled=true \
// publishSkikoJvmRuntimeAndroidX64PublicationToMavenLocal \
// publishSkikoJvmRuntimeAndroidArm64PublicationToMavenLocal \
// publishAndroidReleasePublicationToMavenLocal
dependencies { dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0")
implementation("org.jetbrains.skiko:skiko-android:$version") implementation("org.jetbrains.skiko:skiko-android:$version")
...@@ -88,7 +84,10 @@ dependencies { ...@@ -88,7 +84,10 @@ dependencies {
skikoNativeArm64("org.jetbrains.skiko:skiko-android-runtime-arm64:$version") skikoNativeArm64("org.jetbrains.skiko:skiko-android-runtime-arm64:$version")
} }
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile>().configureEach { tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
dependsOn(unzipTaskX64) dependsOn(unzipTaskX64)
dependsOn(unzipTaskArm64) dependsOn(unzipTaskArm64)
} }
...@@ -96,7 +95,7 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile>().configureEa ...@@ -96,7 +95,7 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile>().configureEa
// SKIKO-934: we need to unpack these libraries before these are collected from android // SKIKO-934: we need to unpack these libraries before these are collected from android
// TODO the tasks we're actually targetting are mergeDebugJniLibFolders and mergeReleaseJniLibFolders, // TODO the tasks we're actually targetting are mergeDebugJniLibFolders and mergeReleaseJniLibFolders,
// this adds unncessary dependencies // this adds unncessary dependencies
tasks.withType<com.android.build.gradle.tasks.MergeSourceSetFolders>() tasks.withType<MergeSourceSetFolders>()
.configureEach { .configureEach {
dependsOn(unzipTaskX64) dependsOn(unzipTaskX64)
dependsOn(unzipTaskArm64) dependsOn(unzipTaskArm64)
......
...@@ -36,16 +36,12 @@ val OS.isCompatibleWithHost: Boolean ...@@ -36,16 +36,12 @@ val OS.isCompatibleWithHost: Boolean
OS.Android -> true OS.Android -> true
} }
fun compilerForTarget(os: OS, arch: Arch, isJvm: Boolean = false): String = fun compilerForTarget(os: OS, arch: Arch): String =
when (os) { when (os) {
// TODO: Use clang++ for all Linux targets // TODO: Use clang++ for all Linux targets
OS.Linux -> when (arch) { OS.Linux -> when (arch) {
Arch.X64 -> "g++" Arch.X64 -> "g++"
Arch.Arm64 -> if (isJvm) { Arch.Arm64 -> if (hostArch == Arch.Arm64) "g++" else "aarch64-linux-gnu-g++"
"clang++"
} else {
if (hostArch == Arch.Arm64) "g++" else "aarch64-linux-gnu-g++"
}
Arch.Wasm -> "Unexpected combination: $os & $arch" Arch.Wasm -> "Unexpected combination: $os & $arch"
} }
OS.Android -> "clang++" OS.Android -> "clang++"
...@@ -54,8 +50,8 @@ fun compilerForTarget(os: OS, arch: Arch, isJvm: Boolean = false): String = ...@@ -54,8 +50,8 @@ fun compilerForTarget(os: OS, arch: Arch, isJvm: Boolean = false): String =
OS.Wasm -> if (Os.isFamily(Os.FAMILY_WINDOWS)) "emcc.bat" else "emcc" OS.Wasm -> if (Os.isFamily(Os.FAMILY_WINDOWS)) "emcc.bat" else "emcc"
} }
fun linkerForTarget(os: OS, arch: Arch, isJvm: Boolean = false): String = fun linkerForTarget(os: OS, arch: Arch): String =
if (os.isWindows) "lld-link.exe" else compilerForTarget(os, arch, isJvm) if (os.isWindows) "lld-link.exe" else compilerForTarget(os, arch)
val OS.dynamicLibExt: String val OS.dynamicLibExt: String
get() = when (this) { get() = when (this) {
......
...@@ -24,7 +24,6 @@ import org.gradle.api.tasks.TaskProvider ...@@ -24,7 +24,6 @@ import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.bundling.Jar import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.testing.Test import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.withType import org.gradle.kotlin.dsl.withType
import org.gradle.util.internal.VersionNumber
import projectDirs import projectDirs
import registerOrGetSkiaDirProvider import registerOrGetSkiaDirProvider
import registerSkikoTask import registerSkikoTask
...@@ -67,7 +66,7 @@ fun SkikoProjectContext.createCompileJvmBindingsTask( ...@@ -67,7 +66,7 @@ fun SkikoProjectContext.createCompileJvmBindingsTask(
includeHeadersNonRecursive(projectDir.resolve("src/jvmMain/cpp/include")) includeHeadersNonRecursive(projectDir.resolve("src/jvmMain/cpp/include"))
includeHeadersNonRecursive(projectDir.resolve("src/commonMain/cpp/common/include")) includeHeadersNonRecursive(projectDir.resolve("src/commonMain/cpp/common/include"))
compiler.set(compilerForTarget(targetOs, targetArch, isJvm = true)) compiler.set(compilerForTarget(targetOs, targetArch))
val osFlags: Array<String> val osFlags: Array<String>
when (targetOs) { when (targetOs) {
...@@ -237,7 +236,7 @@ fun SkikoProjectContext.createLinkJvmBindings( ...@@ -237,7 +236,7 @@ fun SkikoProjectContext.createLinkJvmBindings(
buildSuffix.set("jvm") buildSuffix.set("jvm")
buildTargetArch.set(targetArch) buildTargetArch.set(targetArch)
buildVariant.set(buildType) buildVariant.set(buildType)
linker.set(linkerForTarget(targetOs, targetArch, isJvm = true)) linker.set(linkerForTarget(targetOs, targetArch))
when (targetOs) { when (targetOs) {
OS.MacOS -> { OS.MacOS -> {
......
...@@ -52,21 +52,13 @@ fun SkikoProjectContext.compileNativeBridgesTask( ...@@ -52,21 +52,13 @@ fun SkikoProjectContext.compileNativeBridgesTask(
): TaskProvider<CompileSkikoCppTask> = with (this.project) { ): TaskProvider<CompileSkikoCppTask> = with (this.project) {
val skiaNativeDir = registerOrGetSkiaDirProvider(os, arch, isUikitSim = isUikitSim) val skiaNativeDir = registerOrGetSkiaDirProvider(os, arch, isUikitSim = isUikitSim)
val setupMultistrapTask = if (os == OS.Linux && arch == Arch.Arm64 && hostArch != Arch.Arm64) {
setupMultistrapTask(os, arch, isUikitSim = isUikitSim)
} else {
null
}
val actionName = "compileNativeBridges".withSuffix(isUikitSim = isUikitSim) val actionName = "compileNativeBridges".withSuffix(isUikitSim = isUikitSim)
return project.registerSkikoTask<CompileSkikoCppTask>(actionName, os, arch) { return project.registerSkikoTask<CompileSkikoCppTask>(actionName, os, arch) {
dependsOn(skiaNativeDir) dependsOn(skiaNativeDir)
val unpackedSkia = skiaNativeDir.get() val unpackedSkia = skiaNativeDir.get()
setupMultistrapTask?.let { dependsOn(it) } compiler.set(compilerForTarget(os, arch))
compiler.set(compilerForTarget(os, arch, isJvm = false))
buildTargetOS.set(os) buildTargetOS.set(os)
if (isUikitSim) { if (isUikitSim) {
buildSuffix.set("sim") buildSuffix.set("sim")
...@@ -135,16 +127,20 @@ fun SkikoProjectContext.compileNativeBridgesTask( ...@@ -135,16 +127,20 @@ fun SkikoProjectContext.compileNativeBridgesTask(
)) ))
} }
OS.Linux -> { OS.Linux -> {
flags.set(listOfNotNull( val linuxFlags = mutableListOf(
*buildType.clangFlags, *buildType.clangFlags,
"-fPIC", "-fPIC",
"-fno-rtti", "-fno-rtti",
"-fno-exceptions", "-fno-exceptions",
"-fvisibility=hidden", "-fvisibility=hidden",
"-fvisibility-inlines-hidden", "-fvisibility-inlines-hidden",
"-D_GLIBCXX_USE_CXX11_ABI=0",
*skiaPreprocessorFlags(OS.Linux, buildType) *skiaPreprocessorFlags(OS.Linux, buildType)
)) )
// Add sysroot for ARM64 cross-compilation
if (arch == Arch.Arm64 && hostArch != Arch.Arm64) {
linuxFlags.add(0, "--sysroot=/opt/arm-gnu-toolchain/aarch64-none-linux-gnu/libc")
}
flags.set(linuxFlags)
} }
else -> throw GradleException("$os not yet supported") else -> throw GradleException("$os not yet supported")
} }
...@@ -265,10 +261,11 @@ fun SkikoProjectContext.configureNativeTarget(os: OS, arch: Arch, target: Kotlin ...@@ -265,10 +261,11 @@ fun SkikoProjectContext.configureNativeTarget(os: OS, arch: Arch, target: Kotlin
"$skiaBinDir/libskunicode_icu.a", "$skiaBinDir/libskunicode_icu.a",
"$skiaBinDir/libskia.a" "$skiaBinDir/libskia.a"
) )
// When cross-compiling for ARM64 from x64, use the ARM toolchain sysroot
if (arch == Arch.Arm64 && hostArch != Arch.Arm64) { if (arch == Arch.Arm64 && hostArch != Arch.Arm64) {
val buildDir = project.layout.buildDirectory.get().asFile // ARM GNU toolchain sysroot paths
options.add(0, "-L$buildDir/multistrap-arm64/usr/lib") options.add(0, "-L/opt/arm-gnu-toolchain/aarch64-none-linux-gnu/libc/lib64")
options.add(1, "-L$buildDir/multistrap-arm64/usr/lib/aarch64-linux-gnu") options.add(1, "-L/opt/arm-gnu-toolchain/aarch64-none-linux-gnu/libc/usr/lib64")
} }
mutableListOfLinkerOptions(options) mutableListOfLinkerOptions(options)
} }
...@@ -310,7 +307,7 @@ fun SkikoProjectContext.configureNativeTarget(os: OS, arch: Arch, target: Kotlin ...@@ -310,7 +307,7 @@ fun SkikoProjectContext.configureNativeTarget(os: OS, arch: Arch, target: Kotlin
workingDir = outDir workingDir = outDir
when (os) { when (os) {
OS.Linux -> { OS.Linux -> {
executable = "ar" executable = if (arch == Arch.Arm64 && hostArch != Arch.Arm64) "aarch64-linux-gnu-ar" else "ar"
argumentProviders.add { listOf("-crs", staticLib) } argumentProviders.add { listOf("-crs", staticLib) }
} }
OS.MacOS, OS.IOS, OS.TVOS -> { OS.MacOS, OS.IOS, OS.TVOS -> {
...@@ -330,23 +327,6 @@ fun SkikoProjectContext.configureNativeTarget(os: OS, arch: Arch, target: Kotlin ...@@ -330,23 +327,6 @@ fun SkikoProjectContext.configureNativeTarget(os: OS, arch: Arch, target: Kotlin
} }
} }
/**
* This installs dependencies needed for cross compiling Skiko on Linux.
* https://youtrack.jetbrains.com/issue/KT-36871
*/
fun SkikoProjectContext.setupMultistrapTask(
os: OS, arch: Arch, isUikitSim: Boolean
): TaskProvider<Exec> = with (this.project) {
require(os == OS.Linux)
require(arch == Arch.Arm64)
val actionName = "setupMultistrap".withSuffix(isUikitSim = isUikitSim)
return project.registerSkikoTask<Exec>(actionName, os, arch) {
workingDir(projectDir)
commandLine("multistrap", "-f", "multistrap-config-${arch.id}")
}
}
fun KotlinMultiplatformExtension.configureIOSTestsWithMetal(project: Project) { fun KotlinMultiplatformExtension.configureIOSTestsWithMetal(project: Project) {
val metalTestTargets = listOf("iosX64", "iosSimulatorArm64") val metalTestTargets = listOf("iosX64", "iosSimulatorArm64")
......
...@@ -38,7 +38,7 @@ fun SkikoProjectContext.declareWasmTasks() { ...@@ -38,7 +38,7 @@ fun SkikoProjectContext.declareWasmTasks() {
val compileWasm by project.tasks.registering(CompileSkikoCppTask::class) { val compileWasm by project.tasks.registering(CompileSkikoCppTask::class) {
dependsOn(skiaWasmDir) dependsOn(skiaWasmDir)
compiler.set(compilerForTarget(OS.Wasm, Arch.Wasm, isJvm = false)) compiler.set(compilerForTarget(OS.Wasm, Arch.Wasm))
buildTargetOS.set(OS.Wasm) buildTargetOS.set(OS.Wasm)
buildTargetArch.set(Arch.Wasm) buildTargetArch.set(Arch.Wasm)
buildVariant.set(buildType) buildVariant.set(buildType)
...@@ -67,7 +67,7 @@ fun SkikoProjectContext.declareWasmTasks() { ...@@ -67,7 +67,7 @@ fun SkikoProjectContext.declareWasmTasks() {
dependsOn(compileWasm) dependsOn(compileWasm)
dependsOn(skiaWasmDir) dependsOn(skiaWasmDir)
linker.set(linkerForTarget(OS.Wasm, Arch.Wasm, isJvm = false)) linker.set(linkerForTarget(OS.Wasm, Arch.Wasm))
buildTargetOS.set(OS.Wasm) buildTargetOS.set(OS.Wasm)
buildTargetArch.set(Arch.Wasm) buildTargetArch.set(Arch.Wasm)
buildVariant.set(buildType) buildVariant.set(buildType)
......
FROM ubuntu:20.04 FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \ RUN apt update -y && \
apt-get install binutils build-essential software-properties-common -y && \ apt install binutils build-essential software-properties-common -y && \
apt-get install zip unzip git python curl wget -y && \ apt install zip unzip git python curl wget xvfb -y && \
apt-get install fontconfig libfontconfig1-dev libglu1-mesa-dev libxrandr-dev libdbus-1-dev multistrap -y && \ apt install fontconfig libfontconfig1-dev libglu1-mesa-dev libxrandr-dev libdbus-1-dev -y && \
apt-get install openjdk-21-jdk -y && \ apt install openjdk-21-jdk -y && \
apt-get install gcc-9 g++-9 -y && \ rm -rf /var/lib/apt/lists/*
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 && \
update-alternatives --config gcc && \
apt-get install gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu -y && \
update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-9 60 --slave /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-9 && \
update-alternatives --config aarch64-linux-gnu-gcc
# Install chromium tools # Install chromium tools
ENV DEPOT_TOOLS=/usr/depot_tools ENV DEPOT_TOOLS=/usr/depot_tools
ENV PATH=$DEPOT_TOOLS:$PATH ENV PATH=$DEPOT_TOOLS:$PATH
RUN git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' $DEPOT_TOOLS RUN git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' $DEPOT_TOOLS
# Install ARM64 libraries for cross-compilation
RUN dpkg --add-architecture arm64 && echo \
"deb [arch=arm64] http://ports.ubuntu.com/ focal main restricted\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal-updates main restricted\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal universe\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal-updates universe\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal multiverse\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal-updates multiverse\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal-backports main restricted universe multiverse" \
| tee /etc/apt/sources.list.d/arm-cross-compile-sources.list && \
sed -i -E "s/(deb)\ (http:.+)/\1\ [arch=amd64]\ \2/" /etc/apt/sources.list && \
apt update -y && \
apt install libfontconfig1-dev:arm64 libglu1-mesa-dev:arm64 libxrandr-dev:arm64 libdbus-1-dev:arm64 -y && \
rm -rf /var/lib/apt/lists/*
# Install cross-compilation toolchain for ARM64
ENV ARM_TOOLCHAIN_VERSION=9.2-2019.12
ENV ARM_TOOLCHAIN_NAME=gcc-arm-${ARM_TOOLCHAIN_VERSION}-x86_64-aarch64-none-linux-gnu
ENV ARM_TOOLCHAIN_PATH=/opt/arm-gnu-toolchain
ENV ARM_TOOLCHAIN_SYSROOT=$ARM_TOOLCHAIN_PATH/aarch64-none-linux-gnu/libc
ENV PATH="/usr/local/bin:$ARM_TOOLCHAIN_PATH/bin:$PATH"
RUN cd /tmp && mkdir -p $ARM_TOOLCHAIN_PATH && \
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-a/$ARM_TOOLCHAIN_VERSION/binrel/$ARM_TOOLCHAIN_NAME.tar.xz && \
tar -xf $ARM_TOOLCHAIN_NAME.tar.xz --strip-components=1 -C $ARM_TOOLCHAIN_PATH && rm $ARM_TOOLCHAIN_NAME.tar.xz && \
ln -s $ARM_TOOLCHAIN_PATH/bin/aarch64-none-linux-gnu-g++ /usr/local/bin/aarch64-linux-gnu-g++ && \
ln -s $ARM_TOOLCHAIN_PATH/bin/aarch64-none-linux-gnu-gcc /usr/local/bin/aarch64-linux-gnu-gcc && \
ln -s $ARM_TOOLCHAIN_PATH/bin/aarch64-none-linux-gnu-ar /usr/local/bin/aarch64-linux-gnu-ar
# Copy development headers to ARM64 sysroot
RUN mkdir -p $ARM_TOOLCHAIN_SYSROOT/usr/include && \
cp -r /usr/include/fontconfig $ARM_TOOLCHAIN_SYSROOT/usr/include/ && \
cp -r /usr/include/freetype2 $ARM_TOOLCHAIN_SYSROOT/usr/include/ && \
cp -r /usr/include/GL $ARM_TOOLCHAIN_SYSROOT/usr/include/ && \
cp -r /usr/include/X11 $ARM_TOOLCHAIN_SYSROOT/usr/include/ && \
cp -r /usr/include/KHR $ARM_TOOLCHAIN_SYSROOT/usr/include/
# Use UTF-8 by default # Use UTF-8 by default
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF
FROM ubuntu:20.04 FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \ RUN apt update -y && \
apt-get install binutils build-essential software-properties-common -y && \ apt install binutils build-essential software-properties-common -y && \
apt-get install zip unzip git python curl wget -y && \ apt install zip unzip git python curl wget -y && \
apt-get install fontconfig libfontconfig1-dev libglu1-mesa-dev libxrandr-dev libdbus-1-dev -y && \ apt install fontconfig libfontconfig1-dev libglu1-mesa-dev libxrandr-dev libdbus-1-dev -y && \
apt-get install openjdk-21-jdk -y && \ apt install openjdk-21-jdk -y && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Install Android SDK # Install Android SDK
......
FROM arm64v8/ubuntu:20.04 FROM arm64v8/ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \ RUN apt update -y && \
apt-get install binutils build-essential software-properties-common -y && \ apt install binutils build-essential software-properties-common -y && \
apt-get install zip unzip git python curl wget -y && \ apt install zip unzip git python curl wget xvfb -y && \
apt-get install fontconfig libfontconfig1-dev libglu1-mesa-dev libxrandr-dev libdbus-1-dev -y && \ apt install fontconfig libfontconfig1-dev libglu1-mesa-dev libxrandr-dev libdbus-1-dev -y && \
apt-get install openjdk-21-jdk -y && \ apt install openjdk-21-jdk -y && \
apt-get install clang-11 -y && \
apt-get remove g++ -y && \
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-11 100 && \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-11 100 && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Install chromium tools # Install chromium tools
......
# Multi-architecture Dockerfile for building Skiko on Linux, compatiable with GLIBC 2.26
# Supports both amd64 (x64) and arm64 architectures
FROM amazonlinux:2
ARG TARGETARCH
# Install basic & development tools
RUN yum install -y tar xz git wget curl zip gzip && \
yum install -y gcc gcc-c++ binutils make && \
yum clean all
# Install libraries
RUN yum install -y fontconfig fontconfig-devel mesa-libGLU-devel libXrandr-devel dbus-devel && \
yum clean all
# Install Java (architecture-specific)
ENV JAVA_HOME=/usr/java/21
ENV PATH=$JAVA_HOME/bin:$PATH
RUN if [ "$TARGETARCH" = "arm64" ]; then \
JAVA_URL=https://corretto.aws/downloads/latest/amazon-corretto-21-aarch64-linux-jdk.tar.gz; \
JAVA_PATTERN="amazon-corretto-21*linux-aarch64"; \
else \
JAVA_URL=https://corretto.aws/downloads/latest/amazon-corretto-21-x64-linux-jdk.tar.gz; \
JAVA_PATTERN="amazon-corretto-21*linux-x64"; \
fi && \
JAVA_ARCHIVE=/tmp/jdk.tar.gz && \
JAVA_BASE=/usr/java/ && \
wget $JAVA_URL --output-document $JAVA_ARCHIVE && \
mkdir -p $JAVA_BASE && \
tar -xzf $JAVA_ARCHIVE --directory $JAVA_BASE && \
find $JAVA_BASE -type d -maxdepth 1 -name "$JAVA_PATTERN" -exec mv {} $JAVA_HOME \; && \
rm $JAVA_ARCHIVE
# Install chromium tools
ENV DEPOT_TOOLS=/usr/depot_tools
ENV PATH=$DEPOT_TOOLS:$PATH
RUN git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' $DEPOT_TOOLS
# Install cross-compilation toolchain for ARM64
ENV ARM_TOOLCHAIN_VERSION=9.2-2019.12
ENV ARM_TOOLCHAIN_NAME=gcc-arm-${ARM_TOOLCHAIN_VERSION}-x86_64-aarch64-none-linux-gnu
ENV ARM_TOOLCHAIN_PATH=/opt/arm-gnu-toolchain
ENV PATH="/usr/local/bin:$ARM_TOOLCHAIN_PATH/bin:$PATH"
ENV ARM_TOOLCHAIN_SYSROOT=$ARM_TOOLCHAIN_PATH/aarch64-none-linux-gnu/libc
RUN if [ "$TARGETARCH" = "amd64" ]; then \
cd /tmp && mkdir -p $ARM_TOOLCHAIN_PATH && \
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-a/$ARM_TOOLCHAIN_VERSION/binrel/$ARM_TOOLCHAIN_NAME.tar.xz && \
tar -xf $ARM_TOOLCHAIN_NAME.tar.xz --strip-components=1 -C $ARM_TOOLCHAIN_PATH && rm $ARM_TOOLCHAIN_NAME.tar.xz && \
ln -s $ARM_TOOLCHAIN_PATH/bin/aarch64-none-linux-gnu-g++ /usr/local/bin/aarch64-linux-gnu-g++ && \
ln -s $ARM_TOOLCHAIN_PATH/bin/aarch64-none-linux-gnu-gcc /usr/local/bin/aarch64-linux-gnu-gcc && \
ln -s $ARM_TOOLCHAIN_PATH/bin/aarch64-none-linux-gnu-ar /usr/local/bin/aarch64-linux-gnu-ar; \
fi
# Copy development headers to ARM64 sysroot
RUN if [ "$TARGETARCH" = "amd64" ]; then \
mkdir -p $ARM_TOOLCHAIN_SYSROOT/usr/include && \
cp -r /usr/include/fontconfig $ARM_TOOLCHAIN_SYSROOT/usr/include/ && \
cp -r /usr/include/freetype2 $ARM_TOOLCHAIN_SYSROOT/usr/include/ && \
cp -r /usr/include/GL $ARM_TOOLCHAIN_SYSROOT/usr/include/ && \
cp -r /usr/include/X11 $ARM_TOOLCHAIN_SYSROOT/usr/include/ && \
cp -r /usr/include/KHR $ARM_TOOLCHAIN_SYSROOT/usr/include/; \
fi
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF"
FROM ubuntu:20.04 FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \ RUN apt update -y && \
apt-get install binutils build-essential software-properties-common -y && \ apt install binutils build-essential software-properties-common -y && \
apt-get install zip unzip git python curl wget -y && \ apt install zip unzip git python curl wget -y && \
apt-get install fontconfig libfontconfig1-dev libglu1-mesa-dev libxrandr-dev libdbus-1-dev -y && \ apt install fontconfig libfontconfig1-dev libglu1-mesa-dev libxrandr-dev libdbus-1-dev -y && \
apt-get install openjdk-21-jdk -y && \ apt install openjdk-21-jdk -y && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Install emscripten # Install emscripten
......
[General]
arch=arm64
directory=build/multistrap-arm64
cleanup=true
noauth=false
unpack=true
cleanup=true
aptsources=Ubuntu
bootstrap=Ubuntu
[Ubuntu]
packages=fontconfig libfontconfig1-dev libglu1-mesa-dev
source=https://ports.ubuntu.com/
keyring=ubuntu-keyring
suite=jammy
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment