62 lines
1.9 KiB
Bash

# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>
# Contributor: Daichi Shinozaki <dsdseg@gmail.com>
pkgbase=flatbuffers
pkgname=(flatbuffers python-flatbuffers)
# https://github.com/google/flatbuffers/blob/master/CHANGELOG.md
pkgver=24.3.25
pkgrel=2
pkgdesc='An efficient cross platform serialization library for C++, with support for Java, C# and Go'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='https://google.github.io/flatbuffers/'
license=(Apache)
depends=(gcc-libs)
makedepends=(cmake python-setuptools python-numpy)
source=(https://github.com/google/$pkgbase/archive/v$pkgver/$pkgbase-$pkgver.tar.gz)
sha256sums=('4157c5cacdb59737c5d627e47ac26b140e9ee28b1102f812b36068aab728c1ed')
prepare() {
sed -i 's/-Werror=/-W/g;s/-Werror//g' $pkgname-$pkgver/CMakeLists.txt
cd $pkgbase-$pkgver
# Work-around missing out-of-source build support in Python tests
sed -i 's#${test_dir}/../flatc#${test_dir}/../../build/flatc#' tests/PythonTest.sh
}
build() {
cmake -B build -S $pkgbase-$pkgver \
-DCMAKE_INSTALL_PREFIX=/usr \
-DFLATBUFFERS_BUILD_FLATLIB=OFF \
-DFLATBUFFERS_BUILD_SHAREDLIB=ON
cmake --build build
# Python bindings
cd $pkgbase-$pkgver/python
VERSION=$pkgver python setup.py build
}
check() {
# tests are broken with out-of-source builds
# https://github.com/google/flatbuffers/issues/7282
cmake --build build --target test || true
./$pkgbase-$pkgver/tests/PythonTest.sh
}
package_flatbuffers() {
DESTDIR="$pkgdir" cmake --install build
}
package_python-flatbuffers() {
pkgdesc='An efficient cross platform serialization library for Python'
depends=(python)
optdepends=(
'python-numpy: support for Numpy arrays'
)
cd $pkgbase-$pkgver/python
VERSION=$pkgver python setup.py install --root="$pkgdir" --optimize=1 --skip-build
}