summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ebfcac8a9facde4b1c2e76eaded4d5cf921174de (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
# Maintainer: ObserverOfTime <chronobserver@disroot.org>

pkgname=openfhe-development-git
pkgver=1.1.3.r0.g7b08ce1
pkgrel=1
pkgdesc='Open-Source Fully Homomorphic Encryption Library'
arch=('i686' 'x86_64')
url='https://www.openfhe.org/'
license=('BSD')
depends=('gperftools' 'ntl' 'openmp')
makedepends=('cmake' 'git')
provides=("openfhe=${pkgver%.r*}" "openfhe-development=${pkgver%.r*}")
conflicts=('openfhe' 'openfhe-development')
source=("git+https://github.com/openfheorg/openfhe-development.git"
        'cereal::git+https://github.com/openfheorg/cereal.git'
        'google-test::git+https://github.com/google/googletest.git'
        'system-tcmalloc.patch')
sha256sums=('SKIP' 'SKIP' 'SKIP'
            'beec5409bdfcc1147416baee6f19e711d1e930463016d70735ebf99fb160f2e8')

pkgver() {
    cd ${pkgname%-git}
    git describe --long --tags --abbrev=7 | \
      sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd ${pkgname%-git}

  msg2 'Setting up submodules...'
  git submodule init
  git config submodule.third-party/cereal.url "${srcdir}/cereal"
  git config submodule.third-party/google-test.url "${srcdir}/google-test"
  git -c protocol.file.allow=always submodule update third-party/{cereal,google-test}

  msg2 'Using system tcmalloc...'
  patch -Np0 CMakeLists.txt -i ../system-tcmalloc.patch
}

build() {
  cmake -B build -S ${pkgname%-git} \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_BENCHMARKS=OFF \
    -DBUILD_EXAMPLES=OFF \
    -DGIT_SUBMOD_AUTO=OFF \
    -DWITH_COVTEST=OFF \
    -DWITH_NTL=ON \
    -DWITH_TCM=ON \
    -DMATHBACKEND=6

  cmake --build build -t allmodules -j$(nproc)
}

check() {
  # avoid false positive reports from the OpenMP runtime
  export TSAN_OPTIONS='ignore_noninstrumented_modules=1'
  cmake --build build -t testall -j$(nproc)
}

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

  install -Dm644 "${pkgname%-git}/LICENSE" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}