From 450946f96bb20ca3f71d494c0800c3ad747de769 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Sun, 29 Dec 2024 19:18:13 +0200
Subject: [PATCH] ci: Test compiling for Android

---
 .gitlab-ci.yml | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e1cd18e8..ad1cb998 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -53,6 +53,20 @@ stages:
     _XLDFLAGS: "-arch arm64"
     _BIN_PATH: /Users/videolanci/sandbox/bin
 
+.variables-android-arm: &variables-android-arm
+    _TRIPLET: "arm-linux-androideabi"
+    _CLANG_TRIPLET: "armv7a-linux-androideabi"
+    _ANDROID_VERSION: "21"
+    _PLATFORMSUFFIX: ""
+    _WRAPPER: ""
+
+.variables-android-aarch64: &variables-android-aarch64
+    _TRIPLET: "aarch64-linux-android"
+    _CLANG_TRIPLET: "aarch64-linux-android"
+    _ANDROID_VERSION: "21"
+    _PLATFORMSUFFIX: ""
+    _WRAPPER: ""
+
 .build:
     stage: build
     script: |
@@ -184,6 +198,25 @@ build-macos-arm64:
         - monterey
     variables: *variables-macos-arm64
 
+.build-android:
+    extends: .build
+    image: registry.videolan.org/vlc-debian-android:20241118101328
+    tags:
+        - docker
+        - amd64
+    script: |
+        set -x
+        CC=${_CLANG_TRIPLET}${_ANDROID_VERSION}-clang AR=llvm-ar RANLIB=llvm-ranlib STRIP=llvm-strip PKGCONFIG=pkg-config ./configure --host="${_TRIPLET}" --enable-pic --enable-strip
+        make -j$(getconf _NPROCESSORS_ONLN) x264 checkasm
+
+build-android-arm:
+    extends: .build-android
+    variables: *variables-android-arm
+
+build-android-aarch64:
+    extends: .build-android
+    variables: *variables-android-aarch64
+
 .test: &test
     stage: test
     script: |
-- 
GitLab