[Slackbuilds-users] XEmacs SlackBuild

Sean MacLennan seanm at seanm.ca
Sun Aug 23 22:16:46 UTC 2009


I have an XEmacs Slackbuild file I have started modifying to more
closely fit the slackbuilds format. I hope it is ok to ask questions
here about the SlackBuild file. If not, ignore this email ;)

The file is at the bottom of the email. Please be kind, this files is
many years old and predates the SlackBuild file when the files where
all called make-slack.

1) First off, there are three patches. One of the patches just gets
shifted function keys working. This patch could very easily be mapped
out for the slackbuilds case, but I have used this patch for years with
no problems.

The other two patches allow you to build an XEmacs package while XEmacs
is installed. I could leave out the two patches, but you would have to
uninstall XEmacs to build a new XEmacs package.

2) A second problem is that I require two XEmacs packages to build the
Slackware package. These packages are required to use the XEmacs
package system. Yes, you need some packages to get the package system
going to download packages :( Adding them to the Slackware package made
sense for personal use and for Linuxpackages. I am not sure it is a
good idea to require them for the slackbuilds case since the versions
are hardcoded.

3) The website made it clear you have to set the SLKCFLAGS. I really
think this is a bad idea for XEmacs. I have a comment in the SlackBuild
file about this. How hard a requirement is this?

Cheers,
   Sean

#!/bin/sh
# Slackware build script for XEmacs
# Created by Sean MacLennan <xemacs at seanm.ca>

CWD=`pwd`

DO_UNTAR=1
DO_BUILD=1
DO_SLACKBUILDS=1

VERSION=21.4.22
BASE_VERSION=2.19
EFS_VERSION=1.34
ARCH=${ARCH:-i486}
BUILD=${BUILD:-2}

if [ $DO_SLACKBUILDS -eq 1 ] ; then
TMP=${TMP:-/tmp/SBo}
TAG=${TAG:-_SBo}
OUTPUT=${OUTPUT:-/tmp}

# This is required for slackbuilds. I recommend turning this off since
# XEmacs quite often needs to be built at specific optimization
# levels. You are much better off trusting the XEmacs Makefile ;)
#
# That said, with Slackware 12.2 a quick sanity check of the xemacs
# with the i486 options worked.
#
# To turn it off, change the true below to false
if true; then
if [ "$ARCH" = "i486" ]; then
   SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
   SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
   SLKCFLAGS="-O2 -fPIC"
fi
fi

else
TMP=${TMP:-/tmp}
TAG=${TAG:-sam}
OUTPUT=$TMP
fi

#DATADIR=usr/share
DATADIR=usr/lib

# Let's be nice and warn upfront if things are missing
ok=1
for f in xemacs-$VERSION.tar.bz2 \
	xemacs-base-$BASE_VERSION-pkg.tar.gz \
	efs-$EFS_VERSION-pkg.tar.gz \
	check-features.patch \
	dump-paths.patch \
	mod-shift.patch ; do
    [ -f ./$f ] || { echo "$f missing"; ok=0; }
done
[ $ok = 1 ] || exit 2

PKG=$TMP/package-xemacs
rm -rf $PKG
mkdir -p $TMP $OUPUT $PKG || exit 1

cd $TMP
if [ $DO_UNTAR -eq 1 ] ; then
    rm -rf xemacs-$VERSION
    tar xjf $CWD/xemacs-$VERSION.tar.bz2 || exit 1

    cd xemacs-$VERSION

    # These patches allow building xemacs with xemacs installed
    # dump-paths patch from Enrico Scholz
    patch -p1 < $CWD/dump-paths.patch || exit 1
    patch -p1 < $CWD/check-features.patch || exit 1

    # Obsolete in Xorg 6.9.0
    patch -p1 < $CWD/mod-shift.patch || exit 1
else
    cd xemacs-$VERSION || exit 1
    echo "Skipping untar...."
fi

if [ $DO_BUILD -eq 1 ] ; then
    if [ -n "$SLKCFLAGS" ] ; then
    CFLAGS="$SLKCFLAGS" ./configure \
		--prefix=/usr \
		--datadir=/$DATADIR \
		--with-sound=none \
		--with-file-coding \
		$ARCH-slackware-linux || exit 1
    else
    ./configure \
		--prefix=/usr \
		--datadir=/$DATADIR \
		--with-sound=none \
		--with-file-coding \
		$ARCH-slackware-linux || exit 1
    fi

    make || exit 1
else
    echo "Skipping build...."
fi


make prefix=$PKG/usr datadir=$PKG/$DATADIR install || exit 1
#make prefix=$PKG/usr datadir=$PKG/$DATADIR gzip-el

(   # Add minimal packages to allow package tools to work
    mkdir -p $PKG/$DATADIR/xemacs/xemacs-packages
    cd $PKG/$DATADIR/xemacs/xemacs-packages
    tar zxf $CWD/xemacs-base-$BASE_VERSION-pkg.tar.gz || exit 1
    tar zxf $CWD/efs-$EFS_VERSION-pkg.tar.gz || exit 1
    # Make sure the .elc files are newer
    find . -name \*.elc -exec touch {} \;
)

