build 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. [% c("var/set_default_env") -%]
  3. export PROJECT_PATH=/var/tmp/dist/[% project %]
  4. export SDK_HOME=$PROJECT_PATH/android-sdk-linux
  5. export NDK_HOME=$PROJECT_PATH/android-ndk
  6. android_release_dir_9=android-9
  7. android_release_dir_10=android-10
  8. android_release_dir_11=android-11
  9. # Make directories
  10. mkdir -p $NDK_HOME $SDK_HOME
  11. # Compiler Archives
  12. unzip -qq [% c("input_files_by_name/android_sdk_tools") %] -d $SDK_HOME
  13. unzip -qq [% c("input_files_by_name/android_ndk_compiler")%] -d $NDK_HOME
  14. # NDK Archive
  15. # Adjust cross compilation prefix for armv7a. Unfortunately, the compiler cross
  16. # compilation prefix and the one for all the other tools differ. Let's fix that
  17. # so we only have to take care of one. See: #33557 (comment 2674649).
  18. cd $NDK_HOME/android-ndk-r[% c("var/android_ndk_version") %][% c("var/android_ndk_revision") %]/toolchains/llvm/prebuilt/linux-x86_64/bin
  19. for f in `ls arm-linux-androideabi-*`; do
  20. ln -s $f ${f//arm-linux-androideabi/armv7a-linux-androideabi}
  21. done
  22. # Tool Archives
  23. cd $SDK_HOME
  24. unzip -qq $HOME/[% c("input_files_by_name/build_tools") %] -d $SDK_HOME
  25. mkdir -p build-tools/[% c("var/version_30") %]
  26. mv $android_release_dir_11/* build-tools/[% c("var/version_30") %]
  27. unzip -qq $HOME/[% c("input_files_by_name/platform") %] -d $SDK_HOME
  28. mkdir -p platforms/android-[% c("var/android_api_level") %]
  29. mv $android_release_dir_11/* platforms/android-[% c("var/android_api_level") %]
  30. # Apart from GeckoView all other projects do still need build-tools 28.0.3 as
  31. # they are using the Gradle plugin 3.2.1 - 3.6.0 without specifying
  32. # `buildToolsVersion`.
  33. unzip -qq $HOME/[% c("input_files_by_name/build_tools_28") %] -d $SDK_HOME
  34. mkdir -p build-tools/[% c("var/version_28") %]
  35. mv $android_release_dir_9/* build-tools/[% c("var/version_28") %]
  36. unzip -qq $HOME/[% c("input_files_by_name/build_tools_29") %] -d $SDK_HOME
  37. mkdir -p build-tools/[% c("var/version_29") %]
  38. mv $android_release_dir_10/* build-tools/[% c("var/version_29") %]
  39. unzip -qq $HOME/[% c("input_files_by_name/platform_29") %] -d $SDK_HOME
  40. mkdir -p platforms/android-[% c("var/android_api_level_29") %]
  41. mv $android_release_dir_10/* platforms/android-[% c("var/android_api_level_29") %]
  42. unzip -qq $HOME/[% c("input_files_by_name/platform_tools") %] -d $SDK_HOME
  43. # That's a quirk required by GeckoView but let's have it here instead of in the
  44. # project's build script
  45. mkdir emulator
  46. cp tools/emulator emulator/
  47. # Cleanup
  48. rm -fR $android_release_dir_9 $android_release_dir_10 $android_release_dir_11
  49. # Archive dist directory
  50. cd /var/tmp/dist
  51. [% c('tar', {
  52. tar_src => [ project ],
  53. tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
  54. }) %]