1 # Maintainer: Antonio Rojas <arojas@archlinux.org>
2 # Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>
3 # Contributor: Daichi Shinozaki <dsdseg@gmail.com>
6 pkgname=(flatbuffers python-flatbuffers)
7 # https://github.com/google/flatbuffers/blob/master/CHANGELOG.md
10 pkgdesc='An efficient cross platform serialization library for C++, with support for Java, C# and Go'
12 url='https://google.github.io/flatbuffers/'
15 makedepends=(cmake python-setuptools python-numpy)
16 source=(https://github.com/google/$pkgbase/archive/v$pkgver/$pkgbase-$pkgver.tar.gz)
17 sha256sums=('8aff985da30aaab37edf8e5b02fda33ed4cbdd962699a8e2af98fdef306f4e4d')
20 sed -i 's/-Werror=/-W/g;s/-Werror//g' $pkgname-$pkgver/CMakeLists.txt
23 # Work-around missing out-of-source build support in Python tests
24 sed -i 's#${test_dir}/../flatc#${test_dir}/../../build/flatc#' tests/PythonTest.sh
25 # This script no longer works for us after https://github.com/google/flatbuffers/pull/7529
26 # TODO: notify upstream about this and that the Python workflow [1] doesn't work [2]
27 # [1] https://github.com/google/flatbuffers/blob/v22.9.24/.github/workflows/build.yml#L413
28 # [2] https://github.com/google/flatbuffers/actions/runs/3103852116/jobs/5034196360
29 sed -i 's#${test_dir}/../../python#${test_dir}/../python#' tests/PythonTest.sh
33 cmake -B build -S $pkgbase-$pkgver \
34 -DCMAKE_INSTALL_PREFIX=/usr \
35 -DFLATBUFFERS_BUILD_FLATLIB=OFF \
36 -DFLATBUFFERS_BUILD_SHAREDLIB=ON
40 cd $pkgbase-$pkgver/python
41 VERSION=$pkgver python setup.py build
45 # tests are broken with out-of-source builds
46 # https://github.com/google/flatbuffers/issues/7282
47 cmake --build build --target test || true
49 ./$pkgbase-$pkgver/tests/PythonTest.sh
52 package_flatbuffers() {
53 DESTDIR="$pkgdir" cmake --install build
56 package_python-flatbuffers() {
57 pkgdesc='An efficient cross platform serialization library for Python'
60 'python-numpy: support for Numpy arrays'
63 cd $pkgbase-$pkgver/python
64 VERSION=$pkgver python setup.py install --root="$pkgdir" --optimize=1 --skip-build