yet another no-frills web browser
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/env python3
  2. import shutil
  3. import os
  4. import subprocess
  5. def concat_options(default, options=[]):
  6. if not options:
  7. return default
  8. r = ''
  9. for option in options:
  10. if option is default:
  11. r += '*' + option + '* '
  12. else:
  13. r += option + ' '
  14. return r.strip()
  15. def prompt(prompt, default, options=[]):
  16. v = input("{} ({}): ".format(prompt, concat_options(default, options)))
  17. if v is not '':
  18. return v
  19. return default
  20. if __name__ == "__main__":
  21. # build options
  22. build_dir = prompt('build folder', 'build')
  23. build_type = prompt('build type', 'release', ['plain', 'debug', 'debugoptimized', 'release'])
  24. build_prefix = prompt('prefix', '/usr/local')
  25. build_pie = prompt('position-independent executable', 'true', ['true', 'false'])
  26. build_lto = prompt('link-time optimization', 'true', ['true', 'false'])
  27. # feature selection
  28. auto_features = prompt('Feature auto state', 'disabled', ['auto', 'enabled', 'disabled'])
  29. f_breakpad = prompt('Use breakpad', 'disabled', ['enabled', 'disabled'])
  30. f_plasma = prompt('Use plasma', 'disabled', ['enabled', 'disabled'])
  31. f_manpage = prompt('make manpage', 'enabled', ['enabled', 'disabled'])
  32. # compilers
  33. cc = prompt('C compiler', 'gcc')
  34. cpp = prompt('CPP compiler', 'g++')
  35. ld = prompt('Linker', 'gold')
  36. # clean build folder
  37. if os.path.isdir(build_dir):
  38. shutil.rmtree(build_dir)
  39. os.mkdir(build_dir, 0o700)
  40. env = {
  41. **os.environ,
  42. 'CC' : cc,
  43. 'CXX' : cpp
  44. }
  45. # configure build dir
  46. subprocess.run(['meson', '--buildtype={}'.format(build_type), '--prefix={}'.format(build_prefix), '--auto-features={}'.format(auto_features),
  47. '-Db_pie={}'.format(build_pie), '-Db_lto={}'.format(build_lto), '-Dcpp_link_args="-fuse-ld={}"'.format(ld),
  48. '-DBreakpad={}'.format(f_breakpad), '-DPlasma={}'.format(f_plasma), '-Dmanpage={}'.format(f_manpage),
  49. build_dir], env=env, check=True)
  50. print("\n\n--- Configure step complete ---")
  51. print("For more configuration options run 'meson configure' in the configured build directory.")
  52. print("You can now build with 'ninja -C {}'.".format(build_dir))