diff options
author | eDgar | 2023-06-13 01:34:54 +0200 |
---|---|---|
committer | eDgar | 2023-06-13 01:34:54 +0200 |
commit | 3145ade00a21eb29ef849ea9204560cce15fd8f6 (patch) | |
tree | 6c22401c6b1e537581bfeb1d11aef94cb16055ee | |
parent | 0194447e220c8aa0c8ef75045bcaaa5b2facc431 (diff) | |
download | aur-3145ade00a21eb29ef849ea9204560cce15fd8f6.tar.gz |
joy without hack
-rw-r--r-- | 0001-local-build-for-Python.patch | 60 | ||||
-rw-r--r-- | PKGBUILD | 72 |
2 files changed, 106 insertions, 26 deletions
diff --git a/0001-local-build-for-Python.patch b/0001-local-build-for-Python.patch new file mode 100644 index 000000000000..220c13ba229c --- /dev/null +++ b/0001-local-build-for-Python.patch @@ -0,0 +1,60 @@ +From 3e13bc965dbe309f8311509a67fc6990b1781f9c Mon Sep 17 00:00:00 2001 +From: edgar <edgar [no] openmail.cc> +Date: Tue, 13 Jun 2023 00:03:13 +0200 +Subject: [PATCH] local build for Python + +--- + CMakeLists.txt | 1 + + python/CMakeLists.txt | 1 + + python/setup.py | 3 ++- + 3 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3a7f2d94..8e8c01c5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,6 @@ + cmake_minimum_required(VERSION 3.19) + + project(BasixFull VERSION "0.6.0" LANGUAGES CXX) ++list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) + add_subdirectory(cpp) + add_subdirectory(python) +diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt +index a9c33bde..df0b2c83 100644 +--- a/python/CMakeLists.txt ++++ b/python/CMakeLists.txt +@@ -6,6 +6,7 @@ PROJECT(basix_pybind11 VERSION "0.6.0" LANGUAGES CXX) + set(CMAKE_CXX_STANDARD 20) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) ++list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) + + # See https://gitlab.kitware.com/cmake/cmake/-/issues/16414 + if (TARGET basix) +diff --git a/python/setup.py b/python/setup.py +index 6cb52473..0b69b8b8 100644 +--- a/python/setup.py ++++ b/python/setup.py +@@ -47,8 +47,10 @@ class CMakeBuild(build_ext): + self.build_extension(ext) + + def build_extension(self, ext): ++ env = os.environ.copy() + extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) + cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, ++ "-DCMAKE_PREFIX_PATH=" + env["CMAKE_PREFIX_PATH"], + '-DPython3_EXECUTABLE=' + sys.executable, + '-DPython3_LIBRARIES=' + sysconfig.get_config_var("LIBDEST"), + '-DPython3_INCLUDE_DIRS=' + sysconfig.get_config_var("INCLUDEPY")] +@@ -59,7 +61,6 @@ class CMakeBuild(build_ext): + cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg] + build_args += ['--', '-j3'] + +- env = os.environ.copy() + import pybind11 + env['pybind11_DIR'] = pybind11.get_cmake_dir() + env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''), +-- +2.40.0 + @@ -3,18 +3,21 @@ pkgname=fenics-basix-git _base=basix pkgdesc="Interface of FEniCS for ordinary and partial differential equations (C++ and Python from git release)." -pkgver=0.5.1 -pkgrel=1 +pkgver=0.6.0 +pkgrel=3 arch=('i686' 'x86_64') url="https://github.com/FEniCS/basix" license=('GPL3') groups=('fenics-git') -depends=('xtensor' 'xtensor-blas' 'pybind11' 'petsc') -makedepends=('git' 'boost') +depends=('xtensor' 'xtensor-blas' 'petsc' "python-numpy") +makedepends=('git' 'boost' 'python-setuptools' "pybind11") checkdepends=("python-sympy") options=(!emptydirs) -source=("git+${url}") -sha256sums=('SKIP') +source=("git+${url}" + "0001-local-build-for-Python.patch") +sha512sums=('SKIP' + '68798ec16666289131bec093a9b5f762569f2dbc9fa6d537dc5d9573abb6faa07791091cf4f12f2ce41798cd8e8b506311be3f2f55ce63cc28e3f91586a7b549') + provides=("${_base}=${pkgver}" "python-${_base}=${pkgver}" "python-${_base}-git=${pkgver}" @@ -103,6 +106,7 @@ _base_dir="${startdir}"/src/"${_base}" prepare() { cd "${_base_dir}" git checkout origin/release + # git apply "${srcdir}"/0001-local-build-for-Python.patch git -C "${_base_dir}" clean -dfx } @@ -121,38 +125,54 @@ pkgver() { build() { [ -n "$PETSC_DIR" ] && source /etc/profile.d/petsc.sh - cd "${_base_dir}"/cpp # Add CBLAS to linking libraries # (https://github.com/davisking/dlib/issues/154#issuecomment-240651490) # sed -i 's%\(target_link_libraries(basix PRIVATE ${BLAS_LIBRARIES})\)%\nset(BLAS_LIBRARIES "-lcblas;-lblas")\n\1%' "${srcdir}"/"${_base}"/cpp/CMakeLists.txt + + # cmake -DCMAKE_BUILD_TYPE="Release" \ + # -B "${srcdir}"/build \ + # -S "${_base_dir}" \ + # -DCMAKE_INSTALL_PREFIX=/usr \ + # -DXTENSOR_OPTIMIZE=TRUE + # cmake --build "${srcdir}"/build + + # _pydir="${_base_dir}"/python + # cd "${_pydir}" + # python setup.py build + cmake -DCMAKE_BUILD_TYPE="Release" \ -B "${srcdir}"/build \ - -S . \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DXTENSOR_OPTIMIZE=TRUE + -S "${_base_dir}" \ + -DCMAKE_INSTALL_PREFIX=/usr cmake --build "${srcdir}"/build - - _pydir="${_base_dir}"/python - cd "${_pydir}" - python setup.py build } -check() { - cd "${_base_dir}" - pytest test -} +# check() { +# cd "${_base_dir}" +# pytest test +# } package() { - cd "${srcdir}"/"${_base}"/cpp + # cd "${srcdir}"/"${_base}"/cpp cmake --install "${srcdir}"/build --prefix="${pkgdir}"/usr # make -C "${srcdir}"/build DESTDIR="${pkgdir}" install - _pydir="${srcdir}"/"${_base}"/python - cd "${srcdir}"/"${_base}"/python - python setup.py build - PYTHONPYCACHEPREFIX="${_pydir}/.cache/cpython/" \ - python setup.py install \ - --prefix=/usr --root="${pkgdir}"\ - --optimize=1 + # export Basix_DIR="${pkgdir}/usr/" + _pydir="${_base_dir}"/python + cd "${_pydir}" + + export CMAKE_PREFIX_PATH="${pkgdir}"/usr + python -m build --wheel --no-isolation --skip-dependency-check + + # python setup.py build + # PYTHONPYCACHEPREFIX="${_pydir}/.cache/cpython/" \ + # python setup.py install \ + # --prefix=/usr --root="${pkgdir}"\ + # --optimize=1 + # pip install . --no-deps --prefix=/usr --root="${pkgdir}" --compile + + # # python setup.py build + PYTHONPYCACHEPREFIX="${_pydir}/.cache/cpython/" \ + python -m installer --destdir="$pkgdir" dist/*.whl } |