<div class="gmail_quote">On Mon, May 31, 2010 at 8:06 AM, Andrew Antle <span dir="ltr"><<a href="mailto:andrew.antle@gmail.com">andrew.antle@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello -<br></blockquote><div><br>Hello Andrew,<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
This is my first attempt at writing a SlackBuild script. If someone would<br>
look it over to make sure I haven't screwed anything up, that would be<br>
much appreciated. :)<br>
<br>
<br>
#!/bin/sh<br>
<br>
# Slackware build script for SWI-Prolog<br>
#<br>
# Copyright 2010 Andrew Antle <andrew at antlechrist dot org><br>
# All rights reserved.<br>
#<br>
# Redistribution and use of this script, with or without modification, is<br>
# permitted provided that the following conditions are met:<br>
#<br>
# 1. Redistributions of this script must retain the above copyright<br>
# notice, this list of conditions and the following disclaimer.<br>
#<br>
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED<br>
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF<br>
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO<br>
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,<br>
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,<br>
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;<br>
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,<br>
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR<br>
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF<br>
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<br>
#<br>
# 0.1 2010-05-08<br>
# 0.2 2010-05-31<br></blockquote><div><br>I don't think we usually keep this kind of version tracking.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
PRGNAM=swi-prolog<br>
VERSION=${VERSION:-5.10.0}<br>
ARCH=${ARCH:-i486}<br></blockquote><div><br>ARCH isn't set this way any more in the latest template.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
BUILD=${BUILD:-2}<br></blockquote><div><br>This should be 1 in the script you'll submit<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
TAG=${TAG:-_SBo}<br></blockquote><div><br>You miss the whole ARCH setting code here -- you'd better use the latest template when submitting scripts.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
CWD=$(pwd)<br>
TMP=${TMP:-/tmp/SBo}<br>
PKG=$TMP/package-$PRGNAM<br>
OUTPUT=${OUTPUT:-/tmp}<br>
<br>
# Default CFLAGS not set as configure works this out. Is this wrong?<br></blockquote><div><br>If configure allows overriding its autodetected parameters with CFLAGS then yes, it's wrong.<br>Of course unless there are strong reasons against overriding them (like huge performance drawbacks)<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
if [ "$ARCH" = "i486" ]; then<br>
SLKCFLAGS=""<br>
LIBDIRSUFFIX=""<br>
elif [ "$ARCH" = "i686" ]; then<br>
SLKCFLAGS=""<br>
LIBDIRSUFFIX=""<br>
elif [ "$ARCH" = "x86_64" ]; then<br>
SLKCFLAGS=""<br>
LIBDIRSUFFIX="64"<br>
fi<br></blockquote><div><br>This piece also misses something from the last template.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
# Custom variable because source package name differs from what we're<br>
# going to call it.<br>
TARNAM=pl<br>
<br>
set -e<br>
<br>
rm -rf $PKG<br>
mkdir -p $TMP $PKG $OUTPUT<br>
cd $TMP<br>
rm -rf $TARNAM-$VERSION<br>
tar xvf $CWD/$TARNAM-$VERSION.tar.gz<br>
cd $TARNAM-$VERSION<br>
chown -R root:root .<br>
find . \<br>
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \<br>
-exec chmod 755 {} \; -o \<br>
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \<br>
-exec chmod 644 {} \;<br>
<br>
CFLAGS="$SLKCFLAGS" \<br>
CXXFLAGS="$SLKCFLAGS" \<br>
./configure \<br>
--prefix=/usr \<br>
--libdir=/usr/lib${LIBDIRSUFFIX} \<br>
--sysconfdir=/etc \<br>
--localstatedir=/var \<br>
--mandir=/usr/man \<br>
--docdir=/usr/doc/$PRGNAM-$VERSION \<br>
--build=$ARCH-slackware-linux \<br>
--with-world<br>
<br>
make<br>
make install DESTDIR=$PKG<br>
<br>
# Strip binaries and libraries - this can be done with 'make install-strip'<br>
# in many source trees, and that's usually acceptable if so, but if not,<br>
# use this:<br></blockquote><div><br>Drop this comment.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \<br>
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true<br>
<br>
# Compress man pages<br>
# If the man pages are installed to /usr/share/man instead, you'll need to either<br>
# add the --mandir=/usr/man flag to configure or move them manually after the<br>
# make install process is run.<br></blockquote><div><br>This too.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
find $PKG/usr/man -type f -exec gzip -9 {} \;<br>
<br>
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION<br>
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild<br>
<br>
mkdir -p $PKG/install<br>
cat $CWD/slack-desc > $PKG/install/slack-desc<br>
<br>
cd $PKG<br>
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}<br></blockquote><div><br>I don't see other obvious things, but I haven't actually tried running the script.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks,<br></blockquote><div><br>You're welcome.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
--<br>
<font color="#888888">Andrew Antle</font><br></blockquote></div><br>-- <br>Mauro Giachero<br>