vala-headers.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #! /bin/sh
  2. # Copyright (C) 1996-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 to make sure compiling Vala code really works with recursive make.
  17. required="pkg-config valac gcc GNUmake"
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_PROG_CC
  21. AM_PROG_VALAC([0.7.0])
  22. PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
  23. AC_OUTPUT
  24. END
  25. cat > Makefile.am << 'END'
  26. bin_PROGRAMS = zardoz quux
  27. zardoz_SOURCES = zardoz.vala
  28. quux_SOURCES = quux.vala
  29. quux.vala: zardoz.vala
  30. sed 's/Zardoz/Quux/' <zardoz.vala >quux.vala
  31. quux_VALAFLAGS = \
  32. --header HDR.h \
  33. --vapi hello.vapi
  34. zardoz_VALAFLAGS = \
  35. -H foo.h \
  36. --internal-header foo2.h \
  37. --internal-vapi foo3.vapi
  38. AM_CFLAGS = $(GOBJECT_CFLAGS)
  39. LDADD = $(GOBJECT_LIBS)
  40. END
  41. headers='HDR.h hello.vapi foo.h foo2.h foo3.vapi'
  42. cat > zardoz.vala << 'END'
  43. using GLib;
  44. public class Zardoz {
  45. public static void main () {
  46. stdout.printf ("Zardoz!\n");
  47. }
  48. }
  49. END
  50. $ACLOCAL
  51. $AUTOCONF
  52. $AUTOMAKE -a
  53. ./configure
  54. $MAKE
  55. # Test rebuild rules.
  56. for h in $headers; do
  57. rm -f $h
  58. $MAKE $h
  59. test -f $h
  60. done
  61. rm -f $headers
  62. $MAKE $headers
  63. for h in $headers; do test -f $h; done
  64. $MAKE distcheck
  65. $MAKE maintainer-clean
  66. for h in $headers; do test ! -e $h; done
  67. :