#!/bin/sh # Slackware build script for CDE # Copyright 2013 Matteo Bernardini , Pisa, Italy # 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=CDE VERSION=${VERSION:-20131020_6b0da8f} 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 DOCS="CONTRIBUTORS COPYING HISTORY README copyright" SRCNAM=cde-src PREFIX=/usr/dt # this is hardcoded in the sources CDEGRP=${CDEGRP:-cde} CDEGID=${CDEGID:-310} # Check for $CDEGRP presence if ! getent group "$CDEGRP" 2>&1 > /dev/null; then printf "\n You must have a \"$CDEGRP\" group in order to run this script. Add it with something like this: groupadd -g $CDEGID $CDEGRP\n" exit 1 fi # Check for a previous install if [ -d /var/dt ]; then printf "\n You must cleanup from a previous install: issue an rm -fR /var/dt /usr/dt /etc/dt /usr/spool/calendar\n" exit 1 fi set -e rm -rf $PKG mkdir -p $TMP $PKG/usr $OUTPUT cd $TMP rm -rf $SRCNAM-$VERSION tar xvf $CWD/$SRCNAM-$VERSION.tar.?z* cd $SRCNAM-$VERSION/cde 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 {} \; # http://sourceforge.net/p/cdesktopenv/wiki/LinuxBuild/ mkdir -p imports/x11/include ln -s /usr/include/X11 imports/x11/include/X11 sed -i "s|-g -pipe|$SLKCFLAGS -pipe|" config/cf/linux.cf CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ make -j1 World ( cd admin/IntegTools/dbTools ./installCDE -s $TMP/$SRCNAM-$VERSION/cde/ ) # we move stuff from the hardcoded destinations of the make install mkdir -p $PKG/etc $PKG/var/spool/calendar mv $PREFIX $PKG/usr/ mv /etc/dt $PKG/etc/ mv /var/dt $PKG/var/ # remove some spam in /tmp rm -f /tmp/CDE-*.err /tmp/CDE-*.good /tmp/CDE-*.lst /tmp/CDE-*.missing 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 install -m 0755 -D $CWD/files/CDE.sh $PKG/etc/profile.d/CDE.sh install -m 0755 -D $CWD/files/CDE.csh $PKG/etc/profile.d/CDE.csh # install a script to run in the post-install install -m 0755 -D admin/IntegTools/post_install/linux/configRun \ ${PKG}${PREFIX}/opt/sbin/configRun # install a desktop file, a script to start the session and an xinitrc install -m 0644 -D $CWD/files/cde.desktop $PKG/usr/share/xsessions/cde.desktop install -m 0755 -D $CWD/files/startxsession.sh $PKG/usr/dt/bin/startxsession.sh install -m 0755 -D $CWD/files/xinitrc.cde $PKG/etc/X11/xinit/xinitrc.cde ( cd ${PKG}${PREFIX} ; rm -f $DOCS ) mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION sed "s|@LIBDIRSUFFIX@|$LIBDIRSUFFIX|" $CWD/README.Slackware > $PKG/usr/doc/$PRGNAM-$VERSION/README.Slackware cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc sed "s|@CDEGRP@|$CDEGRP|" $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}