diff options
author | Carl Smedstad | 2023-06-14 22:57:18 +0200 |
---|---|---|
committer | Carl Smedstad | 2023-06-14 22:57:18 +0200 |
commit | 24c1610bef7b9b0cf5c9227f8ca71a35d7c4e733 (patch) | |
tree | da448e0e213fddc60f7cf592bf7fe6df045484d3 | |
parent | 473ab54a4679d83967d5734ec8a6af6a590f5ccd (diff) | |
download | aur-24c1610bef7b9b0cf5c9227f8ca71a35d7c4e733.tar.gz |
Publish version 1.74.0-2 - Depend on Python 3.11
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | PKGBUILD | 37 | ||||
-rw-r--r-- | python311-compatibility.patch | 154 |
4 files changed, 188 insertions, 15 deletions
@@ -6,7 +6,8 @@ pkgbase = boost174 arch = x86_64 license = custom makedepends = icu - makedepends = python39 + makedepends = python + makedepends = python-numpy makedepends = bzip2 makedepends = openmpi makedepends = zstd @@ -14,15 +15,17 @@ pkgbase = boost174 source = boost174-ublas-c++20-allocator-patch1.patch::https://github.com/boostorg/ublas/commit/47a314dd01d1.patch source = boost174-ublas-c++20-allocator-patch2.patch::https://github.com/boostorg/ublas/commit/a23a903f9a36.patch source = boost174-ublas-c++20-iterator.patch::https://github.com/boostorg/ublas/commit/a31e5cffa85f.patch + source = python311-compatibility.patch sha256sums = 83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1 sha256sums = 3f42688a87c532ac916889f21a4487b9e94a38a047b18724385eaa474719a9f7 sha256sums = 67f413463a1a12bdf63c913acd318148dda618d3f994e466232e265bbf0c2903 sha256sums = aa38addb40d5f44b4a8472029b475e7e6aef1c460509eb7d8edf03491dc1b5ee + sha256sums = SKIP pkgname = boost174 pkgdesc = Free peer-reviewed portable C++ source libraries (version 1.74) (development headers) depends = boost-libs=1.74.0 - optdepends = python39: for python bindings + optdepends = python: for python bindings provides = boost=1.74.0 options = staticlibs @@ -56,10 +59,10 @@ pkgname = boost174-libs provides = libboost_math_tr1f.so=1.74.0 provides = libboost_math_tr1l.so=1.74.0 provides = libboost_mpi.so=1.74.0 - provides = libboost_numpy39.so=1.74.0 + provides = libboost_numpy.so=1.74.0 provides = libboost_prg_exec_monitor.so=1.74.0 provides = libboost_program_options.so=1.74.0 - provides = libboost_python39.so=1.74.0 + provides = libboost_python.so=1.74.0 provides = libboost_random.so=1.74.0 provides = libboost_regex.so=1.74.0 provides = libboost_serialization.so=1.74.0 diff --git a/.gitignore b/.gitignore index f71c635dafda..d87014d3fe24 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ !.gitignore !PKGBUILD !.SRCINFO +!python311-compatibility.patch @@ -14,7 +14,8 @@ url="https://www.boost.org/" license=(custom) makedepends=( icu - python39 + python + python-numpy bzip2 openmpi zstd @@ -24,12 +25,14 @@ source=( "$pkgbase-ublas-c++20-allocator-patch1.patch::https://github.com/boostorg/ublas/commit/47a314dd01d1.patch" "$pkgbase-ublas-c++20-allocator-patch2.patch::https://github.com/boostorg/ublas/commit/a23a903f9a36.patch" "$pkgbase-ublas-c++20-iterator.patch::https://github.com/boostorg/ublas/commit/a31e5cffa85f.patch" + "python311-compatibility.patch" ) sha256sums=( '83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1' '3f42688a87c532ac916889f21a4487b9e94a38a047b18724385eaa474719a9f7' '67f413463a1a12bdf63c913acd318148dda618d3f994e466232e265bbf0c2903' 'aa38addb40d5f44b4a8472029b475e7e6aef1c460509eb7d8edf03491dc1b5ee' + 'SKIP' ) prepare() { @@ -42,13 +45,14 @@ prepare() { # https://github.com/boostorg/ublas/pull/97 patch -Np2 -i ../$pkgbase-ublas-c++20-iterator.patch -} -_python_version=3.9 -_python_exe=python$_python_version + patch -Np1 -i ../python311-compatibility.patch +} build() { local JOBS="$(sed 's/.*\(-j *[0-9]\+\).*/\1/' <<<$MAKEFLAGS)" + local python_version=$( + python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') pushd $_srcname/tools/build ./bootstrap.sh --cxxflags="$CXXFLAGS $LDFLAGS" @@ -57,7 +61,7 @@ build() { popd cd $_srcname - ./bootstrap.sh --with-toolset=gcc --with-icu --with-python=$_python_exe + ./bootstrap.sh --with-toolset=gcc --with-icu --with-python=python3 # support for OpenMPI echo "using mpi ;" >>project-config.jam @@ -74,7 +78,7 @@ build() { runtime-link=shared \ link=shared,static \ toolset=gcc \ - python=$_python_version \ + python=$python_version \ cflags="$CPPFLAGS $CFLAGS -fPIC -O3 -ffat-lto-objects" \ cxxflags="$CPPFLAGS $CXXFLAGS -fPIC -O3 -ffat-lto-objects" \ linkflags="$LDFLAGS" \ @@ -85,10 +89,13 @@ build() { } package_boost174() { + local python_version=$( + python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') + pkgdesc+=' (development headers)' depends=("boost-libs=$pkgver") provides=("boost=$pkgver") - optdepends=('python39: for python bindings') + optdepends=('python: for python bindings') options=('staticlibs') install -d "$pkgdir"/usr/lib @@ -96,10 +103,18 @@ package_boost174() { cp -a fakeinstall/lib/cmake "$pkgdir"/usr/lib/ cp -a fakeinstall/{bin,include,share} "$pkgdir"/usr/ + # https://github.com/boostorg/python/issues/203#issuecomment-391477685 + for _lib in python numpy; do + ln -srL "$pkgdir"/usr/lib/libboost_${_lib}{${python_version/.},${python_version%.*}}.so + done + install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" $_srcname/LICENSE_1_0.txt } package_boost174-libs() { + local python_version=$( + python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') + pkgdesc+=' (runtime libraries)' depends=('bzip2' 'zlib' 'icu' 'zstd') optdepends=('openmpi: for mpi support') @@ -128,10 +143,10 @@ package_boost174-libs() { "libboost_math_tr1f.so=$pkgver" "libboost_math_tr1l.so=$pkgver" "libboost_mpi.so=$pkgver" - "libboost_numpy39.so=$pkgver" + "libboost_numpy${python_version/.}.so=$pkgver" "libboost_prg_exec_monitor.so=$pkgver" "libboost_program_options.so=$pkgver" - "libboost_python39.so=$pkgver" + "libboost_python${python_version/.}.so=$pkgver" "libboost_random.so=$pkgver" "libboost_regex.so=$pkgver" "libboost_serialization.so=$pkgver" @@ -151,10 +166,10 @@ package_boost174-libs() { cp -a fakeinstall/lib/*.so.* "$pkgdir"/usr/lib/ # https://github.com/boostorg/mpi/issues/112 - local site_packages=$($_python_exe -c 'import site; print(site.getsitepackages()[0])') + local site_packages=$(python -c 'import site; print(site.getsitepackages()[0])') install -d "$pkgdir"$site_packages/boost touch "$pkgdir"$site_packages/boost/__init__.py - $_python_exe -m compileall -o 0 -o 1 -o 2 "$pkgdir"$site_packages/boost + python -m compileall -o 0 -o 1 -o 2 "$pkgdir"$site_packages/boost cp fakeinstall/lib/boost-python*/mpi.so "$pkgdir"$site_packages/boost/mpi.so install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" $_srcname/LICENSE_1_0.txt diff --git a/python311-compatibility.patch b/python311-compatibility.patch new file mode 100644 index 000000000000..9b5474a06633 --- /dev/null +++ b/python311-compatibility.patch @@ -0,0 +1,154 @@ +diff --unified --recursive --text boost_1_74_0.orig/boost/python/detail/wrap_python.hpp boost_1_74_0/boost/python/detail/wrap_python.hpp +--- boost_1_74_0.orig/boost/python/detail/wrap_python.hpp 2023-06-14 21:47:07.406473129 +0200 ++++ boost_1_74_0/boost/python/detail/wrap_python.hpp 2023-06-14 22:16:24.558611081 +0200 +@@ -227,7 +227,11 @@ + + # define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, ++#endif + ++#if PY_VERSION_HEX < 0x030900A4 ++# define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0) ++# define Py_SET_SIZE(obj, size) ((Py_SIZE(obj) = (size)), (void)0) + #endif + + +diff --unified --recursive --text boost_1_74_0.orig/boost/python/object/make_instance.hpp boost_1_74_0/boost/python/object/make_instance.hpp +--- boost_1_74_0.orig/boost/python/object/make_instance.hpp 2023-06-14 21:47:07.403139788 +0200 ++++ boost_1_74_0/boost/python/object/make_instance.hpp 2023-06-14 22:20:46.242736154 +0200 +@@ -47,7 +47,7 @@ + + // Note the position of the internally-stored Holder, + // for the sake of destruction +- Py_SIZE(instance) = offsetof(instance_t, storage); ++ Py_SET_SIZE(instance, offsetof(instance_t, storage)); + + // Release ownership of the python object + protect.cancel(); +diff --unified --recursive --text boost_1_74_0.orig/libs/python/src/exec.cpp boost_1_74_0/libs/python/src/exec.cpp +--- boost_1_74_0.orig/libs/python/src/exec.cpp 2023-06-14 21:47:05.089801030 +0200 ++++ boost_1_74_0/libs/python/src/exec.cpp 2023-06-14 22:26:14.977048858 +0200 +@@ -104,14 +104,22 @@ + if (local.is_none()) local = global; + // should be 'char const *' but older python versions don't use 'const' yet. + char *f = const_cast<char *>(filename); +- // Let python open the file to avoid potential binary incompatibilities. +-#if PY_VERSION_HEX >= 0x03040000 +- FILE *fs = _Py_fopen(f, "r"); ++#if PY_VERSION_HEX >= 0x03010000 ++ // Let python manage any UTF bits to avoid potential incompatibilities. ++ PyObject *fo = Py_BuildValue("s", f); ++ PyObject *fb = Py_None; ++ PyUnicode_FSConverter(fo, &fb); ++ char *f_as_uft = PyBytes_AsString(fb); ++ FILE *fs = fopen(f_as_uft, "r"); ++ Py_DECREF(fo); ++ Py_DECREF(fb); + #elif PY_VERSION_HEX >= 0x03000000 ++ // Let python open the file to avoid potential binary incompatibilities. + PyObject *fo = Py_BuildValue("s", f); +- FILE *fs = _Py_fopen(fo, "r"); ++ FILE *fs = fopen(fo, "r"); + Py_DECREF(fo); + #else ++ // Let python open the file to avoid potential binary incompatibilities. + PyObject *pyfile = PyFile_FromString(f, const_cast<char*>("r")); + if (!pyfile) throw std::invalid_argument(std::string(f) + " : no such file"); + python::handle<> file(pyfile); +@@ -121,6 +129,7 @@ + f, + Py_file_input, + global.ptr(), local.ptr()); ++ fclose(fs); + if (!result) throw_error_already_set(); + return object(detail::new_reference(result)); + } +diff --unified --recursive --text boost_1_74_0.orig/libs/python/src/object/class.cpp boost_1_74_0/libs/python/src/object/class.cpp +--- boost_1_74_0.orig/libs/python/src/object/class.cpp 2023-06-14 21:47:05.089801030 +0200 ++++ boost_1_74_0/libs/python/src/object/class.cpp 2023-06-14 22:32:08.551496842 +0200 +@@ -208,7 +208,7 @@ + { + if (static_data_object.tp_dict == 0) + { +- Py_TYPE(&static_data_object) = &PyType_Type; ++ Py_SET_TYPE(&static_data_object, &PyType_Type); + static_data_object.tp_base = &PyProperty_Type; + if (PyType_Ready(&static_data_object)) + return 0; +@@ -316,7 +316,7 @@ + { + if (class_metatype_object.tp_dict == 0) + { +- Py_TYPE(&class_metatype_object) = &PyType_Type; ++ Py_SET_TYPE(&class_metatype_object, &PyType_Type); + class_metatype_object.tp_base = &PyType_Type; + if (PyType_Ready(&class_metatype_object)) + return type_handle(); +@@ -374,12 +374,7 @@ + // like, so we'll store the total size of the object + // there. A negative number indicates that the extra + // instance memory is not yet allocated to any holders. +-#if PY_VERSION_HEX >= 0x02060000 +- Py_SIZE(result) = +-#else +- result->ob_size = +-#endif +- -(static_cast<int>(offsetof(instance<>,storage) + instance_size)); ++ Py_SET_SIZE(result,-static_cast<int>(offsetof(instance<>,storage) + instance_size)); + } + return (PyObject*)result; + } +@@ -470,7 +465,7 @@ + { + if (class_type_object.tp_dict == 0) + { +- Py_TYPE(&class_type_object) = incref(class_metatype().get()); ++ Py_SET_TYPE(&class_type_object, incref(class_metatype().get())); + class_type_object.tp_base = &PyBaseObject_Type; + if (PyType_Ready(&class_type_object)) + return type_handle(); +@@ -739,7 +734,7 @@ + assert(holder_offset >= offsetof(objects::instance<>,storage)); + + // Record the fact that the storage is occupied, noting where it starts +- Py_SIZE(self) = holder_offset; ++ Py_SET_SIZE(self, holder_offset); + return (char*)self + holder_offset; + } + else +diff --unified --recursive --text boost_1_74_0.orig/libs/python/src/object/enum.cpp boost_1_74_0/libs/python/src/object/enum.cpp +--- boost_1_74_0.orig/libs/python/src/object/enum.cpp 2023-06-14 21:47:05.089801030 +0200 ++++ boost_1_74_0/libs/python/src/object/enum.cpp 2023-06-14 21:48:07.003280973 +0200 +@@ -153,7 +153,7 @@ + { + if (enum_type_object.tp_dict == 0) + { +- Py_TYPE(&enum_type_object) = incref(&PyType_Type); ++ Py_SET_TYPE(&enum_type_object, incref(&PyType_Type)); + #if PY_VERSION_HEX >= 0x03000000 + enum_type_object.tp_base = &PyLong_Type; + #else +diff --unified --recursive --text boost_1_74_0.orig/libs/python/src/object/function.cpp boost_1_74_0/libs/python/src/object/function.cpp +--- boost_1_74_0.orig/libs/python/src/object/function.cpp 2023-06-14 21:47:05.089801030 +0200 ++++ boost_1_74_0/libs/python/src/object/function.cpp 2023-06-14 21:48:07.006614314 +0200 +@@ -107,7 +107,7 @@ + PyObject* p = this; + if (Py_TYPE(&function_type) == 0) + { +- Py_TYPE(&function_type) = &PyType_Type; ++ Py_SET_TYPE(&function_type, &PyType_Type); + ::PyType_Ready(&function_type); + } + +diff --unified --recursive --text boost_1_74_0.orig/libs/python/src/object/life_support.cpp boost_1_74_0/libs/python/src/object/life_support.cpp +--- boost_1_74_0.orig/libs/python/src/object/life_support.cpp 2023-06-14 21:47:05.089801030 +0200 ++++ boost_1_74_0/libs/python/src/object/life_support.cpp 2023-06-14 21:48:07.006614314 +0200 +@@ -93,7 +93,7 @@ + + if (Py_TYPE(&life_support_type) == 0) + { +- Py_TYPE(&life_support_type) = &PyType_Type; ++ Py_SET_TYPE(&life_support_type, &PyType_Type); + PyType_Ready(&life_support_type); + } + |