]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/cortex-strings/autogen.sh
ping(8): Fix a mandoc related issue
[FreeBSD/FreeBSD.git] / contrib / cortex-strings / autogen.sh
1 #!/bin/sh
2 #
3 # autogen.sh glue for hplip
4 #
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.
8 #
9 # BE CAREFUL with trees that are not completely automake-generated,
10 # this script deletes all Makefile.in files it can find.
11 #
12 # Requires: automake 1.9, autoconf 2.57+
13 # Conflicts: autoconf 2.13
14 set -e
15
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
23
24 echo Running autoreconf...
25 autoreconf --force --install
26
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 .
33
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
41         }
42
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
59                         fi
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
66         fi
67 }
68
69 exit 0