#!/bin/bash # ncurses.SlackBuild # Almost entirely the original build script for Slackware Linux by Patrick Volkerding # Modified by Stuart Winter for the Slackware porting Project. # 1-Mar-2004 # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/l/ncurses export PORTCWD=$PWD # Determine the CFLAGS for the known architectures: case $ARCH in arm) SLKCFLAGS="-O2 -march=armv4t" LIBDIRSUFFIX="" ;; powerpc) SLKCFLAGS="" ;; sparc) SLKCFLAGS="" ;; *) SLKCFLAGS="" ;; esac # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete and re-create temporary directories # Extract source: tar xvvf $CWD/$PKGNAM-$VERSION.tar.gz cd $PKGNAM-$VERSION slackhousekeeping # Apply patches: if [ ! -z "$(ls $CWD/patches/ncurses*bz2)" ]; then bzcat $CWD/patches/ncurses*bz2 > tmp-patch.sh bash tmp-patch.sh || exit 1 fi for file in $CWD/patches/ncurses-$VERSION-2*.patch.gz ; do zcat $file | patch -p1 --verbose || exit 1 done zcat $CWD/ncurses.mkhashsize.diff.gz | patch -p1 --verbose || exit 1 ncurses_configure() { CPPFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \ ./configure $WIDEC \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --with-gpm \ --disable-termcap \ --with-normal \ --with-shared \ --enable-symlinks \ --without-debug \ --without-profile \ --without-ada \ --program-prefix="" \ --program-suffix="" \ $ARCH-slackware-linux-gnueabi || failconfig } # Configure & compile normally: ncurses_configure make $NUMJOBS || failmake make install make install DESTDIR=$PKG # Build/install again with wide character support: make clean WIDEC=--enable-widec ncurses_configure make $NUMJOBS || failmake make install make install DESTDIR=$PKG if [ ! -d $PKG/usr/include/ncursesw -a ! -L $PKG/usr/include/ncursesw ]; then ( cd $PKG/usr/include ; ln -vsf ncurses ncursesw ) fi # Move the include files from /usr/include into # /usr/include/ncurses, then make symlinks back # into /usr/include. ( cd $PKG/usr/include rm -rf ncurses mkdir ncurses mv *.h ncurses for file in ncurses/* ; do ln -sf $file . done # This shouldn't clobber the real one: mv termcap.h termcap-ncurses.h ) # Move the ncurses libraries into /lib, since they're important: mkdir -p $PKG/lib${LIBDIRSUFFIX} ( cd $PKG/usr/lib${LIBDIRSUFFIX} chmod 755 *.so chmod 644 *.a mv libncurses.so.5* $PKG/lib${LIBDIRSUFFIX} mv libncursesw.so.5* $PKG/lib${LIBDIRSUFFIX} rm -f libncurses.so ln -sf /lib${LIBDIRSUFFIX}/libncurses.so.5 libncurses.so rm -f libncursesw.so ln -sf /lib${LIBDIRSUFFIX}/libncursesw.so.5 libncursesw.so # Olde obsolete names, just in case rm -f libcurses.so ln -sf libncurses.so libcurses.so rm -f libcursesw.so ln -sf libncursesw.so libcursesw.so ) # Set TERMINFO to point to the package: export TERMINFO=$PKG/usr/share/terminfo # Fix the xterm, screen, rxvt, and Eterm entries: for tfile in $CWD/xterm.terminfo $CWD/screeninfo.src $CWD/rxvt.terminfo $CWD/Eterm.ti ; do if [ -r $tfile ]; then progs/tic -v $tfile fi done unset TERMINFO # Then, add /usr/doc/ncurses-xxxxx with appropriate files. mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION cp -a ANNOUNCE INSTALL MANIFEST NEWS README* TO-DO \ $PKG/usr/doc/$PKGNAM-$VERSION mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION/c++ cp -a c++/NEWS c++/PROBLEMS c++/README-first \ $PKG/usr/doc/$PKGNAM-$VERSION/c++ # 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 slackdesc # install slack-desc and doinst.sh slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links