# What is this 2.3M for?????
rm -rf $PKG/usr/lib/xemacs-$VERSION/$ARCH-slackware-linux/include

strip_bins () {
    for f in $1/*; do
        if file $f | fgrep -q "not stripped" ; then
	    strip $f
        fi
    done
}

strip_bins $PKG/usr/bin
strip_bins $PKG/usr/lib/xemacs-$VERSION/$ARCH-slackware-linux

gzip $PKG/usr/man/*/*

# Some documentation
mkdir -p $PKG/usr/doc/xemacs-$VERSION
cp BUGS CHANGES-release COPYING ChangeLog \
    Installation PROBLEMS README README.packages \
    $PKG/usr/doc/xemacs-$VERSION

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

# For lp.n
chown -R root.root $PKG
#chown -R root.bin $PKG/usr/bin

cat <<EOF >$PKG/install/doinst.sh
#!/bin/sh

# Make sure the elc files are newer than the el files
touch $DATADIR/xemacs-$VERSION/lisp/*.elc
touch $DATADIR/xemacs-$VERSION/lisp/*/*.elc
touch $DATADIR/xemacs/xemacs-packages/lisp/xemacs-base/*.elc
touch $DATADIR/xemacs/xemacs-packages/lisp/efs/*.elc

EOF

# And add the slackbuild
install -D -m664 $CWD/xemacs.SlackBuild
$PKG/usr/src/slackbuilds/xemacs.SlackBuild

########################################################################

cd $PKG

if [ $DATADIR = "usr/share" ] ; then
  ( cd usr/bin
    XBIN=../share/xemacs-$VERSION/bin
    mkdir -p $XBIN || exit 1
    mv xemacs-$VERSION xemacs*.dmp $XBIN || exit 1
    rm xemacs
    ln -s $XBIN/xemacs-$VERSION xemacs
  ) || exit 3
fi

########################################################################
# Split out info package
rm -rf $PKG-info
INFODIR=$DATADIR/xemacs-$VERSION/info
mkdir -p $PKG-info/$INFODIR
mkdir -p $PKG-info/install
cat $CWD/slack-desc-info > $PKG-info/install/slack-desc

mv $INFODIR/* $PKG-info/$INFODIR
gzip $PKG-info/$INFODIR/*

# DO NOT gzip the dir file - it screws up XEmacs
gunzip $PKG-info/$INFODIR/dir.gz

########################################################################
# Split out lisp package
rm -rf $PKG-lisp
LISPDIR=$DATADIR/xemacs-$VERSION/lisp
mkdir -p $PKG-lisp/$LISPDIR
mkdir -p $PKG-lisp/install
cat $CWD/slack-desc-lisp > $PKG-lisp/install/slack-desc

# Taken from gzip-el.sh in lib-src dir
find "$LISPDIR" -type f -name "*.el" -print |
    while read file; do
	if [ -s "${file}c" ] ; then
	    install -D -m 644 "$file" "$PKG-lisp/$file"
	    rm "$file"
	fi
    done

cat <<EOF >$PKG-lisp/install/doinst.sh
#!/bin/sh

# Make sure the .elc files are newer
find $LISPDIR -name \*.elc -exec touch {} \;
EOF

########################################################################
# Split out misc package
rm -rf $PKG-misc
ETCDIR=$DATADIR/xemacs-$VERSION/etc
mkdir -p $PKG-misc/$ETCDIR
mkdir -p $PKG-misc/install
cat $CWD/slack-desc-misc > $PKG-misc/install/slack-desc

cp -a $ETCDIR/photos $PKG-misc/$ETCDIR
rm -rf $ETCDIR/photos

cp -a $ETCDIR/sparcworks $PKG-misc/$ETCDIR
rm -rf $ETCDIR/sparcworks

cp -a $ETCDIR/tests $PKG-misc/$ETCDIR
rm -rf $ETCDIR/tests

for f in $ETCDIR/* ; do
    [ -f $f ] && mv $f $PKG-misc/$ETCDIR
done

# This is required - put it back
mv $PKG-misc/$ETCDIR/package-index.LATEST.gpg $PKG/$ETCDIR

########################################################################
# Build the packages

cd $PKG
makepkg -l y -c n $OUTPUT/xemacs-$VERSION-$ARCH-$BUILD$TAG.tgz
cd $PKG-info
makepkg -l n -c n $OUTPUT/xemacs-info-$VERSION-noarch-$BUILD$TAG.tgz
cd $PKG-lisp
makepkg -l n -c n $OUTPUT/xemacs-lisp-$VERSION-noarch-$BUILD$TAG.tgz
cd $PKG-misc
makepkg -l n -c n $OUTPUT/xemacs-misc-$VERSION-noarch-$BUILD$TAG.tgz

# Clean up the extra stuff:
if [ "$1" = "--cleanup" ]; then
  rm -rf $TMP/xemacs-${VERSION}
  rm -rf $PKG $PKG-info $PKG-lisp $PKG-misc
fi


More information about the SlackBuilds-users mailing list