[f-spot/hyena-submodule] Add the needed bits for Hyena building.



commit 70c573c856e116b3dd71516ee0df89c4a566ecb3
Author: Ruben Vermeersch <ruben savanne be>
Date:   Sat May 29 10:13:36 2010 +0200

    Add the needed bits for Hyena building.

 .gitignore                         |    2 +
 build/DllMapVerifier.cs            |  258 ++++++++++++++++++++++++++++++++++++
 build/Makefile.am                  |   15 ++
 build/build.environment.mk         |   21 +++
 build/build.mk                     |    3 +
 build/build.rules.mk               |   91 +++++++++++++
 build/dll-map-makefile-verifier    |   10 ++
 build/m4/f-spot/gtk-sharp.m4       |   23 +++
 build/private-icon-theme-installer |   23 +++
 configure.ac                       |    8 +-
 lib/Makefile.am                    |    4 +
 src/f-spot.in                      |    2 +-
 12 files changed, 458 insertions(+), 2 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 7ffbf8f..48f6155 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,8 @@ Makefile
 Makefile.in
 /aclocal.m4
 /autom4te.cache
+/bin
+/build/dll-map-verifier.exe
 /config.guess
 /config.h
 /config.h.in
diff --git a/build/DllMapVerifier.cs b/build/DllMapVerifier.cs
new file mode 100644
index 0000000..9acccb6
--- /dev/null
+++ b/build/DllMapVerifier.cs
@@ -0,0 +1,258 @@
+using System;
+using System.IO;
+using System.Xml;
+using System.Text;
+using System.Collections.Generic;
+
+public static class DllMapVerifier
+{
+    private struct DllImportRef
+    {
+        public DllImportRef (string name, int line, int column)
+        {
+            Name = name;
+            Line = line;
+            Column = column;
+        }
+
+        public string Name;
+        public int Line;
+        public int Column;
+    }
+
+    private static Dictionary<string, List<DllImportRef>> dll_imports 
+        = new Dictionary<string, List<DllImportRef>> ();
+    private static List<string> ignore_dlls = new List<string> ();
+    private static List<string> config_dlls = null;
+    
+    public static int Main (string [] args)
+    {
+        LoadConfigDlls (args[0]);
+        foreach (string file in args) {
+            LoadDllImports (file);
+        }
+
+        return VerifyDllImports (args[0]) ? 0 : 1;
+    }
+
+    private static bool VerifyDllImports (string configFile)
+    {
+        int total_unmapped_count = 0;
+
+        foreach (KeyValuePair<string, List<DllImportRef>> dll_import in dll_imports) {
+            int file_unmapped_count = 0;
+            foreach (DllImportRef dll_import_ref in dll_import.Value) {
+                if (config_dlls != null && config_dlls.Contains (dll_import_ref.Name)) {
+                    continue;
+                }
+
+                if (file_unmapped_count++ == 0) {
+                    Console.Error.WriteLine ("Unmapped DLLs in file: {0}", dll_import.Key);
+                }
+
+                Console.Error.WriteLine ("  + {0} : {1},{2}", dll_import_ref.Name, 
+                    dll_import_ref.Line, dll_import_ref.Column);
+            }
+
+            total_unmapped_count += file_unmapped_count;
+        }
+
+        if (total_unmapped_count > 0) {
+            Console.Error.WriteLine ();
+            Console.Error.WriteLine ("  If any DllImport above is explicitly allowed to be unmapped,");
+            Console.Error.WriteLine ("  add an 'willfully unmapped' comment to the inside of the attribute:");
+            Console.Error.WriteLine ();
+            Console.Error.WriteLine ("      [DllImport (\"libX11.so.6\") /* willfully unmapped */]");
+            Console.Error.WriteLine ();
+        }
+
+        if (total_unmapped_count > 0 && config_dlls == null) {
+            Console.Error.WriteLine ("No config file for DLL mapping was found ({0})", configFile);
+        }
+
+        return total_unmapped_count == 0;
+    }
+    
+    private static void LoadDllImports (string csFile)
+    {
+        if (csFile.StartsWith ("-i")) {
+            ignore_dlls.Add (csFile.Substring (2));
+            return;
+        }
+
+        if (Path.GetExtension (csFile) == ".cs" && File.Exists (csFile)) {
+            List<DllImportRef> dll_import_refs = null;
+
+            foreach (DllImportRef dll_import in ParseFileForDllImports (csFile)) {
+                if (ignore_dlls.Contains (dll_import.Name)) {
+                    continue;
+                }
+            
+                if (dll_import_refs == null) {
+                    dll_import_refs = new List<DllImportRef> ();
+                }
+
+                dll_import_refs.Add (dll_import);
+            }
+
+            if (dll_import_refs != null) {
+                dll_imports.Add (csFile, dll_import_refs);
+            }
+        }
+    }
+
+    private static void LoadConfigDlls (string configFile)
+    {
+        try {
+            XmlTextReader config = new XmlTextReader (configFile);
+            config_dlls = new List<string> ();
+            while (config.Read ()) {
+                if (config.NodeType == XmlNodeType.Element && 
+                    config.Name == "dllmap") {
+                    string dll = config.GetAttribute ("dll");
+                    if (!config_dlls.Contains (dll)) {
+                        config_dlls.Add (dll);
+                    }
+                }
+            }
+        } catch {
+        }
+    }
+    
+#region DllImport parser
+
+    private static StreamReader reader;
+    private static int reader_line;
+    private static int reader_col;
+    
+    private static IEnumerable<DllImportRef> ParseFileForDllImports (string file)
+    {
+        reader_line = 1;
+        reader_col = 1;
+
+        using (reader = new StreamReader (file)) {
+            char c;
+            bool in_paren = false;
+            bool in_attr = false;
+            bool in_dll_attr = false;
+            bool in_string = false;
+            bool in_comment = false;
+            int dll_line = 1, dll_col = 1;
+            string dll_string = null;
+            string dll_comment = null;
+            
+            while ((c = (char)reader.Peek ()) != Char.MaxValue) {
+                switch (c) {
+                    case ' ':
+                    case '\t': Read (); break;
+                    case '[': 
+                        in_attr = true;
+                        dll_string = null;
+                        dll_comment = null;
+                        dll_line = reader_line;
+                        dll_col = reader_col;
+                        Read ();
+                        break;
+                    case '(': Read (); in_paren = true; break;
+                    case ')': Read (); in_paren = false; break;
+                    case '"':
+                        Read ();
+                        if (dll_string == null && in_dll_attr && in_paren && !in_string) {
+                            in_string = true;
+                        }
+                        break;
+                    case '/':
+                        Read ();
+                        if ((char)reader.Peek () == '*') {
+                            Read ();
+                            if (in_dll_attr && !in_comment) {
+                                in_comment = true;
+                            }
+                        }
+                        break;
+                    case ']':
+                        if (in_dll_attr && dll_string != null && dll_comment != "willfully unmapped") {
+                            yield return new DllImportRef (dll_string, dll_line, dll_col);
+                        }
+                        in_attr = false;
+                        in_dll_attr = false;
+                        Read ();
+                        break;
+                    default:
+                        if (!in_dll_attr && in_attr && ReadDllAttribute ()) {
+                            in_dll_attr = true;
+                        } else if (in_dll_attr && in_string) {
+                            dll_string = ReadDllString ();
+                            in_string = false;
+                        } else if (in_dll_attr && in_comment) {
+                            dll_comment = ReadDllComment ();
+                            in_comment = false;
+                        } else {
+                            Read ();
+                        }
+                        break;
+                }
+            }
+        }
+    }
+
+    private static bool ReadDllAttribute () 
+    {
+        return
+            Read () == 'D' && 
+            Read () == 'l' &&
+            Read () == 'l' &&
+            Read () == 'I' &&
+            Read () == 'm' &&
+            Read () == 'p' &&
+            Read () == 'o' &&
+            Read () == 'r' &&
+            Read () == 't';
+    }
+
+    private static string ReadDllString ()
+    {
+        StringBuilder builder = new StringBuilder (32);
+        while (true) {
+            char c = Read ();
+            if (Char.IsLetterOrDigit (c) || c == '.' || c == '-' || c == '_') {
+                builder.Append (c);
+            } else {
+                break;
+            }
+        }
+        return builder.ToString ();
+    }
+
+    private static string ReadDllComment ()
+    {
+        StringBuilder builder = new StringBuilder ();
+        char lc = Char.MaxValue;
+        while (true) {
+            char c = Read ();
+            if (c == Char.MaxValue || (c == '/' && lc == '*')) {
+                break;
+            } else if (lc != Char.MaxValue) {
+                builder.Append (lc);
+            }
+            lc = c;
+        }
+        return builder.ToString ().Trim ();
+    }
+    
+    private static char Read ()
+    {
+        char c = (char)reader.Read ();
+        if (c == '\n') {
+            reader_line++;
+            reader_col = 1;
+        } else {
+            reader_col++;
+        }
+        return c;
+    }
+    
+#endregion
+
+}
+
diff --git a/build/Makefile.am b/build/Makefile.am
index a57e338..9ae1045 100644
--- a/build/Makefile.am
+++ b/build/Makefile.am
@@ -1,3 +1,18 @@
 SUBDIRS = pkg-config m4
 
