#!/bin/sh # $Id$ # ----------------------------------------------------------------------------- # # Slackware SlackBuild script # =========================== # By: Eric Hameleers # For: nx # URL: http://www.nomachine.com/ # Needs: # Changelog: # 1.5.0-1: 14/Aug/2005 by Eric Hameleers # * Initial build. # 1.5.0-2: 18/Aug/2005 by Eric Hameleers # * Updated to first maintenance release; added patched version of # esd to get sound in the Windows/Mac client # (the default esd is broken). # If you want sound in KDE, use "UNIX/Custom" in nxclient and the # command line is "nxesddsp startkde". Then, configure KDE to use # the ESD and enable networked sound. # 1.5.0-3: 01/Sep/2005 by Eric Hameleers # * Updated nxdesktop. Also, freenx is patched so that it runs # "nxesddsp" automatically for KDE sessions, so sound should work # with the default client configuration for KDE. # # Run 'sh SlackBuild --cleanup' to build a Slackware package. # The package (.tgz) plus descriptive .txt file are created in /tmp . # Install using 'installpkg'. # # ----------------------------------------------------------------------------- # --- INIT --- # Set initial variables: CWD=`pwd` if [ "$TMP" = "" ]; then TMP=/tmp fi PRGNAM=nx VERSION=1.5.0 ARCH=${ARCH:-i486} BUILD=3 if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mcpu=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "s390x" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" fi PKG=$TMP/package-$PRGNAM if [ ! -d $TMP/tmp-$PRGNAM ]; then mkdir -p $TMP/tmp-$PRGNAM # location to build the source fi if [ ! -d $PKG ]; then mkdir -p $PKG # place for the package to be built fi SOURCE[0]=nxproxy-1.5.0-9.tar.gz SOURCE[1]=nxcomp-1.5.0-65.tar.gz SOURCE[2]=nxcompext-1.5.0-16.tar.gz SOURCE[3]=nx-X11-1.5.0-15.tar.gz SOURCE[4]=nxagent-1.5.0-90.tar.gz SOURCE[5]=nxviewer-1.5.0-14.tar.gz SOURCE[6]=nxdesktop-1.5.0-61.tar.gz SOURCE[7]=nxscripts-1.5.0-11.tar.gz SOURCE[8]=esound-0.2.35.tar.bz2 SOURCE[9]=nxagent SOURCE[10]=docs.tar.bz2 PATCH[0]=NX.diff PATCH[1]=ESPEAKER-fix.diff PATCH[2]=fix-artsd.diff # --- PACKAGE BUILDING --- echo "++" echo "|| $PRGNAM-$VERSION" echo "++" rm -rf $PKG/* cd $PKG # Explode the package framework: if [ -f $CWD/_$PRGNAM.tar.gz ]; then explodepkg $CWD/_$PRGNAM.tar.gz fi cd $TMP/tmp-$PRGNAM # --- TARBALL EXTRACTION,PATCH,MODIFY --- echo "Extracting the program tarballs for $PRGNAM..." for (( i = 0; i < 9; i++ )) ; do if ! [ -f ${CWD}/${SOURCE[$i]} ]; then echo "Missing source file ${SOURCE[$i]} !"; exit 1 fi if file ${CWD}/${SOURCE[$i]} | grep -q ": gzip "; then tar -zxvf ${CWD}/${SOURCE[$i]} else tar -jxvf ${CWD}/${SOURCE[$i]} fi done patch -p0 < $CWD/${PATCH[0]} chown -R root.root * find . -perm 777 -exec chmod 755 {} \; # --- BUILDING --- echo Building ... ln -s rdesktop.1 nxdesktop/doc/nxdesktop.1 cat <<-EOF >> nx-X11/config/cf/host.def #ifdef i386Architecture #undef DefaultGcc2i386Opt #define DefaultGcc2i386Opt $SLKCFLAGS -fno-strict-aliasing #endif #ifdef MipsArchitecture #undef DefaultGcc2MipsOpt #define DefaultGcc2MipsOpt $SLKCFLAGS -fno-strict-aliasing #endif #ifdef s390xArchitecture #undef OptimizedCDebugFlags #define OptimizedCDebugFlags $SLKCFLAGS -fno-strict-aliasing #endif EOF export CFLAGS="$SLKCFLAGS" export CXXFLAGS="$SLKCFLAGS" sed -i -e "s|CXXFLAGS=.-O.*|CXXFLAGS=$CXXFLAGS|" */configure CONFIGURE="./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc" # build Compression Library and Proxy for i in nxcomp nxproxy; do (cd $i; $CONFIGURE; make) done # build X11 Support Libraries and Agents (cd nx-X11; make World) # build Extended Compression Library (cd nxcompext; $CONFIGURE; make) # build RFB Agent (cd nxviewer; xmkmf -a cp -a /usr/X11R6/lib/libXp.so* ../nx-X11/exports/lib/ make 2> /dev/null ) # build RDP Agent if [ "$ARCH" = "i386" -o "$ARCH" = "i486" -o "$ARCH" = "x86_64" ]; then (cd nxdesktop ./configure --prefix=/usr --sharedir=/usr/share/NX make ) fi # Build nxesddsp (cd esound-0.2.35; $CONFIGURE --enable-arts; make) # # Install all the needed stuff to the package dir # mkdir -p $PKG/usr/bin mkdir -p $PKG/usr/lib/NX/lib mkdir -p $PKG/usr/man/man1 # install X11 Support Libraries and Agents cp -a nx-X11/lib/X11/libX11.so.* \ nx-X11/lib/Xext/libXext.so.* \ nx-X11/lib/Xrender/libXrender.so.* \ $PKG/usr/lib/NX/lib/ cp -a nx-X11/programs/Xserver/nxagent $PKG/usr/lib/NX/ chmod 755 $PKG/usr/lib/NX/nxagent cp -a $CWD/${SOURCE[9]} $PKG/usr/bin/ # install Compression Libraries and Proxy cp -a nxcomp/libXcomp.so.* $PKG/usr/lib/NX/lib/ cp -a nxcompext/libXcompext.so.* $PKG/usr/lib/NX/lib/ cp -a nxproxy/nxproxy $PKG/usr/lib/NX/ chmod 755 $PKG/usr/lib/NX/nxproxy ln -snf nxagent $PKG/usr/bin/nxproxy # install RFB Agent ( cd nxviewer make install DESTDIR=$PKG mv $PKG/usr/X11R6/bin/nxviewer $PKG/usr/lib/NX/ ln -snf nxagent $PKG/usr/bin/nxviewer chmod 755 $PKG/usr/bin/nxviewer mv $PKG/usr/X11R6/bin/nxpasswd $PKG/usr/bin/ ) rmdir $PKG/usr/X11R6/bin rmdir $PKG/usr/X11R6 # install RDP Agent if [ "$ARCH" = "i386" -o "$ARCH" = "i486" -o "$ARCH" = "x86_64" ]; then (cd nxdesktop make install DESTDIR=$PKG mv $PKG/usr/bin/nxdesktop $PKG/usr/lib/NX/ ln -snf nxagent $PKG/usr/bin/nxdesktop chmod 755 $PKG/usr/bin/nxdesktop ) fi # Install nxesd sound wrapper (cd esound-0.2.35 cp -a esd $PKG/usr/lib/NX/nxesd cp -a esddsp $PKG/usr/lib/NX/nxesddsp ln -snf nxagent $PKG/usr/bin/nxesddsp chmod 755 $PKG/usr/bin/nxesddsp ) # --- DOCUMENTATION --- mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION # install scripts cp -a nxscripts $PKG/usr/doc/$PRGNAM-$VERSION # documentation and license tar -jxvf $CWD/${SOURCE[10]} -C $PKG/usr/doc/$PRGNAM-$VERSION cp nxcomp/LICENSE $PKG/usr/doc/$PRGNAM-$VERSION cp nxcomp/README $PKG/usr/doc/$PRGNAM-$VERSION/README.nxcomp cp nxdesktop/README $PKG/usr/doc/$PRGNAM-$VERSION/README.nxdesktop cp -a nxdesktop/doc $PKG/usr/doc/$PRGNAM-$VERSION/nxdesktop chmod -R a-w $PKG/usr/doc/$PRGNAM-$VERSION/* # Compress the man page(s) gzip -9f $PKG/usr/man/*/* # Strip binaries ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) # --- OWNERSHIP, RIGHTS --- chmod -R o-w $PKG chown root:bin $PKG/usr/bin/* $PKG/usr/sbin/* $PKG/bin/* $PKG/sbin/* \ $PKG/usr/X11R6/bin/* $PKG/opt/kde/bin/* 2>/dev/null # --- PACKAGE DESCRIPTION --- mkdir -p $PKG/install cat $CWD/${PRGNAM}.slack-desc > $PKG/install/slack-desc if [ -f $CWD/doinst.sh ]; then cat $CWD/doinst.sh > $PKG/install/doinst.sh fi # --- BUILDING --- # Build the package: cd $PKG makepkg --linkadd y --chown n $TMP/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.tgz \ 2>&1 | tee $CWD/makepkg-${PRGNAM}.log (cd $TMP && md5sum ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.tgz > ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.tgz.md5) cat $CWD/${PRGNAM}.slack-desc | grep "^${PRGNAM}" > $TMP/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}.txt # --- CLEANUP --- # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP/tmp-$PRGNAM rm -rf $PKG fi