Skip to content

Instantly share code, notes, and snippets.

@AdamMajer
Created November 21, 2019 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamMajer/277de44eeec11e5c1ecc0011b2c67cc5 to your computer and use it in GitHub Desktop.
Save AdamMajer/277de44eeec11e5c1ecc0011b2c67cc5 to your computer and use it in GitHub Desktop.
Index: boost_1_72_0/tools/build/src/tools/package.jam
===================================================================
--- boost_1_72_0.orig/tools/build/src/tools/package.jam
+++ boost_1_72_0/tools/build/src/tools/package.jam
@@ -207,18 +207,25 @@ rule install ( name package-name ? : req
requirements = [ property.change $(requirements) : <install-header-subdir> ]
;
+ # install prefix, for installing in a "chroot" or package staging
+ local install_prefix = [ os.environ DESTDIR ] ;
+ install_prefix ?= "" ;
+
# First, figure out all locations. Use the default if no prefix option
# given.
local paths = [ paths $(package-name) : $(requirements) ] ;
# Binaries.
- local bin-locate = [ $(paths).bindir ] ;
+ local temp = [ $(paths).bindir ] ;
+ local bin-locate = $(install_prefix)$(temp) ;
# Object code libraries.
- local lib-locate = [ $(paths).libdir ] ;
+ temp = [ $(paths).libdir ] ;
+ local lib-locate = $(install_prefix)$(temp) ;
# Source header files.
- local include-locate = [ $(paths).includedir ] ;
+ temp = [ $(paths).includedir ] ;
+ local include-locate = $(install_prefix)$(temp) ;
stage.install $(name)-bin : $(binaries) : $(requirements)
<location>$(bin-locate) ;
@@ -260,8 +267,11 @@ rule install-data ( target-name : packag
{
package-name ?= target-name ;
+ local install_prefix = [ os.environ DESTDIR ] ;
+ install_prefix ?= "" ;
local paths = [ paths $(package-name) : $(requirements) ] ;
- local datadir = [ $(paths).datarootdir ] ;
+ local tmp = $(paths).datarootdir ;
+ local datadir = $(install_prefix)$(tmp) ;
stage.install $(target-name)
: $(data)
Index: boost_1_72_0/tools/boost_install/boost-install-dirs.jam
===================================================================
--- boost_1_72_0.orig/tools/boost_install/boost-install-dirs.jam
+++ boost_1_72_0/tools/boost_install/boost-install-dirs.jam
@@ -5,6 +5,7 @@
import modules ;
import boostcpp ;
import package ;
+import os ;
# includedir
@@ -60,6 +61,28 @@ rule cmakedir
return $(.cmakedir) ;
}
+# cmakeinstalldir
+
+rule cmakeinstalldir
+{
+ if ! $(.cmakeinstalldir)
+ {
+ package.add-path-option cmakedir : cmake : libdir ;
+
+ local paths = [ package.paths Boost ] ;
+ .cmakeinstalldir = [ $(paths).get cmakedir ] ;
+
+ # install prefix, for installing in a "chroot" or package staging
+ local install_prefix = [ os.environ DESTDIR ] ;
+ install_prefix ?= "" ;
+
+ .cmakeinstalldir = $(install_prefix)$(.cmakeinstalldir) ;
+ }
+
+ return $(.cmakeinstalldir) ;
+}
+
+
# header-subdir
rule header-subdir
Index: boost_1_72_0/tools/boost_install/boost-install.jam
===================================================================
--- boost_1_72_0.orig/tools/boost_install/boost-install.jam
+++ boost_1_72_0/tools/boost_install/boost-install.jam
@@ -22,6 +22,7 @@ import ./boost-install-dirs ;
feature.feature library-type : : free ;
feature.feature boost-install.dependency : : free ;
feature.feature boost-install.cmakedir : : free ;
+feature.feature boost-install.cmakeinstalldir : : free ;
feature.feature boost-install.includedir : : free ;
feature.feature boost-install.libdir : : free ;
@@ -512,6 +513,13 @@ local rule path-native-fwd ( path )
{
path = $(path:T) ;
}
+ else
+ {
+ local installdir_chroot = [ os.environ DESTDIR ] ;
+ installdir_chroot ?= "/" ;
+ path = [ path.relative $(path) $(installdir_chroot) ] ;
+ path = /$(path) ;
+ }
return $(path) ;
}
@@ -558,6 +566,9 @@ rule generate-cmake-config- ( target : s
local cmakedir = [ $(ps).get <boost-install.cmakedir> ] ;
.info " cmakedir=" $(cmakedir) ;
+ local cmakeinstalldir = [ $(ps).get <boost-install.cmakeinstalldir> ] ;
+ .info " cmakeinstalldir=" $(cmakeinstalldir) ;
+
local includedir = [ $(ps).get <boost-install.includedir> ] ;
.info " includedir=" $(includedir) ;
@@ -589,9 +600,9 @@ rule generate-cmake-config- ( target : s
"get_filename_component(_BOOST_CMAKEDIR \"${CMAKE_CURRENT_LIST_DIR}/../\" ABSOLUTE)"
: true ;
- if [ path.is-rooted $(cmakedir) ]
+ if [ path.is-rooted $(cmakeinstalldir) ]
{
- local cmakedir-native = [ path-native-fwd $(cmakedir) ] ;
+ local cmakedir-native = [ path-native-fwd $(cmakeinstalldir) ] ;
print.text
@@ -786,6 +797,7 @@ rule generate-cmake-config ( project nam
local location = [ $(property-set).get <location> ] ;
local library-type = [ $(property-set).get <library-type> ] ;
local cmakedir = [ $(property-set).get <boost-install.cmakedir> ] ;
+ local cmakeinstalldir = [ $(property-set).get <boost-install.cmakeinstalldir> ] ;
local includedir = [ $(property-set).get <boost-install.includedir> ] ;
local libdir = [ $(property-set).get <boost-install.libdir> ] ;
@@ -793,6 +805,7 @@ rule generate-cmake-config ( project nam
<name>$(pname) <version>$(version) <location>$(location)
<library-type>$(library-type)
<boost-install.cmakedir>$(cmakedir)
+ <boost-install.cmakeinstalldir>$(cmakeinstalldir)
<boost-install.includedir>$(includedir)
<boost-install.libdir>$(libdir) ] ;
@@ -882,7 +895,7 @@ local rule install-cmake-config- ( insta
library-type = INTERFACE ;
}
- local reqs = <name>$(name) <version>$(version) <library-type>$(library-type) <boost-install.cmakedir>$(location) <boost-install.includedir>$(includedir) <boost-install.libdir>$(libdir) ;
+ local reqs = <name>$(name) <version>$(version) <library-type>$(library-type) <boost-install.cmakedir>$(location) <boost-install.cmakeinstalldir>$(libdir)cmake <boost-install.includedir>$(includedir) <boost-install.libdir>$(libdir) ;
r += [ generate $(install-or-stage)/$(name)-config.cmake : $(name) : <generating-rule>@boost-install%generate-cmake-config $(reqs) ] ;
r += [ install $(install-or-stage)-$(name)-config.cmake : $(install-or-stage)/$(name)-config.cmake : <location>$(loc) ] ;
@@ -967,7 +980,7 @@ rule install-cmake-config ( name * )
local includedir = [ boost-install-dirs.includedir ] ;
local libdir = [ boost-install-dirs.libdir ] ;
- local cmakedir = [ boost-install-dirs.cmakedir ] ;
+ local cmakedir = [ boost-install-dirs.cmakeinstalldir ] ;
local header-subdir = [ boost-install-dirs.header-subdir ] ;
if $(header-subdir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment