#!/bin/bash # Slackware build script for openvaf-bin # Copyright 2026 A. Tomasini # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OpenVAF is distributed by upstream only as a precompiled, statically linked # x86_64 executable (the build requires LLVM 15, which is not part of # Slackware 15.0). This script therefore repackages the official binary rather # than compiling from source. cd $(dirname $0) ; CWD=$(pwd) PRGNAM=openvaf-bin SRCNAM=openvaf VERSION=${VERSION:-23.5.0} SRCVER=${SRCVER:-23_5_0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then ARCH=$( uname -m ) fi if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi if [ "$ARCH" != "x86_64" ]; then printf "\n$ARCH is not supported: openvaf is a precompiled x86_64 binary.\n\n" exit 1 fi TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT # The upstream tarball holds a single 'openvaf' executable with no top-level # directory, so unpack it into a build directory we create. rm -rf $TMP/$PRGNAM-$VERSION mkdir -p $TMP/$PRGNAM-$VERSION cd $TMP/$PRGNAM-$VERSION tar xvf $CWD/${SRCNAM}_${SRCVER}_linux_amd64.tar.gz chown -R root:root . install -D -m 0755 openvaf $PKG/usr/bin/openvaf # The upstream binary ships unstripped (~210 MB); strip it to shrink the # package. strip only removes debug/symbol data, the compiler still runs. 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 PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION mkdir -p $PKGDOC cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild [ -f $CWD/README ] && cat $CWD/README > $PKGDOC/README mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE