diff options
author | entshuld | 2021-08-29 12:01:32 -0500 |
---|---|---|
committer | entshuld | 2021-08-29 12:30:25 -0500 |
commit | 250920f60cd5bb5a786823e4bf2244489d412598 (patch) | |
tree | 084e81307a8d1496aa2d87297822034f1b17288a | |
download | aur-250920f60cd5bb5a786823e4bf2244489d412598.tar.gz |
build basix with C++ and python (using sed hack)
-rw-r--r-- | .SRCINFO | 29 | ||||
-rw-r--r-- | .gitignore | 13 | ||||
-rw-r--r-- | PKGBUILD | 131 |
3 files changed, 173 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..1eaebd41efb1 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,29 @@ +pkgbase = fenics-basix-git + pkgdesc = C++ interface of FEniCS for ordinary and partial differential equations. + pkgver = 0.1.0.25.g970087e + pkgrel = 1 + url = https://github.com/FEniCS/basix + arch = i686 + arch = x86_64 + groups = fenics-git + license = GPL3 + makedepends = git + makedepends = boost + depends = xtensor + depends = xtensor-blas + depends = pybind11 + depends = petsc + provides = basix=0.1.0 + provides = python-basix=0.1.0 + provides = python-basix-git=0.1.0 + conflicts = basix + conflicts = python-basix + conflicts = python-basix-git + replaces = basix + replaces = python-basix + replaces = python-basix-git + options = !emptydirs + source = git+https://github.com/FEniCS/basix + md5sums = SKIP + +pkgname = fenics-basix-git diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..4a72e03c2c48 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +*.log +*.bak +*\~ +*.pkg.tar.xz +*.tar.bz2 +*.tar.gz +/pkg +/src +/auto +/build + +frag-master.tex +basix diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..6161d6766407 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,131 @@ +# Maintainer: entschuld <edgr@openmail.cc> + +pkgname=fenics-basix-git +_realname=basix +pkgdesc="C++ interface of FEniCS for ordinary and partial differential equations." +pkgver=0.1.0.25.g970087e +pkgrel=1 +arch=('i686' 'x86_64') +url="https://github.com/FEniCS/basix" +license=('GPL3') +groups=('fenics-git') +depends=('xtensor' 'xtensor-blas' 'pybind11' 'petsc') +makedepends=('git' 'boost') +options=(!emptydirs) +source=("git+${url}") +md5sums=('SKIP') +_mainver=$(printf ${pkgver} | cut -d'.' -f1,2,3) +provides=("${_realname}=$_mainver" "python-${_realname}=$_mainver" + "python-${_realname}-git=$_mainver") +replaces=("${_realname}" "python-${_realname}" +"python-${_realname}-git") +conflicts=("${_realname}" "python-${_realname}" +"python-${_realname}-git") + +# 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 + +pkgver() { + cd "${srcdir}/${_realname}" + pkgrel=$(git describe --tags --match '*.*' | awk -F'-' '{print $2"."$3}') + git describe --tags --match '*.*' | tr '-' '.' +} + +build() { + [ -n "$PETSC_DIR" ] && source /etc/profile.d/petsc.sh + + cmake -DCMAKE_BUILD_TYPE=Release \ + -B "${srcdir}"/build \ + -S "${srcdir}"/"${_realname}" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_PREFIX_PATH="${srcdir}"/build \ + -DXTENSOR_OPTIMIZE=TRUE \ + -DCMAKE_SKIP_BUILD_RPATH=TRUE \ + -DCMAKE_SKIP_RPATH=TRUE \ + -DCMAKE_BUILD_TYPE="Release" \ + -Dxtensor_DIR=\ + "$(pacman -Ql xtensor | + awk '/xtensorConfig\.cmake/{print $NF}')" + cmake --build "${srcdir}"/build +} + +package() { + cd "${pkgdir}" + make -C "${srcdir}"/build DESTDIR="${pkgdir}" install + + cd "${srcdir}"/"${_realname}"/python + sed -i "s%\(find_package(Basix.*\)%set(CMAKE_PREFIX_PATH \"${pkgdir}/usr/lib/cmake/basix\")\n\1%" "${srcdir}"/"${_realname}"/python/CMakeLists.txt + python setup.py build + python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1 +} |