#!/bin/bash # screen.SlackBuild # Heavily based on the original Slackware build scripts, # Modified by Stuart Winter # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGSERIES/$PACKAGE export PORTCWD=$PWD # Temporary build locations: export TMPBUILD=$TMP/build-$PACKAGE export PKG=$TMP/package-$PACKAGE mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Determine the CFLAGS for the known architectures: case $PORTARCH in arm) export SLKCFLAGS="-O2 -march=armv3 -mtune=xscale" ;; powerpc) export SLKCFLAGS="-O2" ;; sparc) export SLKCFLAGS="-O2" ;; hppa) export SLKCFLAGS="-O2" ;; *) export SLKCFLAGS="-O2" ;; esac # Extract source: tar jxvvf $CWD/$PACKAGE-$VERSION.tar.bz2 cd $PACKAGE-$VERSION slackhousekeeping # Configure: CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --with-sys-screenrc=/etc/screenrc \ --with-pty-mode=0620 \ --with-pty-group=5 \ --enable-telnet \ --disable-socket-dir \ --enable-locale \ --enable-colors256 \ --enable-rxvt_osc \ $ARCH-slackware-linux || failconfig # Substitutions: perl -pi -e 's|.*#undef HAVE_BRAILLE.*|#define HAVE_BRAILLE 1|' config.h perl -pi -e 's|/usr/local/etc/screenrc|/etc/screenrc|' etc/etcscreenrc doc/* perl -pi -e 's|/local/etc/screenrc|/etc/screenrc|' doc/* # Build: make || failmake # Install into package: make install DESTDIR=$PKG || failinstall chmod 755 $PKG/usr/bin/screen-$VERSION mkdir -p $PKG/etc/skel cat etc/etcscreenrc > $PKG/etc/screenrc.new cat etc/screenrc > $PKG/etc/skel/.screenrc.new # Copy docs: mkdir -p $PKG/usr/doc/$PACKAGE-$VERSION chmod 644 doc/FAQ cp -favv COPYING ChangeLog INSTALL NEWS README TODO \ doc/FAQ doc/README.DOTSCREEN \ $PKG/usr/doc/$PACKAGE-$VERSION # Package install script: mkdir -pm755 $PKG/install install -m644 $CWD/slack-desc $PKG/install cat << EOF > $PKG/install/doinst.sh #!/bin/sh config() { NEW="\$1" OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)" # If there's no config file by that name, mv it over: if [ ! -r \$OLD ]; then mv \$NEW \$OLD elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then # toss the redundant copy rm \$NEW fi # Otherwise, we leave the .new copy for the admin to consider... } config etc/screenrc.new config etc/skel/.screenrc.new # This is probably safer than leaving the hidden .new file... maybe? rm -f etc/skel/.screenrc.new EOF # If necessary, start the fakeroot server so we can set file/dir ownerships: start_fakeroot # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # chown -R root:root, chmod -R og-w, slackchown, slack644docs # Build the package: if [ $PORTARCH = arm ]; then slackmp # run makepkg else makepkg -l y -c n $PKGSTORE/$PKGSERIES/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz fi # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links