build 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
  4. distdir=/var/tmp/dist
  5. mkdir -p /var/tmp/build
  6. mkdir -p $distdir/[% project %]
  7. tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]
  8. # We need to have the get-moz-build-date script available in the container
  9. # but we can't include it via input_files as it is a script shared between
  10. # projects.
  11. cat > get-moz-build-date << "EOF"
  12. [% INCLUDE "get-moz-build-date" %]
  13. EOF
  14. tar -C /var/tmp/dist -xf [% c('input_files_by_name/rust') %]
  15. tar -C /var/tmp/dist -xf [% c('input_files_by_name/cbindgen') %]
  16. tar -C /var/tmp/dist -xf [% c('input_files_by_name/nasm') %]
  17. tar -C /var/tmp/dist -xf [% c('input_files_by_name/node') %]
  18. tar -C /var/tmp/dist -xf [% c('input_files_by_name/clang') %]
  19. export LLVM_CONFIG="/var/tmp/dist/clang/bin/llvm-config"
  20. tar -C /var/tmp/dist -xf [% c('input_files_by_name/binutils') %]
  21. export PATH="/var/tmp/dist/rust/bin:/var/tmp/dist/cbindgen:/var/tmp/dist/nasm/bin:/var/tmp/dist/node/bin:/var/tmp/dist/clang/bin:/var/tmp/dist/binutils/bin:$PATH"
  22. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  23. cd /var/tmp/build/[% project %]-[% c("version") %]
  24. mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig
  25. eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
  26. if [ -z $MOZ_BUILD_DATE ]
  27. then
  28. echo "MOZ_BUILD_DATE is not set"
  29. exit 1
  30. fi
  31. export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64
  32. gradle_repo=/var/tmp/dist/gradle-dependencies
  33. export GRADLE_MAVEN_REPOSITORIES="file://$gradle_repo","file://$gradle_repo/maven2"
  34. export GRADLE_FLAGS="--no-daemon --offline"
  35. # Move the Gradle repo to a hard-coded location. The location is embedded in
  36. # the file chrome/toolkit/content/global/buildconfig.html so it needs to be
  37. # standardized for reproducibility.
  38. mv $rootdir/[% c('input_files_by_name/gradle-dependencies') %] $gradle_repo
  39. cp -r $gradle_repo/m2/* $gradle_repo
  40. rm -f configure
  41. rm -f js/src/configure
  42. # We unbreak mach, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1656993 and https://bugzilla.mozilla.org/show_bug.cgi?id=1755516
  43. export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
  44. # Create .mozbuild to avoid interactive prompt in configure
  45. mkdir "$HOME/.mozbuild"
  46. ./mach configure --with-tor-browser-version=[% c("var/torbrowser_version") %] --with-java-bin-path="$JAVA_HOME/bin" --without-wasm-sandboxed-libraries
  47. ./mach build --verbose
  48. # We don't want the debug or "exoplayer" .aars, but the .aar that has `omni` in its name.
  49. find obj-* -type f -name geckoview*omni*.aar -exec cp {} $distdir/[% project %] \;
  50. cd $distdir
  51. [% c('tar', {
  52. tar_src => [ project ],
  53. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  54. }) %]