summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c010dd280e1a9a1afd24fd147a58ae4bda1ff2b0 (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
pkgname=fmilib2
pkgver=2.4.1
pkgrel=1
pkgdesc="open-source implementation of the FMI open standard"
arch=('x86_64')
url="http://www.jmodelica.org/FMILibrary"
license=('BSD')
makedepends=('cmake')
depends=('glibc')
options=(!lto)
source=("https://github.com/modelon-community/fmi-library/archive/${pkgver}.tar.gz")
sha256sums=('8199d3e9423494b714b9c4e42f055248457a7c9162df3d4652000aa9a10b8316')

prepare() {
  cd "$srcdir"/fmi-library-${pkgver}

  # do not override CMAKE_INSTALL_PREFIX
  sed -i "/CMAKE_INSTALL_PREFIX/d" CMakeLists.txt

  # install doc in /usr/share
  sed -i "s|DESTINATION doc)|DESTINATION share/doc/fmilib)|g" CMakeLists.txt

  # miniunz.c:141:11: error: implicit declaration of function mkdir
  sed -i "50i#include <sys/stat.h>" ThirdParty/Minizip/minizip/miniunz.c

  # build with cmake 3.x
  curl -fSsL https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-linux-x86_64.tar.gz | tar xz
}

build() {
  cd "$srcdir"/fmi-library-${pkgver}
  ./cmake-3.31.6-linux-x86_64/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr -DFMILIB_BUILD_TESTS=OFF -B build .
  make -C build
}

package() {
  cd "$srcdir"/fmi-library-${pkgver}/build
  make DESTDIR="$pkgdir" install
}