#!/bin/bash # Maintainer: Didier Spaier didieratslintdotfr # Run with sudo, not fakeroot else permission denied to access # /run/user/0 cd $(dirname $0) ; CWD=$(pwd) PRGNAM=libportal VERSION=0.6 BUILD=1 TAG=slint PKGTYPE=txz commit=13df0b887a7eb7b0f9b14069561a41f62e813155 _pick() { local p="$1" f d; shift for f; do d="$SRC/$p/${f#$PKG/}" echo mkdir -p "$(dirname "$d")" mkdir -p "$(dirname "$d")" echo mv "$f" "$d" mv "$f" "$d" echo rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")" rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")" done } # Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; # Unless $ARCH is already set, use uname -m for all other archs: *) ARCH=$( uname -m ) ;; esac fi # If the variable PRINT_PACKAGE_NAME is set, then this script will report what # the name of the created package would be, and then exit. This information # could be useful to other scripts. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi TMP=$CWD PKG=$TMP/package-$PRGNAM 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 libportal mkdir -p $TMP $PKG $OUTPUT cd $TMP git clone https://github.com/flatpak/libportal.git cd libportal git checkout $commit 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 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 \ -Dstrip=true "${NINJA:=ninja}" DESTDIR=$PKG $NINJA install cd .. # Don't ship .la files: rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la # Strip binaries and libraries - this can be done with 'make install-strip' # in many source trees, and that's usually acceptable if so, but if not, # use this: 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 # Copy program documentation into the package # The included documentation varies from one application to another, so be sure # to adjust your script as needed # Also, include the SlackBuild script in the documentation directory mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a \ COPYING NEWS README.* \ $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild # Copy the slack-desc (and a custom doinst.sh if necessary) into ./install mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc # Make the package; be sure to leave it in $OUTPUT # If package symlinks need to be created during install *before* # your custom contents of doinst.sh runs, then add the -p switch to # the makepkg command below -- see makepkg(8) for details cd $PKG /sbin/makepkg -l y -c n $CWD/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE