summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Shapovalov2023-06-22 06:46:35 +0400
committerGitHub2023-06-21 21:46:35 -0500
commitf50f87e411c57661ab49c1f1f2e074bb21618baa (patch)
tree798030bf897ae95c982220f9e00901a71693b2bf
parent23f42981667da80d7326bb38a5a3cfc05485be24 (diff)
downloadaur-python-dm-tree.tar.gz
python-dm-tree: use system abseil-cpp + correctness fixes (#247)
* python-dm-tree: do not use arch=(any) This package builds a native extension. * python-dm-tree: do not strip the extension of the source tarball * python-dm-tree: use system abseil-cpp
-rw-r--r--.SRCINFO7
-rw-r--r--CMakeLists.txt.patch99
-rw-r--r--PKGBUILD19
3 files changed, 119 insertions, 6 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 831ee89df3b7..73e687421a46 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -3,7 +3,7 @@ pkgbase = python-dm-tree
pkgver = 0.1.8
pkgrel = 1
url = https://tree.readthedocs.io
- arch = any
+ arch = x86_64
license = Apache-2.0
makedepends = python
makedepends = python-build
@@ -14,7 +14,10 @@ pkgbase = python-dm-tree
makedepends = git
depends = python
depends = python-six
- source = python-dm-tree-0.1.8::https://pypi.org/packages/source/d/dm-tree/dm-tree-0.1.8.tar.gz
+ depends = abseil-cpp
+ source = python-dm-tree-0.1.8.tar.gz::https://pypi.org/packages/source/d/dm-tree/dm-tree-0.1.8.tar.gz
+ source = CMakeLists.txt.patch
sha256sums = 0fcaabbb14e7980377439e7140bd05552739ca5e515ecb3119f234acee4b9430
+ sha256sums = 84c9cbd52b3852af2e97dc6261c0114c78d40bc3deeb6b7638dd3864df1a9f72
pkgname = python-dm-tree
diff --git a/CMakeLists.txt.patch b/CMakeLists.txt.patch
new file mode 100644
index 000000000000..c5a955e9359a
--- /dev/null
+++ b/CMakeLists.txt.patch
@@ -0,0 +1,99 @@
+diff -ur dm-tree-0.1.8.orig/tree/CMakeLists.txt dm-tree-0.1.8/tree/CMakeLists.txt
+--- dm-tree-0.1.8.orig/tree/CMakeLists.txt 2022-12-18 12:35:42.000000000 +0300
++++ dm-tree-0.1.8/tree/CMakeLists.txt 2023-06-15 16:56:39.291503035 +0300
+@@ -11,8 +11,8 @@
+ "Python found ${Python3_VERSION} < 3.6.0")
+ endif()
+
+-# Use C++14 standard.
+-set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ version selection")
++# Use C++17 standard.
++set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ version selection")
+
+ # Position-independent code is needed for Python extension modules.
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+@@ -27,17 +27,12 @@
+ message("PROJECT_BINARY_DIR is: ${PROJECT_BINARY_DIR}")
+
+ if (NOT (WIN32 OR MSVC))
+- if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
+- # Basic build for debugging (default).
+- # -Og enables optimizations that do not interfere with debugging.
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Og")
+- endif()
+-
+- if(${CMAKE_BUILD_TYPE} STREQUAL "Release")
+- # Optimized release build: turn off debug runtime checks
+- # and turn on highest speed optimizations.
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG -O3")
+- endif()
++ # Basic build for debugging (default).
++ # -Og enables optimizations that do not interfere with debugging.
++ set(CMAKE_CXX_FLAGS_DEBUG "-g -Og")
++ # Optimized release build: turn off debug runtime checks
++ # and turn on highest speed optimizations.
++ set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
+ endif()
+
+ if(APPLE)
+@@ -67,54 +62,19 @@
+ # Needed to disable Abseil tests.
+ set (BUILD_TESTING OFF)
+
+-# Include abseil-cpp.
+-set(ABSEIL_VER 20210324.2)
+-include(ExternalProject)
+-set(ABSEIL_CMAKE_ARGS
+- "-DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR}/abseil-cpp"
+- "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}"
+- "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
+- "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}"
+- "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
+- "-DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}"
+- "-DLIBRARY_OUTPUT_PATH=${CMAKE_SOURCE_DIR}/abseil-cpp/lib")
+-if(DEFINED CMAKE_OSX_ARCHITECTURES)
+- set(ABSEIL_CMAKE_ARGS
+- ${ABSEIL_CMAKE_ARGS}
+- "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}")
+-endif()
+-ExternalProject_Add(abseil-cpp
+- GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
+- GIT_TAG ${ABSEIL_VER}
+- PREFIX ${CMAKE_SOURCE_DIR}/abseil-cpp
+- CMAKE_ARGS ${ABSEIL_CMAKE_ARGS}
++set(ABSEIL_LIBS int128 raw_hash_set raw_logging_internal strings throw_delegate)
++find_package(
++ absl
++ REQUIRED
++ COMPONENTS ${ABSEIL_LIBS}
+ )
+-ExternalProject_Get_Property(abseil-cpp install_dir)
+-set(abseil_install_dir ${install_dir})
+-include_directories (${abseil_install_dir}/include)
+-
+
+ # Define pybind11 tree module.
+ pybind11_add_module(_tree tree.h tree.cc)
+-add_dependencies(_tree abseil-cpp)
+-
+-if (WIN32 OR MSVC)
+- set(ABSEIL_LIB_PREF "absl")
+- set(LIB_SUFF "lib")
+-else()
+- set(ABSEIL_LIB_PREF "libabsl")
+- set(LIB_SUFF "a")
+-endif()
+
+-# Link abseil static libs.
+-# We don't use find_library here to force cmake to build abseil before linking.
+-set(ABSEIL_LIBS int128 raw_hash_set raw_logging_internal strings throw_delegate)
+ foreach(ABSEIL_LIB IN LISTS ABSEIL_LIBS)
+- target_link_libraries(_tree PRIVATE
+- "${abseil_install_dir}/lib/${ABSEIL_LIB_PREF}_${ABSEIL_LIB}.${LIB_SUFF}")
++ target_link_libraries(_tree PRIVATE "absl::${ABSEIL_LIB}")
+ endforeach()
+
+ # Make the module private to tree package.
+ set_target_properties(_tree PROPERTIES OUTPUT_NAME tree/_tree)
+-
+-
diff --git a/PKGBUILD b/PKGBUILD
index b887ecc62fda..dad4a89ab337 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,17 +4,28 @@ pkgname=python-dm-tree
pkgver=0.1.8
pkgrel=1
pkgdesc='tree is a library for working with nested data structures'
-arch=('any')
+arch=('x86_64')
url='https://tree.readthedocs.io'
license=('Apache-2.0')
-depends=(python python-six)
+depends=(python python-six abseil-cpp)
makedepends=(python python-build python-installer python-wheel python-setuptools
cmake git)
-source=("$pkgname-$pkgver::https://pypi.org/packages/source/d/dm-tree/dm-tree-${pkgver}.tar.gz")
-sha256sums=('0fcaabbb14e7980377439e7140bd05552739ca5e515ecb3119f234acee4b9430')
+source=("$pkgname-$pkgver.tar.gz::https://pypi.org/packages/source/d/dm-tree/dm-tree-${pkgver}.tar.gz"
+ CMakeLists.txt.patch)
+sha256sums=('0fcaabbb14e7980377439e7140bd05552739ca5e515ecb3119f234acee4b9430'
+ '84c9cbd52b3852af2e97dc6261c0114c78d40bc3deeb6b7638dd3864df1a9f72')
_pkgname=dm-tree
+prepare() {
+ cd "${srcdir}/${_pkgname}-${pkgver}"
+ for p in "${source[@]}"; do
+ if [[ ${p} == *.patch ]]; then
+ patch -Np1 -i "${srcdir}/${p}"
+ fi
+ done
+}
+
build() {
cd "${srcdir}/${_pkgname}-${pkgver}"
python -m build --wheel --no-isolation