autogen.sh 2.4 KB

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