DELETEKEY: Do not require an opened file.
[pwmd.git] / autogen.sh
blob4c4b8a7cc6fbe22728a89aa80d870da7ab27206f
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 cd "$(dirname "$0")"
18 # Refresh GNU autotools toolchain.
19 echo Cleaning autotools files...
20 find . -type d -name autom4te.cache -print0 | xargs -0 rm -rf \;
21 find . -type f \( -name missing -o -name install-sh -o -name mkinstalldirs \
22 -o -name depcomp -o -name ltmain.sh -o -name configure \
23 -o -name config.sub -o -name config.guess \
24 -o -name Makefile.in \) -print0 | xargs -0 rm -f
26 echo Running autoreconf...
27 autoreconf --force --install -Im4
29 # For the Debian package build
30 test -d debian && {
31 # link these in Debian builds
32 rm -f config.sub config.guess
33 ln -s /usr/share/misc/config.sub .
34 ln -s /usr/share/misc/config.guess .
36 # refresh list of executable scripts, to avoid possible breakage if
37 # upstream tarball does not include the file or if it is mispackaged
38 # for whatever reason.
39 [ "$1" = "updateexec" ] && {
40 echo Generating list of executable files...
41 rm -f debian/executable.files
42 find -type f -perm +111 ! -name '.*' -fprint debian/executable.files
45 # Remove any files in upstream tarball that we don't have in the Debian
46 # package (because diff cannot remove files)
47 version=`dpkg-parsechangelog | awk '/Version:/ { print $2 }' | sed -e 's/-[^-]\+$//'`
48 source=`dpkg-parsechangelog | awk '/Source:/ { print $2 }' | tr -d ' '`
49 if test -r ../${source}_${version}.orig.tar.gz ; then
50 echo Generating list of files that should be removed...
51 rm -f debian/deletable.files
52 touch debian/deletable.files
53 [ -e debian/tmp ] && rm -rf debian/tmp
54 mkdir debian/tmp
55 ( cd debian/tmp ; tar -zxf ../../../${source}_${version}.orig.tar.gz )
56 find debian/tmp/ -type f ! -name '.*' -print0 | xargs -0 -ri echo '{}' | \
57 while read -r i ; do
58 if test -e "${i}" ; then
59 filename=$(echo "${i}" | sed -e 's#.*debian/tmp/[^/]\+/##')
60 test -e "${filename}" || echo "${filename}" >>debian/deletable.files
62 done
63 rm -fr debian/tmp
64 else
65 echo Emptying list of files that should be deleted...
66 rm -f debian/deletable.files
67 touch debian/deletable.files
71 exit 0