"Fossies" - the Fresh Open Source Software Archive

Member "automake-1.16.3/t/vala-libs.sh" (19 Nov 2020, 2584 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-libs.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 # Building libraries (libtool and static) from Vala sources.
   18 # And use of vapi files to call C code from Vala.
   19 
   20 required="valac cc pkg-config libtoolize GNUmake"
   21 . test-init.sh
   22 
   23 cat >> configure.ac << 'END'
   24 AC_PROG_CC
   25 AM_PROG_AR
   26 AC_PROG_RANLIB
   27 AC_PROG_LIBTOOL
   28 AM_PROG_VALAC([0.7.3])
   29 PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
   30 AC_OUTPUT
   31 END
   32 
   33 cat > Makefile.am << 'END'
   34 AUTOMAKE_OPTIONS = subdir-objects
   35 lib_LIBRARIES = libservice.a
   36 lib_LTLIBRARIES = src/libzardoz.la
   37 libservice_a_SOURCES = service.vala cservice.c cservice.h
   38 libservice_a_CPPFLAGS = -DOKOKIMDEFINED=1
   39 libservice_a_VALAFLAGS = --vapidir=$(srcdir) --pkg cservice --library service
   40 AM_CFLAGS = $(GOBJECT_CFLAGS)
   41 src_libzardoz_la_LIBADD = $(GOBJECT_LIBS)
   42 src_libzardoz_la_SOURCES = src/zardoz-foo.vala src/zardoz-bar.vala
   43 src/zardoz-bar.vala: src/zardoz-foo.vala
   44     sed 's/Foo/Bar/g' $< >$@
   45 END
   46 
   47 libtoolize
   48 $ACLOCAL
   49 $AUTOCONF
   50 $AUTOMAKE -a
   51 
   52 ./configure
   53 
   54 cat > cservice.c << 'END'
   55 #include "cservice.h"
   56 int c_service_mu_call (void)
   57 {
   58   return OKOKIMDEFINED;
   59 }
   60 END
   61 
   62 cat > cservice.h << 'END'
   63 int c_service_mu (void);
   64 END
   65 
   66 cat > cservice.vapi <<'END'
   67 namespace CService {
   68   public class Mu {
   69     [CCode (cheader_filename = "cservice.h", cname = "c_service_mu_call")]
   70     public int call ();
   71   }
   72 }
   73 END
   74 
   75 cat > service.vala << 'END'
   76 namespace CService {
   77 public class Generator : Object {
   78     public Generator () {
   79         stdout.printf ("construct generator");
   80     }
   81     public void init () {
   82         stdout.printf ("init generator");
   83     }
   84 }
   85 }
   86 END
   87 
   88 mkdir -p src
   89 cat > src/zardoz-foo.vala << 'END'
   90 using GLib;
   91 public class Foo {
   92   public static void zap () {
   93     stdout.printf ("FooFooFoo!\n");
   94   }
   95 }
   96 END
   97 
   98 $MAKE
   99 test -f libservice.a
  100 test -f src/libzardoz.la
  101 $FGREP "construct generator" service.c
  102 $FGREP "FooFooFoo" src/zardoz-foo.c
  103 $FGREP "BarBarBar" src/zardoz-bar.c
  104 test -f libservice_a_vala.stamp
  105 test -f src_libzardoz_la_vala.stamp
  106 
  107 $MAKE distcheck
  108 
  109 :