summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b95408982a1ba6eba7153518aa5981c13dd76375 (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
93
94
95
96
97
98
99
100
101
102
103
# Maintainer: Carl Smedstad <carsme@archlinux.org>

pkgname=fbthrift
pkgver=2024.10.28.00
pkgrel=1
pkgdesc="Facebook's branch of Apache Thrift, including a new C++ server"
arch=(x86_64)
url="https://github.com/facebook/fbthrift"
license=(Apache-2.0)
depends=(
  boost-libs
  double-conversion
  fizz
  fmt
  folly
  gcc-libs
  gflags
  glibc
  google-glog
  openssl
  python
  wangle
  xxhash
  zlib
)
makedepends=(
  boost
  cmake
  cython
  gtest
  mvfst
)
optdepends=(
  'python-snappy: Snappy compression support'
  'python-zstandard: ZStandard compression support'
)
provides=(
  libasync.so
  libcompiler.so
  libcompiler_ast.so
  libconcurrency.so
  libmustache.so
  librpcmetadata.so
  libserverdbginfo.so
  libthrift-core.so
  libthriftannotation.so
  libthriftanyrep.so
  libthriftcpp2.so
  libthriftfrozen2.so
  libthriftmetadata.so
  libthriftprotocol.so
  libthrifttype.so
  libthrifttyperep.so
  libtransport.so
)
conflicts=(python-thrift)
options=(
  !emptydirs
  !lto
)
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha256sums=('3180aacf5dcc715bae9ed1cc107ed589fa2934795ed9ba69585fa3eb97b5b57a')

prepare() {
  cd $pkgname-$pkgver
  # Use system CMake config instead of bundled module
  sed -i 's/find_package(Glog REQUIRED)/find_package(Glog CONFIG REQUIRED)/' \
    CMakeLists.txt
}

build() {
  cd $pkgname-$pkgver
  cmake -S . -B build \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -Wno-dev \
    -Denable_tests=ON \
    -DBUILD_SHARED_LIBS=ON \
    -Dthriftpy3=OFF \
    -Dthriftpy=ON \
    -DCMAKE_CXX_STANDARD=20 \
    -DPACKAGE_VERSION="$pkgver"
  cmake --build build
}

check() {
  cd $pkgname-$pkgver
  ctest --test-dir build --output-on-failure
}

package() {
  cd $pkgname-$pkgver
  DESTDIR="$pkgdir" cmake --install build

  # Move Python extensions to site-packages
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -vdm755 "$pkgdir/$site_packages/thrift"
  mv -vt "$pkgdir/$site_packages/thrift" \
    "$pkgdir/usr/lib/fb-py-libs/thrift_py/thrift/"*
  mv -vt "$pkgdir/$site_packages/thrift/util" \
    "$pkgdir/usr/lib/fb-py-libs/thrift_py_inspect/thrift/util/"*
  rm -vr "$pkgdir/usr/lib/fb-py-libs"
}