commit 26826e6ca0bf6feaa87523b746808b4187cbe3ef
Author: Bertrand Lorentz <bertrand.lore...@gmail.com>
Date:   Sun Mar 28 18:06:44 2010 +0200

    Integrate the mono bindings in the build

 bindings/Makefile.am                               |    4 +-
 bindings/mono/Makefile.am                          |    1 +
 bindings/mono/Makefile.include                     |   30 +++++++
 bindings/mono/libgpod-sharp-test/Makefile.am       |   16 ++++
 .../mono/libgpod-sharp-test/libgpod-sharp-test.in  |    3 +
 bindings/mono/libgpod-sharp/Makefile.am            |   28 +++++++
 bindings/mono/libgpod-sharp/libgpod-sharp.pc.in    |    6 ++
 configure.ac                                       |   12 +++
 m4/mono.m4                                         |   80 ++++++++++++++++++++
 9 files changed, 177 insertions(+), 3 deletions(-)
---
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
index d09be56..5837e49 100644
--- a/bindings/Makefile.am
+++ b/bindings/Makefile.am
@@ -1,3 +1 @@
-if HAVE_PYTHON
-SUBDIRS=python
-endif
+SUBDIRS=mono python
diff --git a/bindings/mono/Makefile.am b/bindings/mono/Makefile.am
new file mode 100644
index 0000000..2326434
--- /dev/null
+++ b/bindings/mono/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS=libgpod-sharp libgpod-sharp-test
diff --git a/bindings/mono/Makefile.include b/bindings/mono/Makefile.include
new file mode 100644
index 0000000..b3ad247
--- /dev/null
+++ b/bindings/mono/Makefile.include
@@ -0,0 +1,30 @@
+SOURCES_BUILD = $(addprefix $(srcdir)/, $(SOURCES))
+
+ASSEMBLY_EXTENSION = $(strip $(patsubst library, dll, $(TARGET)))
+ASSEMBLY_FILE = $(ASSEMBLY).$(ASSEMBLY_EXTENSION)
+
+DEFAULT_INSTALL_DIR = $(pkglibdir)
+INSTALL_DIR_RESOLVED = $(firstword $(subst , $(DEFAULT_INSTALL_DIR), 
$(INSTALL_DIR)))
+
+OUTPUT_FILES = \
+       $(ASSEMBLY_FILE) \
+       $(ASSEMBLY_FILE).mdb
+
+moduledir = $(INSTALL_DIR_RESOLVED)
+module_SCRIPTS = $(OUTPUT_FILES)
+
+all: $(ASSEMBLY_FILE)
+
+$(ASSEMBLY_FILE).mdb: $(ASSEMBLY_FILE)
+
+$(ASSEMBLY_FILE): $(SOURCES_BUILD)
+       $(MCS) -debug -target:$(TARGET) -out:$@ $(LINK) $(SOURCES_BUILD)
+       @if [ -e $(srcdir)/$(notdir $...@.config) ]; then \
+               cp $(srcdir)/$(notdir $...@.config) $(top_builddir)/bin; \
+       fi;
+
+EXTRA_DIST = $(SOURCES_BUILD)
+
+CLEANFILES = $(OUTPUT_FILES)
+DISTCLEANFILES = *.pidb
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/bindings/mono/libgpod-sharp-test/Makefile.am 
b/bindings/mono/libgpod-sharp-test/Makefile.am
new file mode 100644
index 0000000..f06b0a8
--- /dev/null
+++ b/bindings/mono/libgpod-sharp-test/Makefile.am
@@ -0,0 +1,16 @@
+ASSEMBLY = libgpod-sharp-test
+TARGET = exe
+LINK = -r:../libgpod-sharp/libgpod-sharp.dll
+
+SOURCES =  \
+       AssemblyInfo.cs \
+       Main.cs
+
+EXTRAS = \
+       libgpod-sharp-test.in
+
+if HAVE_MONO
+include $(srcdir)/../Makefile.include
+else
+EXTRA_DIST = $(SOURCES)
+endif
diff --git a/bindings/mono/libgpod-sharp-test/libgpod-sharp-test.in 
b/bindings/mono/libgpod-sharp-test/libgpod-sharp-test.in
new file mode 100644
index 0000000..105bdf2
--- /dev/null
+++ b/bindings/mono/libgpod-sharp-test/libgpod-sharp-test.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec mono "@expanded_libdir@/@PACKAGE@/libgpod-sharp-test.exe" "$@"
diff --git a/bindings/mono/libgpod-sharp/Makefile.am 
b/bindings/mono/libgpod-sharp/Makefile.am
new file mode 100644
index 0000000..83f2f0d
--- /dev/null
+++ b/bindings/mono/libgpod-sharp/Makefile.am
@@ -0,0 +1,28 @@
+ASSEMBLY = libgpod-sharp
+TARGET = library
+LINK = $(GLIBSHARP_LIBS) $(GDKSHARP_LIBS)
+
+SOURCES =  \
+       Artwork.cs \
+       AssemblyInfo.cs \
+       Chapter.cs \
+       ChapterData.cs \
+       Device.cs \
+       GPodBase.cs \
+       GPodList.cs \
+       IpodInfo.cs \
+       ITDB.cs \
+       PhotoAlbum.cs \
+       PhotoDB.cs \
+       Playlist.cs \
+       Thumbnail.cs \
+       Track.cs
+
+EXTRAS = \
+       libgpod-sharp.pc.in
+
+if HAVE_MONO
+include $(srcdir)/../Makefile.include
+else
+EXTRA_DIST = $(SOURCES)
+endif
diff --git a/bindings/mono/libgpod-sharp/libgpod-sharp.pc.in 
b/bindings/mono/libgpod-sharp/libgpod-sharp.pc.in
new file mode 100644
index 0000000..ec48738
--- /dev/null
+++ b/bindings/mono/libgpod-sharp/libgpod-sharp.pc.in
@@ -0,0 +1,6 @@
+Name: libgpod-sharp
+Description: libgpod-sharp
+Version: 0.1
+
+Requires: glib-sharp-2.0 gdk-sharp-2.0
+Libs: -r:@expanded_libdir@/@PACKAGE@/libgpod-sharp.dll
diff --git a/configure.ac b/configure.ac
index 2a9072f..156603e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -323,6 +323,13 @@ PYTHON_MUTAGEN_MIN_VERSION=1.8
 SWIG_MIN_VERSION=1.3.24
 LIBGPOD_CHECK_PYTHON($PYTHON_MIN_VERSION)
 
