summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package/lzma/lzma.mk25
-rwxr-xr-xpackage/lzma/lzmacheck.sh9
-rw-r--r--target/linux/Makefile.in3
-rwxr-xr-xtoolchain/dependencies/check-host-lzma.sh13
-rw-r--r--toolchain/dependencies/dependencies.mk2
5 files changed, 45 insertions, 7 deletions
diff --git a/package/lzma/lzma.mk b/package/lzma/lzma.mk
index 8d6d24ae5..ecaf21b48 100644
--- a/package/lzma/lzma.mk
+++ b/package/lzma/lzma.mk
@@ -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
index 000000000..bcb0423d1
--- /dev/null
+++ b/package/lzma/lzmacheck.sh
@@ -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
+
diff --git a/target/linux/Makefile.in b/target/linux/Makefile.in
index 8123e5b09..2b9421428 100644
--- a/target/linux/Makefile.in
+++ b/target/linux/Makefile.in
@@ -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
index 000000000..34e8f0379
--- /dev/null
+++ b/toolchain/dependencies/check-host-lzma.sh
@@ -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"
diff --git a/toolchain/dependencies/dependencies.mk b/toolchain/dependencies/dependencies.mk
index 992f91461..b18ffc050 100644
--- a/toolchain/dependencies/dependencies.mk
+++ b/toolchain/dependencies/dependencies.mk
@@ -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