vala-mix2.sh 2.7 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. # Vala sources, C and C++ sources and C and C++ headers in the same
  17. # program. Functional test. See automake bug#10894.
  18. required='valac cc c++ pkg-config GNUmake'
  19. . test-init.sh
  20. cat >> configure.ac <<'END'
  21. AC_PROG_CC
  22. AC_PROG_CXX
  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 = zardoz
  29. AM_CFLAGS = $(GOBJECT_CFLAGS)
  30. zardoz_LDADD = $(GOBJECT_LIBS)
  31. zardoz_SOURCES = zardoz.vala foo.h bar.c baz.c zen.hh master.cxx
  32. END
  33. cat > zardoz.vala <<'END'
  34. int main ()
  35. {
  36. stdout.printf ("foo is alive\n");
  37. return 0;
  38. }
  39. END
  40. cat > foo.h <<'END'
  41. int foo;
  42. int bar (void);
  43. int baz (void);
  44. END
  45. cat > bar.c <<'END'
  46. #include "foo.h"
  47. int bar (void) { return foo + baz (); }
  48. END
  49. cat > baz.c <<'END'
  50. #include "foo.h"
  51. extern int foo = 0;
  52. int baz (void) { return 0; }
  53. END
  54. cat > zen.hh <<'END'
  55. #include <iostream>
  56. END
  57. cat > master.cxx <<'END'
  58. #include "zen.hh"
  59. void chatty (void) { std::cout << "Hello, stranger!\n"; }
  60. END
  61. $ACLOCAL
  62. $AUTOMAKE -a
  63. $AUTOCONF
  64. # Do not reject slower dependency extractors.
  65. ./configure --enable-dependency-tracking
  66. $MAKE all
  67. ls -l # For debugging.
  68. have_generated_files ()
  69. {
  70. test -f zardoz_vala.stamp
  71. test -f zardoz.c
  72. }
  73. # Our vala-related rules must create stamp files and intermediate
  74. # C files.
  75. have_generated_files
  76. # Remake rules are not uselessly triggered.
  77. $MAKE -q
  78. $MAKE -n | $FGREP vala.stamp && exit 1
  79. # But are triggered when they should.
  80. for file in zardoz.vala foo.h bar.c baz.c zen.hh master.cxx; do
  81. $sleep
  82. echo '& choke me !' >> $file
  83. $MAKE && exit 1
  84. $sleep
  85. sed '$d' $file > t
  86. mv -f t $file
  87. $MAKE
  88. done
  89. # Check the distribution.
  90. $MAKE distcheck
  91. # Stamp files and intermediate C files should *not* be removed
  92. # by "make clean".
  93. $MAKE clean
  94. ls -l # For debugging.
  95. have_generated_files
  96. # But stamp files should be removed by "maintainer-clean" (the
  97. # behaviour w.r.t. intermediate C files is still unclear, and
  98. # better left undefined for the moment).
  99. $MAKE maintainer-clean
  100. ls *vala*.stamp | grep . && exit 1
  101. :