From c347e7a0b476d77674e2c9a6f137f57da026e8fc Mon Sep 17 00:00:00 2001 From: Anton Mitrofanov Date: Mon, 5 Apr 2021 22:39:12 +0300 Subject: [PATCH] CI: Add macos-arm64 target (cross-compile) Rename the old macos target to macos-x86_64. --- .gitlab-ci.yml | 59 ++++++++++++++++++++++++++++++++++++-------------- configure | 5 +++++ 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c17165c6..4e71f848 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,11 +35,21 @@ stages: _PLATFORMSUFFIX: ".exe" _WRAPPER: "" -.variables-macos: &variables-macos +.variables-macos-x86_64: &variables-macos-x86_64 _TRIPLET: "x86_64-apple-darwin19" _PLATFORMSUFFIX: "" _WRAPPER: "" _CONTRIB_URL: "https://artifacts.videolan.org/vlc/macos-x86_64/" + _XCFLAGS: "-arch x86_64" + _XLDFLAGS: "-arch x86_64" + +.variables-macos-arm64: &variables-macos-arm64 + _TRIPLET: "aarch64-apple-darwin19" + _PLATFORMSUFFIX: "" + _WRAPPER: "" + _CONTRIB_URL: "https://artifacts.videolan.org/vlc/macos-arm64/" + _XCFLAGS: "-arch arm64" + _XLDFLAGS: "-arch arm64" .build: stage: build @@ -133,11 +143,8 @@ build-llvm-mingw-aarch64: extends: .build-llvm-mingw variables: *variables-win-aarch64 -build-macos: +.build-macos: extends: .build - tags: - - amd64 - - catalina script: | set -x LOCAL_INSTALL_DIR=`pwd`/${_TRIPLET} @@ -150,13 +157,26 @@ build-macos: sed -i.bak -e "s#@@CONTRIB_PREFIX@@#${LOCAL_INSTALL_DIR}#g" ${PKG_CONFIG_LIBDIR}/*.pc git clone --depth 1 --branch master https://github.com/l-smash/l-smash.git lsmash cd lsmash - ./configure --prefix="${LOCAL_INSTALL_DIR}" + ./configure --prefix="${LOCAL_INSTALL_DIR}" --target-os="${_TRIPLET}" --extra-cflags="${_XCFLAGS}" --extra-ldflags="${_XLDFLAGS}" make -j$(getconf _NPROCESSORS_ONLN) make -j$(getconf _NPROCESSORS_ONLN) install cd .. - ./configure --enable-pic --enable-strip + ./configure --host="${_TRIPLET}" --enable-pic --enable-strip make -j$(getconf _NPROCESSORS_ONLN) x264 checkasm - variables: *variables-macos + +build-macos-x86_64: + extends: .build-macos + tags: + - amd64 + - catalina + variables: *variables-macos-x86_64 + +build-macos-arm64: + extends: .build-macos + tags: + - amd64 + - catalina + variables: *variables-macos-arm64 .test: &test stage: test @@ -195,12 +215,12 @@ test-win64: - build-win64 variables: *variables-win64 -test-macos: +test-macos-x86_64: <<: *test - extends: build-macos + extends: build-macos-x86_64 dependencies: - - build-macos - variables: *variables-macos + - build-macos-x86_64 + variables: *variables-macos-x86_64 .release: &release stage: release @@ -246,9 +266,16 @@ release-win64: - build-win64 variables: *variables-win64 -release-macos: +release-macos-x86_64: + <<: *release + extends: build-macos-x86_64 + dependencies: + - build-macos-x86_64 + variables: *variables-macos-x86_64 + +release-macos-arm64: <<: *release - extends: build-macos + extends: build-macos-arm64 dependencies: - - build-macos - variables: *variables-macos + - build-macos-arm64 + variables: *variables-macos-arm64 diff --git a/configure b/configure index fdac0581..b4426d62 100755 --- a/configure +++ b/configure @@ -828,6 +828,11 @@ case $host_cpu in if [ "$SYS" = MACOSX ] ; then AS="${AS-${CC}}" ASFLAGS="$ASFLAGS -DPREFIX -DPIC" + if cc_check '' "-arch arm64"; then + CFLAGS="$CFLAGS -arch arm64" + LDFLAGS="$LDFLAGS -arch arm64" + ASFLAGS="$ASFLAGS -arch arm64" + fi elif [ "$SYS" = WINDOWS ] && [ "$compiler" = CL ] ; then AS="${AS-${SRCPATH}/tools/gas-preprocessor.pl -arch aarch64 -as-type armasm -- armasm64 -nologo}" else -- 2.40.0