build 2.6 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/python') %]
  18. tar -C /var/tmp/dist -xf [% c('input_files_by_name/node') %]
  19. tar -C /var/tmp/dist -xf [% c('input_files_by_name/clang') %]
  20. export LLVM_CONFIG="/var/tmp/dist/clang/bin/llvm-config"
  21. tar -C /var/tmp/dist -xf [% c('input_files_by_name/binutils') %]
  22. export PATH="/var/tmp/dist/rust/bin:/var/tmp/dist/cbindgen:/var/tmp/dist/nasm/bin:/var/tmp/dist/python/bin:/var/tmp/dist/node/bin:/var/tmp/dist/clang/bin:/var/tmp/dist/binutils/bin:$PATH"
  23. tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
  24. cd /var/tmp/build/[% project %]-[% c("version") %]
  25. mv -f $rootdir/[% c('input_files_by_name/mozconfig') %] .mozconfig
  26. eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
  27. if [ -z $MOZ_BUILD_DATE ]
  28. then
  29. echo "MOZ_BUILD_DATE is not set"
  30. exit 1
  31. fi
  32. export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
  33. gradle_repo=/var/tmp/dist/gradle-dependencies
  34. export GRADLE_MAVEN_REPOSITORIES="file://$gradle_repo"
  35. export GRADLE_FLAGS="--no-daemon --offline"
  36. # Move the Gradle repo to a hard-coded location. The location is embedded in
  37. # the file chrome/toolkit/content/global/buildconfig.html so it needs to be
  38. # standardized for reproducibility.
  39. mv $rootdir/[% c('input_files_by_name/gradle-dependencies') %] $gradle_repo
  40. cp -r $gradle_repo/m2/* $gradle_repo
  41. rm -f configure
  42. rm -f js/src/configure
  43. # We unbreak mach, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1656993.
  44. export MACH_USE_SYSTEM_PYTHON=1
  45. ./mach configure --with-tor-browser-version=[% c("var/torbrowser_version") %]
  46. ./mach build --verbose
  47. # We don't want to have the debug .aar but the one that has `$channel`, `$arch`,
  48. # and `$version` in its name.
  49. find obj-* -type f -name geckoview-*-*-*.aar -exec cp {} $distdir/[% project %] \;
  50. cd $distdir
  51. [% c('tar', {
  52. tar_src => [ project ],
  53. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  54. }) %]