2
0

instdir-no-empty.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #! /bin/sh
  2. # Copyright (C) 2012-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. # An empty "foo_PRIMARY" declaration should *not* cause "make install"
  17. # to create directory $(foodir). See automake bug#10997 and bug#11030.
  18. . test-init.sh
  19. cat >> configure.ac <<'END'
  20. AC_SUBST([CC], [whatever])
  21. AC_SUBST([JAVAC], [whatever])
  22. AM_PATH_PYTHON(,,:)
  23. AC_OUTPUT
  24. END
  25. cat > Makefile.am << 'END'
  26. AUTOMAKE_OPTIONS = no-dependencies
  27. mydir = $(prefix)/my
  28. myexecdir = $(prefix)/myexec
  29. javadir = $(prefix)/java
  30. END
  31. # Write Makefile.am.
  32. {
  33. for dir in sbin bin libexec pkglibexec myexec; do
  34. for dst in '' dist_ nodist_; do
  35. echo "${dst}${dir}_SCRIPTS ="
  36. done
  37. echo "${dir}_PROGRAMS ="
  38. done
  39. for dir in lib pkglib myexec my; do
  40. echo "${dir}_LIBRARIES ="
  41. echo "${dir}_LTLIBRARIES ="
  42. done
  43. for p1 in '' notrans_; do
  44. for p2 in '' dist_ nodist_; do
  45. for s in '' 1 2 3 4 5 6 7 8 9; do
  46. echo "${p1}${p2}man${s}_MANS ="
  47. done
  48. done
  49. done
  50. for dst in '' dist_ nodist_; do
  51. for dir in dataroot data pkgdata doc lisp my; do
  52. echo "${dst}${dir}_DATA ="
  53. done
  54. for dir in include pkginclude oldinclude my; do
  55. echo "${dst}${dir}_HEADERS ="
  56. done
  57. for dir in python my; do
  58. echo "${dst}${dir}_PYTHON ="
  59. done
  60. for dir in info my; do
  61. echo "${dst}${dir}_TEXINFOS ="
  62. done
  63. for dir in java my; do
  64. echo "${dst}${dir}_JAVA ="
  65. done
  66. for dir in lisp my; do
  67. echo "${dst}${dir}_LISP ="
  68. done
  69. done
  70. } > t
  71. cat t >> Makefile.am
  72. sed 's/^/nobase_/' t >> Makefile.am
  73. rm -f t
  74. cat Makefile.am # For debugging.
  75. # Sanity check.
  76. grep '^oldinclude_HEADERS =' Makefile.am \
  77. && grep '^nodist_my_PYTHON =' Makefile.am \
  78. && grep '^notrans_dist_man5_MANS =' Makefile.am \
  79. || fatal_ "creating Makefile.am"
  80. $ACLOCAL
  81. $AUTOCONF
  82. $AUTOMAKE -a
  83. cwd=$(pwd) || fatal_ "getting current working directory"
  84. doinst ()
  85. {
  86. run_make install install-pdf install-ps install-dvi ${1+"$@"}
  87. }
  88. : > foo.sh
  89. ./configure --prefix="$cwd/inst"
  90. doinst
  91. test ! -e inst || { find inst; exit 1; }
  92. $MAKE uninstall
  93. doinst bin_SCRIPTS=foo.sh
  94. test -f inst/bin/foo.sh
  95. # Explicitly pass prefix to avoid spurious influences from
  96. # global config.site scripts.
  97. ./configure --prefix="/usr/local"
  98. test ! -e dest || { find dest; exit 1; }
  99. $MAKE uninstall
  100. doinst DESTDIR="$cwd/dest" bin_SCRIPTS=foo.sh
  101. test -f dest/usr/local/bin/foo.sh
  102. :