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)
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
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])
30 AM_MAINTAINER_MODE
([enable])
36 PKG_PROG_PKG_CONFIG
([0.22])
39 PKG_CHECK_MODULES
(ATEST
, [gio-2.0
])
46 src
/atest-
$API_VERSION.deps
:src
/atest.deps.
in
49 data
/atest-
$API_VERSION.pc
:data
/atest.pc.
in
52 [API_VERSION
='$API_VERSION'])
57 cat > Makefile.am
<< 'END'
63 cat > data
/atest.pc.
in << 'END'
65 exec_prefix
=@exec_prefix@
67 datarootdir
=@datarootdir@
69 includedir
=@includedir@
71 Name
: atest-@API_VERSION@
72 Description
: atest library
74 Requires
: glib-2.0 gobject-2.0
75 Libs
: -L${libdir} -latest-@API_VERSION@
76 Cflags
: -I${includedir}/atest-@API_VERSION@
80 cat > data
/Makefile.am
<< 'END'
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
93 cat > src
/atest.deps.
in << 'END'
98 cat > src
/atest.vala
<< 'END'
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
= \
118 libatest_@API_VERSION@_la_CPPFLAGS
= \
122 libatest_@API_VERSION@_la_CFLAGS
= \
127 libatest_@API_VERSION@_la_LIBADD
= \
131 libatest_@API_VERSION@_la_LDFLAGS
= \
135 libatest_@API_VERSION@_la_VALAFLAGS
= \
136 --vapidir=$
(VAPIDIR
) \
137 --vapidir=$
(srcdir
) \
143 --library atest-@API_VERSION@ \
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
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'
174 [CCode (cheader_filename = "cservice.h", cname = "c_service_mu_call")]
188 test -f src
/libatest_0_la_vala.stamp
189 test -f src
/libatest-0.la