"Fossies" - the Fresh Open Source Software Archive

Member "automake-1.16.3/t/vala-mix2.sh" (19 Nov 2020, 2730 Bytes) of package /linux/misc/automake-1.16.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "vala-mix2.sh": 1.16.2_vs_1.16.3.

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