summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ac785c7e7f0d6f5be96ce440c0804f99f1ff70ee (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
# Maintainer: "Jan Kohnert <bughunter@jan-kohnert.de"
# Contributor: Graziano Giuliani <graziano.giuliani@poste.it>
pkgname=eccodes
pkgver=2.47.0
_attnum=45757960
pkgrel=1
pkgdesc="ECMWF decoding library for GRIB, BUFR and GTS"
arch=("i686" "x86_64")
url="https://confluence.ecmwf.int/display/ECC/ecCodes+Home"
license=("Apache-2.0")
depends=("glibc" "libaec" "libgcc" "libgfortran" "libpng" "libstdc++" "openjpeg2" "netcdf")
makedepends=("gcc-fortran" "cmake")
optdepends=("bash" "ksh")
conflicts=("grib_api" "libbufr-ecmwf")
source=(
    "${pkgname}-${pkgver}-Source.tar.gz::https://confluence.ecmwf.int/download/attachments/${_attnum}/${pkgname}-${pkgver}-Source.tar.gz?api=v2"
    "${pkgname}-${pkgver}-test-data.tar.gz::https://get.ecmwf.int/repository/test-data/eccodes/eccodes_test_data.tar.gz"
)
sha512sums=(
    "4cb0491c327d2832dc3e4b14a67a90e4d6b459c2baa132a6a37c5e7d4886eb3ea0e83dcbc95aa9487c207c685dc4ed338b743be60345a581725d2cba80e11ae8"
    "8b4c7159dd7ed0e1e69068ec7dcabe94064f0d2abf9eac4fca2a9c730d500999e8edf1e7eeebba6fb12ae99b223c1b0843e31414538333c52f2508cb2d410151"
)

build() {
  # make sure we have a clean build environment
  if [ -d build ]; then
    rm -rf build
  fi
  local cmake_options=(
    -B build
    -S "$pkgname-$pkgver-Source"
    -W no-dev
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CMAKE_INSTALL_DATADIR=/usr/share
    -D CMAKE_INSTALL_DATAROOTDIR="/usr/share/$pkgname/definitions"
    -D ENABLE_AEC=ON
    -D ENABLE_ECCODES_THREADS=ON
    -D ENABLE_EXTRA_TESTS=ON
    -D ENABLE_JPG=ON
    -D ENABLE_JPG_LIBJASPER=OFF
    -D ENABLE_JPG_LIBOPENJPEG=ON
    -D ENABLE_PNG=ON
  )
  cmake "${cmake_options[@]}"
  cmake --build build
}

check() {
  # copy extra test data to build dir so we can skip downloading data while testing
  cp -a data/* build/data/
  # Test 'eccodes_t_grib_ecc-2221' does not work reliably an all machines
  local excluded_tests="eccodes_t_grib_ecc-2221"
  local ctest_flags=(
    --test-dir build
    # show the stdout and stderr when the test fails
    --output-on-failure
    # execute tests in parallel
    --parallel $(nproc)
    # exclude problematic tests
    --exclude-regex "$excluded_tests"
  )
  ctest "${ctest_flags[@]}"
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}