#!/bin/bash # Slackware build script for gumbo-parser # Original author: Hunter Sezen. # Modified and now maintained by B. Watson . # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. # 20250619 bkw: update for v0.13.1, switch to meson. # 20250125 bkw: update for v0.13.0. # 20241109 bkw: update for v0.12.1, which is a fork by a different # upstream. the original project's README says "project has been # unmaintained since 2016 and should not be used". using a self-hosted # copy of the release tarball to avoid content-disposition shenanigans. # 20240905 bkw: # - new maintainer. cd $(dirname $0) ; CWD=$(pwd) PRGNAM=gumbo-parser VERSION=${VERSION:-0.13.1} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" else SLKCFLAGS="-O2" LIBDIRSUFFIX="" fi set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM tar xvf $CWD/$PRGNAM-$VERSION.tar.gz cd $PRGNAM chown -R root:root . find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} + # 20250619 bkw: -Dtests=false avoids a dependency on gtest. note that # when tests is true, no actual testing is done: a gumbo_test binary # is built, but doesn't get run, and doesn't get installed with the # package. mkdir build cd build CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ meson .. \ --buildtype=release \ --infodir=/usr/info \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --localstatedir=/var \ --mandir=/usr/man \ --prefix=/usr \ --sysconfdir=/etc \ -Dtests=false \ -Dstrip=true "${NINJA:=ninja}" DESTDIR=$PKG $NINJA install cd .. # 20250619 bkw: don't see a way to tell meson not to build static libs... # upstream used both_libraries(), just rm the one we don't want. rm -f $PKG/usr/lib*/*.a PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION mkdir -p $PKGDOC cp -a *.md doc/* $PKGDOC cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE