build 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.8.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.
  43. export MACH_USE_SYSTEM_PYTHON=1
  44. # Create .mozbuild to avoid interactive prompt in configure
  45. mkdir "$HOME/.mozbuild"
  46. ./mach configure --with-tor-browser-version=[% c("var/torbrowser_version") %]
  47. ./mach build --verbose
  48. # We don't want to have the debug .aar but the one that has `$channel`, `$arch`,
  49. # and `$version` in its name.
  50. find obj-* -type f -name geckoview-*-*-*.aar -exec cp {} $distdir/[% project %] \;
  51. cd $distdir
  52. [% c('tar', {
  53. tar_src => [ project ],
  54. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  55. }) %]