void-packages/srcpkgs/tlsh/template
2021-10-09 08:01:08 -04:00

88 lines
2.6 KiB
Bash

# Template file for 'tlsh'
pkgname=tlsh
version=3.19.1
revision=3
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=a8a7972d8bafb5fd66bd597b72037356dd9882e71a7e9b5f37281751a99ce686
pre_configure() {
vsed -i src/CMakeLists.txt -e 's/set(TLSH_SHARED_LIBRARY 0)/set(TLSH_SHARED_LIBRARY 1)/'
vsed -i Testing/CMakeLists.txt -e '/xlen/d'
}
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}"
}
}