#!/bin/bash # Slackware build script for whdd # # Upstream: https://github.com/whdd/whdd # No SlackBuilds.org entry and not in Debian. Tag 3.1 is the newest # upstream release; Parted Magic previously shipped a 2.2 snapshot # converted from an Ubuntu package. # # CMake 4 removed compatibility with cmake_minimum_required < 3.5 and # whdd's CMakeLists.txt asks for 2.8.4, hence CMAKE_POLICY_VERSION_MINIMUM. # # BUILD DEPENDENCY: libdialog. Slackware's dialog package ships only the # binary, so libdialog.a and its headers must be present at build time: # configure && make libdialog.a in Slackware's dialog source, then # install libdialog.a into /usr/lib64 and dialog.h, dlg_*.h into # /usr/include. Only the static lib is needed -- whdd then carries no # runtime dependency on dialog, which is how the old Ubuntu-derived # package was linked too. cd $(dirname $0) ; CWD=$(pwd) PRGNAM=whdd VERSION=${VERSION:-3.1} BUILD=${BUILD:-1} TAG=${TAG:-_pmagic} PKGTYPE=${PKGTYPE:-txz} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} if [ "$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-$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 {} \+ mkdir -p build cd build cmake \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib${LIBDIRSUFFIX} \ -DCMAKE_BUILD_TYPE=Release .. make make install DESTDIR=$PKG cd .. 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 mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a LICENSE* README* doc $PKG/usr/doc/$PRGNAM-$VERSION 2>/dev/null || true cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$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