transform2.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #! /bin/sh
  2. # Copyright (C) 2002-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Make sure that --program-transform works even when multiple files are
  17. # collapsed.
  18. required=cc
  19. . test-init.sh
  20. cat >>configure.ac <<'END'
  21. AC_PROG_CC
  22. AC_OUTPUT
  23. END
  24. cat >Makefile.am <<'EOF'
  25. bin_PROGRAMS = p1 p2
  26. bin_SCRIPTS = s1.sh s2.sh
  27. man_MANS = m1.1 m2.1
  28. test-install: install
  29. test -f inst/bin/p$(EXEEXT)
  30. test -f inst/bin/s.sh
  31. test -f inst/man/man1/m.1
  32. test-install-foo: install
  33. test -f inst/bin/foo$(EXEEXT)
  34. test -f inst/bin/foo
  35. test -f inst/man/man1/foo.1
  36. test ! -f inst/bin/p1$(EXEEXT)
  37. test ! -f inst/bin/p2$(EXEEXT)
  38. test ! -f inst/bin/s1.sh
  39. test ! -f inst/bin/s2.sh
  40. test ! -f inst/man/man/m1.1
  41. test ! -f inst/man/man/m2.1
  42. EOF
  43. cat >p1.c <<'EOF'
  44. int
  45. main ()
  46. {
  47. return 0;
  48. }
  49. EOF
  50. cp p1.c p2.c
  51. : > s1.sh
  52. : > s2.sh
  53. : > m1.1
  54. : > m2.1
  55. $ACLOCAL
  56. $AUTOCONF
  57. $AUTOMAKE
  58. cwd=$(pwd) || fatal_ "getting current working directory"
  59. ./configure --program-transform-name='s/[12]//' --prefix "$cwd/inst" \
  60. --mandir "$cwd/inst/man"
  61. $MAKE
  62. $MAKE test-install
  63. $MAKE uninstall
  64. test $(find inst -type f -print | wc -l) -eq 0
  65. # Also squash all file types in question.
  66. # On newer Cygwin versions, that won't work, likely due to overly
  67. # aggressive appending of '.exe' suffix when copying/renaming Windows
  68. # executables. So let's skip this part of the test if we detect the
  69. # faulty heuristic is present. See also:
  70. # <http://lists.gnu.org/archive/html/automake-patches/2010-08/msg00153.html>
  71. # <http://thread.gmane.org/gmane.os.cygwin/119380>
  72. echo Foo > foo
  73. echo Bar > bar.exe
  74. chmod a+x foo bar.exe
  75. cp foo bar && cmp foo bar \
  76. || skip_ "your Cygwin is too aggressive in tweaking '.exe' suffixes"
  77. ./configure --program-transform-name='s/.*/foo/' --prefix "$cwd/inst" \
  78. --mandir "$cwd/inst/man"
  79. $MAKE
  80. $MAKE test-install-foo
  81. $MAKE uninstall
  82. test $(find inst -type f -print | wc -l) -eq 0
  83. :