Added a 'deb' Makefile target.
[libpwmd.git] / autogen.sh
blob91520235377bbebb26f118e6b6e6bd33797bf47d
1 #!/bin/sh
3 # autogen.sh glue for hplip
5 # HPLIP used to have five or so different autotools trees. Upstream
6 # has reduced it to two. Still, this script is capable of cleaning
7 # just about any possible mess of autoconf files.
9 # BE CAREFUL with trees that are not completely automake-generated,
10 # this script deletes all Makefile.in files it can find.
12 # Requires: automake 1.9, autoconf 2.57+
13 # Conflicts: autoconf 2.13
14 set -e
16 # Refresh GNU autotools toolchain.
17 echo Cleaning autotools files...
18 find -type d -name autom4te.cache -print0 | xargs -0 rm -rf \;
19 find -type f \( -name missing -o -name install-sh -o -name mkinstalldirs \
20 -o -name depcomp -o -name ltmain.sh -o -name configure \
21 -o -name config.sub -o -name config.guess \
22 -o -name Makefile.in \) -print0 | xargs -0 rm -f
24 echo Running autoreconf...
25 autoreconf --force --install
27 # For the Debian package build
28 test -d debian && {
29 # link these in Debian builds
30 rm -f config.sub config.guess
31 ln -s /usr/share/misc/config.sub .
32 ln -s /usr/share/misc/config.guess .
34 # refresh list of executable scripts, to avoid possible breakage if
35 # upstream tarball does not include the file or if it is mispackaged
36 # for whatever reason.
37 [ "$1" == "updateexec" ] && {
38 echo Generating list of executable files...
39 rm -f debian/executable.files
40 find -type f -perm +111 ! -name '.*' -fprint debian/executable.files
43 # Remove any files in upstream tarball that we don't have in the Debian
44 # package (because diff cannot remove files)
45 version=`dpkg-parsechangelog | awk '/Version:/ { print $2 }' | sed -e 's/-[^-]\+$//'`
46 source=`dpkg-parsechangelog | awk '/Source:/ { print $2 }' | tr -d ' '`
47 if test -r ../${source}_${version}.orig.tar.gz ; then
48 echo Generating list of files that should be removed...
49 rm -f debian/deletable.files
50 touch debian/deletable.files
51 [ -e debian/tmp ] && rm -rf debian/tmp
52 mkdir debian/tmp
53 ( cd debian/tmp ; tar -zxf ../../../${source}_${version}.orig.tar.gz )
54 find debian/tmp/ -type f ! -name '.*' -print0 | xargs -0 -ri echo '{}' | \
55 while read -r i ; do
56 if test -e "${i}" ; then
57 filename=$(echo "${i}" | sed -e 's#.*debian/tmp/[^/]\+/##')
58 test -e "${filename}" || echo "${filename}" >>debian/deletable.files
60 done
61 rm -fr debian/tmp
62 else
63 echo Emptying list of files that should be deleted...
64 rm -f debian/deletable.files
65 touch debian/deletable.files
69 exit 0