File chmsee-xul191.patch of Package chmsee

commit 320f40990ce0bfe6449fbe2cb54733e8c446137e
Author: LI Daobing <lidaobing@gmail.com>
Date:   Sun Aug 2 00:56:04 2009 +0800

    issue 48: support xulrunner 1.8 again.

diff --git a/.gitignore b/.gitignore
index 7897ccf..53d97a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,3 +54,4 @@ data/default-prefs.js
 gtester.xml
 report.html
 test/test
+install_manifest.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 64b6cfa..ff52b9a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,16 @@ project(chmsee)
 cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR)
 set(PACKAGE_VERSION "1.0.7" )
 find_package(PkgConfig)
-pkg_check_modules (CHMSEE REQUIRED gthread-2.0 glib-2.0 libxml-2.0 gtk+-2.0 libglade-2.0 libxul-embedding-unstable>=1.9 libxul-embedding-unstable<=1.9.0.999)
+pkg_check_modules (CHMSEE REQUIRED gthread-2.0 glib-2.0 libxml-2.0 gtk+-2.0 libglade-2.0 nspr)
+pkg_search_module(XULRUNNER libxul-embedding-unstable>=1.9 xulrunner-gtkmozembed>=1.8)
+set(CHMSEE_INCLUDE_DIRS ${CHMSEE_INCLUDE_DIRS} ${XULRUNNER_INCLUDE_DIRS})
+set(CHMSEE_CFLAGS_OTHER ${CHMSEE_CFLAGS_OTHER} ${XULRUNNER_CFLAGS_OTHER} -Wall)
+set(CHMSEE_LIBRARY_DIRS ${CHMSEE_LIBRARY_DIRS} ${XULRUNNER_LIBRARY_DIRS})
+set(CHMSEE_LIBRARIES ${CHMSEE_LIBRARIES} ${XULRUNNER_LIBRARIES} chm gcrypt)
+if(XULRUNNER_VERSION STRLESS "1.9")
+	set(XULRUNNER18 1)
+	set(GECKO_LIB_ROOT "${XULRUNNER_LIBDIR}")
+endif()
 
 set(CHMSEE_BOOKMARK_FILE "chmsee_bookmarks")
 set(CHMSEE_BOOKINFO_FILE "chmsee_bookinfo")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cba2bb8..5b88086 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -4,7 +4,6 @@ include_directories(
   ${CHMSEE_INCLUDE_DIRS}
   )
 add_definitions(
-  -Wall
   ${CHMSEE_CFLAGS_OTHER}
   )
 add_custom_command(
@@ -49,8 +48,6 @@ set(CHMSEE_SRCS
 add_library(chmseelib STATIC ${CHMSEE_SRCS})
 target_link_libraries(chmseelib
   ${CHMSEE_LIBRARIES}
-  chm
-  gcrypt
   )
 
 add_executable(chmsee main.cpp)
diff --git a/src/config.h.in b/src/config.h.in
index a8d6335..35e0f02 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -9,3 +9,6 @@
 #define PACKAGE "chmsee"
 #define GETTEXT_PACKAGE "chmsee"
 #define PACKAGE_LOCALE_DIR "${CMAKE_INSTALL_PREFIX}/share/locale"
+#cmakedefine XULRUNNER_VERSION "${XULRUNNER_VERSION}"
+#cmakedefine XULRUNNER18 1
+#cmakedefine GECKO_LIB_ROOT "${GECKO_LIB_ROOT}"
diff --git a/src/gecko_utils.cpp b/src/gecko_utils.cpp
index c464b75..cf2a2ff 100644
--- a/src/gecko_utils.cpp
+++ b/src/gecko_utils.cpp
@@ -53,7 +53,13 @@
 #include <nsMemory.h>
 #include <nsEmbedString.h>
 #include <nsIPrefService.h>
-#include <nsICommandManager.h>
+#if XULRUNNER18
+  #include <commandhandler/nsICommandManager.h>
+  #include <locale/nsILocaleService.h>
+#else
+  #include <nsICommandManager.h>
+  #include <nsILocaleService.h>
+#endif
 #include <nsIInterfaceRequestorUtils.h>
 #include <nsIDOMWindow.h>
 
@@ -65,7 +71,6 @@
 #include <nsILocalFile.h>
 #include <nsIDOMMouseEvent.h>
 #include <nsIWebBrowserFind.h>
-#include <nsILocaleService.h>
 #include <nsStringAPI.h>
 
 #include "utils/utils.h"
commit 8b752f4344e1143ec83caf7e1cbd81de7f9b6000
Author: LI Daobing <lidaobing@gmail.com>
Date:   Fri Aug 14 18:07:31 2009 +0800

    work with xulrunner 1.9.1

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d28619..dc330c3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,19 @@ if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
 	set(CHMSEE_LIBRARIES ${CHMSEE_LIBRARIES} md)
 endif()
 
+if(XULRUNNER_VERSION MATCHES "1\\.8\\..*")
+	set(XULRUNNER18 1)
+endif()
+if(XULRUNNER_VERSION MATCHES "1\\.9\\..*")
+	set(XULRUNNER19 1)
+endif()
+if(XULRUNNER_VERSION MATCHES "1\\.9\\.0\\..*")
+	set(XULRUNNER190 1)
+endif()
+if(XULRUNNER_VERSION MATCHES "1\\.9\\.1\\..*")
+	set(XULRUNNER191 1)
+endif()
+
 set(CHMSEE_BOOKMARK_FILE "chmsee_bookmarks")
 set(CHMSEE_BOOKINFO_FILE "chmsee_bookinfo")
 set(CHMSEE_NO_LINK "chmsee_no_link")
diff --git a/src/config.h.in b/src/config.h.in
index 35e0f02..a4b31c9 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -11,4 +11,7 @@
 #define PACKAGE_LOCALE_DIR "${CMAKE_INSTALL_PREFIX}/share/locale"
 #cmakedefine XULRUNNER_VERSION "${XULRUNNER_VERSION}"
 #cmakedefine XULRUNNER18 1
+#cmakedefine XULRUNNER19 1
+#cmakedefine XULRUNNER190 1
+#cmakedefine XULRUNNER191 1
 #cmakedefine GECKO_LIB_ROOT "${GECKO_LIB_ROOT}"
diff --git a/src/gecko_utils.cpp b/src/gecko_utils.cpp
index cf2a2ff..fbf209c 100644
--- a/src/gecko_utils.cpp
+++ b/src/gecko_utils.cpp
@@ -210,10 +210,17 @@ gecko_utils_init(void)
 #ifdef XPCOM_GLUE
 	NS_LogInit();
 
+#if XULRUNNER191
+        static const GREVersionRange greVersion = {
+                "1.9.1", PR_TRUE,
+                "1.9.2", PR_FALSE
+        };
+#else
         static const GREVersionRange greVersion = {
                 "1.9a", PR_TRUE,
                 "1.9.1", PR_FALSE
         };
+#endif
 
         char xpcomLocation[4096];
         rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, 4096);
openSUSE Build Service is sponsored by