From 6d9ee44852a37960b35dfca2d6cdac73d4671324 Mon Sep 17 00:00:00 2001 From: B. Watson Date: Tue, 8 Mar 2022 14:44:20 -0500 Subject: development/ldns: Add python3 support. Signed-off-by: B. Watson Signed-off-by: Willy Sudiarto Raharjo --- development/ldns/ldns.SlackBuild | 105 ++++++++++++++++++++++++--------------- 1 file changed, 65 insertions(+), 40 deletions(-) diff --git a/development/ldns/ldns.SlackBuild b/development/ldns/ldns.SlackBuild index 9588369808..e0f34d56ec 100644 --- a/development/ldns/ldns.SlackBuild +++ b/development/ldns/ldns.SlackBuild @@ -37,6 +37,7 @@ # - parallel makes are broken, use -j1. # - fix code that finds the /usr/share/vim/vimXX directory (it would # fail if there were more than one of them). +# - add python3 support, inspired by Dave Woodfall. cd $(dirname $0) ; CWD=$(pwd) @@ -81,46 +82,70 @@ set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT -cd $TMP -rm -rf $PRGNAM-$VERSION -tar xvf $CWD/$PRGNAM-$VERSION.tar.gz -cd $PRGNAM-$VERSION -chown -R root:root . -find -L . \ - \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ - -o -perm 511 \) -exec chmod 755 {} \+ -o \ - \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ - -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+ - -CXXFLAGS="$SLKCFLAGS" \ -CFLAGS="$SLKCFLAGS" \ -./configure \ - --prefix=/usr \ - --libdir=/usr/lib${LIBDIRSUFFIX} \ - --includedir=/usr/include \ - --localstatedir=/var \ - --sysconfdir=/etc \ - --mandir=/usr/man \ - --disable-static \ - --enable-rrtype-ninfo \ - --enable-rrtype-rkey \ - --enable-rrtype-ta \ - --enable-rrtype-avc \ - --disable-rpath \ - --disable-dane-verify \ - --with-drill \ - --with-examples \ - --with-pyldns \ - --with-pyldnsx \ - --with-p5-dns-ldns \ - --with-ca-path=/etc/ssl/certs \ - --with-ca-file=/etc/ssl/certs/ca-certificates.crt \ - --with-trust-anchor=/etc/$PRGNAM/root.key \ - --build=$ARCH-slackware-linux - -make -j1 -make install DESTDIR=$PKG INSTALLVENDORMAN3DIR=/usr/man/man3 INSTALLDIRS=vendor -python -m compileall $PKG/usr/lib*/python*/site-packages + +buildit() { + local pyver="$1" + local perlflag="$2" + + cd $TMP + rm -rf $PRGNAM-$VERSION + tar xvf $CWD/$PRGNAM-$VERSION.tar.gz + cd $PRGNAM-$VERSION + chown -R root:root . + find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \+ -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+ + + PYTHON=/usr/bin/python$pyver \ + CXXFLAGS="$SLKCFLAGS" \ + CFLAGS="$SLKCFLAGS" \ + ./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --includedir=/usr/include \ + --localstatedir=/var \ + --sysconfdir=/etc \ + --mandir=/usr/man \ + --disable-static \ + --enable-rrtype-ninfo \ + --enable-rrtype-rkey \ + --enable-rrtype-ta \ + --enable-rrtype-avc \ + --disable-rpath \ + --disable-dane-verify \ + --with-drill \ + --with-examples \ + --with-pyldns \ + --with-pyldnsx \ + $perlflag \ + --with-ca-path=/etc/ssl/certs \ + --with-ca-file=/etc/ssl/certs/ca-certificates.crt \ + --with-trust-anchor=/etc/$PRGNAM/root.key \ + --build=$ARCH-slackware-linux + + make -j1 + make install DESTDIR=$PKG INSTALLVENDORMAN3DIR=/usr/man/man3 INSTALLDIRS=vendor +} + +# 20220308 bkw: python version is either/or. to include support for +# python2 and python3 in the same package, we have to build everything +# twice. first time around, build python2 support, and skip the perl stuff. +buildit 2 --without-p5-dns-ldns + +# 20220308 bkw: hang onto the python stuff, blow everything else away. +mkdir -p $PKG/.keep +mv $PKG/usr/lib*/python2* $PKG/.keep +rm -rf $PKG/usr +mkdir -p $PKG/usr/lib$LIBDIRSUFFIX +mv $PKG/.keep/* $PKG/usr/lib$LIBDIRSUFFIX +rm -rf $PKG/.keep +python -m compileall $PKG/usr/lib*/python2*/site-packages + +# 20220308 bkw: now do it over again, with python 3 and perl. +buildit 3 --with-p5-dns-ldns +python3 -m compileall $PKG/usr/lib*/python3*/site-packages find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -- cgit v1.2.3