[ease/libraries] [libraries] Partial introspection support, install vapi



commit f9298feee92587b9640548ef2bb925b22d801b4b
Author: Nate Stedman <natesm gmail com>
Date:   Mon Jul 26 08:59:38 2010 -0400

    [libraries] Partial introspection support, install vapi

 .gitignore             |    6 +++-
 Makefile.am            |    5 ++-
 configure.ac           |   13 +++----
 data/themes/build.sh   |    5 ---
 examples/build.sh      |    5 ---
 libease/Makefile.am    |   20 +++++++++-
 libease/ease-temp.vala |    4 +-
 m4/introspection.m4    |   94 ++++++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 128 insertions(+), 24 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index ba76177..55628f6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,10 @@
 *.AppleDouble/
 *DS_Store
 
+# introspection noise
+libease/tmp-introspect*
+*.gir
+
 # build files
 ease
 *.h
@@ -46,7 +50,7 @@ config.*
 depcomp
 install-sh
 ltmain.sh
-m4
+*.m4
 !m4/introspection.m4
 missing
 mkinstalldirs
diff --git a/Makefile.am b/Makefile.am
index 2cf2576..fdb0a93 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,6 +34,9 @@ doc: libease/*.vala
 	gnome-open doc/doc/Ease.html
 
 archive: data/themes/* examples/*
-	sh data/themes/build.sh
 	sh examples/build.sh
+	sh data/themes/build.sh
+
+.PHONY: archive
 
+noinst_PROGRAMS = archive
diff --git a/configure.ac b/configure.ac
index 7add5f4..3cead0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,7 +12,7 @@ AC_CONFIG_FILES([Makefile
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_HEADERS([config.h])
 
-AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2 subdir-objects])
+AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2 subdir-objects -Wno-portability])
 
 # Enable silent rules is available
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -23,9 +23,12 @@ AM_PROG_VALAC([0.9.1])
 AM_PROG_CC_C_O
 AC_PROG_INSTALL
 AC_PROG_INTLTOOL([0.35])
-
 AM_PROG_LIBTOOL
 
+# GObject introspection
+AC_CONFIG_MACRO_DIR([m4])
+GOBJECT_INTROSPECTION_CHECK([0.6.7])
+
 dnl this is preferred, but doesn't work for me :
 dnl LT_PREREQ([2.2.6])
 
@@ -69,10 +72,4 @@ AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext Package])
 AC_SUBST(GETTEXT_PACKAGE)
 AM_GLIB_GNU_GETTEXT
 
-dnl Package Themes
-AC_CONFIG_COMMANDS([build-themes], [sh data/themes/build.sh])
-
-dnl Package Example .ease files
-AC_CONFIG_COMMANDS([build-examples], [sh examples/build.sh])
-
 AC_OUTPUT
diff --git a/data/themes/build.sh b/data/themes/build.sh
index ae8b6e7..7238e91 100755
--- a/data/themes/build.sh
+++ b/data/themes/build.sh
@@ -1,16 +1,11 @@
 #!/bin/sh
 
-echo "  Archiving themes..."
-
 cd data/themes
 
 for THEME in `find ./* -maxdepth 0 -type d | sed "s/.\///g"`
 	do
-		echo "    Archiving $THEME to $THEME.easetheme ..."
 		cd $THEME
 		tar -cf ../$THEME.easetheme `ls`
 		cd ..
 	done
 
-echo "  Done archiving themes."
-
diff --git a/examples/build.sh b/examples/build.sh
index 57f94da..a2f8f3d 100755
--- a/examples/build.sh
+++ b/examples/build.sh
@@ -1,16 +1,11 @@
 #!/bin/sh
 
-echo "  Archiving example .ease files..."
-
 cd examples
 
 for DOC in `find ./* -maxdepth 0 -type d | sed "s/.\///g"`
 	do
-		echo "    Archiving $DOC to $DOC.ease ..."
 		cd $DOC
 		tar -cf ../$DOC.ease `ls`
 		cd ..
 	done
 
-echo "  Done archiving example .ease files."
-
diff --git a/libease/Makefile.am b/libease/Makefile.am
index 926302b..1224635 100644
--- a/libease/Makefile.am
+++ b/libease/Makefile.am
@@ -1,7 +1,6 @@
 lib_LTLIBRARIES = libease-0.1.la
 
 INCLUDES = \
-	-include config.h \
 	$(EASE_CFLAGS)
 
 AM_CPPFLAGS = \
@@ -63,15 +62,32 @@ libease_0_1_la_SOURCES = \
 # compiler flags
 libease_0_1_la_VALAFLAGS = \
 	$(EASE_PACKAGES) \
-	--vapi=ease.vapi \
+	--vapi=ease-0.1.vapi \
 	--header=libease.h \
 	--thread \
+	--library Ease-0.1 \
+	--gir=Ease-0.1.gir \
 	-g \
 	$(NULL)
 
 libease_0_1_la_CFLAGS = $(EASE_CFLAGS)
 libease_0_1_la_LDFLAGS = $(EASE_LDFLAGS)
 
+# build typelib
+
 # header installation
 libease_includedir=$(includedir)/ease-0.1/
 libease_include_HEADERS = libease.h
+
+# vapi installation
+vapidir = $(datadir)/vala/vapi
+vapi_DATA = ease-0.1.vapi
+
+# gir installation
+girdir = $(datadir)/gir-1.0
+gir_DATA = Ease-0.1.gir
+EXTRA_DIST = Ease-0.1.gir
+
+# remove generated c files on `make clean`
+CLEANFILES = $(subst .vala,.c,$(libease_0_1_la_SOURCES))
+
diff --git a/libease/ease-temp.vala b/libease/ease-temp.vala
index 8a9b104..c164ac6 100644
--- a/libease/ease-temp.vala
+++ b/libease/ease-temp.vala
@@ -123,7 +123,7 @@ public static class Ease.Temp : Object
 	 *
 	 * @param filename The path of the archive to extract.
 	 */
