vala-vpath.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 to make sure vala support handles from-scratch VPATH builds.
  17. # See automake bug#8753.
  18. required="cc valac pkg-config GNUmake"
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_CONFIG_SRCDIR([hello.vala])
  22. AC_PROG_CC
  23. AM_PROG_VALAC([0.7.3])
  24. PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
  25. AC_OUTPUT
  26. END
  27. cat > Makefile.am <<'END'
  28. bin_PROGRAMS = foo bar
  29. AM_CFLAGS = $(GOBJECT_CFLAGS)
  30. LDADD = $(GOBJECT_LIBS)
  31. foo_SOURCES = hello.vala
  32. bar_VALAFLAGS = -H zardoz.h
  33. bar_SOURCES = goodbye.vala
  34. END
  35. cat > hello.vala <<'END'
  36. void main ()
  37. {
  38. stdout.printf ("foofoofoo\n");
  39. }
  40. END
  41. cp hello.vala goodbye.vala
  42. $ACLOCAL
  43. $AUTOCONF
  44. $AUTOMAKE
  45. mkdir build
  46. cd build
  47. ../configure
  48. $MAKE
  49. test -f ../foo_vala.stamp
  50. test -f ../bar_vala.stamp
  51. grep foofoofoo ../hello.c
  52. test -f ../zardoz.h
  53. $MAKE distcheck
  54. # Rebuild rules work also in VPATH builds.
  55. cat > ../hello.vala <<'END'
  56. int main ()
  57. {
  58. stdout.printf ("barbarbar\n");
  59. return 0;
  60. }
  61. END
  62. $MAKE
  63. test -f ../foo_vala.stamp
  64. test -f ../bar_vala.stamp
  65. grep barbarbar ../hello.c
  66. # Rebuild rules are not uselessly triggered.
  67. $MAKE -q
  68. $MAKE -n | grep '\.stamp' && exit 1
  69. # Cleanup rules work also in VPATH builds.
  70. $MAKE clean
  71. test -f ../foo_vala.stamp
  72. test -f ../bar_vala.stamp
  73. test -f ../zardoz.h
  74. test -f ../hello.c
  75. $MAKE maintainer-clean
  76. test ! -e ../zardoz.h
  77. test ! -e ../hello.c
  78. test ! -e ../foo_vala.stamp
  79. test ! -e ../bar_vala.stamp
  80. :