+dnl **************************************************
+dnl * optional mono bindings
+dnl **************************************************
+
+MONO_MIN_VERSION=1.9.1
+GTK_SHARP_MIN_VERSION=2.12
+LIBGPOD_CHECK_MONO
 
 dnl warnings bits, copied from gnome-keyring configure.in
 dnl Turn on the additional warnings last, so -Werror doesn't affect other 
tests.
@@ -377,6 +384,10 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 AC_CONFIG_FILES([
 Makefile
 bindings/Makefile
+bindings/mono/Makefile
+bindings/mono/libgpod-sharp/libgpod-sharp.pc
+bindings/mono/libgpod-sharp/Makefile
+bindings/mono/libgpod-sharp-test/Makefile
 bindings/python/gpod.i
 bindings/python/Makefile
 bindings/python/examples/Makefile
@@ -404,6 +415,7 @@ Configuration for $PACKAGE $VERSION :
  Compiler .................: $CC $CFLAGS $LIBGPOD_CFLAGS
  Linker ...................: $CC $LDFLAGS $LIBS $LIBGPOD_LIBS
  Artwork support ..........: $have_gdkpixbuf
+ Mono bindings ............: $with_mono
  Python bindings ..........: $with_python
  PyGObject support ........: $have_pygobject
  iPhone/iPod Touch support.: $enable_libimobiledevice
diff --git a/m4/mono.m4 b/m4/mono.m4
new file mode 100644
index 0000000..2b8415b
--- /dev/null
+++ b/m4/mono.m4
@@ -0,0 +1,80 @@
+AC_DEFUN([SHAMROCK_EXPAND_LIBDIR],
+[
+        expanded_libdir=`(
+                case $prefix in
+                        NONE) prefix=$ac_default_prefix ;;
+                        *) ;;
+                esac
+                case $exec_prefix in
+                        NONE) exec_prefix=$prefix ;;
+                        *) ;;
+                esac
+                eval echo $libdir
+        )`
+        AC_SUBST(expanded_libdir)
+])
+
+AC_DEFUN([SHAMROCK_FIND_PROGRAM],
+[
+       AC_PATH_PROG($1, $2, $3)
+       AC_SUBST($1)
+])
+
+AC_DEFUN([SHAMROCK_FIND_PROGRAM_OR_BAIL],
+[
+       SHAMROCK_FIND_PROGRAM($1, $2, no)
+       if test "x$$1" = "xno"; then
+               AC_MSG_ERROR([You need to install '$2'])
+       fi
+])
+
+AC_DEFUN([SHAMROCK_FIND_MONO_2_0_COMPILER],
+[
+       SHAMROCK_FIND_PROGRAM_OR_BAIL(MCS, gmcs)
+])
+
+AC_DEFUN([SHAMROCK_FIND_MONO_RUNTIME],
+[
+       SHAMROCK_FIND_PROGRAM_OR_BAIL(MONO, mono)
+])
+
+AC_DEFUN([SHAMROCK_CHECK_MONO_MODULE],
+[
+       PKG_CHECK_MODULES(MONO_MODULE, mono >= $1)
+])
+
+AC_DEFUN([CHECK_GLIB_GTK_SHARP],
+[
+       PKG_CHECK_MODULES(GDKSHARP,
+               gdk-sharp-2.0 >= $GTK_SHARP_MIN_VERSION)
+       AC_SUBST(GDKSHARP_LIBS)
+
+       PKG_CHECK_MODULES(GLIBSHARP,
+               glib-sharp-2.0 >= $GTK_SHARP_MIN_VERSION)
+       AC_SUBST(GLIBSHARP_LIBS)
+])
+
+dnl check for mono and required dependencies
+AC_DEFUN([LIBGPOD_CHECK_MONO],
+[
+    AC_ARG_WITH(mono,
+        AC_HELP_STRING([--with-mono],
+            [build mono bindings [[default=yes]]]),
+        [with_mono=$withval],[with_mono=yes])
+
+    AC_MSG_CHECKING(whether to build mono bindings)
+    if test "X$with_mono" != Xno; then
+        with_mono=yes
+    fi
+    AC_MSG_RESULT($with_mono)
+
+    if test "X$with_mono" = Xyes; then
+        SHAMROCK_EXPAND_LIBDIR
+        SHAMROCK_CHECK_MONO_MODULE($MONO_MIN_VERSION)
+        SHAMROCK_FIND_MONO_2_0_COMPILER
+        SHAMROCK_FIND_MONO_RUNTIME
+        CHECK_GLIB_GTK_SHARP
+
+    fi
+    AM_CONDITIONAL(HAVE_MONO, test x$with_mono = xyes)
+])

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to