-	public static string extract(string filename) throws GLib.Error
+	internal static string extract(string filename) throws GLib.Error
 	{
 		// initialize the archive
 		var archive = new Archive.Read();
@@ -175,7 +175,7 @@ public static class Ease.Temp : Object
 	 * @param temp_path The path of the temporary directory.
 	 * @param filename The filename of the archive to save to.
 	 */
-	public static void archive(string temp_path, string filename) throws Error
+	internal static void archive(string temp_path, string filename) throws Error
 	{
 		// create a writable archive
 		var archive = new Archive.Write();
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644
index 0000000..589721c
--- /dev/null
+++ b/m4/introspection.m4
@@ -0,0 +1,94 @@
+dnl -*- mode: autoconf -*-
+dnl Copyright 2009 Johan Dahlin
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+# serial 1
+
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
+[
+    AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+    dnl enable/disable introspection
+    m4_if([$2], [require],
+    [dnl
+        enable_introspection=yes
+    ],[dnl
+        AC_ARG_ENABLE(introspection,
+                  AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
+                                 [Enable introspection for this build]),, 
+                                 [enable_introspection=auto])
+    ])dnl
+
+    AC_MSG_CHECKING([for gobject-introspection])
+
+    dnl presence/version checking
+    AS_CASE([$enable_introspection],
+    [no], [dnl
+        found_introspection="no (disabled, use --enable-introspection to enable)"
+    ],dnl
+    [yes],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0],,
+                         AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
+                         found_introspection=yes,
+                         AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
+    ],dnl
+    [auto],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+    ],dnl
+    [dnl	
+        AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
+    ])dnl
+
+    AC_MSG_RESULT([$found_introspection])
+
+    INTROSPECTION_SCANNER=
+    INTROSPECTION_COMPILER=
+    INTROSPECTION_GENERATE=
+    INTROSPECTION_GIRDIR=
+    INTROSPECTION_TYPELIBDIR=
+    if test "x$found_introspection" = "xyes"; then
+       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+    fi
+    AC_SUBST(INTROSPECTION_SCANNER)
+    AC_SUBST(INTROSPECTION_COMPILER)
+    AC_SUBST(INTROSPECTION_GENERATE)
+    AC_SUBST(INTROSPECTION_GIRDIR)
+    AC_SUBST(INTROSPECTION_TYPELIBDIR)
+    AC_SUBST(INTROSPECTION_CFLAGS)
+    AC_SUBST(INTROSPECTION_LIBS)
+    AC_SUBST(INTROSPECTION_MAKEFILE)
+
+    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
+])
+
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
+])
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
+])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]