2
0

java-compile-install.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #! /bin/sh
  2. # Copyright (C) 2011-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. # Test on compilation and installation of Java class files.
  17. required=javac
  18. . test-init.sh
  19. cat >>configure.ac <<'EOF'
  20. AC_OUTPUT
  21. EOF
  22. cat > Makefile.am << 'END'
  23. javadir = $(datadir)/java
  24. java_JAVA = Foo.java
  25. nobase_java_JAVA = Foo2.java
  26. nobase_dist_java_JAVA = Bar.java
  27. nodist_java_JAVA = Baz.java
  28. # Java files are not distributed by default, so we distribute
  29. # one "by hand" ...
  30. EXTRA_DIST = Foo.java
  31. # ... and make the other one generated.
  32. Foo2.java:
  33. rm -f $@ $@-t
  34. echo 'class bClass {}' > $@-t
  35. chmod a-w $@-t && mv -f $@-t $@
  36. # Explicitly declared as 'nodist_', so generate it.
  37. Baz.java:
  38. rm -f $@ $@-t
  39. echo 'class Baz {}' > $@-t
  40. echo 'class Baz2 {}' >> $@-t
  41. chmod a-w $@-t && mv -f $@-t $@
  42. test:
  43. ls -l $(srcdir) . ;: For debugging.
  44. test -f $(srcdir)/Foo.java
  45. test -f $(srcdir)/Bar.java
  46. test -f Foo2.java
  47. test -f Baz.java
  48. test -f aClass.class
  49. test -f bClass.class
  50. test -f Zardoz.class
  51. test -f Baz.class
  52. test -f Baz2.class
  53. test ! -r Foo.class
  54. test ! -r Bar.class
  55. test -f classjava.stamp
  56. test-install:
  57. ls -l $(javadir) ;: For debugging.
  58. test -f '$(javadir)/bClass.class'
  59. test -f '$(javadir)/aClass.class'
  60. test -f '$(javadir)/Zardoz.class'
  61. test -f '$(javadir)/Baz.class'
  62. test -f '$(javadir)/Baz2.class'
  63. test ! -r '$(javadir)/Foo.class'
  64. test ! -r '$(javadir)/Bar.class'
  65. if find $(prefix) | grep '\.stamp$$'; then exit 1; else :; fi
  66. check-local: test
  67. installcheck-local: test-install
  68. .PHONY: test test-install
  69. DISTCLEANFILES = Baz.java Foo2.java
  70. END
  71. echo 'class aClass {}' > Foo.java
  72. echo 'class Zardoz {}' > Bar.java
  73. $ACLOCAL
  74. $AUTOCONF
  75. $AUTOMAKE
  76. ./configure --prefix="$(pwd)"/_inst
  77. $MAKE
  78. $MAKE test
  79. $MAKE install
  80. $MAKE test-install
  81. $MAKE distcheck
  82. :