mozconfig 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. . $topsrcdir/mozconfig-[% IF c("var/macos"); GET 'macos-x86_64'; ELSE; GET c("var/osname"); END; %][% IF c("var/asan") %]-asan[% END %]
  2. [% IF c("var/linux") -%]
  3. # We want to build with clang now and point to the GCC toolchain until #29041 is
  4. # fixed. We explicitly need to define the host compiler as well as for some
  5. # reason the gcc-toolchain argument does not get passed along otherwise.
  6. CC="clang --gcc-toolchain=/var/tmp/dist/gcc"
  7. CXX="clang++ --gcc-toolchain=/var/tmp/dist/gcc"
  8. HOST_CC=$CC
  9. HOST_CXX=$CXX
  10. export BINDGEN_CFLAGS='--gcc-toolchain=/var/tmp/dist/gcc'
  11. [% IF c("var/linux-arm64") -%]
  12. ac_add_options --host=aarch64-unknown-linux-gnu
  13. [% END -%]
  14. [% IF c("var/linux-armhf") -%]
  15. ac_add_options --host=armv7-unknown-linux-gnueabihf
  16. [% END -%]
  17. [% END -%]
  18. [% IF c("var/windows") -%]
  19. CROSS_COMPILE=1
  20. HOST_CC="clang"
  21. HOST_CXX="clang++"
  22. CC="[% c('arch') %]-w64-mingw32-clang"
  23. CXX="[% c('arch') %]-w64-mingw32-clang++"
  24. CXXFLAGS="-fms-extensions"
  25. AR=llvm-ar
  26. RANLIB=llvm-ranlib
  27. clang_path=/var/tmp/dist/mingw-w64-clang
  28. # For Stylo
  29. BINDGEN_CFLAGS="-I$clang_path/[% c('arch') %]-w64-mingw32/include/c++/v1 -I$clang_path/[% c('arch') %]-w64-mingw32/include"
  30. [% END -%]
  31. [% IF c("var/macos") -%]
  32. TOOLCHAIN_DIR=/var/tmp/dist/macosx-toolchain
  33. # ld needs libLTO.so from llvm
  34. mk_add_options "export LD_LIBRARY_PATH=$TOOLCHAIN_DIR/clang/lib"
  35. CROSS_CCTOOLS_PATH=$TOOLCHAIN_DIR/cctools
  36. CROSS_SYSROOT=$TOOLCHAIN_DIR/MacOSX[% pc('macosx-toolchain', 'version') %].sdk
  37. CROSS_PRIVATE_FRAMEWORKS=$CROSS_SYSROOT/System/Library/PrivateFrameworks
  38. HARDENING_FLAGS="-Werror=format -Werror=format-security -fstack-protector-strong -D_FORTIFY_SOURCE=2"
  39. FLAGS="-target [% c('var/build_target') %] -B $CROSS_CCTOOLS_PATH/bin -isysroot $CROSS_SYSROOT $HARDENING_FLAGS"
  40. export CC="$TOOLCHAIN_DIR/clang/bin/clang $FLAGS"
  41. export CXX="$TOOLCHAIN_DIR/clang/bin/clang++ $FLAGS"
  42. export LLVMCONFIG=$TOOLCHAIN_DIR/clang/bin/llvm-config
  43. export LDFLAGS="-Wl,-syslibroot,$CROSS_SYSROOT -Wl,-pie"
  44. export BINDGEN_CFLAGS="$FLAGS"
  45. export TOOLCHAIN_PREFIX=$CROSS_CCTOOLS_PATH/bin/[% c('var/build_target') %]-
  46. export DSYMUTIL="$TOOLCHAIN_DIR/clang/bin/dsymutil"
  47. export HOST_CFLAGS="-g"
  48. export HOST_CXXFLAGS="-g"
  49. export HOST_LDFLAGS="-g"
  50. ac_add_options --target=[% c('var/build_target') %]
  51. export MACOS_SDK_DIR=$CROSS_SYSROOT
  52. export MACOS_PRIVATE_FRAMEWORKS_DIR=$CROSS_PRIVATE_FRAMEWORKS
  53. [% IF c("var/macos-aarch64") -%]
  54. # As of Clang 13, the default is -mcpu=apple-m1 when using a aarch64-apple-macos target,
  55. # but we're using apple64-apple-darwin, which defaults to -mcpu=apple-a7, which disables
  56. # a bunch of # performance-enabling CPU features.
  57. # TODO: We'll want to switch to aarch64-apple-macos eventually.
  58. export CFLAGS="$CFLAGS -mcpu=apple-m1"
  59. export CXXFLAGS="$CXXFLAGS -mcpu=apple-m1"
  60. [% END -%]
  61. [% END -%]
  62. [% IF c("var/tor-browser") %]
  63. ac_add_options --enable-tor-browser-update
  64. ac_add_options --enable-verify-mar
  65. [% END -%]
  66. ac_add_options --with-relative-profile=[% c('var/ProjectName') %]/Data/Browser
  67. mk_add_options MOZ_APP_DISPLAYNAME="[% c('var/Project_Name') %]"
  68. [% IF c("var/linux-arm64") -%]
  69. # for machines with 4 GB or less ram, otherwise the build is a swapping frenzy
  70. mk_add_options MOZ_PARALLEL_BUILD=2
  71. [% ELSIF c("var/linux-armhf") -%]
  72. mk_add_options MOZ_PARALLEL_BUILD=1
  73. [% ELSE -%]
  74. mk_add_options MOZ_PARALLEL_BUILD=[% c("num_procs") %]
  75. [% END -%]