[Slackbuilds-users] swi-prolog SlackBuild - First attempt

Andrew Antle andrew.antle at gmail.com
Mon May 31 08:03:17 UTC 2010


On Mon, May 31, 2010 at 09:27:23AM +0200, Mauro Giachero wrote:
> On Mon, May 31, 2010 at 8:06 AM, Andrew Antle <andrew.antle at gmail.com>wrote:
> 
> > ARCH=${ARCH:-i486}
> 
> ARCH isn't set this way any more in the latest template.
> 
> > BUILD=${BUILD:-2}
> 
> This should be 1 in the script you'll submit
> 
> > TAG=${TAG:-_SBo}
> 
> You miss the whole ARCH setting code here -- you'd better use the latest
> template when submitting scripts.
> 
> > CWD=$(pwd)
> > TMP=${TMP:-/tmp/SBo}
> > PKG=$TMP/package-$PRGNAM
> > OUTPUT=${OUTPUT:-/tmp}
> >
> > # Default CFLAGS not set as configure works this out.  Is this wrong?
> 
> If configure allows overriding its autodetected parameters with CFLAGS then
> yes, it's wrong.
> Of course unless there are strong reasons against overriding them (like huge
> performance drawbacks)
> 
> > if [ "$ARCH" = "i486" ]; then
> >  SLKCFLAGS=""
> >  LIBDIRSUFFIX=""
> > elif [ "$ARCH" = "i686" ]; then
> >  SLKCFLAGS=""
> >  LIBDIRSUFFIX=""
> > elif [ "$ARCH" = "x86_64" ]; then
> >  SLKCFLAGS=""
> >  LIBDIRSUFFIX="64"
> > fi
>
> This piece also misses something from the last template.
>
> > # 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:
> 
> Drop this comment.
> 
> > find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
>     | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
> >
> > # Compress man pages
> > # If the man pages are installed to /usr/share/man instead, you'll need to
> > either
> > # add the --mandir=/usr/man flag to configure or move them manually after
> > the
> > # make install process is run.
> 
> This too.
> 
> > find $PKG/usr/man -type f -exec gzip -9 {} \;
> >
> > mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
> > 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:-tgz}
> 
> I don't see other obvious things, but I haven't actually tried running the
> script.

Hi Mauro -

Thanks for the feedback. Here's a diff, and the revised SlackBuild is
attached.


$ diff -u swi-prolog.SlackBuild.orig swi-prolog.SlackBuild
--- swi-prolog.SlackBuild.orig	2010-05-31 03:46:17.547816051 -0400
+++ swi-prolog.SlackBuild	2010-05-31 03:58:52.323700794 -0400
@@ -21,31 +21,37 @@
 # 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.
-#
-# 0.1 2010-05-08
-# 0.2 2010-05-31
 
 PRGNAM=swi-prolog
 VERSION=${VERSION:-5.10.0}
-ARCH=${ARCH:-i486}
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-1}
 TAG=${TAG:-_SBo}
 
+if [ -z "$ARCH" ]; then
+  case "$( uname -m )" in
+    i?86) ARCH=i486 ;;
+    arm*) ARCH=arm ;;
+       *) ARCH=$( uname -m ) ;;
+  esac
+fi
+
 CWD=$(pwd)
 TMP=${TMP:-/tmp/SBo}
 PKG=$TMP/package-$PRGNAM
 OUTPUT=${OUTPUT:-/tmp}
 
-# Default CFLAGS not set as configure works this out.  Is this wrong?
 if [ "$ARCH" = "i486" ]; then
-  SLKCFLAGS=""
+  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
   LIBDIRSUFFIX=""
 elif [ "$ARCH" = "i686" ]; then
-  SLKCFLAGS=""
+  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
   LIBDIRSUFFIX=""
 elif [ "$ARCH" = "x86_64" ]; then
-  SLKCFLAGS=""
+  SLKCFLAGS="-O2 -fPIC"
   LIBDIRSUFFIX="64"
+else
+  SLKCFLAGS="-O2"
+  LIBDIRSUFFIX=""
 fi
 
 # Custom variable because source package name differs from what we're
@@ -82,16 +88,9 @@
 make
 make install DESTDIR=$PKG
 
-# 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 | xargs file | grep -e "executable" -e "shared object" | grep ELF \
   | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
 
-# Compress man pages
-# If the man pages are installed to /usr/share/man instead, you'll need to either
-# add the --mandir=/usr/man flag to configure or move them manually after the
-# make install process is run.
 find $PKG/usr/man -type f -exec gzip -9 {} \;
 
 mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION


Thanks again,
-- 
Andrew Antle
-------------- next part --------------
#!/bin/sh

# Slackware build script for SWI-Prolog
#
# Copyright 2010  Andrew Antle  <andrew at antlechrist dot org>
# 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.

PRGNAM=swi-prolog
VERSION=${VERSION:-5.10.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i486 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -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

# Custom variable because source package name differs from what we're
# going to call it.
TARNAM=pl

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $TARNAM-$VERSION
tar xvf $CWD/$TARNAM-$VERSION.tar.gz
cd $TARNAM-$VERSION
chown -R root:root .
find . \
 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --mandir=/usr/man \
  --docdir=/usr/doc/$PRGNAM-$VERSION \
  --build=$ARCH-slackware-linux \
  --with-world

make
make install DESTDIR=$PKG

find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

find $PKG/usr/man -type f -exec gzip -9 {} \;

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
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:-tgz}


More information about the SlackBuilds-users mailing list