summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 90a757cfdbbec76ac8963c525b52aa8015ca7e04 (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
# Maintainer: Juacrumar <juacrumar at lairen dot eu>

pkgname=pineappl
pkgver=0.7.4
fullver=${pkgver}
pkgrel=2
pkgdesc='PineAPPL is not an extension of APPLgrid. Installs pineappl_cli, pineappl library and python package'
arch=('any')
url="https://nnpdf.github.io/pineappl/"
license=('GPL3')
makedepends=("python-setuptools" "maturin" "python-pip" "cargo" "cargo-c")
depends=("lhapdf"
         "python-pkgconfig"
         "python-numpy"
         )
optdepends=()
provides=("pineappl")
changelog=
source=("https://github.com/NNPDF/pineappl/archive/v${fullver}.tar.gz")
md5sums=("ff756719b29ff185eb2739cf4446ac8e")

# workaround for the problem with ring, see https://gitlab.archlinux.org/archlinux/packaging/packages/pacman/-/issues/20
options=(!lto)

prepare() {
    cd "$pkgname-$fullver"
    cargo fetch --target x86_64-unknown-linux-gnu --locked
    # Set manually the version
    sed -i "/version = git_version!(/{:a;N;/)/!ba;s/version = git_version!(.*)/version = \"$fullver-arch-$pkgrel\"/}" pineappl_cli/src/lib.rs
}

build() {
    export CARGO_TARGET_DIR=target
    cd "$pkgname-$fullver"/pineappl_py
    # Now build the python interface
    maturin build --release --locked
}

package() {
 	cd "$pkgname-$pkgver"
    cargo install --path pineappl_cli --root=${pkgdir}/usr --no-track --locked --features=evolve
    # Install also the pineappl_capi
 	cd pineappl_capi
    cargo cinstall --locked --release --destdir=${pkgdir} --prefix=/usr
    cd ..
    # And the python wrapper
    cd pineappl_py/target/wheels/
    PYTHONDONTWRITEBYTECODE=1 PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps *.whl
    # manually remove __pycache__ from pkgdir (isn't there a better way?)
    rm -rf ${pkgdir}/usr/lib/python*/site-packages/pineappl/__pycache__
    # Note: some debug information, including the folder where the package was built, might stored
}