diff --git a/xfig-3.2.7-0.build.sh b/xfig-3.2.7-0.build.sh new file mode 100755 index 0000000..4875362 --- /dev/null +++ b/xfig-3.2.7-0.build.sh @@ -0,0 +1,119 @@ +#! /bin/bash + +PKG=xfig +VERSION=3.2.7 +BUILD=0 + +PREFIX=/pkg/$PKG-$VERSION-$BUILD +if [ -n "$TESTING" ]; then PREFIX=/dev/shm/$PKG-$VERSION-$BUILD ; fi + +set -xe +umask 022 + +BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.build.tmp +test -d $BUILD_TMPDIR && ( chmod -R u+rwx $BUILD_TMPDIR || true ; rm -rf $BUILD_TMPDIR ) +mkdir -p $BUILD_TMPDIR/home +export TMPDIR=$BUILD_TMPDIR +export HOME=$BUILD_TMPDIR/home + +exec $PREFIX/profile <<-EOF + PATH=$PREFIX/bin:\$PATH + if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} ; fi +EOF +. $PREFIX/profile + +export MAKEFLAGS="-j $(nproc)" + +BUILDDIR=$PREFIX/build + +mkdir -p $BUILDDIR +cd $BUILDDIR + +( + NPBMVERSION=10.73.28 + test -e netpbm-${NPBMVERSION}.tar.gz || wget https://sourceforge.net/projects/netpbm/files/latest/download -O netpbm-${NPBMVERSION}.tar.gz + test -d netpbm-${NPBMVERSION} || tar xvf netpbm-${NPBMVERSION}.tar.gz + cd netpbm-${NPBMVERSION} + cat config.mk.in - <<- EOF > config.mk + DEFAULT_TARGET = nonmerge + NETPBMLIBTYPE = unixshared + NETPBMLIBSUFFIX = so + STATICLIB_TOO = Y + CFLAGS = -O3 -ffast-math -pedantic -fno-common -Wall -Wno-uninitialized -Wmissing-declarations -Wimplicit -Wwrite-strings -Wmissing-prototypes -Wundef -Wno-unknown-pragmas + CFLAGS_MERGE = -Wno-missing-declarations -Wno-missing-prototypes + LDRELOC = ld --reloc + LINKER_CAN_DO_EXPLICIT_LIBRARY = Y + LINKERISCOMPILER = Y + CFLAGS_SHLIB += -fPIC + TIFFLIB = libtiff.so + JPEGLIB = libjpeg.so + ZLIB = libz.so + NETPBM_DOCURL = http://netpbm.sourceforge.net/doc/ + WANT_SSE = Y + RPATH = -Wl,-rpath=$PREFIX/lib +EOF + + make || make -j1 + PKGDIR=$(pwd)/pkg + make package pkgdir=$PKGDIR + + # say no to interactive buildtools/installnetpbm.pl + mkdir -p $PREFIX/bin + mkdir -p $PREFIX/share/man + mkdir -p $PREFIX/lib/pkgconfig + + sed -e "s,@VERSION@,$NPBMVERSION," \ + -e "s,@LINKDIR@,$PREFIX/lib," \ + -e "s,@INCLUDEDIR@,$PREFIX/include," \ + buildtools/pkgconfig_template > $PREFIX/lib/pkgconfig/netpbm.pc + + cd $PKGDIR + cp -va bin $PREFIX + cp -va include $PREFIX + ( cd $PREFIX/include; for i in netpbm/*.h; do ln -s $i; done ) # an awful compatibility hack ... + if [ -r lib/libnetpbm.so.11 ]; then + ( cd lib ; rm -f libnetpbm.so ; ln -sf libnetpbm.so.11 libnetpbm.so ) + else + echo "ERROR: libnetpbm.so.11 not found." + echo "Please edit the correct library major version into the build script" + kill $$; exit 1 + fi + cp -va lib $PREFIX + cp -vp link/libnetpbm.a $PREFIX/lib + cp -va man/man? $PREFIX/share/man + cp -vp misc/* $PREFIX/lib +) + +( + test -e xfig-${VERSION}.tar.xz || wget http://downloads.sourceforge.net/mcj/xfig-full-${VERSION}a.tar.xz -O xfig-${VERSION}.tar.xz + test -d xfig-${VERSION}a || tar xvf xfig-${VERSION}.tar.xz + cd xfig-${VERSION}a + ./configure \ + --prefix=$PREFIX + make + make install + # create a xfig wrapper since /etc/X11/app-defaults/Fig is gone/outdated + ( + cd $PREFIX/bin + mv xfig xfig.app + cat <<- EOF > xfig + #! /bin/bash + XAPPLRESDIR=\${XAPPLRESDIR:-$PREFIX/share/X11/app-defaults} \ + exec $PREFIX/bin/xfig.app "\$@" + EOF + chmod 755 xfig + ) +) + +( + cd fig2dev-${VERSION}a + ./configure \ + --prefix=$PREFIX + make + make install +) + +exit