changeset 2778:daff1938f6b1

Merge pull request #81 from tonytheodore/glib-optional-native Review: Build glib native tools only if they're not installed
author Volker Grabsch <vog@notjusthosting.com>
date Fri, 21 Sep 2012 09:49:59 -0700
parents 1a91124dd342 (current diff) abf2a94d035f (diff)
children 6bc26fc1e74c
files Makefile
diffstat 2 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Sep 21 18:45:05 2012 +0200
+++ b/Makefile	Fri Sep 21 09:49:59 2012 -0700
@@ -191,6 +191,7 @@
 	@echo '[done]     $(1)'
 
 .PHONY: build-only-$(1)
+build-only-$(1): PKG = $(1)
 build-only-$(1):
 	$(if $(value $(1)_BUILD),
 	    rm -rf   '$(2)'
--- a/src/glib.mk	Fri Sep 21 18:45:05 2012 +0200
+++ b/src/glib.mk	Fri Sep 21 09:49:59 2012 -0700
@@ -15,8 +15,7 @@
     head -1
 endef
 
-define $(PKG)_BUILD
-    cd '$(1)' && ./autogen.sh
+define $(PKG)_NATIVE_BUILD
     cp -Rp '$(1)' '$(1).native'
 
     # native build of libiconv (used by glib-genmarshal)
@@ -51,7 +50,23 @@
     $(MAKE) -C '$(1).native/gio'     -j '$(JOBS)' glib-compile-resources
     $(INSTALL) -m755 '$(1).native/gio/glib-compile-schemas' '$(PREFIX)/$(TARGET)/bin/'
     $(INSTALL) -m755 '$(1).native/gio/glib-compile-resources' '$(PREFIX)/$(TARGET)/bin/'
+endef
 
+define $(PKG)_SYMLINK
+    ln -sf `which glib-genmarshal`        '$(PREFIX)/$(TARGET)/bin/'
+    ln -sf `which glib-compile-schemas`   '$(PREFIX)/$(TARGET)/bin/'
+    ln -sf `which glib-compile-resources` '$(PREFIX)/$(TARGET)/bin/'
+endef
+
+define $(PKG)_BUILD
+    cd '$(1)' && ./autogen.sh
+    rm -f '$(PREFIX)/$(TARGET)/bin/glib-*'
+    $(if $(findstring y,\
+            $(shell [ -x "`which glib-genmarshal`" ] && \
+                    [ -x "`which glib-compile-schemas`" ] && \
+                    [ -x "`which glib-compile-resources`" ] && echo y)), \
+        $($(PKG)_SYMLINK), \
+        $($(PKG)_NATIVE_BUILD))
     # cross build
     cd '$(1)' && ./configure \
         --host='$(TARGET)' \