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

Mauro Giachero mauro.giachero at gmail.com
Mon May 31 07:27:23 UTC 2010


On Mon, May 31, 2010 at 8:06 AM, Andrew Antle <andrew.antle at gmail.com>wrote:

> Hello -
>

Hello Andrew,


> This is my first attempt at writing a SlackBuild script.  If someone would
> look it over to make sure I haven't screwed anything up, that would be
> much appreciated. :)
>
>
> #!/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.
> #
> # 0.1 2010-05-08
> # 0.2 2010-05-31
>

I don't think we usually keep this kind of version tracking.

PRGNAM=swi-prolog
> VERSION=${VERSION:-5.10.0}
> 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.


> # 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
>
> # 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.


> Thanks,
>

You're welcome.


> --
> Andrew Antle
>

-- 
Mauro Giachero
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.slackbuilds.org/pipermail/slackbuilds-users/attachments/20100531/6ca4d2ad/attachment.htm>


More information about the SlackBuilds-users mailing list