#!/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 # 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.?z cd $PKGNAM-$VERSION || exit 1 slackhousekeeping # Apply patches: # This allows some other patches to come first by making them bz2... gz next if [ ! -z "$(ls $CWD/patches/ncurses*bz2 2> /dev/null)" ]; then bzcat $CWD/patches/ncurses*bz2 > tmp-patch.sh bash tmp-patch.sh || exit 1 fi # Apply official upstream patches. if [ ! -z "$(ls $CWD/patches/ncurses-$VERSION-2*.patch.gz 2> /dev/null)" ]; then for file in $CWD/patches/ncurses-$VERSION-2*.patch.gz ; do zcat $file | patch -p1 --verbose || exit 1 done fi # Apply upstream patch collection: xzcat $CWD/ncurses-5.9-20141206-patch.sh.xz > ncurses-5.9-20141206-patch.sh sh ncurses-5.9-20141206-patch.sh zcat $CWD/ncurses.mkhashsize.diff.gz | patch -p1 --verbose || exit 1 ncurses_configure() { # x86_64 flags are: + X86_64OPTS=" --with-chtype=long --with-mmask-t=long " # as a reminder incase we need to find some ARM specific ones too. CPPFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \ ./configure $WIDEC \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --mandir=/usr/man \ --with-gpm \ --disable-termcap \ --with-shared \ --with-cxx-shared \ --without-normal \ --without-debug \ --without-profile \ --enable-pc-files \ --with-pkg-config-libdir=/usr/lib${LIBDIRSUFFIX}/pkgconfig \ --enable-symlinks \ --without-ada \ --program-prefix="" \ --program-suffix="" \ --build=$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 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++ changelogliposuction NEWS $PKGNAM $VERSION # Trim down a "ChangeLog" file # 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