diff –git a/Makefile-gir.am b/Makefile-gir.am index 52f7ee3..c03f4e2 100644 — a/Makefile-gir.am +++ b/Makefile-gir.am @@ -68,7 +68,8 @@ GLib_2_0_gir_SCANNERFLAGS = \
--symbol-prefix=g \ --symbol-prefix=glib \ --c-include="glib.h" \
-
$(GLib_2_0_gir_DOCSRC)
+ $(GLib_2_0_gir_DOCSRC) \ + –library-path=$(GLIB_LIBDIR)
GLib_2_0_gir_PACKAGES = glib-2.0 GLib_2_0_gir_CFLAGS = \ -I$(GLIB_INCLUDEDIR) \
@@ -87,7 +88,12 @@ endif
BUILT_GIRSOURCES += GLib-2.0.gir
-GLib-2.0.gir: g-ir-scanner g-ir-compiler$(EXEEXT) +if BUILD_SCANNER +G_IR_SCANNER_DEPENDENCY = g-ir-scanner +else +G_IR_SCANNER_DEPENDENCY = +endif +GLib-2.0.gir: $(G_IR_SCANNER_DEPENDENCY) g-ir-compiler$(EXEEXT)
gir/DBusGLib-1.0.typelib: GObject-2.0.gir
@@ -105,7 +111,8 @@ GObject_2_0_gir_SCANNERFLAGS = \
--identifier-prefix=G \ --c-include="glib-object.h" \ --add-include-path=. \
-
$(GObject_2_0_gir_DOCSRC)
+ $(GObject_2_0_gir_DOCSRC) \ + –library-path=$(GOBJECT_LIBDIR)
GObject_2_0_gir_PACKAGES = gobject-2.0 GObject_2_0_gir_INCLUDES = GLib-2.0
@@ -133,7 +140,8 @@ GModule_2_0_gir_SCANNERFLAGS = \
--identifier-prefix=G \ --c-include="gmodule.h" \ --add-include-path=. \
-
$(GModule_2_0_gir_DOCSRC)
+ $(GModule_2_0_gir_DOCSRC) \ + –library-path=$(GMODULE_LIBDIR)
GModule_2_0_gir_PACKAGES = gmodule-2.0 GModule_2_0_gir_INCLUDES = GLib-2.0
@@ -171,7 +179,8 @@ Gio_2_0_gir_SCANNERFLAGS = \
--c-include="gio/gio.h" \ $(GIO_CINCLUDES) \ --add-include-path=. \
-
$(Gio_2_0_gir_DOCSRC)
+ $(Gio_2_0_gir_DOCSRC) \ + –library-path=$(GIO_LIBDIR)
Gio_2_0_gir_PACKAGES = gio-2.0 $(GIO_UNIX_PACKAGES) Gio_2_0_gir_INCLUDES = GObject-2.0
diff –git a/Makefile-giscanner.am b/Makefile-giscanner.am index c2273cd..0f47126 100644 — a/Makefile-giscanner.am +++ b/Makefile-giscanner.am @@ -1,17 +1,21 @@
## Process this file with automake to produce Makefile.in
+if BUILD_SCANNER
BUILT_SOURCES += \ scannerparser.c \ scannerparser.h \ scannerlexer.c \ scannerlexer.h
+endif
AM_YFLAGS = -d -t # Why do I have to do this automake? scannerlexer.h: scannerlexer.c
+if BUILD_SCANNER
noinst_LTLIBRARIES += libgiscanner.la
+endif
libgiscanner_la_SOURCES = \ giscanner/sourcescanner.c \
@@ -24,7 +28,9 @@ libgiscanner_la_CFLAGS = $(GOBJECT_CFLAGS) $(GIO_CFLAGS)
# Python module pkgpyexecdir = $(pkglibdir)/giscanner
+if BUILD_SCANNER
pkgpyexec_LTLIBRARIES = _giscanner.la
+endif
pkgpyexec_PYTHON = \ giscanner/__init__.py \ giscanner/annotationmain.py \
diff –git a/Makefile-tools.am b/Makefile-tools.am index 34d2a25..87c3a1f 100644 — a/Makefile-tools.am +++ b/Makefile-tools.am @@ -1,5 +1,8 @@
bin_PROGRAMS += g-ir-compiler g-ir-generate
+ +if BUILD_SCANNER
bin_SCRIPTS += g-ir-scanner g-ir-annotation-tool
+endif
if BUILD_DOCTOOL bin_SCRIPTS += g-ir-doc-tool
@@ -12,6 +15,7 @@ EXTRA_DIST += \
TOOL_SUBSTITUTIONS = sed -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON\@,$(PYTHON),
+if BUILD_SCANNER
g-ir-scanner: tools/g-ir-scanner.in _giscanner.la Makefile $(AM_V_GEN) $(TOOL_SUBSTITUTIONS) $< > $@.tmp && mv $@.tmp $@ @chmod a+x $@
@@ -19,10 +23,13 @@ g-ir-scanner: tools/g-ir-scanner.in _giscanner.la Makefile
g-ir-annotation-tool: tools/g-ir-annotation-tool.in _giscanner.la Makefile $(AM_V_GEN) $(TOOL_SUBSTITUTIONS) $< > $@.tmp && mv $@.tmp $@ @chmod a+x $@
+endif
+if BUILD_DOCTOOL
g-ir-doc-tool: tools/g-ir-doc-tool.in _giscanner.la Makefile $(AM_V_GEN) $(TOOL_SUBSTITUTIONS) $< > $@.tmp && mv $@.tmp $@ @chmod a+x $@
+endif
g_ir_compiler_SOURCES = tools/compiler.c g_ir_compiler_CPPFLAGS = -DGIREPO_DEFAULT_SEARCH_PATH="\"$(libdir)\"" \
@@ -46,4 +53,10 @@ GCOVSOURCES = \
$(g_ir_compiler_SOURCES) \ $(g_ir_generate_SOURCES)
-CLEANFILES += g-ir-scanner g-ir-annotation-tool g-ir-doc-tool +if BUILD_SCANNER +CLEANFILES += g-ir-scanner g-ir-annotation-tool +endif + +if BUILD_DOCTOOL +CLEANFILES += g-ir-doc-tool +endif diff –git a/Makefile.am b/Makefile.am index 1a988a5..b14b745 100644 — a/Makefile.am +++ b/Makefile.am @@ -35,8 +35,11 @@ DISTCHECK_CONFIGURE_FLAGS = –enable-gtk-doc –enable-doctool
man_MANS += \ docs/g-ir-compiler.1 \
-
docs/g-ir-generate.1 \
+ docs/g-ir-generate.1 +if BUILD_SCANNER +man_MANS += \
docs/g-ir-scanner.1
+endif
pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gobject-introspection-1.0.pc gobject-introspection-no-export-1.0.pc
diff –git a/common.mk b/common.mk index 303622f..30a011a 100644 — a/common.mk +++ b/common.mk @@ -9,11 +9,14 @@
INTROSPECTION_SCANNER = \ env PATH=".libs:$(PATH)" \ LPATH=.libs \
-
CC=“$(CC)” \
+ CC=“$(CC)” +if BUILD_SCANNER +INTROSPECTION_SCANNER += \
PYTHONPATH=$(top_builddir):$(top_srcdir) \ UNINSTALLED_INTROSPECTION_SRCDIR=$(top_srcdir) \
-
UNINSTALLED_INTROSPECTION_BUILDDIR=$(top_builddir) \
-
$(top_builddir)/g-ir-scanner
+ UNINSTALLED_INTROSPECTION_BUILDDIR=$(top_builddir) +endif +INTROSPECTION_SCANNER += $(G_IR_SCANNER)
INTROSPECTION_SCANNER_ARGS = \ --verbose \
diff –git a/configure.ac b/configure.ac index 1fd260a..615ff18 100644 — a/configure.ac +++ b/configure.ac @@ -250,19 +250,42 @@ AC_FUNC_STRTOD
AC_CHECK_FUNCS([memchr strchr strspn strstr strtol strtoull]) AC_CHECK_FUNCS([backtrace backtrace_symbols])
-# Python -AM_PATH_PYTHON([2.6]) -case “$host” in ---mingw*)
-
# Change backslashes to forward slashes in pyexecdir to avoid
-
# quoting issues
-
pyexecdir=`echo $pyexecdir | tr '\\' '/'`
-
;;
+AC_ARG_WITH(g_ir_scanner, + AS_HELP_STRING(, + [Use existing g-ir-scanner instead of building. @<:@default=no@:>@]), + [], + [with_g_ir_scanner=no]) +case “x${with_g_ir_scanner}” in +xyes) + AC_PATH_PROG(G_IR_SCANNER, + [g-ir-scanner], + [AC_MSG_ERROR([g-ir-scanner not found.])]) + build_g_ir_scanner=no + ;; +xno) + # Python + AM_PATH_PYTHON() + case “$host” in + --mingw*) + # Change backslashes to forward slashes in pyexecdir to avoid + # quoting issues + pyexecdir=`echo $pyexecdir | tr '\\' '/'` + ;; + esac + AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found])) + if test “x$os_win32” = “xyes”; then + AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.])) + fi + G_IR_SCANNER=“$(top_builddir)/g-ir-scanner” + build_g_ir_scanner=yes + ;; +*) + G_IR_SCANNER=“${with_g_ir_scanner}” + build_g_ir_scanner=no + ;;
esac
-AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found])) -if test “x$os_win32” = “xyes”; then
-
AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.]))
-fi +AC_SUBST(G_IR_SCANNER) +AM_CONDITIONAL(BUILD_SCANNER, test x${build_g_ir_scanner} = xyes)
dnl Not enabled by default until 3.6 cycle when we can propose mako as dnl an external dependency
@@ -347,6 +370,13 @@ fi
AC_SUBST(EXTRA_LINK_FLAGS)
+AC_ARG_ENABLE(tests, + [AS_HELP_STRING(, + [disable tests])], + [], + [enable_tests=yes]) +AM_CONDITIONAL(ENABLE_TESTS, test x“$enable_tests” = xyes) +
AC_CONFIG_FILES([ Makefile tests/Makefile
diff –git a/tests/Makefile.am b/tests/Makefile.am index bdd0fa7..70f1825 100644 — a/tests/Makefile.am +++ b/tests/Makefile.am @@ -17,7 +17,9 @@ tests_DATA = \
gimarshallingtests.h \ gitestmacros.h
+if ENABLE_TESTS
EXTRA_LTLIBRARIES = libeverything-1.0.la libgimarshallingtests-1.0.la
+endif
libeverything_1_0_la_SOURCES = everything.c libgimarshallingtests_1_0_la_SOURCES = gimarshallingtests.c
@@ -27,7 +29,9 @@ EXTRA_DIST += \
gi-tester \ gitestmacros.h
+if ENABLE_TESTS
BUILT_SOURCES += everything.c everything.h
+endif
CLEANFILES += \ $(BUILT_SOURCES) \
diff –git a/tests/offsets/Makefile.am b/tests/offsets/Makefile.am index 65d8773..66b00b1 100644 — a/tests/offsets/Makefile.am +++ b/tests/offsets/Makefile.am @@ -11,7 +11,9 @@ EXTRA_PROGRAMS =
############################################################
+if ENABLE_TESTS
EXTRA_LTLIBRARIES += liboffsets.la
+endif
liboffsets_la_SOURCES = \ offsets.h \
@@ -32,7 +34,9 @@ CLEANFILES += Offsets-1.0.gir Offsets-1.0.typelib liboffsets.la
############################################################
+if ENABLE_TESTS
EXTRA_PROGRAMS += gitestoffsets
+endif
nodist_gitestoffsets_SOURCES = gitestoffsets.c gitestoffsets_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository -I$(top_srcdir)/tests
@@ -41,9 +45,11 @@ gitestoffsets_LDADD = $(top_builddir)/libgirepository-1.0.la $(GIREPO_LIBS)
gitestoffsets.c: gen-gitestoffsets offsets.h Offsets-1.0.typelib $(AM_V_GEN) $(PYTHON) $(srcdir)/gen-gitestoffsets $(srcdir)/offsets.h > $@ || ( rm -f $@ && false )
+if ENABLE_TESTS
EXTRA_DIST += gen-gitestoffsets BUILT_SOURCES += gitestoffsets.c CLEANFILES += gitestoffsets.c $(EXTRA_PROGRAMS)
+endif
############################################################
diff –git a/tests/repository/Makefile.am b/tests/repository/Makefile.am index 882fa9e..89c9069 100644 — a/tests/repository/Makefile.am +++ b/tests/repository/Makefile.am @@ -2,8 +2,10 @@ AM_CFLAGS = $(GOBJECT_CFLAGS)
AM_LDFLAGS = -module -avoid-version LIBS = $(GOBJECT_LIBS)
+if ENABLE_TESTS
EXTRA_PROGRAMS = gitestrepo gitestthrows gitypelibtest CLEANFILES = $(EXTRA_PROGRAMS)
+endif
gitestrepo_SOURCES = $(srcdir)/gitestrepo.c gitestrepo_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
diff –git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am index 92ab12a..41f4de8 100644 — a/tests/scanner/Makefile.am +++ b/tests/scanner/Makefile.am @@ -9,6 +9,7 @@ INTROSPECTION_SCANNER_ARGS += –warn-all
CLEANFILES =
+if ENABLE_TESTS
EXTRA_LTLIBRARIES = \ libsletter.la \ libutility.la \
@@ -19,6 +20,7 @@ EXTRA_LTLIBRARIES = \
libtypedefs.la \ $(NULL) CLEANFILES += $(EXTRA_LTLIBRARIES)
+endif
GI_SCANNER_CFLAGS = -I$(top_srcdir)/tests AM_CPPFLAGS = -I$(top_srcdir)/girepository
@@ -147,7 +149,7 @@ Typedefs_1_0_gir_FILES = $(libtypedefs_la_SOURCES)
Typedefs_1_0_gir_SCANNERFLAGS = --c-include="typedefs.h" --identifier-prefix=Typedefs --symbol-prefix=typedefs GIRS += Typedefs-1.0.gir
-if !OS_WIN32 +if ENABLE_TESTS
EXTRA_PROGRAMS = barapp CLEANFILES += $(EXTRA_PROGRAMS)