void-packages/srcpkgs/tlsh/template
2020-02-18 16:03:10 +01:00

87 lines
2.5 KiB
Bash

# Template file for 'tlsh'
pkgname=tlsh
version=3.17.0
revision=1
build_style=cmake
hostmakedepends="python3"
makedepends="python3-devel"
short_desc="Fuzzy matching library"
maintainer="Piotr Wójcik <chocimier@tlen.pl>"
license="Apache-2.0, BSD-3-Clause"
homepage="https://github.com/trendmicro/tlsh"
distfiles="https://github.com/trendmicro/tlsh/archive/${version}.tar.gz"
checksum=810cecdda1632ecb836278e5a58560d5b2b7911d02ed7419dc02b6a38e635985
pre_configure() {
vsed -i src/CMakeLists.txt -e 's/set(TLSH_SHARED_LIBRARY 0)/set(TLSH_SHARED_LIBRARY 1)/'
}
post_build() {
cd py_ext
if [ -n "$CROSS_BUILD" ]; then
PYPREFIX="$XBPS_CROSS_BASE"
CFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_inc} -I${XBPS_CROSS_BASE}/usr/include"
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_lib} -L${XBPS_CROSS_BASE}/usr/lib"
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
LDSHARED="${CC} -shared $LDFLAGS"
for f in ${XBPS_CROSS_BASE}/${py3_lib}/_sysconfigdata_*; do
f=${f##*/}
_PYTHON_SYSCONFIGDATA_NAME=${f%.py}
done
env CC="$CC" LDSHARED="$LDSHARED" \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
PYTHONPATH=${XBPS_CROSS_BASE}/${py3_lib} \
_PYTHON_SYSCONFIGDATA_NAME="$_PYTHON_SYSCONFIGDATA_NAME" \
LDFLAGS="$LDFLAGS" python3 setup.py build ${make_build_args}
else
python3 setup.py build ${make_build_args}
fi
}
pre_check() {
ln -sr bin/tlsh_unittest bin/tlsh
}
post_install() {
vlicense LICENSE
cd py_ext
if [ -n "$CROSS_BUILD" ]; then
PYPREFIX="$XBPS_CROSS_BASE"
CFLAGS+=" -I${XBPS_CROSS_BASE}/${py3_inc} -I${XBPS_CROSS_BASE}/usr/include"
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py3_lib} -L${XBPS_CROSS_BASE}/usr/lib"
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
LDSHARED="${CC} -shared $LDFLAGS"
for f in ${XBPS_CROSS_BASE}/${py3_lib}/_sysconfigdata_*; do
f=${f##*/}
_PYTHON_SYSCONFIGDATA_NAME=${f%.py}
done
env CC="$CC" LDSHARED="$LDSHARED" \
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
PYTHONPATH=${XBPS_CROSS_BASE}/${py3_lib} \
_PYTHON_SYSCONFIGDATA_NAME="$_PYTHON_SYSCONFIGDATA_NAME" \
LDFLAGS="$LDFLAGS" python3 setup.py \
install --prefix=/usr --root=${DESTDIR} ${make_install_args}
else
python3 setup.py install --prefix=/usr --root=${DESTDIR} ${make_install_args}
fi
}
tlsh-devel_package() {
depends="${sourcepkg}>=${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/include
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
}
}
python3-tlsh_package() {
depends="python3"
short_desc+=" - python module"
pkg_install() {
vlicense LICENSE
vmove "${py3_lib}"
}
}