1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- . $topsrcdir/mozconfig-[% IF c("var/macos"); GET 'macos-x86_64'; ELSE; GET c("var/osname"); END; %][% IF c("var/asan") %]-asan[% END %]
- [% IF c("var/linux") -%]
- # We want to build with clang now and point to the GCC toolchain until #29041 is
- # fixed. We explicitly need to define the host compiler as well as for some
- # reason the gcc-toolchain argument does not get passed along otherwise.
- CC="clang --gcc-toolchain=/var/tmp/dist/gcc"
- CXX="clang++ --gcc-toolchain=/var/tmp/dist/gcc"
- HOST_CC=$CC
- HOST_CXX=$CXX
- export BINDGEN_CFLAGS='--gcc-toolchain=/var/tmp/dist/gcc'
- [% IF c("var/linux-arm64") -%]
- ac_add_options --host=aarch64-unknown-linux-gnu
- [% END -%]
- [% IF c("var/linux-armhf") -%]
- ac_add_options --host=armv7-unknown-linux-gnueabihf
- [% END -%]
- [% END -%]
- [% IF c("var/windows") -%]
- CROSS_COMPILE=1
- HOST_CC="clang"
- HOST_CXX="clang++"
- CC="[% c('arch') %]-w64-mingw32-clang"
- CXX="[% c('arch') %]-w64-mingw32-clang++"
- CXXFLAGS="-fms-extensions"
- AR=llvm-ar
- RANLIB=llvm-ranlib
- clang_path=/var/tmp/dist/mingw-w64-clang
- # For Stylo
- BINDGEN_CFLAGS="-I$clang_path/[% c('arch') %]-w64-mingw32/include/c++/v1 -I$clang_path/[% c('arch') %]-w64-mingw32/include"
- [% END -%]
- [% IF c("var/macos") -%]
- TOOLCHAIN_DIR=/var/tmp/dist/macosx-toolchain
- # ld needs libLTO.so from llvm
- mk_add_options "export LD_LIBRARY_PATH=$TOOLCHAIN_DIR/clang/lib"
- CROSS_CCTOOLS_PATH=$TOOLCHAIN_DIR/cctools
- 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 [% 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/[% 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=[% c('var/build_target') %]
- export MACOS_SDK_DIR=$CROSS_SYSROOT
- export MACOS_PRIVATE_FRAMEWORKS_DIR=$CROSS_PRIVATE_FRAMEWORKS
- [% IF c("var/macos-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") %]
- ac_add_options --enable-tor-browser-update
- ac_add_options --enable-verify-mar
- [% END -%]
- ac_add_options --with-relative-profile=[% c('var/ProjectName') %]/Data/Browser
- mk_add_options MOZ_APP_DISPLAYNAME="[% c('var/Project_Name') %]"
- [% IF c("var/linux-arm64") -%]
- # for machines with 4 GB or less ram, otherwise the build is a swapping frenzy
- mk_add_options MOZ_PARALLEL_BUILD=2
- [% ELSIF c("var/linux-armhf") -%]
- mk_add_options MOZ_PARALLEL_BUILD=1
- [% ELSE -%]
- mk_add_options MOZ_PARALLEL_BUILD=[% c("num_procs") %]
- [% END -%]
|