build.jam 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # showcasing several default install directories
  2. install a1 : a : <location>(bindir) ;
  3. install a2 : a : <location>(libdir)/a2 ;
  4. install (sbindir)/a3 : a ;
  5. # using a custom prefix; the file will be installed into foo/bar/bin/a4
  6. install (bindir)/a4 : a : <install-prefix>foo/bar ;
  7. # this one deduces installed package name to be the basename of the project
  8. # directory, so e.g. on Linux the file will be installed installed into
  9. # /usr/local/share/doc/<name of project's directory>/a5
  10. install (docdir)/a5 : a : <install-prefix>bar/baz ;
  11. # use a custom named directory; its default on Linux is /usr/local/share/xyz/
  12. import stage ;
  13. stage.add-install-dir foodir : xyz : datadir ;
  14. install (foodir)/a6 : a ;
  15. # another custom named directory, this one appends package name like docdir;
  16. # so, e.g. on Linux it defaults to /usr/local/lib/named-install-dirs
  17. stage.add-install-dir privatedir : "" : libdir : package-suffix ;
  18. install (privatedir)/a7 : a ;
  19. # using stage.get-package-name
  20. make a8 : a : @write-dirs : <staging-prefix>p/q/r <install-bindir>/bin ;
  21. rule write-dirs ( target : sources * : properties * )
  22. {
  23. import property-set ;
  24. import print ;
  25. local ps = [ property-set.create $(properties) ] ;
  26. local pn = [ stage.get-package-name $(ps) ] ;
  27. print.output $(target) ;
  28. print.text
  29. [ stage.get-dir docdir : $(ps) : $(pn) ]
  30. [ stage.get-dir docdir : $(ps) : $(pn) : staged ]
  31. [ stage.get-dir docdir : $(ps) : $(pn) : relative ]
  32. [ stage.get-dir docdir : $(ps) : $(pn) : relative staged ]
  33. [ stage.get-dir bindir : $(ps) : $(pn) : relative ]
  34. : overwrite
  35. ;
  36. }
  37. # using staging prefix; on Linux installs into q/r/s/share/a9
  38. install (datarootdir)/a9 : a : <staging-prefix>q/r/s ;
  39. build-project x ;
  40. # Copyright 2020 Dmitry Arkhipov
  41. # Distributed under the Boost Software License, Version 1.0.
  42. # (See accompanying file LICENSE.txt or copy at
  43. # https://www.bfgroup.xyz/b2/LICENSE.txt)