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