#!/bin/sh

# Rebuild like Debian does, but without the whole infrastructure.
# Used for bisect.

set -e

cp config.mk.in config.mk
echo 'DEFAULT_TARGET = nonmerge
NETPBMLIBTYPE=unixshared
NETPBMLIBSUFFIX=so
STATICLIB_TOO=Y
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
PNGHDR_DIR = USE_PKG_CONFIG.a
PNGLIB = USE_PKG_CONFIG.a
ZLIB = libz.so
X11HDR_DIR = USE_PKGCONFIG.a
X11LIB = USE_PKGCONFIG.a
NETPBM_DOCURL = http://netpbm.sourceforge.net/doc/
INSTALL=install
STRIPFLAG =
' >> config.mk
echo "CFLAGS = `dpkg-buildflags --get CFLAGS`" >> config.mk
echo "running make" 1>&2
make
echo "running testsuite" 1>&2
make check-tree RESULTDIR=`pwd`/debian/netpbm-test
