archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / hdf5 / trunk / PKGBUILD
blob8c0f97cd82b52e468f7e88f9038b2e6254564c0e
1 # Maintainer: Ronald van Haren <ronald.archlinux.org>
2 # Maintainer: Bruno Pagani <archange@archlinux.org>
3 # Contributor: Stefan Husmann <stefan-husmann@t-online.de>
4 # Contributor: damir <damir@archlinux.org>
5 # Contributor: Tom K <tomk@runbox.com>
7 pkgname=hdf5
8 pkgver=1.14.1
9 pkgrel=1
10 pkgdesc="General purpose library and file format for storing scientific data"
11 arch=(x86_64)
12 url="https://www.hdfgroup.org/hdf5"
13 license=(custom)
14 depends=(zlib libaec bash)
15 makedepends=(cmake time gcc-fortran java-environment)
16 replaces=(hdf5-java)
17 provides=(hdf5-java)
18 source=(https://support.hdfgroup.org/ftp/HDF5/releases/${pkgname}-${pkgver:0:4}/${pkgname}-${pkgver/_/-}/src/${pkgname}-${pkgver/_/-}-2.tar.bz2)
19 sha256sums=('06ca141d1a3c312b5d7cc4826a12737293ae131031748861689f6a2ec8219dbd')
21 prepare() {
22     mv ${pkgname}-${pkgver/_/-}{-2,}
23     cd ${pkgname}-${pkgver/_/-}
24     # Don't mess with build flags
25     sed -e '/-Werror/d' -i configure
28 build() {
29     # Crazy workaround: run CMake to generate pkg-config file
30     #cmake -B build -S ${pkgname}-${pkgver/_/-} \
31     mkdir -p build && cd build
32     cmake ../${pkgname}-${pkgver/_/-} \
33         -DCMAKE_INSTALL_PREFIX=/usr \
34         -DBUILD_STATIC_LIBS=OFF \
35         -DCMAKE_BUILD_TYPE=Release \
36         -DHDF5_BUILD_HL_LIB=ON \
37         -DHDF5_BUILD_CPP_LIB=ON \
38         -DHDF5_BUILD_FORTRAN=ON \
39         -DHDF5_BUILD_JAVA=ON \
40         -DHDF5_ENABLE_Z_LIB_SUPPORT=ON \
41         -DHDF5_ENABLE_SZIP_SUPPORT=ON \
42         -DHDF5_ENABLE_SZIP_ENCODING=ON \
43         -DUSE_LIBAEC=ON
44     # But don’t build with it, it’s quite broken
45     cd ../${pkgname}-${pkgver/_/-}
46     ./configure \
47         --prefix=/usr \
48         --docdir=/usr/share/doc/hdf5/ \
49         --with-examplesdir=/usr/share/doc/hdf5/examples/ \
50         --disable-static \
51         --disable-sharedlib-rpath \
52         --enable-build-mode=production \
53         --enable-hl \
54         --enable-cxx \
55         --enable-fortran \
56         --enable-java \
57         --with-pic \
58         --with-zlib \
59         --with-szlib
60     make
63 check() {
64     cd ${pkgname}-${pkgver/_/-}
65     # Without this, checks are failing with messages like “error while loading shared libraries: libhdf5.so.101: cannot open shared object file: No such file or directory”
66     export LD_LIBRARY_PATH="${srcdir}"/${pkgname}-${pkgver/_/-}/src/.libs/
67     export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"${srcdir}"/${pkgname}-${pkgver/_/-}/c++/src/.libs/
68     export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"${srcdir}"/${pkgname}-${pkgver/_/-}/fortran/src/.libs/
69     export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"${srcdir}"/${pkgname}-${pkgver/_/-}/hl/src/.libs/
70     export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"${srcdir}"/${pkgname}-${pkgver/_/-}/hl/c++/src/.libs/
71     export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"${srcdir}"/${pkgname}-${pkgver/_/-}/hl/fortran/src/.libs/
72     make check
75 package() {
76     cd ${pkgname}-${pkgver/_/-}
77     make DESTDIR="${pkgdir}" install
78     install -Dm644 COPYING -t "${pkgdir}"/usr/share/licenses/${pkgname}
80     # Install pkg-config files from CMake tree
81     install -Dm644 ../build/CMakeFiles/hdf5{,_hl}{,_cpp,_fortran}.pc -t "${pkgdir}"/usr/lib/pkgconfig/
82     # Fix version numbers in pkg-config files
83     sed -i '/Requires/ s/-/ = /g' "${pkgdir}"/usr/lib/pkgconfig/*.pc
84     # Fix bogus include path
85     sed -e "s|-I/build/hdf5/src/hdf5-$pkgver/src/H5FDsubfiling||g" -i "${pkgdir}"/usr/lib/libhdf5.settings -i "${pkgdir}"/usr/bin/*