Skip to content

Instantly share code, notes, and snippets.

@mtorromeo
Last active August 30, 2020 16:35
Show Gist options
  • Save mtorromeo/1d48de16534dc8ee29cd872f94b070e5 to your computer and use it in GitHub Desktop.
Save mtorromeo/1d48de16534dc8ee29cd872f94b070e5 to your computer and use it in GitHub Desktop.
re2 PKGBUILD using cmake
# Maintainer: Evangelos Foutras <[email protected]>
# Contributor: Anatol Pomozov <[email protected]>
# Contributor: Gustavo Alvarez <[email protected]>
# Contributor: Alexandre Bique <[email protected]>
pkgname=re2
_re2ver=2020-08-01
pkgver=${_re2ver//-}
pkgrel=2
epoch=1
pkgdesc="Fast, safe, thread-friendly regular expression engine"
arch=('x86_64')
url="https://github.com/google/re2"
license=('BSD')
makedepends=('cmake')
depends=('gcc-libs')
source=(re2-$pkgver.tar.gz::https://github.com/google/re2/archive/$_re2ver.tar.gz)
sha256sums=('6f4c8514249cd65b9e85d3e6f4c35595809a63ad71c5d93083e4d1dcdf9e0cd6')
prepare() {
cd $pkgname-$_re2ver
mkdir build
SOMAJOR=$(grep '^SONAME=' Makefile | cut -d= -f2)
echo "set_target_properties(re2 PROPERTIES VERSION $SOMAJOR.0.0 SOVERSION $SOMAJOR)" >> CMakeLists.txt
}
build() {
cd $pkgname-$_re2ver/build
cmake \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_CXX_FLAGS="${CXXFLAGS} -DNDEBUG" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
..
make
sed 's#@includedir@#/usr/include#;s#@libdir@#/usr/lib#' ../re2.pc > re2.pc
}
check() {
cd $pkgname-$_re2ver/build
make test
}
package() {
cd $pkgname-$_re2ver/build
make prefix=/usr DESTDIR="$pkgdir" install
install -Dm644 re2.pc "$pkgdir/usr/lib/pkgconfig/re2.pc"
install -Dm644 ../LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment