diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 129 |
1 files changed, 110 insertions, 19 deletions
@@ -1,39 +1,130 @@ -# Maintainer: Lucas H. Gabrielli <heitzmann@gmail.com> +# Maintainer: entschuld < edgar -a t . openmail.cc> +# Contributor: Lucas H. Gabrielli <heitzmann@gmail.com> -pkgname=python-basix-git +_base=basix +pkgname=python-"${_base}"-git pkgdesc="Python interface of FEniCS for ordinary and partial differential equations." -pkgver=20210202 +pkgver=0.7.0.dev0_r943.b172e62 pkgrel=1 arch=('i686' 'x86_64') -url="https://github.com/FEniCS/basix" -license=('GPL3') +url="https://github.com/FEniCS/${_base}" +license=('MIT') groups=('fenics-git') -depends=('eigen' 'pybind11') -makedepends=('python-setuptools' 'python-wheel' -'python-scikit-build' 'xtensor' 'xtensor-blas' 'git' -'ninja') +depends=('xtensor' 'xtensor-blas' 'petsc' "blas-openblas" "fenics-basix" "fenics-basix") +makedepends=('git' 'boost' 'python-setuptools' "pybind11" "gcc") options=(!emptydirs) -source=("basix::git+https://github.com/FEniCS/basix.git") +source=("git+${url}#branch=main") md5sums=('SKIP') +provides=("python-${_base}" + "python-fenics-${_base}") +replaces=("${provides}") + +# From UPC: Building And Using Static And Shared "C" +# Libraries.html +# #+begin_QUOTE +# we need that all jump calls ("goto", in assembly speak) +# and subroutine calls will use relative addresses, and not +# absolute addresses. Thus, we need to use ... ~-fPIC~ or +# ~-fpic~ +# #+end_QUOTE +# +# From makepkg.conf +# -march (or -mcpu) builds exclusively for an architecture +# -mtune optimizes for an architecture, but builds for +# whole processor family +# +# -O3 optimises +# +# -D-FORTIFY-SOURCE=2 +# | https://stackoverflow.com/a/16604146 +# |- man 7 feature_test_macros +# checks to be performed to detect some buffer overflow +# errors when employing various string and memory +# manipulation functions ... some conforming programs +# might fail +# +# -fcf-protection +# | Info pages for gcc (gnu compiler collection) +# intended to protect against such threats as +# Return-oriented Programming (ROP), and similarly +# call/jmp-oriented programming (COP/JOP) +# +# -pipe +# | Info pages for gcc (controlling the kind of output) +# Use pipes rather than temporary files for communication +# between the various stages of compilation +# +# -fno-plt +# | Info pages for gcc (code generation conventions) +# leads to more efficient code by eliminating PLT stubs and +# exposing GOT loads to optimizations +# +# -fopenmp +# | Info pages for gcc (controlling c dialect) +# Enable handling of OpenMP directives +# + +safe_flags="-Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS" +safe_flags+=" -fcf-protection -fno-plt" +safe_flags+=" -fstack-clash-protection -Wformat" +safe_flags+=" -Werror=format-security" +generic_flags="-pipe -fno-plt -fPIC -fopenmp" +generic_flags+=" -march=native" +generic_flags+=" -mtune=native ${safe_flags}" +opt_flags="${generic_flags} -O3" +generic_flags="${generic_flags} -O2" + +export COPTFLAGS="${opt_flags}" +export CXXOPTFLAGS="$COPTFLAGS" +export FOPTFLAGS="$COPTFLAGS" +export CPPFLAGS="$generic_flags" +export CXXFLAGS="$CPPFLAGS" +export CFLAGS="$generic_flags" +export FFLAGS="$generic_flags" +export FCFLAGS="$generic_flags" +export F90FLAGS="$generic_flags" +export F77FLAGS="$generic_flags" + +export CC=mpicc +export CXX=mpicxx +export FC=mpif90 +export F90=mpif90 + +export LANG=en_IE.UTF-8 +export LC_ALL=en_IE.UTF-8 + +_base_dir="${startdir}"/src/"${_base}" prepare() { - cd basix - git checkout $(git rev-list -1 --before="${pkgver:0:4}-${pkgver:4:2}-${pkgver:6:2}" main) + git -C "${_base_dir}" clean -dfx } pkgver() { - cd basix - git log --format="%cd" --date=short -1 | sed 's/-//g' + cd "${_base_dir}" + # Gets the version from pyproject.toml + tag="$(grep -m 1 version "${_base_dir}"/pyproject.toml | + tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3 )" + printf "%s_r%s.%s" \ + ${tag%%.} \ + "$(git rev-list --count HEAD)" \ + "$(git rev-parse --short=7 HEAD)" } build() { - cd basix - python setup.py build + [ -n "$PETSC_DIR" ] && source /etc/profile.d/petsc.sh + cd "${_base_dir}"/python + python -m build --wheel --skip-dependency-check --no-isolation +} + +check() { + cd "${_base_dir}" + python -m venv --system-site-packages test-env + test-env/bin/python -m installer python/dist/*.whl + test-env/bin/python -m pytest || printf "Tests failed\n" } package() { - cd basix - python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1 - ln -s /usr/lib/python3.9/site-packages/basix/lib/libbasix.so "${pkgdir}/usr/lib/libbasix.so" + cd "${_base_dir}"/python + python -m installer --destdir="$pkgdir" dist/*.whl } |