sgpemv2/distro/deb/build.sh

53 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/sh
curdir="$(pwd)"
if [ "${1}" == "" ]; then
echo "You need to pass the control file as the first parameter of this script."
echo "Usage: ./build.sh <control-file> <package.tar.bz2>"
exit -1
fi
pkgname="$( awk '/^Package/ { print $2; }' "${1}" )"
version="$( awk '/^Version/ { print $2; }' "${1}" )"
echo "Building debian package from ${1}."
tarname="${pkgname}-${version}.tar.bz2"
if [ ! -f "${tarname}" ]; then
echo "Please put the source package ${tarname} in this directory and launch me again."
exit -1
fi
tar -xvjf "${tarname}"
cd "${pkgname}-${version}"
mkdir =build
cd =build
CXXFLAGS="-O3 -pipe" ../configure --disable-tests --disable-debug --prefix=/usr
make
make pdf
destdir="${curdir}/inst-root"
make DESTDIR="${destdir}" install-strip
docdir="${destdir}/usr/share/doc/${pkgname}-${version}"
mkdir -p "${docdir}"
cp doc/sgpem2uman.pdf doc/sgpem2dman.pdf "${docdir}"
cd ..
for i in AUTHORS NEWS README COPYING ChangeLog; do
gzip -c "${i}" > "${docdir}/${i}.gz"
done
cd ${curdir}
mkdir -p "${destdir}/DEBIAN"
cp "$1" "${destdir}/DEBIAN/control"
dpkg -b "${destdir}" .
rm -rf "${pkgname}-${version}"
rm -rf "${destdir}"