56 lines
1.2 KiB
Bash
Executable File
56 lines
1.2 KiB
Bash
Executable File
#!/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 --disable-static --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}
|
|
|
|
pkg_size="$( du -sk "${curdir}" | awk '{ print $1; }' )"
|
|
|
|
mkdir -p "${destdir}/DEBIAN"
|
|
sed "s|@SIZE@|${pkg_size}|g" "$1" > "${destdir}/DEBIAN/control"
|
|
|
|
dpkg -b "${destdir}" .
|
|
|
|
rm -rf "${pkgname}-${version}"
|
|
rm -rf "${destdir}"
|