commit c51caf4a609c9c3e037b302cb1fba508fea14045 Author: Georg Koppen gk@torproject.org Date: Thu Jul 9 20:31:58 2020 +0000
Bug 34229: Update macOS toolchain for Firefox 78 ESR
Clean-up and getting us closer to the way Mozilla is deploying the cross-compilation setup. --- projects/fenix-rust/build | 17 +---------------- projects/firefox/mozconfig-osx-x86_64 | 10 +++++----- projects/libevent/build | 5 ----- projects/macosx-toolchain/build | 4 ++-- projects/macosx-toolchain/config | 3 +++ projects/openssl/build | 2 +- projects/openssl/config | 2 +- projects/rust/build | 17 +---------------- projects/tor/build | 4 +--- rbm.conf | 4 ++-- 10 files changed, 17 insertions(+), 51 deletions(-)
diff --git a/projects/fenix-rust/build b/projects/fenix-rust/build index a8f886b..5d3d5c1 100644 --- a/projects/fenix-rust/build +++ b/projects/fenix-rust/build @@ -16,23 +16,8 @@ export PATH="$distdir-rust-old/bin:$PATH" # (i.e. Linux). unset CC unset LDFLAGS - # Target 10.9 as our toolchain does. Without this explicit declaration Bad - # Things will happen, as a lot of dependent code then assumes that the - # official macOS target, x86_64-apple-darwin, essentially means 10.4. - export MACOSX_DEPLOYMENT_TARGET=[% c("var/macosx_deployment_target") %] - # The Rust target for macOS is x86_64-apple-darwin, yet our toolchain is built - # for x86_64-apple-darwin11. We can't mix those targets as clang gets confused - # that way. Changing the Rust target to x86_64-apple-darwin11 would require a - # fair amount of patching, thus we create symlinks to provide Rust with the - # necessary tools while using our toolchain underneath, targeting 10.9. - cd $cctoolsdir - for f in `ls x86_64-apple-darwin11-*`; do - ln -s $f ${f//x86_64-apple-darwin11/x86_64-apple-darwin} - done - cd .. - ln -s x86_64-apple-darwin11 x86_64-apple-darwin - mkdir $distdir/helper
+ mkdir $distdir/helper # 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. diff --git a/projects/firefox/mozconfig-osx-x86_64 b/projects/firefox/mozconfig-osx-x86_64 index 8f088a5..9b0773d 100644 --- a/projects/firefox/mozconfig-osx-x86_64 +++ b/projects/firefox/mozconfig-osx-x86_64 @@ -7,23 +7,23 @@ CROSS_CCTOOLS_PATH=$TOOLCHAIN_DIR/cctools CROSS_SYSROOT=$TOOLCHAIN_DIR/MacOSX10.11.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-darwin11 -B $CROSS_CCTOOLS_PATH/bin -isysroot $CROSS_SYSROOT $HARDENING_FLAGS" +FLAGS="-target x86_64-apple-darwin -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-darwin11- +export TOOLCHAIN_PREFIX=$CROSS_CCTOOLS_PATH/bin/x86_64-apple-darwin- 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-darwin11 -ac_add_options --with-macos-sdk=$CROSS_SYSROOT -ac_add_options --with-macos-private-frameworks=$CROSS_PRIVATE_FRAMEWORKS +ac_add_options --target=x86_64-apple-darwin +export MACOS_SDK_DIR=$CROSS_SYSROOT +export MACOS_PRIVATE_FRAMEWORKS_DIR=$CROSS_PRIVATE_FRAMEWORKS
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-macos mk_add_options MOZ_APP_DISPLAYNAME="Tor Browser" diff --git a/projects/libevent/build b/projects/libevent/build index 9c4f190..cc9d6b5 100644 --- a/projects/libevent/build +++ b/projects/libevent/build @@ -5,11 +5,6 @@ distdir=/var/tmp/dist/[% project %] mkdir -p /var/tmp/build tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz cd /var/tmp/build/[% project %]-[% c('version') %] -[% IF c("var/osx") -%] - # Setting this after `configure` but before `make` might be enough, but let's - # not bet on that and just set it here. - export MACOSX_DEPLOYMENT_TARGET=[% c("var/macosx_deployment_target") %] -[% END -%] ./autogen.sh ./configure [% c("var/configure_opt") %] --disable-libevent-regress --disable-samples --prefix=$distdir [% IF c("var/osx") -%] diff --git a/projects/macosx-toolchain/build b/projects/macosx-toolchain/build index f306302..cd19c1d 100644 --- a/projects/macosx-toolchain/build +++ b/projects/macosx-toolchain/build @@ -8,8 +8,8 @@ tar xf [% c('input_files_by_name/clang') %] mv clang "$distdir/clang" tar -C $distdir -xf [% c('input_files_by_name/cctools') %] cd $distdir/cctools/bin -ln -s ../../clang/bin/clang x86_64-apple-darwin11-clang -ln -s ../../clang/bin/clang++ x86_64-apple-darwin11-clang++ +ln -s ../../clang/bin/clang x86_64-apple-darwin-clang +ln -s ../../clang/bin/clang++ x86_64-apple-darwin-clang++
cd "/var/tmp/dist" [% c('tar', { diff --git a/projects/macosx-toolchain/config b/projects/macosx-toolchain/config index b7d5a39..29f7c4b 100644 --- a/projects/macosx-toolchain/config +++ b/projects/macosx-toolchain/config @@ -14,6 +14,7 @@ var: export LD_LIBRARY_PATH=/var/tmp/dist/[% project %]/clang/lib export CC="$clangdir/bin/clang [% c('var/FLAGS') %]" export LDFLAGS="[% c('var/LDFLAGS') %]" + export MACOSX_DEPLOYMENT_TARGET=[% c("var/macosx_deployment_target") %]
input_files: - project: container-image @@ -21,6 +22,8 @@ input_files: project: clang - name: cctools project: cctools + # Instructions on how to create the SDK tarball can be found at: + # build/macosx/cross-mozconfig.common - name: SDK URL: https://people.torproject.org/~gk/mirrors/sources/MacOSX10.11.sdk.tar.bz2 sha256sum: d11e410d757d023be66d2fe7eaa85a1d232da3ac04f177eff3d8b8275cd9ffca diff --git a/projects/openssl/build b/projects/openssl/build index 5f275a0..7737f88 100644 --- a/projects/openssl/build +++ b/projects/openssl/build @@ -10,7 +10,7 @@ export CC='gcc -m32' [% END %] [% IF c("var/osx") -%] # Tricking OpenSSL into using our clang as cross-compiler - ln -s $clangdir/bin/clang $clangdir/bin/x86_64-apple-darwin11-cc + ln -s $clangdir/bin/clang $clangdir/bin/x86_64-apple-darwin-cc export CC="cc [% c("var/FLAGS") %]" [% END -%] [% IF c("var/windows") -%] diff --git a/projects/openssl/config b/projects/openssl/config index ab62b14..fd38237 100644 --- a/projects/openssl/config +++ b/projects/openssl/config @@ -21,7 +21,7 @@ targets: openssldir: 'Program Files[% IF c("var/windows-i686") %] (x86)[% END %]/OpenSSL' osx-x86_64: var: - configure_opts: --cross-compile-prefix=x86_64-apple-darwin11- darwin64-x86_64-cc enable-ec_nistp_64_gcc_128 + configure_opts: --cross-compile-prefix=x86_64-apple-darwin- darwin64-x86_64-cc enable-ec_nistp_64_gcc_128 android: var: configure_opts: '[% IF c("var/android-fenix") %]CC=[% c("var/CC") %] android-[% c("var/toolchain_arch") %] -no-shared -D__ANDROID_API__=[% c("var/android_min_api") %][% ELSE %]CC=clang android-[% c("var/toolchain_arch") %] -no-shared[% END %]' diff --git a/projects/rust/build b/projects/rust/build index a8f886b..5d3d5c1 100644 --- a/projects/rust/build +++ b/projects/rust/build @@ -16,23 +16,8 @@ export PATH="$distdir-rust-old/bin:$PATH" # (i.e. Linux). unset CC unset LDFLAGS - # Target 10.9 as our toolchain does. Without this explicit declaration Bad - # Things will happen, as a lot of dependent code then assumes that the - # official macOS target, x86_64-apple-darwin, essentially means 10.4. - export MACOSX_DEPLOYMENT_TARGET=[% c("var/macosx_deployment_target") %] - # The Rust target for macOS is x86_64-apple-darwin, yet our toolchain is built - # for x86_64-apple-darwin11. We can't mix those targets as clang gets confused - # that way. Changing the Rust target to x86_64-apple-darwin11 would require a - # fair amount of patching, thus we create symlinks to provide Rust with the - # necessary tools while using our toolchain underneath, targeting 10.9. - cd $cctoolsdir - for f in `ls x86_64-apple-darwin11-*`; do - ln -s $f ${f//x86_64-apple-darwin11/x86_64-apple-darwin} - done - cd .. - ln -s x86_64-apple-darwin11 x86_64-apple-darwin - mkdir $distdir/helper
+ mkdir $distdir/helper # 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. diff --git a/projects/tor/build b/projects/tor/build index 4345d35..96c2a16 100644 --- a/projects/tor/build +++ b/projects/tor/build @@ -90,8 +90,6 @@ openssldir=/var/tmp/dist/openssl/openssl
[% IF c("var/osx") %] cp $libeventdir/lib/libevent-*.dylib $TORBINDIR/ - # The target version needs to be set before the configure step. - export MACOSX_DEPLOYMENT_TARGET=[% c("var/macosx_deployment_target") %] [% END %]
cd /var/tmp/build/[% project %]-[% c('version') %] @@ -122,7 +120,7 @@ cp $distdir/share/tor/geoip6 $TORCONFIGDIR cd $distdir cp bin/tor $TORBINDIR/ cd $TORBINDIR/ - x86_64-apple-darwin11-install_name_tool -change $libeventdir/lib/$LIBEVENT_FILE @executable_path/$LIBEVENT_FILE tor + x86_64-apple-darwin-install_name_tool -change $libeventdir/lib/$LIBEVENT_FILE @executable_path/$LIBEVENT_FILE tor [% END %]
cd $distdir diff --git a/rbm.conf b/rbm.conf index a3850d9..c3f778b 100644 --- a/rbm.conf +++ b/rbm.conf @@ -439,8 +439,8 @@ targets: suite: buster arch: amd64 compiler: 'macosx-toolchain' - configure_opt: '--host=x86_64-apple-darwin11 CC="x86_64-apple-darwin11-clang [% c("var/FLAGS") %]" CXX="x86_64-apple-darwin11-clang++ [% c("var/FLAGS") %]" [% c("var/configure_opt_project") %]' - FLAGS: "-target x86_64-apple-darwin11 -B $cctoolsdir -isysroot $sysrootdir" + 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" LDFLAGS: "-Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie" macosx_deployment_target: '10.9' locale_ja: ja-JP-mac
tbb-commits@lists.torproject.org