SConstruct 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. """ SCons build recipe for the GPSD project
  2. Important targets:
  3. build - build the software (default)
  4. dist - make distribution tarballs .gz and .xz, plus .zip
  5. zip - make distribution zip
  6. install - install programs, libraries, and manual pages
  7. uninstall - undo an install
  8. check - run regression and unit tests.
  9. audit - run code-auditing tools
  10. testbuild - test-build the code from a tarball
  11. website - refresh the website
  12. release - ship a release
  13. --clean - clean all normal build targets
  14. -c - clean all normal build targets
  15. Useful configuration options:
  16. debug=yes -- Compile and link with debugging options. Turns off
  17. optimizations,
  18. debug_opt=yes -- Compile and link with debugging options. Leaves on
  19. optimizations,
  20. Useful scons options:
  21. --warn=all -- to see scons warnings
  22. Setting the DESTDIR environment variable will prefix the install destinations
  23. without changing the --prefix prefix.
  24. Pretty much all this file does is create the variant_dir, and call SConscript.
  25. """
  26. # Unfinished items:
  27. # * Coveraging mode: gcc "-coverage" flag requires a hack
  28. # for building the python bindings
  29. # This file is Copyright 2010 by the GPSD project
  30. # SPDX-License-Identifier: BSD-2-clause
  31. #
  32. # This code runs compatibly under Python 2 and 3.x for x >= 2.
  33. # Preserve this property!
  34. from __future__ import print_function
  35. import atexit # for atexit.register()
  36. import os
  37. # gpsd needs Scons version at least 2.3
  38. EnsureSConsVersion(2, 3, 0)
  39. # gpsd needs Python version at least 2.6
  40. EnsurePythonVersion(2, 6)
  41. # package version
  42. gpsd_version = "3.23.2~dev"
  43. # name 'build' is already taken, put stuff in gpsd-$VERSION
  44. # it makes tar simple
  45. variantdir = 'gpsd-' + gpsd_version
  46. # one touch clean!
  47. # also, for brutal effect, you can do: git clean -dfx
  48. if GetOption('clean'):
  49. # .pages and .public are GitLab "pages".
  50. clean_targets = '%s buildtmp .public .pages testbuild' % variantdir
  51. atexit.register(lambda: os.system('rm -rf ' + clean_targets))
  52. # Not everything respects this chdir()
  53. SConscriptChdir(1)
  54. SConscript('SConscript',
  55. duplicate=1,
  56. exports=['gpsd_version', 'variantdir'],
  57. must_exit=True,
  58. variant_dir=variantdir,
  59. )
  60. # VariantDir('buildtmp', '.')
  61. # SConscript('buildtmp/SConscript', must_exit=True, duplicate=1)