# Maintainer: Felix Yan # ALARM: Kevin Mihelich # - disable lto via -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF pkgbase=opencc pkgname=(opencc opencc-doc) pkgver=1.1.5 pkgrel=1 pkgdesc="Library for Open Chinese Convert" url="https://github.com/BYVoid/OpenCC" arch=('x86_64') license=('Apache') makedepends=('chrpath' 'cmake' 'darts' 'doxygen' 'marisa' 'pybind11' 'python-setuptools' 'python-wheel' 'rapidjson' 'tclap' 'gtest') source=("https://github.com/BYVoid/OpenCC/archive/ver.$pkgver/$pkgbase-$pkgver.tar.gz") sha512sums=('c100740e9a748eb1743a90d3520fc3e1326036a9509be710d623537e4237a7cbddc268fc31d1d7457bcfada6c18aa3eea85d99b212b4ff80ae7abfce3c5a0b93') prepare() { cd OpenCC-ver.$pkgver rm -r deps } build() { cd OpenCC-ver.$pkgver cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_DOCUMENTATION:BOOL=ON -DBUILD_PYTHON:BOOL=ON \ -DUSE_SYSTEM_MARISA:BOOL=ON -DUSE_SYSTEM_PYBIND11:BOOL=ON -DUSE_SYSTEM_RAPIDJSON:BOOL=ON \ -DUSE_SYSTEM_TCLAP:BOOL=ON -DUSE_SYSTEM_DARTS:BOOL=ON -DENABLE_GTEST:BOOL=ON \ -DUSE_SYSTEM_GTEST:BOOL=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF make cp opencc_clib.*.so python/opencc/clib/ python setup.py build } check() { cd OpenCC-ver.$pkgver make test } package_opencc() { pkgdesc="Library for Open Chinese Convert" depends=('marisa') cd OpenCC-ver.$pkgver make DESTDIR="$pkgdir" install python setup.py install --root="$pkgdir" --optimize=1 # Hack to make opencc's python binding to use system opencc's configs mkdir "$pkgdir"/usr/lib/python3.10/site-packages/opencc/clib/share ln -s ../../../../../../share/opencc "$pkgdir"/usr/lib/python3.10/site-packages/opencc/clib/share/ # Remove insecure RPath chrpath --delete "$pkgdir"/usr/lib/python3.10/site-packages/opencc/clib/*.so # Remove docs - install in split package rm -r "$pkgdir/usr/share/opencc/doc" } package_opencc-doc() { pkgdesc="Documentation for Library for Open Chinese Convert" cd OpenCC-ver.$pkgver/doc make DESTDIR="$pkgdir" install }