From: Bernhard Reutner-Fischer Date: Tue, 21 Aug 2007 15:33:33 +0000 (-0000) Subject: - add handling of lzma for the host (unconditionally for now) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e99518277a04f0e8cf5054a6d305b2d859a59b25;p=buildroot.git - add handling of lzma for the host (unconditionally for now) - remove non-working attempt to install an lzma to the host via sudo --- diff --git a/package/lzma/lzma.mk b/package/lzma/lzma.mk index 8d6d24ae58..ecaf21b482 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 0000000000..bcb0423d1b --- /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 8123e5b095..2b9421428e 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 0000000000..34e8f03792 --- /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 992f914615..b18ffc050b 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