build-libchromiumcontent.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env python
  2. import argparse
  3. import os
  4. import sys
  5. from lib.config import enable_verbose_mode, get_target_arch
  6. from lib.util import execute_stdout
  7. SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
  8. def main():
  9. os.chdir(SOURCE_ROOT)
  10. args = parse_args()
  11. if args.verbose:
  12. enable_verbose_mode()
  13. # ./script/bootstrap
  14. # ./script/update -t x64 --defines=''
  15. # ./script/build --no_shared_library -t x64
  16. # ./script/create-dist -c static_library -t x64 --no_zip
  17. script_dir = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor',
  18. 'libchromiumcontent', 'script')
  19. bootstrap = os.path.join(script_dir, 'bootstrap')
  20. update = os.path.join(script_dir, 'update')
  21. build = os.path.join(script_dir, 'build')
  22. create_dist = os.path.join(script_dir, 'create-dist')
  23. execute_stdout([sys.executable, bootstrap])
  24. execute_stdout([sys.executable, update, '-t', args.target_arch,
  25. '--defines', args.defines])
  26. execute_stdout([sys.executable, build, '-R', '-t', args.target_arch])
  27. execute_stdout([sys.executable, create_dist, '-c', 'static_library',
  28. '--no_zip', '-t', args.target_arch])
  29. def parse_args():
  30. parser = argparse.ArgumentParser(description='Build libchromiumcontent')
  31. parser.add_argument('--target_arch',
  32. help='Specify the arch to build for')
  33. parser.add_argument('--defines', default='',
  34. help='The definetions passed to gyp')
  35. parser.add_argument('-v', '--verbose', action='store_true',
  36. help='Prints the output of the subprocesses')
  37. return parser.parse_args()
  38. if __name__ == '__main__':
  39. sys.exit(main())