void-packages/srcpkgs/cln/template
Jürgen Buchmüller 70bbffa186 cln: use templates for {int,float}param.h for cross
When cross building the configure script hangs or at least takes
insane amounts of time for some architectures to create the values
for the header files include/cln/{int,float}param.h

Since we know our architectures and the sizes of their integer
and floating point values, we can just as well create the files
from templates using $XBPS_TARGET_WORDSIZE and $XBPS_TARGET_ENDIAN.

[ci skip]
2020-09-08 21:07:13 +02:00

59 lines
1.5 KiB
Bash

# Template file for 'cln'
pkgname=cln
version=1.3.6
revision=1
build_style=gnu-configure
makedepends="gmp-devel"
short_desc="Class library (C++) for numbers"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-only"
homepage="https://www.ginac.de/CLN/"
distfiles="${homepage}/${pkgname}-${version}.tar.bz2"
checksum=f492530e8879bda529009b6033e1923c8f4aae843149fc28c667c20b094d984a
case "$XBPS_TARGET_MACHINE" in
arm*|aarch64*) CPPFLAGS="-DNO_ASM";;
esac
pre_configure() {
if [ "$CROSS_BUILD" ]; then
local ENDIAN="UNKNOWN"
local LBITS=$XBPS_TARGET_WORDSIZE
local LBYTES=$(($XBPS_TARGET_WORDSIZE / 8))
local INTPARAM_H=${wrksrc}/include/cln/intparam.h
local FLOATPARAM_H=${wrksrc}/include/cln/floatparam.h
if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
ENDIAN="BIG"
fi
if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
ENDIAN="LITTLE"
fi
# Make substitutions in intparam.h
sed ${FILESDIR}/intparam.h \
-e "s;@LBITS@;$LBITS;g" \
-e "s;@LBYTES@;$LBYTES;g" \
-e "s;@ENDIAN@;$ENDIAN;g" \
-e "s;@endian@;${ENDIAN,,};g" \
> ${INTPARAM_H}
# No substitutions in floatparam.h
cat ${FILESDIR}/floatparam.h \
> ${FLOATPARAM_H}
configure_args+=" cl_cv_file_intparam_h=$INTPARAM_H"
configure_args+=" cl_cv_file_floatparam_h=$FLOATPARAM_H"
fi
}
cln-devel_package() {
short_desc+=" - development files"
depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
pkg_install() {
vmove usr/include
vmove usr/lib/libcln.so
vmove usr/lib/libcln.a
vmove usr/lib/pkgconfig
}
}