+DLL_MAP_VERIFIER_ASSEMBLY = dll-map-verifier.exe
+
+ALL_TARGETS = $(DLL_MAP_VERIFIER_ASSEMBLY)
+
+all: $(ALL_TARGETS)
+
+$(DLL_MAP_VERIFIER_ASSEMBLY): DllMapVerifier.cs
+	$(MCS) -out:$@ $<
+
+EXTRA_DIST = \
+	private-icon-theme-installer \
+	DllMapVerifier.cs \
+	dll-map-makefile-verifier
+
+CLEANFILES = *.exe *.mdb
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/build/build.environment.mk b/build/build.environment.mk
new file mode 100644
index 0000000..d550ec4
--- /dev/null
+++ b/build/build.environment.mk
@@ -0,0 +1,21 @@
+# Initializers
+MONO_BASE_PATH = 
+MONO_ADDINS_PATH =
+
+# Install Paths
+DEFAULT_INSTALL_DIR = $(pkglibdir)
+EXTENSIONS_INSTALL_DIR = $(DEFAULT_INSTALL_DIR)/Extensions
+
+# External libraries to link against, generated from configure
+LINK_SYSTEM = -r:System
+
+DIR_BIN = $(top_builddir)/bin
+
+# Cute hack to replace a space with something
+colon:= :
+empty:=
+space:= $(empty) $(empty)
+
+# Build path to allow running uninstalled
+RUN_PATH = $(subst $(space),$(colon), $(MONO_BASE_PATH))
+
diff --git a/build/build.mk b/build/build.mk
new file mode 100644
index 0000000..78e0760
--- /dev/null
+++ b/build/build.mk
@@ -0,0 +1,3 @@
+include $(top_srcdir)/build/build.environment.mk
+include $(top_srcdir)/build/build.rules.mk
+
diff --git a/build/build.rules.mk b/build/build.rules.mk
new file mode 100644
index 0000000..434994e
--- /dev/null
+++ b/build/build.rules.mk
@@ -0,0 +1,91 @@
+UNIQUE_FILTER_PIPE = tr [:space:] \\n | sort | uniq
+BUILD_DATA_DIR = $(top_builddir)/bin/share/$(PACKAGE)
+
+SOURCES_BUILD = $(addprefix $(srcdir)/, $(SOURCES))
+SOURCES_BUILD += $(top_srcdir)/src/AssemblyInfo.cs
+
+RESOURCES_EXPANDED = $(addprefix $(srcdir)/, $(RESOURCES))
+RESOURCES_BUILD = $(foreach resource, $(RESOURCES_EXPANDED), \
+	-resource:$(resource),$(notdir $(resource)))
+
+INSTALL_ICONS = $(top_srcdir)/build/private-icon-theme-installer "$(mkinstalldirs)" "$(INSTALL_DATA)"
+THEME_ICONS_SOURCE = $(wildcard $(srcdir)/ThemeIcons/*/*/*.png) $(wildcard $(srcdir)/ThemeIcons/scalable/*/*.svg)
+THEME_ICONS_RELATIVE = $(subst $(srcdir)/ThemeIcons/, , $(THEME_ICONS_SOURCE))
+
+ASSEMBLY_EXTENSION = $(strip $(patsubst library, dll, $(TARGET)))
+ASSEMBLY_FILE = $(top_builddir)/bin/$(ASSEMBLY).$(ASSEMBLY_EXTENSION)
+
+INSTALL_DIR_RESOLVED = $(firstword $(subst , $(DEFAULT_INSTALL_DIR), $(INSTALL_DIR)))
+
+if ENABLE_TESTS
+    LINK += " $(NUNIT_LIBS)"
+    ENABLE_TESTS_FLAG = "-define:ENABLE_TESTS"
+endif
+
+if ENABLE_ATK
+    ENABLE_ATK_FLAG = "-define:ENABLE_ATK"
+endif
+
+FILTERED_LINK = $(shell echo "$(LINK)" | $(UNIQUE_FILTER_PIPE))
+DEP_LINK = $(shell echo "$(LINK)" | $(UNIQUE_FILTER_PIPE) | sed s,-r:,,g | grep '$(top_builddir)/bin/')
+
+OUTPUT_FILES = \
+	$(ASSEMBLY_FILE) \
+	$(ASSEMBLY_FILE).mdb
+
+moduledir = $(INSTALL_DIR_RESOLVED)
+module_SCRIPTS = $(OUTPUT_FILES)
+
+all: $(ASSEMBLY_FILE) theme-icons
+
+run: 
+	@pushd $(top_builddir); \
+	make run; \
+	popd;
+
+test:
+	@pushd $(top_builddir)/tests; \
+	make $(ASSEMBLY); \
+	popd;
+
+build-debug:
+	@echo $(DEP_LINK)
+
+$(ASSEMBLY_FILE).mdb: $(ASSEMBLY_FILE)
+
+$(ASSEMBLY_FILE): $(SOURCES_BUILD) $(RESOURCES_EXPANDED) $(DEP_LINK)
+	@mkdir -p $(top_builddir)/bin
+	@if [ ! "x$(ENABLE_RELEASE)" = "xyes" ]; then \
+		$(top_srcdir)/build/dll-map-makefile-verifier $(srcdir)/Makefile.am $(srcdir)/$(notdir $  config) && \
+		$(MONO) $(top_builddir)/build/dll-map-verifier.exe $(srcdir)/$(notdir $  config) -iwinmm -ilibbanshee -ilibbnpx11 -ilibc -ilibc.so.6 -iintl -ilibmtp.dll -ilibigemacintegration.dylib -iCFRelease $(SOURCES_BUILD); \
+	fi;
+	$(MCS) \
+		$(GMCS_FLAGS) \
+		$(ASSEMBLY_BUILD_FLAGS) \
+		-nowarn:0278 -nowarn:0078 $$warn \
+		-define:HAVE_GTK_2_10 -define:NET_2_0 \
+		-debug -target:$(TARGET) -out:$@ \
+		$(BUILD_DEFINES) $(ENABLE_TESTS_FLAG) $(ENABLE_ATK_FLAG) \
+		$(FILTERED_LINK) $(RESOURCES_BUILD) $(SOURCES_BUILD)
+	@if [ -e $(srcdir)/$(notdir $  config) ]; then \
+		cp $(srcdir)/$(notdir $  config) $(top_builddir)/bin; \
+	fi;
+	@if [ ! -z "$(EXTRA_BUNDLE)" ]; then \
+		cp $(EXTRA_BUNDLE) $(top_builddir)/bin; \
+	fi;
+
+theme-icons: $(THEME_ICONS_SOURCE)
+	@$(INSTALL_ICONS) -il "$(BUILD_DATA_DIR)" "$(srcdir)" $(THEME_ICONS_RELATIVE)
+
+install-data-local: $(THEME_ICONS_SOURCE)
+	@$(INSTALL_ICONS) -i "$(DESTDIR)$(pkgdatadir)" "$(srcdir)" $(THEME_ICONS_RELATIVE)
+	
+uninstall-local: $(THEME_ICONS_SOURCE)
+	@$(INSTALL_ICONS) -u "$(DESTDIR)$(pkgdatadir)" "$(srcdir)" $(THEME_ICONS_RELATIVE)
+
+EXTRA_DIST = $(SOURCES_BUILD) $(RESOURCES_EXPANDED) $(THEME_ICONS_SOURCE)
+
+CLEANFILES = $(OUTPUT_FILES)
+DISTCLEANFILES = *.pidb
+MAINTAINERCLEANFILES = Makefile.in
+
diff --git a/build/dll-map-makefile-verifier b/build/dll-map-makefile-verifier
new file mode 100755
index 0000000..c75afa5
--- /dev/null
+++ b/build/dll-map-makefile-verifier
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+if [ -f $2 ]; then
+	# Lame, but better than nothing
+	grep $(basename $2) $1 | grep module_SCRIPTS &>/dev/null || {
+		echo "Assembly has corresponding .config file, but it was not found in module_SCRIPTS in Makefile.am" 2>&1
+		exit 1
+	}
+fi
+
diff --git a/build/m4/f-spot/gtk-sharp.m4 b/build/m4/f-spot/gtk-sharp.m4
new file mode 100644
index 0000000..4b3442a
--- /dev/null
+++ b/build/m4/f-spot/gtk-sharp.m4
@@ -0,0 +1,23 @@
+AC_DEFUN([FSPOT_CHECK_GTK_SHARP],
+[
+	GTKSHARP_REQUIRED=2.12.2
+
+	PKG_CHECK_MODULES(GTKSHARP,
+		gtk-sharp-2.0 >= $GTKSHARP_REQUIRED)
+	AC_SUBST(GTKSHARP_LIBS)
+
+	PKG_CHECK_MODULES(GLIBSHARP,
+		glib-sharp-2.0 >= $GTKSHARP_REQUIRED)
+	AC_SUBST(GLIBSHARP_LIBS)
+
+	PKG_CHECK_MODULES(GLIBSHARP_2_12_7,
+		glib-sharp-2.0 >= 2.12.7,
+		HAVE_GLIBSHARP_2_12_7=yes,
+		HAVE_GLIBSHARP_2_12_7=no)
+	AM_CONDITIONAL(HAVE_GLIBSHARP_2_12_7, [test "$HAVE_GLIBSHARP_2_12_7" = "yes"])
+
+    PKG_CHECK_MODULES(GTKSHARP_A11Y, gtk-sharp-2.0 >= 2.12.10, gtksharp_with_a11y=yes, gtksharp_with_a11y=no)
+	AM_CONDITIONAL(ENABLE_ATK, test "x$gtksharp_with_a11y" = "xyes")
+
+])
+
diff --git a/build/private-icon-theme-installer b/build/private-icon-theme-installer
new file mode 100755
index 0000000..00f0ffe
--- /dev/null
+++ b/build/private-icon-theme-installer
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+mkinstalldirs=$1; shift
+install_data=$1; shift
+action=$1; shift
+dest_dir=$1; shift
+src_dir=$1; shift
+
+for icon in $@; do
+	dest_dir_build="${dest_dir}/icons/hicolor/$(dirname ${icon})"
+	if [[ ${action} == "-i" || ${action} == "-il" ]]; then
+		src_file="${src_dir}/ThemeIcons/${icon}"
+		$mkinstalldirs "${dest_dir_build}" &>/dev/null
+		if [[ ${action} == "-i" ]]; then 
+			echo "Installing private icon theme icon: ${icon}"
+		fi
+		$install_data "${src_file}" "${dest_dir_build}"
+	else
+		echo "Uninstalling private icon theme icon: ${icon}"
+		rm -f "${dest_dir_build}/$(basename ${icon})"
+	fi
+done
+
diff --git a/configure.ac b/configure.ac
index 44cc68a..3836dfb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,6 +72,7 @@ SHAMROCK_CHECK_MONO_2_0_GAC_ASSEMBLIES([
     Mono.Cairo
 ])
 
+FSPOT_CHECK_GTK_SHARP
 FSPOT_CHECK_GNOME_KEYRING_SHARP
 
 
@@ -150,7 +151,7 @@ CAIRO_REQUIRED=1.4.0
 LCMS_REQUIRED=1.12
 MONOADDINS_REQUIRED=0.3
 
-PKG_CHECK_MODULES(F, libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libexif >= $LIBEXIF_REQUIRED_MIN libexif < $LIBEXIF_REQUIRED_MAX gtk-sharp-2.0 >= $GTKSHARP_REQUIRED glib-sharp-2.0 >= $GTKSHARP_REQUIRED glade-sharp-2.0 >= $GTKSHARP_REQUIRED gtk+-2.0 >= $GTK_REQUIRED mono-cairo >= $MONO_CAIRO_REQUIRED cairo >= $CAIRO_REQUIRED mono-addins >= $MONOADDINS_REQUIRED mono-addins-gui >= $MONOADDINS_REQUIRED mono-addins-setup >= $MONOADDINS_REQUIRED)
+PKG_CHECK_MODULES(F, libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libexif >= $LIBEXIF_REQUIRED_MIN libexif < $LIBEXIF_REQUIRED_MAX glade-sharp-2.0 >= $GTKSHARP_REQUIRED gtk+-2.0 >= $GTK_REQUIRED mono-cairo >= $MONO_CAIRO_REQUIRED cairo >= $CAIRO_REQUIRED mono-addins >= $MONOADDINS_REQUIRED mono-addins-gui >= $MONOADDINS_REQUIRED mono-addins-setup >= $MONOADDINS_REQUIRED)
 AC_SUBST(F_CFLAGS)
 AC_SUBST(F_LIBS)
 
@@ -353,6 +354,11 @@ lib/semweb/Makefile
 lib/unique-sharp/Makefile
 lib/unique-sharp/generator/Makefile
 lib/unique-sharp/unique/Makefile
+lib/Hyena/src/Hyena/Makefile
+lib/Hyena/src/Mono.Data.Sqlite/Makefile
+lib/Hyena/src/Hyena.Data.Sqlite/Makefile
+lib/Hyena/src/Hyena.Gui/Makefile
+
 docs/Makefile
 icons/Makefile
 tools/Makefile
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 243733a..fa5e6ab 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -4,6 +4,10 @@ SUBDIRS = \
 	GKeyFile 			\
 	gio-sharp			\
 	gtk-sharp-beans		\
+	Hyena/src/Hyena     \
+	Hyena/src/Mono.Data.Sqlite     \
+	Hyena/src/Hyena.Data.Sqlite     \
+	Hyena/src/Hyena.Gui     \
 	libjpegtran			\
 	libfspot			\
 	semweb				\
diff --git a/src/f-spot.in b/src/f-spot.in
index 020388f..926cc44 100644
--- a/src/f-spot.in
+++ b/src/f-spot.in
@@ -55,7 +55,7 @@ for arg in "$@"; do
 	x--uninstalled)
 	    echo "*** Running uninstalled f-spot ***"
 	    EXE_TO_RUN="./f-spot.exe"
-	    export MONO_PATH=../lib/semweb:../lib/gio-sharp/gio:../lib/gtk-sharp-beans:../lib/unique-sharp/unique:$MONO_PATH
+	    export MONO_PATH=../lib/semweb:../lib/gio-sharp/gio:../lib/gtk-sharp-beans:../lib/unique-sharp/unique:../bin:$MONO_PATH
 	    ;;
     esac
 done



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