From: Wolfgang Rosenauer
Subject: pkgconfig tuning


diff --git a/xulrunner/installer/Makefile.in b/xulrunner/installer/Makefile.in
--- a/xulrunner/installer/Makefile.in
+++ b/xulrunner/installer/Makefile.in
@@ -67,6 +67,9 @@ INSTALL_SDK = 1
 
 include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
 
+# the apilibdir always ends with 1.9 as every patch update will provide a link
+apilibdir = $(dir $(installdir))xulrunner-1.9.1
+
 $(MOZILLA_VERSION).system.conf: $(topsrcdir)/config/milestone.txt Makefile
 	printf "[%s]\nGRE_PATH=%s\nxulrunner=true\nabi=%s" \
 	  $(MOZILLA_VERSION) $(installdir) $(TARGET_XPCOM_ABI)> $@
@@ -123,6 +126,7 @@ endif
 	-e "s|%includedir%|$(includedir)|" \
 	-e "s|%idldir%|$(idldir)|" \
 	-e "s|%sdkdir%|$(sdkdir)|" \
+	-e "s|%libdir%|$(apilibdir)|" \
 	-e "s|%MOZ_APP_NAME%|$(MOZ_APP_NAME)|" \
 	-e "s|%MOZILLA_VERSION%|$(MOZ_APP_VERSION)|" \
 	-e "s|%WCHAR_CFLAGS%|$(WCHAR_CFLAGS)|" \
diff --git a/xulrunner/installer/libxul-embedding-unstable.pc.in b/xulrunner/installer/libxul-embedding-unstable.pc.in
--- a/xulrunner/installer/libxul-embedding-unstable.pc.in
+++ b/xulrunner/installer/libxul-embedding-unstable.pc.in
@@ -1,11 +1,12 @@ prefix=%prefix%
 prefix=%prefix%
 sdkdir=%sdkdir%
 includedir=%includedir%
-idldir=%idldir%
+idldir=%idldir%/unstable
 includetype=unstable
 
 Name: libxul-embedding-unstable
 Description: Static library for version-independent embedding of the Mozilla runtime (unstable API)
 Version: %MOZILLA_VERSION%
+Requires: %NSPR_NAME% >= %NSPR_VERSION%
 Libs: -L${sdkdir}/lib -lxpcomglue
 Cflags: -DXPCOM_GLUE -I${includedir}/${includetype} %WCHAR_CFLAGS%
diff --git a/xulrunner/installer/libxul-embedding.pc.in b/xulrunner/installer/libxul-embedding.pc.in
--- a/xulrunner/installer/libxul-embedding.pc.in
+++ b/xulrunner/installer/libxul-embedding.pc.in
@@ -1,7 +1,7 @@ prefix=%prefix%
 prefix=%prefix%
 sdkdir=%sdkdir%
 includedir=%includedir%
-idldir=%idldir%
+idldir=%idldir%/stable
 includetype=stable
 
 # Note: the default pkg-config cflags will only list include directories
@@ -11,5 +11,6 @@ Name: libxul-embedding
 Name: libxul-embedding
 Description: Static library for version-independent embedding of the Mozilla runtime
 Version: %MOZILLA_VERSION%
-Libs: -L${sdkdir}/lib -lxpcomglue
+Requires: %NSPR_NAME% >= %NSPR_VERSION%
+Libs: -L${sdkdir}/sdk/lib -lxpcomglue
 Cflags: -DXPCOM_GLUE -I${includedir}/${includetype} %WCHAR_CFLAGS%
diff --git a/xulrunner/installer/libxul-unstable.pc.in b/xulrunner/installer/libxul-unstable.pc.in
--- a/xulrunner/installer/libxul-unstable.pc.in
+++ b/xulrunner/installer/libxul-unstable.pc.in
@@ -1,7 +1,8 @@ prefix=%prefix%
 prefix=%prefix%
 sdkdir=%sdkdir%
+libdir=%libdir%
 includedir=%includedir%
-idldir=%idldir%
+idldir=%idldir%/unstable
 includetype=unstable
 
 Name: libxul
diff --git a/xulrunner/installer/libxul.pc.in b/xulrunner/installer/libxul.pc.in
--- a/xulrunner/installer/libxul.pc.in
+++ b/xulrunner/installer/libxul.pc.in
@@ -1,7 +1,8 @@ prefix=%prefix%
 prefix=%prefix%
 sdkdir=%sdkdir%
+libdir=%libdir%
 includedir=%includedir%
-idldir=%idldir%
+idldir=%idldir%/stable
 includetype=stable
 
 # Note: the default pkg-config includes will only list include directories
diff --git a/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in b/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in
--- a/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in
+++ b/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in
@@ -1,5 +1,6 @@ prefix=%prefix%
 prefix=%prefix%
 sdkdir=%sdkdir%
+libdir=%libdir%
 includedir=%includedir%
 
 Name: mozilla-gtkembedmoz
diff --git a/xulrunner/installer/mozilla-gtkmozembed.pc.in b/xulrunner/installer/mozilla-gtkmozembed.pc.in
--- a/xulrunner/installer/mozilla-gtkmozembed.pc.in
+++ b/xulrunner/installer/mozilla-gtkmozembed.pc.in
@@ -1,8 +1,9 @@ prefix=%prefix%
 prefix=%prefix%
 sdkdir=%sdkdir%
+libdir=%libdir%
 includedir=%includedir%
 
 Name: mozilla-gtkembedmoz
-Description: Mozilla Embedding Widget for Gtk+
+Description: Mozilla Embedding Widget for Gtk+ 
 Version: %MOZILLA_VERSION%
 Requires: libxul-unstable = %MOZILLA_VERSION%
diff --git a/xulrunner/installer/mozilla-js.pc.in b/xulrunner/installer/mozilla-js.pc.in
--- a/xulrunner/installer/mozilla-js.pc.in
+++ b/xulrunner/installer/mozilla-js.pc.in
@@ -1,10 +1,11 @@ prefix=%prefix%
 prefix=%prefix%
 sdkdir=%sdkdir%
+libdir=%libdir%
 includedir=%includedir%
 
 Name: JavaScript
 Description: The Mozilla JavaScript Library
 Version: %MOZILLA_VERSION%
 Requires: %NSPR_NAME% >= %NSPR_VERSION%
-Libs: -L${sdkdir}/lib -lmozjs
-Cflags: -I${includedir}/stable -DXP_UNIX -DJS_THREADSAFE
+Libs: -Wl,-rpath,${libdir} -L${sdkdir}/lib -lmozjs
+Cflags: -I${includedir}/unstable -DXP_UNIX -DJS_THREADSAFE
