missing: shellcheck disable=SC2006,SC2268
[automake.git] / t / vala-libs-distcheck.sh
blobfc1055aa6e41830623ed7414bc093ab960e92d02
1 #! /bin/sh
2 # Copyright (C) 2012-2024 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Building libraries (libtool and static) from Vala sources.
18 # And use of vapi files to call C code from Vala.
20 required="valac cc pkg-config libtoolize GNUmake"
21 am_create_testdir=empty
22 . test-init.sh
24 cat >> configure.ac << 'END'
25 AC_INIT([atest],[0.1])
26 AC_CONFIG_SRCDIR([data/atest.pc.in])
27 AC_SUBST([API_VERSION],[0])
29 AM_INIT_AUTOMAKE
30 AM_MAINTAINER_MODE([enable])
31 AM_PROG_AR
32 LT_INIT
34 AC_PROG_CC
35 AC_PROG_INSTALL
36 PKG_PROG_PKG_CONFIG([0.22])
37 AM_PROG_VALAC([0.32])
39 PKG_CHECK_MODULES(ATEST, [gio-2.0])
41 AC_CONFIG_FILES([
42 Makefile
44 src/Makefile
46 src/atest-$API_VERSION.deps:src/atest.deps.in
48 data/Makefile
49 data/atest-$API_VERSION.pc:data/atest.pc.in
51 ],[],
52 [API_VERSION='$API_VERSION'])
53 AC_OUTPUT
54 END
57 cat > Makefile.am << 'END'
58 SUBDIRS=data src
59 END
61 mkdir data
63 cat > data/atest.pc.in << 'END'
64 prefix=@prefix@
65 exec_prefix=@exec_prefix@
66 libdir=@libdir@
67 datarootdir=@datarootdir@
68 datadir=@datadir@
69 includedir=@includedir@
71 Name: atest-@API_VERSION@
72 Description: atest library
73 Version: @VERSION@
74 Requires: glib-2.0 gobject-2.0
75 Libs: -L${libdir} -latest-@API_VERSION@
76 Cflags: -I${includedir}/atest-@API_VERSION@
77 END
80 cat > data/Makefile.am << 'END'
81 # pkg-config data
82 # Note that the template file is called atest.pc.in, but generates a
83 # versioned .pc file using some magic in AC_CONFIG_FILES.
84 pkgconfigdir = $(libdir)/pkgconfig
85 pkgconfig_DATA = atest-$(API_VERSION).pc
87 DISTCLEANFILES = $(pkgconfig_DATA)
88 EXTRA_DIST = atest.pc.in
89 END
91 mkdir src
93 cat > src/atest.deps.in << 'END'
94 glib-2.0
95 END
98 cat > src/atest.vala << 'END'
99 using GLib;
101 namespace Atest {
102 public class A {
103 public bool foo() { return false; }
108 cat > src/Makefile.am << 'END'
109 lib_LTLIBRARIES = libatest-@API_VERSION@.la
111 libatest_@API_VERSION@_la_SOURCES = \
112 atest.vala \
113 cservice.c \
114 cservice.h \
115 $(NULL)
118 libatest_@API_VERSION@_la_CPPFLAGS = \
119 -DOKOKIMDEFINED=1 \
120 $(NULL)
122 libatest_@API_VERSION@_la_CFLAGS = \
123 $(ATEST_CFLAGS) \
124 $(WARN_CFLAGS) \
125 $(NULL)
127 libatest_@API_VERSION@_la_LIBADD = \
128 $(ATEST_LIBS) \
129 $(NULL)
131 libatest_@API_VERSION@_la_LDFLAGS = \
132 $(WARN_LDFLAGS) \
133 $(NULL)
135 libatest_@API_VERSION@_la_VALAFLAGS = \
136 --vapidir=$(VAPIDIR) \
137 --vapidir=$(srcdir) \
138 --pkg cservice \
139 --thread \
140 --target-glib=2.44 \
141 --pkg glib-2.0 \
142 -H atest.h \
143 --library atest-@API_VERSION@ \
144 $(NULL)
146 header_DATA=atest.h
147 headerdir=$(includedir)/atest-@API_VERSION@/atest
149 atest-@API_VERSION@.deps:
150 cp atest.deps atest-@API_VERSION@.deps
152 vapi_DATA=atest-@API_VERSION@.vapi atest-@API_VERSION@.deps
153 vapidir=$(VAPIDIR)
155 CLEANFILES = atest-@API_VERSION@.deps
159 cat > src/cservice.c << 'END'
160 #include "cservice.h"
161 int c_service_mu_call (void)
163 return OKOKIMDEFINED;
167 cat > src/cservice.h << 'END'
168 int c_service_mu (void);
171 cat > src/cservice.vapi <<'END'
172 namespace CService {
173 public class Mu {
174 [CCode (cheader_filename = "cservice.h", cname = "c_service_mu_call")]
175 public int call ();
180 libtoolize
181 $ACLOCAL
182 $AUTOCONF
183 $AUTOMAKE -a
185 ./configure
187 $MAKE
188 test -f src/libatest_0_la_vala.stamp
189 test -f src/libatest-0.la
191 $MAKE distcheck