- add handling of lzma for the host (unconditionally for now)
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Tue, 21 Aug 2007 15:33:33 +0000 (15:33 -0000)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Tue, 21 Aug 2007 15:33:33 +0000 (15:33 -0000)
- remove non-working attempt to install an lzma to the host via sudo

package/lzma/lzma.mk
package/lzma/lzmacheck.sh [new file with mode: 0755]
target/linux/Makefile.in
toolchain/dependencies/check-host-lzma.sh [new file with mode: 0755]
toolchain/dependencies/dependencies.mk

index 8d6d24ae581b3e796fb6b66388760a9e4bd4b3df..ecaf21b482639357c89696a90fd8d34a282189ea 100644 (file)
@@ -15,6 +15,12 @@ LZMA_CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 endif
 LZMA_TARGET_BINARY:=bin/lzma
 
+# lzma binary for use on the host
+LZMA=$(TOOL_BUILD_DIR)/bin/lzma
+HOST_LZMA_BINARY=$(shell $(CONFIG_SHELL) package/lzma/lzmacheck.sh)
+HOST_LZMA_IF_ANY=$(shell $(CONFIG_SHELL) toolchain/dependencies/check-host-lzma.sh)
+
+
 $(DL_DIR)/$(LZMA_SOURCE):
        $(WGET) -P $(DL_DIR) $(LZMA_SITE)/$(LZMA_SOURCE)
 
@@ -47,6 +53,20 @@ $(STAGING_DIR)/bin/lzma: $(LZMA_HOST_DIR)/src/lzma/lzma
        $(SED) "s,^libdir=.*,libdir=\'$(STAGING_DIR)/lib\',g" \
                $(STAGING_DIR)/lib/liblzmadec.la
 
+.PHONY: lzma-host use-lzma-host-binary
+use-lzma-host-binary:
+       if [ ! -f "$(TOOL_BUILD_DIR)/bin/lzma" ] ; then \
+               [ -d $(TOOL_BUILD_DIR)/bin ] || mkdir $(TOOL_BUILD_DIR)/bin ; \
+               ln -sf "$(HOST_LZMA_IF_ANY)" "$(TOOL_BUILD_DIR)/bin/lzma" ; \
+       fi
+
+build-lzma-host-binary: $(LZMA_HOST_DIR)/src/lzma/lzma
+       -rm -f $(TOOL_BUILD_DIR)/bin/lzma
+       [ -d $(TOOL_BUILD_DIR)/bin ] || mkdir $(TOOL_BUILD_DIR)/bin
+       cp -pf $(LZMA_HOST_DIR)/src/lzma/lzma $(TOOL_BUILD_DIR)/bin/lzma
+
+host-lzma: $(HOST_LZMA_BINARY)
+
 lzma-host: $(STAGING_DIR)/bin/lzma
 
 lzma-host-clean:
@@ -55,11 +75,6 @@ lzma-host-clean:
 lzma-host-dirclean:
        rm -rf $(LZMA_HOST_DIR)
 
-/usr/local/bin/lzma: lzma_host
-       sudo    $(MAKE) DESTDIR=/usr/local -C $(LZMA_HOST_DIR) install
-       sudo    $(SED) "s,^libdir=.*,libdir=\'/usr/local/lib\',g" \
-               /usr/local/lib/liblzmadec.la
-
 lzma-host-install: /usr/local/bin/lzma
 
 ######################################################################
diff --git a/package/lzma/lzmacheck.sh b/package/lzma/lzmacheck.sh
new file mode 100755 (executable)
index 0000000..bcb0423
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+bin=$(toolchain/dependencies/check-host-lzma.sh)
+if [ "x$bin" = "x" ] ; then
+  echo build-lzma-host-binary
+else
+  echo use-lzma-host-binary
+fi
+
index 8123e5b095ff0a3e8bf4a5d1471a7a145628f2c6..2b9421428ec7a753850ed864d86d1819464f5b23 100644 (file)
@@ -143,7 +143,8 @@ $(LINUX26_DIR)/.depend_done: $(LINUX26_DIR)/.configured
        touch $@
 
 $(LINUX26_KERNEL): $(LINUX26_DIR)/.depend_done
-       $(MAKE) $(LINUX26_MAKE_FLAGS) -C $(LINUX26_DIR) $(LINUX26_FORMAT)
+       $(MAKE) $(LINUX26_MAKE_FLAGS) LZMA="$(LZMA)" \
+               -C $(LINUX26_DIR) $(LINUX26_FORMAT)
        cp -dpf $(LINUX26_DIR)/$(LINUX26_BINLOC) $(LINUX26_KERNEL)
        touch -c $@
 
diff --git a/toolchain/dependencies/check-host-lzma.sh b/toolchain/dependencies/check-host-lzma.sh
new file mode 100755 (executable)
index 0000000..34e8f03
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+ok=""
+
+for bin in /usr/bin/lzma $LZMA
+do
+# TODO: add check for proper functionality here..
+  $bin --version > /dev/null 2>&1 && ok="$bin"
+  if test "x$ok" != "x" ; then
+    break
+  fi
+done
+echo "$ok"
index 992f914615646e9a01233e12df0d067f80b3cc93..b18ffc050b00c0ee30ff80f2d2ad0cba3e9cc319 100644 (file)
@@ -5,7 +5,7 @@
 #
 ######################################################################
 
-dependencies: host-sed
+dependencies: host-sed host-lzma
        @HOSTCC="$(firstword $(HOSTCC))" MAKE="$(MAKE)" \
                HOST_SED_DIR="$(HOST_SED_DIR)" \
                $(TOPDIR)/toolchain/dependencies/dependencies.sh