java-uninstall.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #! /bin/sh
  2. # Copyright (C) 1998-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. # Check uninstallation of Java class files.
  17. required=javac
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_OUTPUT
  21. END
  22. cat > Makefile.am << 'END'
  23. javadir = $(prefix)/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. DISTCLEANFILES = Baz.java Foo2.java
  43. END
  44. echo 'class aClass {}' > Foo.java
  45. echo 'class Zardoz {}' > Bar.java
  46. $ACLOCAL
  47. $AUTOCONF
  48. $AUTOMAKE
  49. ./configure --prefix="$(pwd)"/_inst
  50. javadir=_inst/java
  51. check_uninstallation()
  52. {
  53. test ! -e $javadir/aClass.class
  54. test ! -e $javadir/bClass.class
  55. test ! -e $javadir/Zardoz.class
  56. test ! -e $javadir/Baz.class
  57. test ! -e $javadir/Baz2.class
  58. test -f $javadir/Foo.class
  59. test -f $javadir/Bar.class
  60. test -f $javadir/xClass.class
  61. }
  62. $MAKE
  63. ls -l
  64. $MAKE install
  65. : > $javadir/Foo.class
  66. : > $javadir/Bar.class
  67. : > $javadir/xClass.class
  68. ls -l $javadir
  69. $MAKE uninstall
  70. ls -l $javadir
  71. check_uninstallation
  72. # FIXME: "make uninstall" should continue to work also after "make clean",
  73. # but currently this doesn't happen. See automake bug#8540.
  74. $MAKE install
  75. ls -l $javadir
  76. $MAKE clean
  77. ls -l
  78. $MAKE uninstall
  79. ls -l $javadir
  80. #check_uninstallation
  81. $MAKE distcheck
  82. :