summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 173dba50acc5c18d8a81a5f6b23738b5b349508a (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
87
88
89
90
91
92
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: Ronald van Haren <ronald.archlinux.org>
# Contributor: Bruno Pagani <archange@archlinux.org>
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
# Contributor: damir <damir@archlinux.org>
# Contributor: Tom K <tomk@runbox.com>

_android_arch=aarch64

pkgname=android-${_android_arch}-hdf5
pkgver=1.14.5
pkgrel=1
arch=('any')
pkgdesc="General purpose library and file format for storing scientific data (Android ${_android_arch})"
url="https://www.hdfgroup.org/hdf5"
license=('custom')
groups=('android-hdf5')
depends=("android-${_android_arch}-zlib"
         "android-${_android_arch}-libaec")
makedepends=('android-cmake'
             'time')
options=(!strip !buildflags staticlibs !emptydirs)
source=("https://github.com/HDFGroup/hdf5/archive/hdf5_${pkgver}/hdf5-${pkgver}.tar.gz")
md5sums=('8a2d6ec803964913c880c8a984f71d61')

prepare() {
    cd "${srcdir}/hdf5-hdf5_${pkgver/_/-}"

    # Don't mess with build flags
    sed -i -e '/-Werror/d' configure
    sed -i 's/fseeko/fseek/g' src/H5FDstdio.c
    sed -i 's/ftello/ftell/g' src/H5FDstdio.c
}

build() {
    cd "${srcdir}/hdf5-hdf5_${pkgver/_/-}"
    source android-env ${_android_arch}

    # Crazy workaround: run CMake to generate pkg-config file
    android-${_android_arch}-cmake \
        -S . \
        -B build \
        -DBUILD_STATIC_LIBS=ON \
        -DHDF5_BUILD_HL_LIB=ON \
        -DHDF5_BUILD_CPP_LIB=ON \
        -DHDF5_BUILD_FORTRAN=OFF \
        -DHDF5_BUILD_JAVA=OFF \
        -DHDF5_ENABLE_Z_LIB_SUPPORT=ON \
        -DHDF5_ENABLE_SZIP_SUPPORT=OFF \
        -DHDF5_ENABLE_SZIP_ENCODING=OFF \
        -DBUILD_TESTING=OFF \
        -DDISABLE_PDB_FILES=ON \
        -DHDF5_BUILD_EXAMPLES=OFF \
        -DHDF5_BUILD_TOOLS=OFF \
        -DHDF5_BUILD_UTILS=OFF
    # But don’t build with it, it’s quite broken

    android-${_android_arch}-configure \
        --disable-sharedlib-rpath \
        --enable-build-mode=production \
        --enable-hl \
        --enable-cxx \
        --with-pic \
        --with-zlib \
        --with-szlib \
        --enable-tests=no \
        --enable-tools=no \
        --disable-doxygen-man \
        --disable-doxygen-html
    make $MAKEFLAGS
}

package() {
    cd "${srcdir}/hdf5-hdf5_${pkgver/_/-}"
    source android-env ${_android_arch}

    make DESTDIR="${pkgdir}" install
    rm -rf "${pkgdir}/${ANDROID_PREFIX_BIN}/"
    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a

    # Install pkg-config files from CMake tree
    install -Dm644 build/CMakeFiles/hdf5{,_hl}{,_cpp}.pc -t "${pkgdir}/${ANDROID_PREFIX_LIB}/pkgconfig/"

    # Fix version numbers in pkg-config files
    sed -i '/Requires/ s/-/ = /g' "${pkgdir}/${ANDROID_PREFIX_LIB}/pkgconfig"/*.pc

    # Fix bogus include path
    sed  -i -re "s|-I/build/hdf5/src/hdf5.*/src/H5FDsubfiling||g" "${pkgdir}/${ANDROID_PREFIX_LIB}/libhdf5.settings"

    install -Dm644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
}