summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a0134f2d32d926ee04abeee07f666d4a4c476ccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Contributor: Viktor Drobot (aka dviktor) linux776 [at] gmail [dot] com
# Contributor: Anton Kudelin <kudelin at protonmail dot com>

_pkgname=libint
pkgname=libint2
pkgver=2.9.0
pkgrel=1
pkgdesc='A high-performance library for computing Gaussian integrals in quantum mechanics'
url='https://github.com/evaleev/libint'
license=('GPL-3.0-only' 'LGPL-3.0-only')
arch=('x86_64')
depends=('boost')
makedepends=('python' 'gcc-fortran' 'cmake' 'eigen')
source=(${pkgname}-${pkgver}.tar.gz::"https://github.com/evaleev/libint/archive/v${pkgver}.tar.gz")
sha256sums=('4929b2f2d3e53479270be052e366e8c70fa154a7f309e5c2c23b7d394159687d')
options=(staticlibs)


prepare() {
    cd "${_pkgname}-${pkgver}"

    ./autogen.sh
    
    # Detecting FMA support
    if [ $( gcc -march=native -dM -E - < /dev/null | egrep "FMA__" | tail -c 2 ) \
        == 1 ]
    then
        FMA=yes
        CXXFLAGS="$CXXFLAGS -mfma"
        echo "Support of FMA intrinsics is enabled"
    else 
        FMA=no
        echo "Support of FMA intrinsics is disabled"
    fi
    
    # Setting build environment
    export CC=gcc
    export CXX=g++
    export FC=gfortran
    export CXXGENFLAGS="$CXXFLAGS"
}

build() {
    ## generating libint library
    tarball_build_dir="${srcdir}/prepare_tarball"
    libint_build_dir="${srcdir}/build_libint"

    # create dir for building tarball 
    mkdir -p "$tarball_build_dir"
    
    # run conf from building tarball dir
    cd "$tarball_build_dir"
    ../$_pkgname-$pkgver/configure \
                --enable-eri=1 \
                --enable-eri2=1 \
                --enable-eri3=1 \
                --enable-fma=$FMA \
                --with-max-am=5 \
                --with-eri-max-am=5,4 \
                --with-eri2-max-am=7,6 \
                --with-eri3-max-am=7,6 \
                --with-opt-am=3
    make export
    
    ## compiling libint library
    # create dir for building libint 
    mkdir -p "$libint_build_dir"

    tar xzf "$tarball_build_dir/${_pkgname}-${pkgver}.tgz" -C "$libint_build_dir"

    cd "$libint_build_dir/${_pkgname}-${pkgver}"
    cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_FLAGS="$CXXFLAGS"
    cmake --build .
}

check() {
    libint_build_dir="${srcdir}/build_libint"
    cd "$libint_build_dir/${_pkgname}-${pkgver}"
    cmake --build . --target check
}

package() {
    libint_build_dir="${srcdir}/build_libint"
    cd "$libint_build_dir/${_pkgname}-${pkgver}"
    DESTDIR="$pkgdir" cmake --install .
}