vala-recursive-setup.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. mkdir src
  20. cat >> 'configure.ac' << 'END'
  21. AC_PROG_CC
  22. AM_PROG_VALAC([0.7.0])
  23. PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
  24. AC_CONFIG_FILES([src/Makefile])
  25. AC_OUTPUT
  26. END
  27. cat > 'Makefile.am' <<'END'
  28. SUBDIRS = src
  29. END
  30. cat > 'src/Makefile.am' <<'END'
  31. bin_PROGRAMS = zardoz
  32. zardoz_VALAFLAGS = -H zardoz.h
  33. zardoz_CFLAGS = $(GOBJECT_CFLAGS)
  34. zardoz_LDADD = $(GOBJECT_LIBS)
  35. zardoz_SOURCES = zardoz.vala
  36. END
  37. cat > 'src/zardoz.vala' <<'END'
  38. using GLib;
  39. public class Zardoz {
  40. public static void main () {
  41. stdout.printf ("Zardoz!\n");
  42. }
  43. }
  44. END
  45. $ACLOCAL
  46. $AUTOCONF
  47. $AUTOMAKE -a
  48. ./configure
  49. $MAKE
  50. # Test rebuild rules.
  51. rm -f src/zardoz.h
  52. $MAKE -C src zardoz.h
  53. test -f src/zardoz.h
  54. rm -f src/zardoz.c
  55. $MAKE -C src
  56. test -f src/zardoz.c
  57. echo am--error > src/zardoz.h
  58. echo am--error > src/zardoz.c
  59. $sleep
  60. touch src/zardoz.vala
  61. $MAKE
  62. grep 'am--error' src/zardoz.[ch] && exit 1
  63. # Check the distribution.
  64. $MAKE distcheck
  65. $MAKE distclean
  66. # Tru a VPATH setup.
  67. mkdir build
  68. cd build
  69. ../configure
  70. $MAKE
  71. $MAKE distcheck
  72. # Test rebuild rules from builddir.
  73. rm -f ../src/zardoz.h
  74. $MAKE -C src ../../src/zardoz.h
  75. test -f ../src/zardoz.h
  76. rm -f ../src/zardoz.c
  77. $MAKE
  78. grep 'Zardoz!' ../src/zardoz.c
  79. $sleep
  80. sed 's/Zardoz!/FooBar!/' ../src/zardoz.vala > t
  81. mv -f t ../src/zardoz.vala
  82. $MAKE
  83. grep 'FooBar!' ../src/zardoz.c
  84. grep 'Zardoz!' ../src/zardoz.c && exit 1
  85. :