diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/python/Jamfile | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/python/Jamfile')
-rw-r--r-- | src/boost/libs/python/Jamfile | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/boost/libs/python/Jamfile b/src/boost/libs/python/Jamfile new file mode 100644 index 00000000..32e87d80 --- /dev/null +++ b/src/boost/libs/python/Jamfile @@ -0,0 +1,68 @@ +# Copyright (c) 2018 Stefan Seefeld +# All rights reserved. +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import option ; +import regex ; +import python ; + +# +# The `version-suffix` rule really belongs into python.jam, and +# should be moved there. `split-version` is only duplicated here +# as a prerequisite. (See https://github.com/boostorg/build/pull/290) +# + + +# Validate the version string and extract the major/minor part we care about. +# +local rule split-version ( version ) +{ + local major-minor = [ MATCH "^([0-9]+)\.([0-9]+)(.*)$" : $(version) : 1 2 3 ] ; + if ! $(major-minor[2]) || $(major-minor[3]) + { + ECHO "Warning: \"using python\" expects a two part (major, minor) version number; got" $(version) instead ; + + # Add a zero to account for the missing digit if necessary. + major-minor += 0 ; + } + + return $(major-minor[1]) $(major-minor[2]) ; +} + +# Define a version suffix for libraries depending on Python. +# For example, Boost.Python built for Python 2.7 uses the suffix "27" +rule version-suffix ( version ) +{ + local major-minor = [ split-version $(version) ] ; + local suffix = $(major-minor:J="") ; + return $(suffix) ; +} + + +# Python build id (for Python libraries only). +python-id = [ option.get "python-buildid" ] ; +if $(python-id) +{ + PYTHON_ID = [ regex.replace $(python-id) "[*\\/:.\"\']" _ ] ; +} + +rule python-tag ( name : type ? : property-set ) +{ + local result = $(name) ; + if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB + { + local version = [ $(property-set).get <python> ] ; + local lib-suffix = [ version-suffix $(version) ] ; + result = $(result)$(lib-suffix) ; + } + if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB && $(PYTHON_ID) + { + result = $(result)-$(PYTHON_ID) ; + } + + # forward to the boost tagging rule + return [ tag $(result) : $(type) : $(property-set) ] ; +} |