[tbb-commits] [builders/tor-browser-build] branch main updated: Bug 40158: Add support for macOS AArch64

gitolite role git at cupani.torproject.org
Wed Sep 28 08:50:25 UTC 2022


This is an automated email from the git hooks/post-receive script.

boklm pushed a commit to branch main
in repository builders/tor-browser-build.

The following commit(s) were added to refs/heads/main by this push:
     new fdebcff  Bug 40158: Add support for macOS AArch64
fdebcff is described below

commit fdebcff9cbcc771aae3c153172a11ad7e49ecdad
Author: Nicolas Vigier <boklm at torproject.org>
AuthorDate: Tue Nov 16 18:17:45 2021 +0100

    Bug 40158: Add support for macOS AArch64
    
    We don't enable aarch64 build by default yet. This will be done in a
    second part (tor-browser-build#40439) where we create universal
    x86-64/arm64 dmg files.
    
    In projects/macosx-toolchain/build we also clean up the flags used to
    build compiler-rt, trying to stay close to what Mozilla is doing.
    
    We also switch back to using Ninja, to avoid an error in compiler-rt
    build for aarch64:
    https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/issues/40158#note_2836499
---
 Makefile                                           | 24 +++++++
 projects/browser/build                             |  4 +-
 projects/browser/config                            |  7 ++
 projects/cctools/build                             |  6 ++
 projects/firefox-langpacks/config                  |  2 +-
 projects/firefox/config                            |  4 +-
 projects/firefox/mozconfig                         | 14 +++-
 projects/go/config                                 |  7 +-
 projects/libevent/config                           |  2 +-
 projects/macosx-toolchain/build                    | 76 ++++++++++++----------
 .../compiler-rt-cross-compile.patch                |  6 +-
 projects/macosx-toolchain/config                   |  2 +
 projects/node/config                               |  2 +-
 projects/openssl/build                             |  2 +-
 projects/openssl/config                            |  4 +-
 projects/release/build                             |  3 +
 projects/release/config                            | 10 +++
 projects/rust/build                                |  6 +-
 projects/rust/config                               |  4 +-
 projects/tor/build                                 |  2 +-
 projects/tor/config                                |  2 +-
 rbm.conf                                           | 31 +++++++--
 22 files changed, 159 insertions(+), 61 deletions(-)

diff --git a/Makefile b/Makefile
index 957234d..465d0ea 100644
--- a/Makefile
+++ b/Makefile
@@ -45,6 +45,9 @@ torbrowser-release-windows-x86_64: submodule-update
 torbrowser-release-osx-x86_64: submodule-update
 	$(rbm) build release --target release --target browser-osx-x86_64 --target torbrowser
 
+torbrowser-release-osx-aarch64: submodule-update
+	$(rbm) build release --target release --target browser-osx-aarch64 --target torbrowser
+
 torbrowser-release-src: submodule-update
 	$(rbm) build release --target release --target browser-src --target torbrowser
 
@@ -87,6 +90,9 @@ torbrowser-alpha-windows-x86_64: submodule-update
 torbrowser-alpha-osx-x86_64: submodule-update
 	$(rbm) build release --target alpha --target browser-osx-x86_64 --target torbrowser
 
+torbrowser-alpha-osx-aarch64: submodule-update
+	$(rbm) build release --target alpha --target browser-osx-aarch64 --target torbrowser
+
 torbrowser-alpha-src: submodule-update
 	$(rbm) build release --target alpha --target browser-src --target torbrowser
 
@@ -129,6 +135,9 @@ torbrowser-nightly-windows-x86_64: submodule-update
 torbrowser-nightly-osx-x86_64: submodule-update
 	$(rbm) build release --target nightly --target browser-osx-x86_64 --target torbrowser
 
+torbrowser-nightly-osx-aarch64: submodule-update
+	$(rbm) build release --target nightly --target browser-osx-aarch64 --target torbrowser
+
 torbrowser-nightly-src: submodule-update
 	$(rbm) build release --target nightly --target browser-src --target torbrowser
 
@@ -171,6 +180,9 @@ torbrowser-testbuild-windows-i686: submodule-update
 torbrowser-testbuild-osx-x86_64: submodule-update
 	$(rbm) build release --target testbuild --target browser-osx-x86_64 --target torbrowser
 
+torbrowser-testbuild-osx-aarch64: submodule-update
+	$(rbm) build release --target testbuild --target browser-osx-aarch64 --target torbrowser
+
 torbrowser-testbuild-src: submodule-update
 	$(rbm) build release --target testbuild --target browser-src-testbuild --target torbrowser
 
@@ -312,6 +324,9 @@ basebrowser-release-windows-x86_64: submodule-update
 basebrowser-release-osx-x86_64: submodule-update
 	$(rbm) build release --target release --target browser-osx-x86_64 --target basebrowser
 
+basebrowser-release-osx-aarch64: submodule-update
+	$(rbm) build release --target release --target browser-osx-aarch64 --target basebrowser
+
 basebrowser-release-src: submodule-update
 	$(rbm) build release --target release --target browser-src --target basebrowser
 
@@ -354,6 +369,9 @@ basebrowser-alpha-windows-x86_64: submodule-update
 basebrowser-alpha-osx-x86_64: submodule-update
 	$(rbm) build release --target alpha --target browser-osx-x86_64 --target basebrowser
 
+basebrowser-alpha-osx-aarch64: submodule-update
+	$(rbm) build release --target alpha --target browser-osx-aarch64 --target basebrowser
+
 basebrowser-alpha-src: submodule-update
 	$(rbm) build release --target alpha --target browser-src --target basebrowser
 
@@ -396,6 +414,9 @@ basebrowser-nightly-windows-x86_64: submodule-update
 basebrowser-nightly-osx-x86_64: submodule-update
 	$(rbm) build release --target nightly --target browser-osx-x86_64 --target basebrowser
 
+basebrowser-nightly-osx-aarch64: submodule-update
+	$(rbm) build release --target nightly --target browser-osx-aarch64 --target basebrowser
+
 basebrowser-nightly-src: submodule-update
 	$(rbm) build release --target nightly --target browser-src --target basebrowser
 
@@ -438,6 +459,9 @@ basebrowser-testbuild-windows-i686: submodule-update
 basebrowser-testbuild-osx-x86_64: submodule-update
 	$(rbm) build release --target testbuild --target browser-osx-x86_64 --target basebrowser
 
+basebrowser-testbuild-osx-aarch64: submodule-update
+	$(rbm) build release --target testbuild --target browser-osx-aarch64 --target basebrowser
+
 basebrowser-testbuild-src: submodule-update
 	$(rbm) build release --target testbuild --target browser-src-testbuild --target basebrowser
 
diff --git a/projects/browser/build b/projects/browser/build
index 9c7e4a0..908bc2a 100644
--- a/projects/browser/build
+++ b/projects/browser/build
@@ -299,7 +299,7 @@ cd $distdir
 [% ELSIF c("var/osx") %]
   [% c('var/ddmg', {
         dmg_src => '"$PKG_DIR"',
-        dmg_out => '$OUTDIR/' _ c('var/ProjectName') _ '-' _ c("var/torbrowser_version") _ '-osx64_${PKG_LOCALE}.dmg',
+        dmg_out => '$OUTDIR/' _ c('var/ProjectName') _ '-' _ c("var/torbrowser_version") _ '-' _ c("var/dmg_name") _ '_${PKG_LOCALE}.dmg',
     }) %]
 [% ELSIF c("var/windows") %]
   find "$PKG_DIR" -exec [% c("touch") %] {} \;
@@ -424,7 +424,7 @@ cp $rootdir/[% c('input_files_by_name/firefox') %]/mar-tools-*.zip "$OUTDIR"/
            END; -%]
         [% c('var/ddmg', {
           dmg_src => tbdir,
-          dmg_out => '$OUTDIR/' _ c('var/ProjectName') _ '-' _ c("var/torbrowser_version") _ '-osx64_' _ lang _ '.dmg',
+          dmg_out => '$OUTDIR/' _ c('var/ProjectName') _ '-' _ c("var/torbrowser_version") _ '-' _ c("var/dmg_name") _ '_' _ lang _ '.dmg',
         }) %]
       [% ELSIF c("var/windows") %]
         find "[% tbdir %]" -exec [% c("touch") %] {} \;
diff --git a/projects/browser/config b/projects/browser/config
index 35b800b..86086d0 100644
--- a/projects/browser/config
+++ b/projects/browser/config
@@ -29,6 +29,13 @@ targets:
   osx-x86_64:
     var:
       mar_osname: osx64
+      dmg_name: osx64
+  osx-aarch64:
+    var:
+      mar_osname: osx64-aarch64
+      dmg_name: osx64-aarch64
+  osx:
+    var:
       arch_deps:
         - genisoimage
         - faketime
diff --git a/projects/cctools/build b/projects/cctools/build
index 8668785..d851586 100644
--- a/projects/cctools/build
+++ b/projects/cctools/build
@@ -31,6 +31,12 @@ cp $CLANG_DIR/bin/dsymutil $distdir/bin/x86_64-apple-darwin-dsymutil
 # various build scripts based on cmake want to find `lipo` without a prefix
 cp $distdir/bin/x86_64-apple-darwin-lipo $distdir/bin/lipo
 
+# We build cctools for x86_64 and add aarch64 symlinks, following what
+# Mozilla is doing in taskcluster/scripts/misc/build-cctools-port.sh
+(cd $distdir/bin/; for i in x86_64-apple-darwin-*; do
+    ln $i aarch64${i#x86_64}
+done)
+
 cd /var/tmp/dist
 [% c('tar', {
         tar_src => [ project ],
diff --git a/projects/firefox-langpacks/config b/projects/firefox-langpacks/config
index 34d6fad..c0518bb 100644
--- a/projects/firefox-langpacks/config
+++ b/projects/firefox-langpacks/config
@@ -17,7 +17,7 @@ targets:
   windows-x86_64:
     var:
       ff_arch: win64
-  osx-x86_64:
+  osx:
     var:
       ff_arch: mac
 
diff --git a/projects/firefox/config b/projects/firefox/config
index feddd96..43f2d7d 100644
--- a/projects/firefox/config
+++ b/projects/firefox/config
@@ -108,9 +108,9 @@ targets:
         # To support Wayland mode
         - libdrm-dev:i386
 
-  osx-x86_64:
+  osx:
     var:
-      martools_filename: mar-tools-mac64.zip
+      martools_filename: 'mar-tools-mac-[% c("var/osx_arch") %].zip'
       arch_deps:
         - python3
         - python3-distutils
diff --git a/projects/firefox/mozconfig b/projects/firefox/mozconfig
index aca39ce..04b20bd 100755
--- a/projects/firefox/mozconfig
+++ b/projects/firefox/mozconfig
@@ -39,23 +39,31 @@
   CROSS_SYSROOT=$TOOLCHAIN_DIR/MacOSX[% pc('macosx-toolchain', 'version') %].sdk
   CROSS_PRIVATE_FRAMEWORKS=$CROSS_SYSROOT/System/Library/PrivateFrameworks
   HARDENING_FLAGS="-Werror=format -Werror=format-security -fstack-protector-strong -D_FORTIFY_SOURCE=2"
-  FLAGS="-target x86_64-apple-darwin -B $CROSS_CCTOOLS_PATH/bin -isysroot $CROSS_SYSROOT $HARDENING_FLAGS"
+  FLAGS="-target [% c('var/build_target') %] -B $CROSS_CCTOOLS_PATH/bin -isysroot $CROSS_SYSROOT $HARDENING_FLAGS"
 
   export CC="$TOOLCHAIN_DIR/clang/bin/clang $FLAGS"
   export CXX="$TOOLCHAIN_DIR/clang/bin/clang++ $FLAGS"
   export LLVMCONFIG=$TOOLCHAIN_DIR/clang/bin/llvm-config
   export LDFLAGS="-Wl,-syslibroot,$CROSS_SYSROOT -Wl,-pie"
   export BINDGEN_CFLAGS="$FLAGS"
-  export TOOLCHAIN_PREFIX=$CROSS_CCTOOLS_PATH/bin/x86_64-apple-darwin-
+  export TOOLCHAIN_PREFIX=$CROSS_CCTOOLS_PATH/bin/[% c('var/build_target') %]-
   export DSYMUTIL="$TOOLCHAIN_DIR/clang/bin/dsymutil"
 
   export HOST_CFLAGS="-g"
   export HOST_CXXFLAGS="-g"
   export HOST_LDFLAGS="-g"
 
-  ac_add_options --target=x86_64-apple-darwin
+  ac_add_options --target=[% c('var/build_target') %]
   export MACOS_SDK_DIR=$CROSS_SYSROOT
   export MACOS_PRIVATE_FRAMEWORKS_DIR=$CROSS_PRIVATE_FRAMEWORKS
+  [% IF c("var/osx-aarch64") -%]
+    # As of Clang 13, the default is -mcpu=apple-m1 when using a aarch64-apple-macos target,
+    # but we're using apple64-apple-darwin, which defaults to -mcpu=apple-a7, which disables
+    # a bunch of # performance-enabling CPU features.
+    # TODO: We'll want to switch to aarch64-apple-macos eventually.
+    export CFLAGS="$CFLAGS -mcpu=apple-m1"
+    export CXXFLAGS="$CXXFLAGS -mcpu=apple-m1"
+  [% END -%]
 [% END -%]
 
 [% IF c("var/tor-browser") %]
diff --git a/projects/go/config b/projects/go/config
index 2fd0af6..8578a6b 100644
--- a/projects/go/config
+++ b/projects/go/config
@@ -82,8 +82,13 @@ targets:
       GOARCH: amd64
   osx-x86_64:
     var:
-      GOOS: darwin
       GOARCH: amd64
+  osx-aarch64:
+    var:
+      GOARCH: arm64
+  osx:
+    var:
+      GOOS: darwin
   linux:
     var:
       GOOS: linux
diff --git a/projects/libevent/config b/projects/libevent/config
index 1dcdc79..7c4bc98 100644
--- a/projects/libevent/config
+++ b/projects/libevent/config
@@ -12,7 +12,7 @@ var:
   configure_opt_project: --disable-static
 
 targets:
-  osx-x86_64:
+  osx:
     var:
       arch_deps:
         - faketime
diff --git a/projects/macosx-toolchain/build b/projects/macosx-toolchain/build
index 89739c8..e1c546e 100644
--- a/projects/macosx-toolchain/build
+++ b/projects/macosx-toolchain/build
@@ -5,21 +5,38 @@ mkdir $builddir
 distdir=/var/tmp/dist/[% project %]
 mkdir -p "$distdir"
 tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
+tar -C /var/tmp/dist -xf [% c('input_files_by_name/ninja') %]
 tar -C $distdir -xf [% c('input_files_by_name/clang') %]
 tar -C $distdir -xf [% c('input_files_by_name/SDK') %]
 tar -C $distdir -xf [% c('input_files_by_name/cctools') %]
 tar -C $builddir -xf [% c('input_files_by_name/llvm-project') %]
 
-arch=x86_64
+arch=[% c("var/osx_arch") %]
 clangdir=$distdir/clang/bin
 cctoolsdir=$distdir/cctools/bin
 sysrootdir=$distdir/MacOSX[% c("version") %].sdk/
-target=x86_64-apple-darwin
+target=[% c("var/build_target") %]
 # We still need to put the cctoolsdir on the path. That's because of `lipo`. See
 # the respective comment in the cctools build script.
-export PATH="/var/tmp/dist/cmake/bin:$cctoolsdir:$PATH"
+export PATH="/var/tmp/dist/ninja:/var/tmp/dist/cmake/bin:$cctoolsdir:$PATH"
 export MACOSX_DEPLOYMENT_TARGET=[% c("var/macosx_deployment_target") %]
 
+[% IF c("var/osx-aarch64") -%]
+  # wrapper taken from:
+  # tor-browser.git/taskcluster/scripts/misc/build-llvm-common.sh
+  clangwrappersdir=$distdir/clang/wrappers
+  mkdir $clangwrappersdir
+  compiler_wrapper() {
+    echo exec $clangdir/$1 -mcpu=apple-m1 \"\$@\" > $clangwrappersdir/$1
+    chmod +x $clangwrappersdir/$1
+  }
+  compiler_wrapper clang
+  compiler_wrapper clang++
+  clang=$clangwrappersdir/clang
+[% ELSE -%]
+  clang=$clangdir/clang
+[% END -%]
+
 cd $builddir/clang-source
 patch -p1 < $rootdir/compiler-rt-cross-compile.patch
 patch -p1 < $rootdir/compiler-rt-no-codesign.patch
@@ -29,20 +46,18 @@ mkdir build_compiler_rt
 cd build_compiler_rt
 
 # And we build compiler-rt by following taskcluster/scripts/misc/build-compiler-rt.sh.
-cmake -G "Unix Makefiles" \
-      -DCMAKE_C_COMPILER=$clangdir/clang \
-      -DCMAKE_CXX_COMPILER=$clangdir/clang++ \
+cmake -GNinja \
+      -DCMAKE_C_COMPILER=$clang \
+      -DCMAKE_CXX_COMPILER=$clang++ \
       -DCMAKE_C_COMPILER_TARGET=$target \
       -DCMAKE_CXX_COMPILER_TARGET=$target \
       -DCMAKE_ASM_COMPILER_TARGET=$target \
       -DCMAKE_AR=$clangdir/llvm-ar \
       -DCMAKE_RANLIB=$clangdir/llvm-ranlib \
-      -DCMAKE_C_FLAGS="[% c('var/FLAGS') %] -I$sysrootdir/usr/include -iframework $sysrootdir/System/Library/Frameworks" \
-      -DCMAKE_CXX_FLAGS="-stdlib=libc++ [% c('var/FLAGS') %] -I$sysrootdir/usr/include -iframework $sysrootdir/System/Library/Frameworks" \
-      -DCMAKE_ASM_FLAGS="[% c('var/FLAGS') %] -I$sysrootdir/usr/include -iframework $sysrootdir/System/Library/Frameworks" \
-      -DCMAKE_EXE_LINKER_FLAGS="[% c('var/LDFLAGS') %]" \
-      -DCMAKE_SHARED_LINKER_FLAGS="[% c('var/LDFLAGS') %]" \
+      -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \
+      -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" \
       -DCMAKE_BUILD_TYPE=Release \
+      -DLLVM_DEFAULT_TARGET_TRIPLE=$target \
       -DLLVM_ENABLE_ASSERTIONS=OFF \
       -DCMAKE_INSTALL_PREFIX=$distdir/clang/lib/clang/[% pc("clang", "version") %]/ \
       -DLLVM_CONFIG_PATH=$clangdir/llvm-config \
@@ -50,68 +65,63 @@ cmake -G "Unix Makefiles" \
       -DCOMPILER_RT_ENABLE_IOS=OFF \
       -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
       -DCOMPILER_RT_BUILD_ORC=OFF \
-      -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
       -DCOMPILER_RT_ENABLE_TVOS=OFF \
       -DCOMPILER_RT_ENABLE_WATCHOS=OFF \
       -DCOMPILER_RT_BUILD_XRAY=OFF \
-      -DCMAKE_LINKER=$cctoolsdir/$target-ld \
-      -DCMAKE_LIPO=$cctoolsdir/lipo \
+      -DCMAKE_LINKER=$clangdir/ld64.lld \
+      -DCMAKE_LIPO=$clangdir/llvm-lipo \
       -DCMAKE_SYSTEM_NAME=Darwin \
       -DCMAKE_SYSTEM_VERSION=$MACOSX_DEPLOYMENT_TARGET \
       -DDARWIN_macosx_OVERRIDE_SDK_VERSION=$MACOSX_DEPLOYMENT_TARGET \
+      -DCMAKE_OSX_ARCHITECTURES=$arch \
       -DDARWIN_osx_ARCHS=$arch \
       -DDARWIN_osx_SYSROOT=$sysrootdir \
       -DDARWIN_osx_BUILTIN_ARCHS=$arch \
       -DCMAKE_OSX_SYSROOT=$sysrootdir \
-      -DCMAKE_FIND_ROOT_PATH=$sysrootdir \
-      -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-      -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-      -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-      -DDARWIN_osx_BUILTIN_ARCHS=$arch \
       $builddir/clang-source/compiler-rt
 
-make -j[% c("num_procs") %]
-make install
+ninja -j[% c("num_procs") %] -v install
 
 cd $builddir/clang-source
 
-cmake -G "Unix Makefiles" -S runtimes -B build \
+cmake -GNinja -S runtimes -B build \
       -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
-      -DCMAKE_C_COMPILER=$clangdir/clang \
-      -DCMAKE_CXX_COMPILER=$clangdir/clang++ \
+      -DCMAKE_C_COMPILER=$clang \
+      -DCMAKE_CXX_COMPILER=$clang++ \
       -DCMAKE_C_COMPILER_TARGET=$target \
       -DCMAKE_CXX_COMPILER_TARGET=$target \
       -DCMAKE_ASM_COMPILER_TARGET=$target \
       -DCMAKE_AR=$clangdir/llvm-ar \
       -DCMAKE_RANLIB=$clangdir/llvm-ranlib \
-      -DCMAKE_C_FLAGS="-target x86_64-apple-darwin -B $cctoolsdir -isysroot $sysrootdir -I$sysrootdir/usr/include -iframework $sysrootdir/System/Library/Frameworks" \
-      -DCMAKE_CXX_FLAGS="-stdlib=libc++ -target x86_64-apple-darwin -B $cctoolsdir -isysroot $sysrootdir -I$sysrootdir/usr/include -iframework $sysrootdir/System/Library/Frameworks" \
-      -DCMAKE_ASM_FLAGS="-target x86_64-apple-darwin -B $cctoolsdir -isysroot $sysrootdir -I$sysrootdir/usr/include -iframework $sysrootdir/System/Library/Frameworks" \
+      -DCMAKE_C_FLAGS="-target $target -B $cctoolsdir -isysroot $sysrootdir -I$sysrootdir/usr/include -iframework $sysrootdir/System/Library/Frameworks" \
+      -DCMAKE_CXX_FLAGS="-stdlib=libc++ -target $target -B $cctoolsdir -isysroot $sysrootdir -I$sysrootdir/usr/include -iframework $sysrootdir/System/Library/Frameworks" \
+      -DCMAKE_ASM_FLAGS="-target $target -B $cctoolsdir -isysroot $sysrootdir -I$sysrootdir/usr/include -iframework $sysrootdir/System/Library/Frameworks" \
       -DCMAKE_EXE_LINKER_FLAGS="-Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie" \
       -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie" \
       -DCMAKE_BUILD_TYPE=Release \
+      -DLLVM_DEFAULT_TARGET_TRIPLE=$target \
       -DLLVM_ENABLE_ASSERTIONS=OFF \
       -DCMAKE_INSTALL_PREFIX=$distdir/clang \
       -DCMAKE_LINKER=$cctoolsdir/$target-ld \
+      -DCMAKE_LIPO=$clangdir/llvm-lipo \
       -DCMAKE_SYSTEM_NAME=Darwin \
       -DCMAKE_SYSTEM_VERSION=$MACOSX_DEPLOYMENT_TARGET \
       -DDARWIN_macosx_OVERRIDE_SDK_VERSION=$MACOSX_DEPLOYMENT_TARGET \
+      -DCMAKE_OSX_ARCHITECTURES=$arch \
       -DDARWIN_osx_ARCHS=$arch \
       -DDARWIN_osx_BUILTIN_ARCHS=$arch \
       -DCMAKE_OSX_SYSROOT=$sysrootdir \
       -DCMAKE_FIND_ROOT_PATH=$sysrootdir \
       -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
       -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-      -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-      -DDARWIN_osx_BUILTIN_ARCHS=$arch \
+      -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
 
 cd build
-make -j[% c("num_procs") %]
-make install
+ninja -j[% c("num_procs") %] -v install
 
 cd $distdir/cctools/bin
-ln -s ../../clang/bin/clang x86_64-apple-darwin-clang
-ln -s ../../clang/bin/clang++ x86_64-apple-darwin-clang++
+ln -s ../../clang/bin/clang $target-clang
+ln -s ../../clang/bin/clang++ $target-clang++
 
 cd /var/tmp/dist
 [% c('tar', {
diff --git a/projects/macosx-toolchain/compiler-rt-cross-compile.patch b/projects/macosx-toolchain/compiler-rt-cross-compile.patch
index b3cc167..330d4a2 100644
--- a/projects/macosx-toolchain/compiler-rt-cross-compile.patch
+++ b/projects/macosx-toolchain/compiler-rt-cross-compile.patch
@@ -4,12 +4,12 @@ diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt
 index 28d398672..aac68bf36 100644
 --- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
 +++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
-@@ -390,7 +390,7 @@ endfunction()
+@@ -265,7 +265,7 @@ endfunction()
  macro(darwin_add_builtin_libraries)
    set(DARWIN_EXCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Darwin-excludes)
-
+ 
 -  set(CFLAGS "-fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer")
-+  set(CFLAGS "-fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer -target x86_64-apple-darwin -isysroot ${CMAKE_OSX_SYSROOT} -I${CMAKE_OSX_SYSROOT}/usr/include")
++  set(CFLAGS "-fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer -target ${LLVM_DEFAULT_TARGET_TRIPLE} -isysroot ${CMAKE_OSX_SYSROOT} -I${CMAKE_OSX_SYSROOT}/usr/include")
    set(CMAKE_C_FLAGS "")
    set(CMAKE_CXX_FLAGS "")
    set(CMAKE_ASM_FLAGS "")
diff --git a/projects/macosx-toolchain/config b/projects/macosx-toolchain/config
index 4aa1f49..ac58b2c 100644
--- a/projects/macosx-toolchain/config
+++ b/projects/macosx-toolchain/config
@@ -24,6 +24,8 @@ input_files:
     project: cctools
   - name: cmake
     project: cmake
+  - name: ninja
+    project: ninja
   # Instructions on how to create the SDK tarball can be found at:
   # build/macosx/cross-mozconfig.common
   - name: SDK
diff --git a/projects/node/config b/projects/node/config
index 6250ac4..4fe0f05 100644
--- a/projects/node/config
+++ b/projects/node/config
@@ -12,7 +12,7 @@ targets:
     var:
       arch_deps:
         - python2
-  osx-x86_64:
+  osx:
     var:
       arch_deps:
         - python2
diff --git a/projects/openssl/build b/projects/openssl/build
index 094b7cd..d3c7ded 100644
--- a/projects/openssl/build
+++ b/projects/openssl/build
@@ -11,7 +11,7 @@ export CC='gcc -m32'
 # OpenSSL prepends the host triple to $CC
 [% IF c("var/osx") -%]
   # Tricking OpenSSL into using our clang as cross-compiler
-  ln -s $clangdir/bin/clang $clangdir/bin/x86_64-apple-darwin-cc
+  ln -s $clangdir/bin/clang $clangdir/bin/[% c("var/build_target") %]-cc
   export CC="cc [% c("var/FLAGS") %]"
 [% END -%]
 [% IF c("var/windows") -%]
diff --git a/projects/openssl/config b/projects/openssl/config
index 350a702..c7aae88 100644
--- a/projects/openssl/config
+++ b/projects/openssl/config
@@ -19,9 +19,9 @@ targets:
       flag_mwindows: ''
       configure_opts: '-shared --cross-compile-prefix=[% c("arch") %]-w64-mingw32- mingw[% IF c("var/windows-x86_64") %]64[% END %] "[% c("var/CFLAGS") %] [% c("var/LDFLAGS") %]"'
       openssldir: 'Program Files[% IF c("var/windows-i686") %] (x86)[% END %]/OpenSSL'
-  osx-x86_64:
+  osx:
     var:
-      configure_opts: --cross-compile-prefix=x86_64-apple-darwin- darwin64-x86_64-cc enable-ec_nistp_64_gcc_128
+      configure_opts: '--cross-compile-prefix=[% c("var/build_target") %]- darwin64-[% c("var/osx_arch") %]-cc enable-ec_nistp_64_gcc_128'
   android:
     var:
       configure_opts: 'CC=[% c("var/CC") %] android-[% c("var/toolchain_arch") %] -no-shared -D__ANDROID_API__=[% c("var/android_min_api") %]'
diff --git a/projects/release/build b/projects/release/build
index ed110ee..f69f776 100644
--- a/projects/release/build
+++ b/projects/release/build
@@ -31,6 +31,9 @@ mkdir -p "$destdir"
 [% IF c("var/browser-osx-x86_64") -%]
   mv [% c('input_files_by_name/osx-x86_64') %]/* "$destdir"/
 [% END -%]
+[% IF c("var/browser-osx-aarch64") -%]
+  mv [% c('input_files_by_name/osx-aarch64') %]/* "$destdir"/
+[% END -%]
 [% IF c("var/browser-linux-i686") -%]
   mv [% c('input_files_by_name/linux-i686') %]/* "$destdir"/
 [% END -%]
diff --git a/projects/release/config b/projects/release/config
index 39e8ae9..4d0948c 100644
--- a/projects/release/config
+++ b/projects/release/config
@@ -63,6 +63,9 @@ targets:
   browser-osx-x86_64:
     var:
       browser-osx-x86_64: 1
+  browser-osx-aarch64:
+    var:
+      browser-osx-aarch64: 1
   browser-src:
     var:
       browser-src: '[% ! c("var/testbuild") %]'
@@ -192,6 +195,13 @@ input_files:
      - '[% c("var/build_target") %]'
      - '[% c("var/browser_type") %]-osx-x86_64'
 
+ - name: osx-aarch64
+   project: browser
+   enable: '[% c("var/browser-osx-aarch64") %]'
+   target:
+     - '[% c("var/build_target") %]'
+     - '[% c("var/browser_type") %]-osx-aarch64'
+
  - name: windows-expert-bundle
    project: tor
    enable: '[% c("var/browser-windows-i686") %]'
diff --git a/projects/rust/build b/projects/rust/build
index d5b600e..783087c 100644
--- a/projects/rust/build
+++ b/projects/rust/build
@@ -37,13 +37,13 @@ export PATH="$distdir-rust-prebuilt/bin:$PATH"
   # We need to adapt our CFLAGS and make sure our flags are passed down to all
   # dependencies. Using `CFLAGS_x86_apple-darwin` did not do the trick, so resort
   # to a wrapper script.
-  cat > $distdir/helper/x86_64-apple-darwin-clang << 'EOF'
+  cat > $distdir/helper/[% c("var/build_target") %]-clang << 'EOF'
 #!/bin/sh
 BASEDIR=/var/tmp/dist/macosx-toolchain
-$BASEDIR/cctools/bin/x86_64-apple-darwin-clang -target x86_64-apple-darwin -B $BASEDIR/cctools/bin -isysroot $sysrootdir -Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie "$@"
+$BASEDIR/cctools/bin/[% c("var/build_target") %]-clang -target [% c("var/build_target") %] -B $BASEDIR/cctools/bin -isysroot $sysrootdir -Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie [% IF c('var/osx-aarch64') %]-mcpu=apple-m1[% END %] "$@"
 EOF
 
-  chmod +x $distdir/helper/x86_64-apple-darwin-clang
+  chmod +x $distdir/helper/[% c("var/build_target") %]-clang
   export PATH=$distdir/helper:$PATH
 [% END %]
 
diff --git a/projects/rust/config b/projects/rust/config
index 83f794c..f5f5f1e 100644
--- a/projects/rust/config
+++ b/projects/rust/config
@@ -56,13 +56,13 @@ targets:
       # binaries do.
       configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --llvm-root=/var/tmp/dist/clang --set rust.jemalloc --target=x86_64-unknown-linux-gnu,i686-unknown-linux-gnu --set target.x86_64-unknown-linux-gnu.linker=clang --set target.x86_64-unknown-linux-gnu.ar=llvm-ar --set target.x86_64-unknown-linux-gnu.ranlib=llvm-ranlib --set target.i686-unknown-linux-gnu.linker=clang --set target.i686-unknown-linux-gnu.ar=llvm-ar --set target. [...]
 
-  osx-x86_64:
+  osx:
     var:
       arch_deps:
         - libssl-dev
         - pkg-config
         - zlib1g-dev
-      configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --llvm-root=/var/tmp/dist/macosx-toolchain/clang --set rust.jemalloc --target=x86_64-unknown-linux-gnu,x86_64-apple-darwin --set=target.x86_64-apple-darwin.cc=x86_64-apple-darwin-clang --set target.x86_64-unknown-linux-gnu.linker=clang --set target.x86_64-unknown-linux-gnu.ar=llvm-ar --set target.x86_64-unknown-linux-gnu.ranlib=llvm-ranlib
+      configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --llvm-root=/var/tmp/dist/macosx-toolchain/clang --set rust.jemalloc --target=x86_64-unknown-linux-gnu,[% c("var/build_target") %] --set=target.[% c("var/build_target") %].cc=[% c("var/build_target") %]-clang --set target.x86_64-unknown-linux-gnu.linker=clang --set target.x86_64-unknown-linux-gnu.ar=llvm-ar --set target.x86_64-unknown-linux-gnu.ranlib=llvm-ranlib
 
   windows:
     var:
diff --git a/projects/tor/build b/projects/tor/build
index c4c1e65..5c23e9b 100644
--- a/projects/tor/build
+++ b/projects/tor/build
@@ -102,7 +102,7 @@ cp $distdir/share/tor/geoip6 $TORCONFIGDIR
   cd $distdir
   cp bin/tor $TORBINDIR/
   cd $TORBINDIR/
-  x86_64-apple-darwin-install_name_tool -change $libeventdir/lib/$LIBEVENT_FILE @executable_path/$LIBEVENT_FILE tor
+  [% c("var/build_target") %]-install_name_tool -change $libeventdir/lib/$LIBEVENT_FILE @executable_path/$LIBEVENT_FILE tor
 [% END %]
 
 cd $distdir
diff --git a/projects/tor/config b/projects/tor/config
index 4425d48..1145d57 100644
--- a/projects/tor/config
+++ b/projects/tor/config
@@ -37,7 +37,7 @@ targets:
         - libtool
         - zlib1g-dev
         - hardening-wrapper
-  osx-x86_64:
+  osx:
     var:
       arch_deps:
         - faketime
diff --git a/rbm.conf b/rbm.conf
index ba590fc..4ff3e92 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -514,23 +514,46 @@ targets:
 
   torbrowser-osx-x86_64:
     - osx-x86_64
+    - osx
+    - torbrowser
+  torbrowser-osx-aarch64:
+    - osx-aarch64
+    - osx
     - torbrowser
   basebrowser-osx-x86_64:
     - osx-x86_64
+    - osx
+    - basebrowser
+  basebrowser-osx-aarch64:
+    - osx-aarch64
+    - osx
     - basebrowser
+  osx-aarch64:
+    arch: aarch64
+    var:
+      osx-aarch64: 1
+      osname: osx-aarch64
+      osx_arch: arm64
+      build_target: aarch64-apple-darwin
+      macosx_deployment_target: '11.0'
   osx-x86_64:
     arch: x86_64
     var:
-      osx: 1
+      osx-x86_64: 1
       osname: osx-x86_64
+      osx_arch: x86_64
+      build_target: x86_64-apple-darwin
+      macosx_deployment_target: '10.12'
+  osx:
+    var:
+      osx: 1
       container:
         suite: bullseye
         arch: amd64
       compiler: 'macosx-toolchain'
-      configure_opt: '--host=x86_64-apple-darwin CC="x86_64-apple-darwin-clang [% c("var/FLAGS") %]" CXX="x86_64-apple-darwin-clang++ [% c("var/FLAGS") %]" [% c("var/configure_opt_project") %]'
-      FLAGS: "-target x86_64-apple-darwin -B $cctoolsdir -isysroot $sysrootdir"
+      configure_opt: '--host=[% c("var/build_target") %] CC="[% c("var/build_target") %]-clang [% c("var/FLAGS") %]" CXX="[% c("var/build_target") %]-clang++ [% c("var/FLAGS") %]" [% c("var/configure_opt_project") %]'
+      FLAGS: "-target [% c('var/build_target') %] -B $cctoolsdir -isysroot $sysrootdir [% IF c('var/osx-aarch64') %]-mcpu=apple-m1[% END %]"
       LDFLAGS: "-Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie"
-      macosx_deployment_target: '10.12'
       locale_ja: ja-JP-mac
       rlbox: 0
       deps:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list