public inbox for ipfire-scm@lists.ipfire.org
 help / color / mirror / Atom feed
From: git@ipfire.org
To: ipfire-scm@lists.ipfire.org
Subject: [git.ipfire.org] IPFire 2.x development tree branch, next, updated. f978327791ec8fd4cba6b92c2288434ed43841ab
Date: Thu, 23 Nov 2017 16:03:17 +0000	[thread overview]
Message-ID: <20171123160318.4DAE01081BCF@git01.ipfire.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 104353 bytes --]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".

The branch, next has been updated
       via  f978327791ec8fd4cba6b92c2288434ed43841ab (commit)
       via  f74072a24a066a1872f8e1356d8cb83a65abc178 (commit)
       via  658232a64cb4ad1795de44691d64f3ee9f78ea2f (commit)
       via  aecbe1232b0952155b3b11b941089ded84c6eabf (commit)
       via  813659f268114c4c80439d08f6d777dd74d630e4 (commit)
       via  69a6ec55addc5ebd412956ef011290156c9a54f0 (commit)
       via  6c4cc7ea1bcb58c586ae64ae6f76720b6b89bda4 (commit)
       via  f1effdf75849c86828765adce612508e472af442 (commit)
      from  beb256e0a0a302a8722d082741375336ed4371f8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f978327791ec8fd4cba6b92c2288434ed43841ab
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Thu Nov 23 14:46:55 2017 +0000

    make.sh: Refactor build status code
    
    This replaces the old lines that make the build
    output pretty and replaces it by a version that showns
    progress as it is going on as well as providing useful
    output when the console is non-interactive.
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit f74072a24a066a1872f8e1356d8cb83a65abc178
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Thu Nov 23 11:56:18 2017 +0000

    Compress toolchain using XZ
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit 658232a64cb4ad1795de44691d64f3ee9f78ea2f
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Thu Nov 23 12:39:57 2017 +0000

    make.sh: Refactor renice and root check
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit aecbe1232b0952155b3b11b941089ded84c6eabf
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Thu Nov 23 12:35:17 2017 +0000

    make.sh: Cleanup prepareenv
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit 813659f268114c4c80439d08f6d777dd74d630e4
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Thu Nov 23 12:24:38 2017 +0000

    make.sh: TARGET_ARCH has been replaced by BUILD_ARCH
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit 69a6ec55addc5ebd412956ef011290156c9a54f0
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Thu Nov 23 12:18:41 2017 +0000

    make.sh: Merge make-functions into make.sh
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit 6c4cc7ea1bcb58c586ae64ae6f76720b6b89bda4
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Thu Nov 23 11:39:23 2017 +0000

    Move toolchain from /tools to /tools_${arch}
    
    This will allow us to run multiple builds on the same
    system at the same time (or at least have them on disk).
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

commit f1effdf75849c86828765adce612508e472af442
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Thu Nov 23 12:01:39 2017 +0000

    make.sh: Drop option to generate a source ISO
    
    This is a very weird way to distribute sources in 2017.
    Let's save the environment and stop using CDs.
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

-----------------------------------------------------------------------

Summary of changes:
 lfs/Config            |    5 +-
 lfs/automake          |    4 +-
 lfs/bash              |    8 +-
 lfs/binutils          |   12 +-
 lfs/bzip2             |    4 +-
 lfs/ccache            |   28 +-
 lfs/cleanup-toolchain |   22 +-
 lfs/coreutils         |    4 +-
 lfs/dejagnu           |    2 +-
 lfs/diffutils         |    4 +-
 lfs/expect            |    6 +-
 lfs/fake-environ      |    2 +-
 lfs/findutils         |    4 +-
 lfs/flex              |    2 +-
 lfs/gawk              |    4 +-
 lfs/gcc               |   34 +-
 lfs/gettext           |    6 +-
 lfs/glibc             |   10 +-
 lfs/grep              |    4 +-
 lfs/gzip              |    4 +-
 lfs/linux             |    2 +-
 lfs/m4                |    4 +-
 lfs/make              |    4 +-
 lfs/ncurses           |    6 +-
 lfs/ncurses-compat    |    4 +-
 lfs/patch             |    4 +-
 lfs/perl              |   10 +-
 lfs/pkg-config        |    6 +-
 lfs/sed               |    4 +-
 lfs/sources-iso       |   52 --
 lfs/stage1            |    4 +-
 lfs/stage2            |   10 +-
 lfs/strip             |    2 +-
 lfs/tar               |    4 +-
 lfs/tcl               |    4 +-
 lfs/texinfo           |    4 +-
 lfs/xz                |    2 +-
 make.sh               | 1359 ++++++++++++++++++++++++++++++++++++-------------
 src/stripper          |    2 +-
 tools/make-functions  |  762 ---------------------------
 40 files changed, 1129 insertions(+), 1289 deletions(-)
 delete mode 100644 lfs/sources-iso
 delete mode 100644 tools/make-functions

Difference in files:
diff --git a/lfs/Config b/lfs/Config
index 1077f25..a45b76b 100644
--- a/lfs/Config
+++ b/lfs/Config
@@ -31,7 +31,7 @@
 ###############################################################################
 
 # Cleanup environment from any variables
-unexport BUILD_ARCH BUILD_PLATFORM BUILDTARGET CROSSTARGET TOOLCHAIN
+unexport BUILD_ARCH BUILD_PLATFORM BUILDTARGET CROSSTARGET TOOLCHAIN TOOLS_DIR
 
 ifeq "$(BUILD_ARCH)" "aarch64"
 	IS_64BIT = 1
@@ -80,7 +80,7 @@ CCACHE_COMPILERCHECK += $(shell gcc -dumpspecs 2>/dev/null | md5sum | cut -d ' '
 #
 define FIND_FILES
 	cd $(ROOT)/ && find -mount \
-		\( -path './tools' -or -path './tmp' -or -path './usr/src' \
+		\( -path '.$(TOOLS_DIR)' -or -path './tmp' -or -path './usr/src' \
 		-or -path './run' -or -path './dev' -or -path './proc' \
 		-or -path './install' \) -prune -or -print | sort
 endef
@@ -175,7 +175,6 @@ define MD5
 	# error mean file signature don't match the one in lfs script
 	[ "$($@_MD5)" = `md5sum $(DIR_DL)/$@ | awk '{ print $$1 }'` ]
 	echo "$@ checksum OK"
-	echo "$@" >>$(DIR_INFO)/_build.othersrc-list.log
 endef
 
 define PAK
diff --git a/lfs/automake b/lfs/automake
index a372443..15bdad1 100644
--- a/lfs/automake
+++ b/lfs/automake
@@ -32,13 +32,13 @@ DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
 	PREFIX = /usr
 	TARGET = $(DIR_INFO)/$(THISAPP)
 else
-	PREFIX = /tools
+	PREFIX = $(TOOLS_DIR)
 	TARGET = $(DIR_INFO)/$(THISAPP)-tools
 endif
 
diff --git a/lfs/bash b/lfs/bash
index e98b6fd..99a293d 100644
--- a/lfs/bash
+++ b/lfs/bash
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.gz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -39,7 +39,7 @@ ifeq "$(ROOT)" ""
     --with-installed-readline
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  CONFIGURE_OPTIONS = --prefix=/tools
+  CONFIGURE_OPTIONS = --prefix=$(TOOLS_DIR)
 endif
 
 CONFIGURE_OPTIONS += \
@@ -100,10 +100,10 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	cd $(DIR_APP) && make install
 
 ifeq "$(TOOLCHAIN)" "1"
-	ln -svf bash /tools/bin/sh
+	ln -svf bash $(TOOLS_DIR)/bin/sh
 
 	mkdir -pv $(ROOT)/bin
-	ln -svf ../tools/bin/bash $(ROOT)/bin/sh
+	ln -svf ..$(TOOLS_DIR)/bin/bash $(ROOT)/bin/sh
 else
 	ln -svf bash /bin/sh
 endif
diff --git a/lfs/binutils b/lfs/binutils
index 79ac96b..79b208d 100644
--- a/lfs/binutils
+++ b/lfs/binutils
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.gz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -53,9 +53,9 @@ ifeq "$(PASS)" "1"
   TARGET = $(DIR_INFO)/$(THISAPP)-tools1
   EXTRA_CONFIG = \
 	--target=$(CROSSTARGET) \
-	--prefix=/tools \
+	--prefix=$(TOOLS_DIR) \
 	--with-sysroot=$(ROOT) \
-	--with-lib-path=/tools/lib
+	--with-lib-path=$(TOOLS_DIR)/lib
   EXTRA_MAKE =
   EXTRA_INSTALL = 
 else
@@ -67,8 +67,8 @@ else
   EXTRA_CONFIG = \
 	--host=$(BUILDTARGET) \
 	--build=$(BUILDTARGET) \
-	--prefix=/tools \
-	--with-lib-path=/tools/lib
+	--prefix=$(TOOLS_DIR) \
+	--with-lib-path=$(TOOLS_DIR)/lib
   EXTRA_MAKE = 
   EXTRA_INSTALL = 
 endif
@@ -138,7 +138,7 @@ ifeq "$(TOOLCHAIN)" "1"
  ifeq "$(PASS)" "2"
 	cd $(DIR_SRC)/binutils-build && make -C ld clean
 	cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib
-	cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new /tools/bin
+	cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new $(TOOLS_DIR)/bin
  endif
 endif
 
diff --git a/lfs/bzip2 b/lfs/bzip2
index 44fa757..89f0ca7 100644
--- a/lfs/bzip2
+++ b/lfs/bzip2
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.gz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -90,7 +90,7 @@ ifeq "$(ROOT)" ""
 	ln -sfv bzip2 /bin/bzcat
 else
 	cd $(DIR_APP) && make $(MAKETUNING)
-	cd $(DIR_APP) && make PREFIX=/tools install
+	cd $(DIR_APP) && make PREFIX=$(TOOLS_DIR) install
 endif
 	@rm -rf $(DIR_APP)
 	@$(POSTBUILD)
diff --git a/lfs/ccache b/lfs/ccache
index f7da652..470890d 100644
--- a/lfs/ccache
+++ b/lfs/ccache
@@ -79,28 +79,28 @@ $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
-	cd $(DIR_APP) && ./configure --prefix=/tools
+	cd $(DIR_APP) && ./configure --prefix=$(TOOLS_DIR)
 	cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE)
 	cd $(DIR_APP) && make install
 
 ifeq "$(TOOLCHAIN)" "1"
  ifeq "$(PASS)" "1"
-	mkdir -pv /tools/ccache/bin
-	ln -svf ../../bin/ccache /tools/ccache/bin/gcc
-	ln -svf ../../bin/ccache /tools/ccache/bin/g++
-	ln -svf ../../bin/ccache /tools/ccache/bin/cc
-	ln -svf ../../bin/ccache /tools/ccache/bin/c++
-	ln -svf ../../bin/ccache /tools/ccache/bin/$(CROSSTARGET)-gcc
-	ln -svf ../../bin/ccache /tools/ccache/bin/$(CROSSTARGET)-g++
-	ln -svf ../../bin/ccache /tools/ccache/bin/$(CROSSTARGET)-cc
-	ln -svf ../../bin/ccache /tools/ccache/bin/$(CROSSTARGET)-c++
+	mkdir -pv $(TOOLS_DIR)/ccache/bin
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/gcc
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/g++
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/cc
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/c++
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/$(CROSSTARGET)-gcc
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/$(CROSSTARGET)-g++
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/$(CROSSTARGET)-cc
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/$(CROSSTARGET)-c++
  endif
 
  ifeq "$(PASS)" "2"
-	ln -svf ../../bin/ccache /tools/ccache/bin/$(BUILDTARGET)-gcc
-	ln -svf ../../bin/ccache /tools/ccache/bin/$(BUILDTARGET)-g++
-	ln -svf ../../bin/ccache /tools/ccache/bin/$(BUILDTARGET)-cc
-	ln -svf ../../bin/ccache /tools/ccache/bin/$(BUILDTARGET)-c++
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/$(BUILDTARGET)-gcc
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/$(BUILDTARGET)-g++
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/$(BUILDTARGET)-cc
+	ln -svf ../../bin/ccache $(TOOLS_DIR)/ccache/bin/$(BUILDTARGET)-c++
  endif
 endif
 
diff --git a/lfs/cleanup-toolchain b/lfs/cleanup-toolchain
index 91e056e..1c1fa8a 100644
--- a/lfs/cleanup-toolchain
+++ b/lfs/cleanup-toolchain
@@ -59,30 +59,30 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 
 ifeq "$(TOOLCHAIN)" "1"
 	# Remove the first cross compiler which is not needed anymore.
-	find /tools/ -name "$(CROSSTARGET)*" | xargs rm -rfv
+	find $(TOOLS_DIR)/ -name "$(CROSSTARGET)*" | xargs rm -rfv
 
 	# Remove man and info pages.
-	rm -rfv /tools/{,share}/{info,man}
+	rm -rfv $(TOOLS_DIR)/{,share}/{info,man}
 
 	# Strip all binaries.
-	STRIP="/usr/bin/strip" $(DIR_SRC)/src/stripper /tools/
+	STRIP="/usr/bin/strip" $(DIR_SRC)/src/stripper $(TOOLS_DIR)/
 
 	# Fix ownership of the toolchain.
-	chown -R root:root /tools/
+	chown -R root:root $(TOOLS_DIR)/
 
 	# Update/create linker cache.
-	/tools/sbin/ldconfig
+	$(TOOLS_DIR)/sbin/ldconfig
 
 	# Set a marker when the toolchain was successfully built
-	touch /tools/.toolchain-successful
+	touch $(TOOLS_DIR)/.toolchain-successful
 else
-	mv -v /tools/bin/{ld,ld-old}
-	mv -v /tools/$(BUILDTARGET)/bin/{ld,ld-old}
-	mv -v /tools/bin/{ld-new,ld}
-	ln -sv /tools/bin/ld /tools/$(BUILDTARGET)/bin/ld
+	mv -v $(TOOLS_DIR)/bin/{ld,ld-old}
+	mv -v $(TOOLS_DIR)/$(BUILDTARGET)/bin/{ld,ld-old}
+	mv -v $(TOOLS_DIR)/bin/{ld-new,ld}
+	ln -sv $(TOOLS_DIR)/bin/ld $(TOOLS_DIR)/$(BUILDTARGET)/bin/ld
 
 	gcc -dumpspecs | sed \
-		-e 's@/tools@@g' \
+		-e 's@$(TOOLS_DIR)@@g' \
 		-e '/\*startfile_prefix_spec:/{n;s(a).*@/usr/lib/ @}' \
 		-e '/\*cpp:/{n;s@$$@ -isystem /usr/include@}' > \
 		$$(dirname $$(gcc -print-libgcc-file-name))/specs
diff --git a/lfs/coreutils b/lfs/coreutils
index 324dc78..904bd2b 100644
--- a/lfs/coreutils
+++ b/lfs/coreutils
@@ -31,14 +31,14 @@ DL_FILE    = $(THISAPP).tar.xz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
   CONFIGURE_OPTIONS = --prefix=/usr
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  CONFIGURE_OPTIONS = --prefix=/tools
+  CONFIGURE_OPTIONS = --prefix=$(TOOLS_DIR)
 endif
 
 CONFIGURE_OPTIONS += \
diff --git a/lfs/dejagnu b/lfs/dejagnu
index b510565..3623c9b 100644
--- a/lfs/dejagnu
+++ b/lfs/dejagnu
@@ -70,7 +70,7 @@ $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
-	cd $(DIR_APP) && ./configure --prefix=/tools --disable-nls
+	cd $(DIR_APP) && ./configure --prefix=$(TOOLS_DIR) --disable-nls
 	cd $(DIR_APP) && make install
 	@rm -rf $(DIR_APP)
 	@$(POSTBUILD)
diff --git a/lfs/diffutils b/lfs/diffutils
index c8dc42f..d3e957d 100644
--- a/lfs/diffutils
+++ b/lfs/diffutils
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.xz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -40,7 +40,7 @@ ifeq "$(ROOT)" ""
   EXTRA_INSTALL =
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  EXTRA_CONFIG = --prefix=/tools --disable-nls --build=$(BUILDTARGET)
+  EXTRA_CONFIG = --prefix=$(TOOLS_DIR) --disable-nls --build=$(BUILDTARGET)
   EXTRA_MAKE = 
   EXTRA_INSTALL = 
 endif
diff --git a/lfs/expect b/lfs/expect
index 93d6fe6..2ebd6a8 100644
--- a/lfs/expect
+++ b/lfs/expect
@@ -71,10 +71,10 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) $(DIR_SRC)/tcl* && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
 	cd $(DIR_APP) && ./configure \
-			--prefix=/tools \
+			--prefix=$(TOOLS_DIR) \
 			--build=$(BUILDTARGET) \
-			--with-tcl=/tools/lib \
-			--with-tclinclude=/tools/include \
+			--with-tcl=$(TOOLS_DIR)/lib \
+			--with-tclinclude=$(TOOLS_DIR)/include \
 			--with-x=no \
 			--disable-nls
 	cd $(DIR_APP) && make $(MAKETUNING)
diff --git a/lfs/fake-environ b/lfs/fake-environ
index 978a90d..7c8dd06 100644
--- a/lfs/fake-environ
+++ b/lfs/fake-environ
@@ -52,7 +52,7 @@ $(TARGET) :
 	cp -rvf $(DIR_SRC)/src/$(THISAPP) $(DIR_APP)
 
 	cd $(DIR_APP) && make install CFLAGS="$(CFLAGS)" \
-		TOOLS_DIR="/tools"
+		TOOLS_DIR="$(TOOLS_DIR)"
 
 	@rm -rf $(DIR_APP)
 	@$(POSTBUILD)
diff --git a/lfs/findutils b/lfs/findutils
index d1a520b..6b9e0fc 100644
--- a/lfs/findutils
+++ b/lfs/findutils
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.gz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -41,7 +41,7 @@ ifeq "$(ROOT)" ""
   EXTRA_INSTALL =
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  EXTRA_CONFIG = --prefix=/tools --disable-nls --build=$(BUILDTARGET)
+  EXTRA_CONFIG = --prefix=$(TOOLS_DIR) --disable-nls --build=$(BUILDTARGET)
   EXTRA_MAKE = 
   EXTRA_INSTALL = 
 endif
diff --git a/lfs/flex b/lfs/flex
index 4b1a75b..f3cc095 100644
--- a/lfs/flex
+++ b/lfs/flex
@@ -70,7 +70,7 @@ $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
-	cd $(DIR_APP) && HELP2MAN=/tools/bin/true \
+	cd $(DIR_APP) && HELP2MAN=$(TOOLS_DIR)/bin/true \
 		./configure --prefix=/usr --disable-nls
 	cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE)
 	cd $(DIR_APP) && make $(EXTRA_INSTALL) install
diff --git a/lfs/gawk b/lfs/gawk
index 62bad01..cfa106d 100644
--- a/lfs/gawk
+++ b/lfs/gawk
@@ -32,13 +32,13 @@ DL_FILE    = $(THISAPP).tar.xz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 ifeq "$(ROOT)" ""
 	TARGET = $(DIR_INFO)/$(THISAPP)
 	EXTRA_CONFIG = --prefix=/usr --libexecdir=/usr/lib --disable-nls
 else
 	TARGET = $(DIR_INFO)/$(THISAPP)-tools
-	EXTRA_CONFIG = --prefix=/tools --disable-nls
+	EXTRA_CONFIG = --prefix=$(TOOLS_DIR) --disable-nls
 endif
 
 ###############################################################################
diff --git a/lfs/gcc b/lfs/gcc
index 9325792..9cc6ce3 100644
--- a/lfs/gcc
+++ b/lfs/gcc
@@ -50,7 +50,7 @@ ifeq "$(BUILD_ARCH)" "armv5tel"
 	FULL_BOOTSTRAP = 1
 endif
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -71,10 +71,10 @@ ifeq "$(PASS)" "1"
   TARGET = $(DIR_INFO)/$(THISAPP)-tools1
   EXTRA_CONFIG = \
 	--target=$(CROSSTARGET) \
-	--prefix=/tools \
+	--prefix=$(TOOLS_DIR) \
 	--with-sysroot=$(ROOT) \
-	--with-local-prefix=/tools \
-	--with-native-system-header-dir=/tools/include \
+	--with-local-prefix=$(TOOLS_DIR) \
+	--with-native-system-header-dir=$(TOOLS_DIR)/include \
 	--disable-nls \
 	--disable-shared \
 	--disable-decimal-float \
@@ -107,9 +107,9 @@ ifeq "$(PASS)" "2"
 	RANLIB="$(CROSSTARGET)-ranlib"
   EXTRA_CONFIG = \
 	--build=$(BUILDTARGET) \
-	--prefix=/tools \
-	--with-local-prefix=/tools \
-	--with-native-system-header-dir=/tools/include \
+	--prefix=$(TOOLS_DIR) \
+	--with-local-prefix=$(TOOLS_DIR) \
+	--with-native-system-header-dir=$(TOOLS_DIR)/include \
 	--enable-languages=c,c++ \
 	--disable-libstdcxx-pch \
 	--disable-libgomp
@@ -130,13 +130,13 @@ else
 	RANLIB="$(CROSSTARGET)-ranlib"
   EXTRA_CONFIG = \
 	--host=$(CROSSTARGET) \
-	--prefix=/tools \
+	--prefix=$(TOOLS_DIR) \
 	--with-sysroot=$(ROOT) \
 	--disable-shared \
 	--disable-nls \
 	--disable-libstdcxx-threads \
 	--disable-libstdcxx-pch \
-	--with-gxx-include-dir=/tools/$(CROSSTARGET)/include/c++/$(VER)
+	--with-gxx-include-dir=$(TOOLS_DIR)/$(CROSSTARGET)/include/c++/$(VER)
   EXTRA_MAKE = 
   EXTRA_INSTALL = 
 endif
@@ -234,18 +234,18 @@ ifeq "$(TOOLCHAIN)" "1"
 
 ifeq "$(PASS)" "2"
 	cd $(DIR_APP) && cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
-			`dirname $$(/tools/bin/$(CROSSTARGET)-gcc -print-libgcc-file-name)`/include-fixed/limits.h
+			`dirname $$($(TOOLS_DIR)/bin/$(CROSSTARGET)-gcc -print-libgcc-file-name)`/include-fixed/limits.h
 endif
 
 	for file in $$(find $(DIR_APP)/gcc/config -name linux64.h -o -name linux.h \
 			-o -name sysv4.h -o -name linux-eabi.h -o -name linux-elf.h -o -name aarch64-linux.h); do \
 		echo "Processing $${file}..."; \
 		sed -i $${file} \
-			-e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
-			-e 's@/usr@/tools(a)g'; \
+			-e 's@/lib\(64\)\?\(32\)\?/ld@$(TOOLS_DIR)&@g' \
+			-e 's@/usr@$(TOOLS_DIR)@g'; \
 		echo '#undef STANDARD_STARTFILE_PREFIX_1' >> $${file}; \
 		echo '#undef STANDARD_STARTFILE_PREFIX_2' >> $${file}; \
-		echo '#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"' >> $${file}; \
+		echo '#define STANDARD_STARTFILE_PREFIX_1 "$(TOOLS_DIR)/lib/"' >> $${file}; \
 		echo '#define STANDARD_STARTFILE_PREFIX_2 ""' >> $${file}; \
 	done
 endif
@@ -271,18 +271,18 @@ endif
 
 ifeq "$(TOOLCHAIN)" "1"
  ifeq "$(PASS)" "1"
-	ln -svf libgcc.a $$(/tools/bin/$(CROSSTARGET)-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/')
+	ln -svf libgcc.a $$($(TOOLS_DIR)/bin/$(CROSSTARGET)-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/')
  endif
 
  ifeq "$(PASS)" "2"
-	ln -svf gcc /tools/bin/cc
+	ln -svf gcc $(TOOLS_DIR)/bin/cc
 	# remove gdb python files from libdir
-	rm -rf /tools/lib/*-gdb.py
+	rm -rf $(TOOLS_DIR)/lib/*-gdb.py
  endif
 
  ifeq "$(PASS)" "L"
 	# Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70936
-	sed -e "s/^#include_next/#include/" -i /tools/$(CROSSTARGET)/include/c++/$(VER)/cstdlib
+	sed -e "s/^#include_next/#include/" -i $(TOOLS_DIR)/$(CROSSTARGET)/include/c++/$(VER)/cstdlib
  endif
 
 else # NON-TOOLCHAIN
diff --git a/lfs/gettext b/lfs/gettext
index 3896ec1..e4eeb72 100644
--- a/lfs/gettext
+++ b/lfs/gettext
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.xz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -40,7 +40,7 @@ ifeq "$(ROOT)" ""
   EXTRA_INSTALL =
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  EXTRA_CONFIG = --prefix=/tools --disable-shared --disable-nls --build=$(BUILDTARGET)
+  EXTRA_CONFIG = --prefix=$(TOOLS_DIR) --disable-shared --disable-nls --build=$(BUILDTARGET)
   EXTRA_MAKE = 
   EXTRA_INSTALL = 
 endif
@@ -92,7 +92,7 @@ else
 	cd $(DIR_APP)/gettext-tools && make -C gnulib-lib
 	cd $(DIR_APP)/gettext-tools && make -C intl pluralx.c
 	cd $(DIR_APP)/gettext-tools && make -C src msgfmt
-	cd $(DIR_APP)/gettext-tools && cp -v src/msgfmt /tools/bin
+	cd $(DIR_APP)/gettext-tools && cp -v src/msgfmt $(TOOLS_DIR)/bin
 endif
 	@rm -rf $(DIR_APP)
 	@$(POSTBUILD)
diff --git a/lfs/glibc b/lfs/glibc
index 122aca5..061bf8c 100644
--- a/lfs/glibc
+++ b/lfs/glibc
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.gz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -45,8 +45,8 @@ else
   EXTRA_CONFIG = \
 	--host=$(CROSSTARGET) \
 	--build=$(BUILDTARGET) \
-	--prefix=/tools \
-	--with-headers=/tools/include \
+	--prefix=$(TOOLS_DIR) \
+	--with-headers=$(TOOLS_DIR)/include \
 	libc_cv_forced_unwind=yes \
 	libc_cv_c_cleanup=yes
 endif
@@ -160,8 +160,8 @@ ifeq "$(TOOLCHAIN)" "1"
 	cd $(DIR_APP) && echo "int main() { return 0; }" > dummy.c
 	cd $(DIR_APP) && $(CROSSTARGET)-gcc dummy.c -o dummy
 
-	# Must be using a runtime linker from /tools
-	cd $(DIR_APP) && readelf -l dummy | grep "Requesting program interpreter: /tools"
+	# Must be using a runtime linker from $(TOOLS_DIR)
+	cd $(DIR_APP) && readelf -l dummy | grep "Requesting program interpreter: $(TOOLS_DIR)"
 	cd $(DIR_APP) && rm -vf dummy dummy.c
 endif
 
diff --git a/lfs/grep b/lfs/grep
index 5ac45c1..3c3d976 100644
--- a/lfs/grep
+++ b/lfs/grep
@@ -31,14 +31,14 @@ DL_FILE    = $(THISAPP).tar.xz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
   EXTRA_CONFIG = --prefix=/usr --bindir=/bin --disable-nls
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  EXTRA_CONFIG = --prefix=/tools --disable-nls \
+  EXTRA_CONFIG = --prefix=$(TOOLS_DIR) --disable-nls \
     --disable-perl-regexp --without-included-regex
 
 endif
diff --git a/lfs/gzip b/lfs/gzip
index e61d78a..12fae78 100644
--- a/lfs/gzip
+++ b/lfs/gzip
@@ -31,14 +31,14 @@ DL_FILE    = $(THISAPP).tar.xz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
   EXTRA_CONFIG = --prefix=/usr --disable-nls --bindir=/bin
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  EXTRA_CONFIG = --prefix=/tools --disable-nls
+  EXTRA_CONFIG = --prefix=$(TOOLS_DIR) --disable-nls
 endif
 
 ###############################################################################
diff --git a/lfs/linux b/lfs/linux
index b3ccb7a..c740512 100644
--- a/lfs/linux
+++ b/lfs/linux
@@ -56,7 +56,7 @@ VERSUFIX=ipfire$(KCFG)
 
 ifeq "$(TOOLCHAIN)" "1"
 	TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
-	HEADERS_PREFIX = /tools
+	HEADERS_PREFIX = $(TOOLS_DIR)
 else
 	TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
 	HEADERS_PREFIX = /usr
diff --git a/lfs/m4 b/lfs/m4
index 55cc4c3..3864d42 100644
--- a/lfs/m4
+++ b/lfs/m4
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.xz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -39,7 +39,7 @@ ifeq "$(ROOT)" ""
   EXTRA_MAKE =
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  EXTRA_CONFIG = --prefix=/tools --disable-nls
+  EXTRA_CONFIG = --prefix=$(TOOLS_DIR) --disable-nls
   EXTRA_MAKE = 
 endif
 
diff --git a/lfs/make b/lfs/make
index 213ef9a..979357e 100644
--- a/lfs/make
+++ b/lfs/make
@@ -35,7 +35,7 @@ PAK_VER    = 4
 
 DEPS       = ""
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -44,7 +44,7 @@ ifeq "$(ROOT)" ""
   EXTRA_INSTALL =
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  EXTRA_CONFIG = --prefix=/tools --disable-nls
+  EXTRA_CONFIG = --prefix=$(TOOLS_DIR) --disable-nls
   EXTRA_MAKE = 
   EXTRA_INSTALL = 
 endif
diff --git a/lfs/ncurses b/lfs/ncurses
index 1d8fd40..1186b52 100644
--- a/lfs/ncurses
+++ b/lfs/ncurses
@@ -31,14 +31,14 @@ DL_FILE    = $(THISAPP).tar.gz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
   PREFIX = /usr
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  PREFIX = /tools
+  PREFIX = $(TOOLS_DIR)
   EXTRA_CONFIG = --build=$(BUILDTARGET)
 endif
 
@@ -94,7 +94,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	cd $(DIR_APP) && sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in
 	# Create pkgconfig dir in toolchain
 ifneq "$(ROOT)" ""
-	mkdir -pv /tools/lib/pkgconfig/
+	mkdir -pv $(TOOLS_DIR)/lib/pkgconfig/
 endif
 	cd $(DIR_APP) && CPPFLAGS=-P ./configure $(EXTRA_CONFIG)
 	cd $(DIR_APP) && make $(MAKETUNING)
diff --git a/lfs/ncurses-compat b/lfs/ncurses-compat
index 09ec434..1480736 100644
--- a/lfs/ncurses-compat
+++ b/lfs/ncurses-compat
@@ -31,14 +31,14 @@ DL_FILE    = $(THISAPP).tar.gz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
   PREFIX = /usr
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  PREFIX = /tools
+  PREFIX = $(TOOLS_DIR)
 endif
 
 EXTRA_CONFIG += \
diff --git a/lfs/patch b/lfs/patch
index 88adf25..c938ac8 100644
--- a/lfs/patch
+++ b/lfs/patch
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.xz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -40,7 +40,7 @@ ifeq "$(ROOT)" ""
   EXTRA_INSTALL =
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  EXTRA_CONFIG = --prefix=/tools --disable-nls
+  EXTRA_CONFIG = --prefix=$(TOOLS_DIR) --disable-nls
   EXTRA_MAKE =
   EXTRA_INSTALL = 
 endif
diff --git a/lfs/perl b/lfs/perl
index 9ab8efa..0c23931 100644
--- a/lfs/perl
+++ b/lfs/perl
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.bz2
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -90,13 +90,13 @@ ifeq "$(ROOT)" ""
 	cd $(DIR_APP) && make $(MAKETUNING)
 	cd $(DIR_APP) && make install
 else
-	cd $(DIR_APP) && ./configure.gnu --prefix=/tools -Dstatic_ext='Data/Dumper Fcntl IO'
+	cd $(DIR_APP) && ./configure.gnu --prefix=$(TOOLS_DIR) -Dstatic_ext='Data/Dumper Fcntl IO'
 	cd $(DIR_APP) && sed -i 's/^0$$//' makefile
 	cd $(DIR_APP) && sed -i 's/^0$$//' x2p/makefile
 	cd $(DIR_APP) && make perl utilities
-	cd $(DIR_APP) && cp -v perl pod/pod2man /tools/bin
-	cd $(DIR_APP) && mkdir -pv /tools/lib/perl5/$(VER)
-	cd $(DIR_APP) && cp -Rv lib/* /tools/lib/perl5/$(VER)
+	cd $(DIR_APP) && cp -v perl pod/pod2man $(TOOLS_DIR)/bin
+	cd $(DIR_APP) && mkdir -pv $(TOOLS_DIR)/lib/perl5/$(VER)
+	cd $(DIR_APP) && cp -Rv lib/* $(TOOLS_DIR)/lib/perl5/$(VER)
 endif
 	@rm -rf $(DIR_APP)
 	@$(POSTBUILD)
diff --git a/lfs/pkg-config b/lfs/pkg-config
index 36fb40a..fe2752a 100644
--- a/lfs/pkg-config
+++ b/lfs/pkg-config
@@ -32,14 +32,14 @@ DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
   PREFIX = /usr
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  PREFIX = /tools
+  PREFIX = $(TOOLS_DIR)
 endif
 
 ###############################################################################
@@ -82,7 +82,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
 ifeq "$(ROOT)" ""
 else
-	mkdir -pv /tools/lib/pkgconfig
+	mkdir -pv $(TOOLS_DIR)/lib/pkgconfig
 endif
 	cd $(DIR_APP) && ./configure --prefix=$(PREFIX) --with-internal-glib
 	cd $(DIR_APP) && make $(MAKETUNING)
diff --git a/lfs/sed b/lfs/sed
index 77eba0b..3ac39a7 100644
--- a/lfs/sed
+++ b/lfs/sed
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.gz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -40,7 +40,7 @@ ifeq "$(ROOT)" ""
   EXTRA_INSTALL =
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  EXTRA_CONFIG = --prefix=/tools --disable-nls
+  EXTRA_CONFIG = --prefix=$(TOOLS_DIR) --disable-nls
   EXTRA_MAKE = 
   EXTRA_INSTALL = 
 endif
diff --git a/lfs/sources-iso b/lfs/sources-iso
deleted file mode 100644
index 4f658cf..0000000
--- a/lfs/sources-iso
+++ /dev/null
@@ -1,52 +0,0 @@
-###############################################################################
-#                                                                             #
-# IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
-#                                                                             #
-# This program is free software: you can redistribute it and/or modify        #
-# it under the terms of the GNU General Public License as published by        #
-# the Free Software Foundation, either version 3 of the License, or           #
-# (at your option) any later version.                                         #
-#                                                                             #
-# This program is distributed in the hope that it will be useful,             #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
-# GNU General Public License for more details.                                #
-#                                                                             #
-# You should have received a copy of the GNU General Public License           #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
-#                                                                             #
-###############################################################################
-
-###############################################################################
-# Definitions
-###############################################################################
-
-include Config
-
-THISAPP    = sources-iso
-
-###############################################################################
-# Top-level Rules
-###############################################################################
-
-check :
-
-download :
-
-md5 :
-
-###############################################################################
-# Installation Details
-###############################################################################
-
-install : $(DIR_INFO)/_build.othersrc-list.log
-	rm -rf /install/cdrom/*
-	for i in `cat $(DIR_INFO)/_build.othersrc-list.log`; do \
-		cp $(DIR_DL)/$$i /install/cdrom; \
-	done
-	
-	# make the sources CDROM iso
-	cd /install/cdrom && mkisofs -J -r -V "$(NAME)_$(VERSION)" \
-		. > /install/images/$(SNAME)-sources-cd-$(VERSION).$(BUILD_ARCH).iso
-	rm -rf /install/cdrom/*
diff --git a/lfs/stage1 b/lfs/stage1
index c4c5784..99e3edb 100644
--- a/lfs/stage1
+++ b/lfs/stage1
@@ -48,10 +48,10 @@ md5 :
 $(TARGET) :
 	@$(PREBUILD)
 
-	mkdir -pv /tools/lib
+	mkdir -pv $(TOOLS_DIR)/lib
 
 ifeq "$(IS_64BIT)" "1"
-	ln -svf lib /tools/lib64
+	ln -svf lib $(TOOLS_DIR)/lib64
 endif
 
 	@$(POSTBUILD)
diff --git a/lfs/stage2 b/lfs/stage2
index 0a5ac65..4ab5edd 100644
--- a/lfs/stage2
+++ b/lfs/stage2
@@ -71,11 +71,11 @@ endif
 
 	# Symlinks
 	# for this reason, stage2 rebuild will broke the iso:perl, grubbatch
-	-ln -sv /tools/bin/{bash,cat,echo,pwd,stty} /bin
-	-ln -sv /tools/bin/perl /usr/bin
-	-ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
-	-ln -sv /tools/lib/libstdc++.so{,.6} /usr/lib
-	sed 's/tools/usr/' /tools/lib/libstdc++.la > /usr/lib/libstdc++.la
+	-ln -sv $(TOOLS_DIR)/bin/{bash,cat,echo,pwd,stty} /bin
+	-ln -sv $(TOOLS_DIR)/bin/perl /usr/bin
+	-ln -sv $(TOOLS_DIR)/lib/libgcc_s.so{,.1} /usr/lib
+	-ln -sv $(TOOLS_DIR)/lib/libstdc++.so{,.6} /usr/lib
+	sed 's@$(TOOLS_DIR)@/usr@' $(TOOLS_DIR)/lib/libstdc++.la > /usr/lib/libstdc++.la
 	-ln -sv bash /bin/sh
 
 	# Config files
diff --git a/lfs/strip b/lfs/strip
index 237f4d2..9fbdf76 100644
--- a/lfs/strip
+++ b/lfs/strip
@@ -50,5 +50,5 @@ $(TARGET) :
 	# which does not work when unneeded symbols get stripped from
 	# /usr/sbin/vdr.
 	$(DIR_SRC)/src/stripper $(ROOT) \
-		--exclude=/usr/src --exclude=/tools \
+		--exclude=/usr/src --exclude=$(TOOLS_DIR) \
 		--exclude=/usr/sbin/vdr --exclude=/usr/lib/vdr
diff --git a/lfs/tar b/lfs/tar
index d701dd0..2cca099 100644
--- a/lfs/tar
+++ b/lfs/tar
@@ -31,7 +31,7 @@ DL_FILE    = $(THISAPP).tar.bz2
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
@@ -41,7 +41,7 @@ ifeq "$(ROOT)" ""
   EXTRA_INSTALL =
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  EXTRA_CONFIG = --prefix=/tools --disable-nls
+  EXTRA_CONFIG = --prefix=$(TOOLS_DIR) --disable-nls
   EXTRA_MAKE = 
   EXTRA_INSTALL = 
 endif
diff --git a/lfs/tcl b/lfs/tcl
index 06e9e08..7762a1d 100644
--- a/lfs/tcl
+++ b/lfs/tcl
@@ -76,7 +76,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
 ifneq "$(ROOT)" ""
-	cd $(DIR_APP)/unix && ./configure --prefix=/tools --disable-nls
+	cd $(DIR_APP)/unix && ./configure --prefix=$(TOOLS_DIR) --disable-nls
 else
 	cd $(DIR_APP)/unix && ./configure --prefix=/usr --disable-nls
 endif
@@ -84,7 +84,7 @@ endif
 	cd $(DIR_APP)/unix && make install
 ifneq "$(ROOT)" ""
 	cd $(DIR_APP)/unix && make install-private-headers
-	ln -sf tclsh8.6 /tools/bin/tclsh
+	ln -sf tclsh8.6 $(TOOLS_DIR)/bin/tclsh
 else
 	ln -sf tclsh8.6 /usr/bin/tclsh
 endif
diff --git a/lfs/texinfo b/lfs/texinfo
index 95e244a..8927156 100644
--- a/lfs/texinfo
+++ b/lfs/texinfo
@@ -31,14 +31,14 @@ DL_FILE    = $(THISAPP).tar.xz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/texinfo-6.3
 
-# Normal build or /tools build.
+# Normal build or $(TOOLS_DIR) build.
 #
 ifeq "$(ROOT)" ""
   TARGET = $(DIR_INFO)/$(THISAPP)
   EXTRA_CONFIG = --prefix=/usr
 else
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  EXTRA_CONFIG = --prefix=/tools
+  EXTRA_CONFIG = --prefix=$(TOOLS_DIR)
 endif
 
 ###############################################################################
diff --git a/lfs/xz b/lfs/xz
index a0da50a..219c160 100644
--- a/lfs/xz
+++ b/lfs/xz
@@ -35,7 +35,7 @@ ifeq "$(ROOT)" ""
 	PREFIX = /usr
 	TARGET = $(DIR_INFO)/$(THISAPP)
 else
-	PREFIX = /tools
+	PREFIX = $(TOOLS_DIR)
 	TARGET = $(DIR_INFO)/$(THISAPP)-tools
 endif
 
diff --git a/make.sh b/make.sh
index f8a2e5b..c088057 100755
--- a/make.sh
+++ b/make.sh
@@ -37,11 +37,57 @@ KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
 GIT_TAG=$(git tag | tail -1)					# Git Tag
 GIT_LASTCOMMIT=$(git log | head -n1 | cut -d" " -f2 |head -c8)	# Last commit
 
-TOOLCHAINVER=20170705
+TOOLCHAINVER=20171121
+
+###############################################################################
+#
+# Beautifying variables & presentation & input output interface
+#
+###############################################################################
+
+# Remember if the shell is interactive or not
+if [ -t 0 ] && [ -t 1 ]; then
+	INTERACTIVE=true
+else
+	INTERACTIVE=false
+fi
+
+## Screen Dimentions
+# Find current screen size
+if [ -z "${COLUMNS}" ]; then
+	COLUMNS=$(stty size)
+	COLUMNS=${COLUMNS##* }
+fi
+
+# When using remote connections, such as a serial port, stty size returns 0
+if ! ${INTERACTIVE} || [ "${COLUMNS}" = "0" ]; then
+	COLUMNS=80
+fi
+
+## Measurements for positioning result messages
+OPTIONS_WIDTH=20
+TIME_WIDTH=12
+STATUS_WIDTH=8
+NAME_WIDTH=$(( COLUMNS - OPTIONS_WIDTH - TIME_WIDTH - STATUS_WIDTH ))
+LINE_WIDTH=$(( COLUMNS - STATUS_WIDTH ))
+
+TIME_COL=$(( COLUMNS - TIME_WIDTH - STATUS_WIDTH ))
+STATUS_COL=$(( COLUMNS - STATUS_WIDTH ))
+
+# Define color for messages
+BOLD="\\033[1;39m"
+DONE="\\033[1;32m"
+SKIP="\\033[1;34m"
+WARN="\\033[1;35m"
+FAIL="\\033[1;31m"
+NORMAL="\\033[0;39m"
 
 # New architecture variables
 HOST_ARCH="$(uname -m)"
 
+PWD=$(pwd)
+BASENAME=$(basename $0)
+
 # Debian specific settings
 if [ ! -e /etc/debian_version ]; then
 	FULLPATH=`which $0`
@@ -54,327 +100,922 @@ else
 	fi
 fi
 
-PWD=`pwd`
-BASENAME=`basename $0`
-BASEDIR=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
+# This is the directory where make.sh is in
+export BASEDIR=$(echo $FULLPATH | sed "s/\/$BASENAME//g")
+
 LOGFILE=$BASEDIR/log/_build.preparation.log
-export BASEDIR LOGFILE
+export LOGFILE
 DIR_CHK=$BASEDIR/cache/check
 mkdir $BASEDIR/log/ 2>/dev/null
 
-# Load configuration file
-if [ -f .config ]; then
-	. .config
-fi
+system_processors() {
+	getconf _NPROCESSORS_ONLN 2>/dev/null || echo "1"
+}
 
-# Include funtions
-. tools/make-functions
+system_memory() {
+	local key val unit
+
+	while read -r key val unit; do
+		case "${key}" in
+			MemTotal:*)
+				# Convert to MB
+				echo "$(( ${val} / 1024 ))"
+				break
+				;;
+		esac
+	done < /proc/meminfo
+}
 
-# Get the amount of memory in this build system
-HOST_MEM=$(system_memory)
+configure_build() {
+	local build_arch="${1}"
 
-if [ -n "${BUILD_ARCH}" ]; then
-	configure_build "${BUILD_ARCH}"
-elif [ -n "${TARGET_ARCH}" ]; then
-	configure_build "${TARGET_ARCH}"
-	unset TARGET_ARCH
-else
-	configure_build "default"
-fi
+	if [ "${build_arch}" = "default" ]; then
+		build_arch="$(configure_build_guess)"
+	fi
+
+	case "${build_arch}" in
+		x86_64)
+			BUILDTARGET="${build_arch}-unknown-linux-gnu"
+			CROSSTARGET="${build_arch}-cross-linux-gnu"
+			BUILD_PLATFORM="x86"
+			CFLAGS_ARCH="-m64 -mtune=generic"
+			;;
+
+		i586)
+			BUILDTARGET="${build_arch}-pc-linux-gnu"
+			CROSSTARGET="${build_arch}-cross-linux-gnu"
+			BUILD_PLATFORM="x86"
+			CFLAGS_ARCH="-march=i586 -mtune=generic -fomit-frame-pointer"
+			;;
+
+		aarch64)
+			BUILDTARGET="${build_arch}-unknown-linux-gnu"
+			CROSSTARGET="${build_arch}-cross-linux-gnu"
+			BUILD_PLATFORM="arm"
+			CFLAGS_ARCH=""
+			;;
+
+		armv7hl)
+			BUILDTARGET="${build_arch}-unknown-linux-gnueabi"
+			CROSSTARGET="${build_arch}-cross-linux-gnueabi"
+			BUILD_PLATFORM="arm"
+			CFLAGS_ARCH="-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
+			;;
+
+		armv5tel)
+			BUILDTARGET="${build_arch}-unknown-linux-gnueabi"
+			CROSSTARGET="${build_arch}-cross-linux-gnueabi"
+			BUILD_PLATFORM="arm"
+			CFLAGS_ARCH="-march=armv5te -mfloat-abi=soft -fomit-frame-pointer"
+			;;
+
+		*)
+			exiterror "Cannot build for architure ${build_arch}"
+			;;
+	esac
+
+	# Check if the QEMU helper is available if needed.
+	if qemu_is_required "${build_arch}"; then
+		local qemu_build_helper="$(qemu_find_build_helper_name "${build_arch}")"
+
+		if [ -n "${qemu_build_helper}" ]; then
+			QEMU_TARGET_HELPER="${qemu_build_helper}"
+		else
+			exiterror "Could not find a binfmt_misc helper entry for ${build_arch}"
+		fi
+	fi
+
+	BUILD_ARCH="${build_arch}"
+	TOOLS_DIR="/tools_${BUILD_ARCH}"
+
+	# Enables hardening
+	HARDENING_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4"
+
+	CFLAGS="-O2 -pipe -Wall -fexceptions -fPIC ${CFLAGS_ARCH}"
+	CXXFLAGS="${CFLAGS}"
+
+	# Determine parallelism
+	if [ -z "${MAKETUNING}" ]; then
+		# We assume that each process consumes about
+		# 192MB of memory. Therefore we find out how
+		# many processes fit into memory.
+		local mem_max=$(( ${HOST_MEM} / 192 ))
+
+		local processors="$(system_processors)"
+		local cpu_max=$(( ${processors} * 2 ))
+
+		local parallelism
+		if [ ${mem_max} -lt ${cpu_max} ]; then
+			parallelism=${mem_max}
+		else
+			parallelism=${cpu_max}
+		fi
+
+		MAKETUNING="-j${parallelism}"
+	fi
+}
+
+configure_build_guess() {
+	case "${HOST_ARCH}" in
+		x86_64|i686|i586)
+			echo "i586"
+			;;
+
+		aarch64)
+			echo "aarch64"
+			;;
+
+		armv7*|armv6*|armv5*)
+			echo "armv5tel"
+			;;
+
+		*)
+			exiterror "Cannot guess build architecture"
+			;;
+	esac
+}
+
+stdumount() {
+	umount $BASEDIR/build/sys			2>/dev/null;
+	umount $BASEDIR/build/dev/shm		2>/dev/null;
+	umount $BASEDIR/build/dev/pts		2>/dev/null;
+	umount $BASEDIR/build/dev			2>/dev/null;
+	umount $BASEDIR/build/proc			2>/dev/null;
+	umount $BASEDIR/build/install/mnt		2>/dev/null;
+	umount $BASEDIR/build/usr/src/cache	2>/dev/null;
+	umount $BASEDIR/build/usr/src/ccache	2>/dev/null;
+	umount $BASEDIR/build/usr/src/config	2>/dev/null;
+	umount $BASEDIR/build/usr/src/doc		2>/dev/null;
+	umount $BASEDIR/build/usr/src/html		2>/dev/null;
+	umount $BASEDIR/build/usr/src/langs	2>/dev/null;
+	umount $BASEDIR/build/usr/src/lfs		2>/dev/null;
+	umount $BASEDIR/build/usr/src/log		2>/dev/null;
+	umount $BASEDIR/build/usr/src/src		2>/dev/null;
+}
+
+now() {
+	date -u "+%s"
+}
+
+format_runtime() {
+	local seconds=${1}
+
+	if [ ${seconds} -ge 3600 ]; then
+		printf "%d:%02d:%02d\n" \
+			"$(( seconds / 3600 ))" \
+			"$(( seconds % 3600 / 60 ))" \
+			"$(( seconds % 3600 % 60 ))"
+	elif [ ${seconds} -ge 60 ]; then
+		printf "%d:%02d\n" \
+			"$(( seconds / 60 ))" \
+			"$(( seconds % 60 ))"
+	else
+		printf "%d\n" "${seconds}"
+	fi
+}
+
+print_line() {
+	local line="$@"
+
+	printf "%-${LINE_WIDTH}s" "${line}"
+}
+
+_print_line() {
+	local status="${1}"
+	shift
+
+	if ${INTERACTIVE}; then
+		printf "${!status}"
+	fi
+
+	print_line "$@"
+
+	if ${INTERACTIVE}; then
+		printf "${NORMAL}"
+	fi
+}
+
+print_headline() {
+	_print_line BOLD "$@"
+}
+
+print_error() {
+	_print_line FAIL "$@"
+}
+
+print_package() {
+	local name="${1}"
+	shift
+
+	local version="$(grep -E "^VER |^VER=|^VER	" $BASEDIR/lfs/${name} | awk '{ print $3 }')"
+	local options="$@"
+
+	local string="${name}"
+	if [ -n "${version}" ] && [ "${version}" != "ipfire" ]; then
+		string="${string} (${version})"
+	fi
+
+	printf "%-$(( ${NAME_WIDTH} - 1 ))s " "${string}"
+
+	if [ -n "${options}" ]; then
+		printf "[ %-$(( ${OPTIONS_WIDTH} - 4 ))s ]" "${options}"
+	else
+		printf "%${OPTIONS_WIDTH}s" ""
+	fi
+}
+
+print_runtime() {
+	local runtime=$(format_runtime $@)
+
+	if ${INTERACTIVE}; then
+		printf "\\033[${TIME_COL}G[ ${BOLD}%$(( ${TIME_WIDTH} - 4 ))s${NORMAL} ]" "${runtime}"
+	else
+		printf "[ %$(( ${TIME_WIDTH} - 4 ))s ]" "${runtime}"
+	fi
+}
+
+print_status() {
+	local status="${1}"
+
+	local color="${!status}"
+
+	if ${INTERACTIVE}; then
+		printf "\\033[${STATUS_COL}G[${color-${BOLD}} %-$(( ${STATUS_WIDTH} - 4 ))s ${NORMAL}]\n" "${status}"
+	else
+		printf "[ %-$(( ${STATUS_WIDTH} - 4 ))s ]\n" "${status}"
+	fi
+}
+
+print_build_stage() {
+	print_headline "$@"
+
+	# end line
+	printf "\n"
+}
+
+print_build_summary() {
+	local runtime=$(format_runtime $@)
+
+	print_line "*** Build finished in ${runtime}"
+	print_status DONE
+}
+
+exiterror() {
+	stdumount
+	for i in `seq 0 7`; do
+		if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
+		losetup -d /dev/loop${i} 2>/dev/null
+		fi;
+	done
+
+	# Dump logfile
+	if [ -n "${LOGFILE}" ]; then
+		echo # empty line
+
+		local line
+		while read -r line; do
+			echo "    ${line}"
+		done <<< "$(tail -n30 ${LOGFILE})"
+	fi
+
+	echo # empty line
+
+	local line
+	for line in "ERROR: $@" "    Check ${LOGFILE} for errors if applicable"; do
+		print_error "${line}"
+		print_status FAIL
+	done
+
+	exit 1
+}
 
 prepareenv() {
-    ############################################################################
-    #                                                                          #
-    # Are we running the right shell?                                          #
-    #                                                                          #
-    ############################################################################
-    if [ ! "$BASH" ]; then
-			exiterror "BASH environment variable is not set.  You're probably running the wrong shell."
-    fi
-
-    if [ -z "${BASH_VERSION}" ]; then
-			exiterror "Not running BASH shell."
-    fi
-
-
-    ############################################################################
-    #                                                                          #
-    # Trap on emergency exit                                                   #
-    #                                                                          #
-    ############################################################################
-    trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
-
-
-    ############################################################################
-    #                                                                          #
-    # Resetting our nice level                                                 #
-    #                                                                          #
-    ############################################################################
-    echo -ne "Resetting our nice level to $NICE" | tee -a $LOGFILE
-    renice $NICE $$ > /dev/null
-    if [ `nice` != "$NICE" ]; then
-			beautify message FAIL
-			exiterror "Failed to set correct nice level"
-    else
-			beautify message DONE
-    fi
-
-
-    ############################################################################
-    #                                                                          #
-    # Checking if running as root user                                         #
-    #                                                                          #
-    ############################################################################
-    echo -ne "Checking if we're running as root user" | tee -a $LOGFILE
-    if [ `id -u` != 0 ]; then
-			beautify message FAIL
+	# Are we running the right shell?
+	if [ ! -z "${BASH}" ]; then
+		exiterror "BASH environment variable is not set.  You're probably running the wrong shell."
+	fi
+
+	if [ -z "${BASH_VERSION}" ]; then
+		exiterror "Not running BASH shell."
+	fi
+
+	# Trap on emergency exit
+	trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
+
+	# Resetting our nice level
+	if ! renice ${NICE} $$ >/dev/null; then
+			exiterror "Failed to set nice level to ${NICE}"
+	fi
+
+	# Checking if running as root user
+	if [ $(id -u) -ne 0 ]; then
 			exiterror "Not building as root"
-    else
-			beautify message DONE
-    fi
-
-
-    ############################################################################
-    #                                                                          #
-    # Checking for necessary temporary space                                   #
-    #                                                                          #
-    ############################################################################
-    echo -ne "Checking for necessary space on disk $BASE_DEV" | tee -a $LOGFILE
-    BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
-    BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
-    if (( 2048000 > $BASE_ASPACE )); then
+	fi
+
+	# Checking for necessary temporary space
+	print_line "Checking for necessary space on disk $BASE_DEV"
+	BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
+	BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
+	if (( 2048000 > $BASE_ASPACE )); then
 			BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'`
 			if (( 2048000 - $BASE_USPACE > $BASE_ASPACE )); then
-				beautify message FAIL
+				print_status FAIL
 				exiterror "Not enough temporary space available, need at least 2GB on $BASE_DEV"
 			fi
-    else
-			beautify message DONE
-    fi
-
-    ############################################################################
-    #                                                                          #
-    # Building Linux From Scratch system                                       #
-    #                                                                          #
-    ############################################################################
-    # Set umask
-    umask 022
-
-    # Set LFS Directory
-    LFS=$BASEDIR/build
-
-    # Check /tools symlink
-    if [ -h /tools ]; then
-        rm -f /tools
-    fi
-    if [ ! -a /tools ]; then
-			ln -s $BASEDIR/build/tools /
-    fi
-    if [ ! -h /tools ]; then
-			exiterror "Could not create /tools symbolic link."
-    fi
-
-    # Setup environment
-    set +h
-    LC_ALL=POSIX
-    export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
-    unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
-
-    # Make some extra directories
-    mkdir -p $BASEDIR/build/{tools,etc,usr/src} 2>/dev/null
-    mkdir -p $BASEDIR/build/{dev/{shm,pts},proc,sys}
-    mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null
-    mkdir -p $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache}
-
-    mknod -m 600 $BASEDIR/build/dev/console c 5 1 2>/dev/null
-    mknod -m 666 $BASEDIR/build/dev/null c 1 3 2>/dev/null
-
-    # Make all sources and proc available under lfs build
-    mount --bind /dev            $BASEDIR/build/dev
-    mount --bind /dev/pts        $BASEDIR/build/dev/pts
-    mount --bind /dev/shm        $BASEDIR/build/dev/shm
-    mount --bind /proc           $BASEDIR/build/proc
-    mount --bind /sys            $BASEDIR/build/sys
-    mount --bind $BASEDIR/cache  $BASEDIR/build/usr/src/cache
-    mount --bind $BASEDIR/ccache $BASEDIR/build/usr/src/ccache
-    mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config
-    mount --bind $BASEDIR/doc    $BASEDIR/build/usr/src/doc
-    mount --bind $BASEDIR/html   $BASEDIR/build/usr/src/html
-    mount --bind $BASEDIR/langs  $BASEDIR/build/usr/src/langs
-    mount --bind $BASEDIR/lfs    $BASEDIR/build/usr/src/lfs
-    mount --bind $BASEDIR/log    $BASEDIR/build/usr/src/log
-    mount --bind $BASEDIR/src    $BASEDIR/build/usr/src/src
-
-    # Run LFS static binary creation scripts one by one
-    export CCACHE_DIR=$BASEDIR/ccache
-    export CCACHE_COMPRESS=1
-    export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
-
-    # Remove pre-install list of installed files in case user erase some files before rebuild
-    rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null
-
-    # Prepare string for /etc/system-release.
-    SYSTEM_RELEASE="${NAME} ${VERSION} (${BUILD_ARCH})"
-    if [ "$(git status -s | wc -l)" == "0" ]; then
+	else
+			print_status DONE
+	fi
+
+	# Set umask
+	umask 022
+
+	# Set LFS Directory
+	LFS=$BASEDIR/build
+
+	# Check ${TOOLS_DIR} symlink
+	if [ -h "${TOOLS_DIR}" ]; then
+	  rm -f "${TOOLS_DIR}"
+	fi
+
+	if [ ! -e "${TOOLS_DIR}" ]; then
+	   ln -s "${BASEDIR}/build${TOOLS_DIR}" "${TOOLS_DIR}"
+	fi
+
+	if [ ! -h "${TOOLS_DIR}" ]; then
+	  exiterror "Could not create ${TOOLS_DIR} symbolic link"
+	fi
+
+	# Setup environment
+	set +h
+	LC_ALL=POSIX
+	export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
+	unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
+
+	# Make some extra directories
+	mkdir -p "${BASEDIR}/build${TOOLS_DIR}" 2>/dev/null
+	mkdir -p $BASEDIR/build/{etc,usr/src} 2>/dev/null
+	mkdir -p $BASEDIR/build/{dev/{shm,pts},proc,sys}
+	mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null
+	mkdir -p $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache}
+
+	mknod -m 600 $BASEDIR/build/dev/console c 5 1 2>/dev/null
+	mknod -m 666 $BASEDIR/build/dev/null c 1 3 2>/dev/null
+
+	# Make all sources and proc available under lfs build
+	mount --bind /dev            $BASEDIR/build/dev
+	mount --bind /dev/pts        $BASEDIR/build/dev/pts
+	mount --bind /dev/shm        $BASEDIR/build/dev/shm
+	mount --bind /proc           $BASEDIR/build/proc
+	mount --bind /sys            $BASEDIR/build/sys
+	mount --bind $BASEDIR/cache  $BASEDIR/build/usr/src/cache
+	mount --bind $BASEDIR/ccache $BASEDIR/build/usr/src/ccache
+	mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config
+	mount --bind $BASEDIR/doc    $BASEDIR/build/usr/src/doc
+	mount --bind $BASEDIR/html   $BASEDIR/build/usr/src/html
+	mount --bind $BASEDIR/langs  $BASEDIR/build/usr/src/langs
+	mount --bind $BASEDIR/lfs    $BASEDIR/build/usr/src/lfs
+	mount --bind $BASEDIR/log    $BASEDIR/build/usr/src/log
+	mount --bind $BASEDIR/src    $BASEDIR/build/usr/src/src
+
+	# Run LFS static binary creation scripts one by one
+	export CCACHE_DIR=$BASEDIR/ccache
+	export CCACHE_COMPRESS=1
+	export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
+
+	# Remove pre-install list of installed files in case user erase some files before rebuild
+	rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null
+
+	# Prepare string for /etc/system-release.
+	SYSTEM_RELEASE="${NAME} ${VERSION} (${BUILD_ARCH})"
+	if [ "$(git status -s | wc -l)" == "0" ]; then
 	GIT_STATUS=""
-    else
+	else
 	GIT_STATUS="-dirty"
-    fi
-    case "$GIT_BRANCH" in
+	fi
+	case "$GIT_BRANCH" in
 	core*|beta?|rc?)
 		SYSTEM_RELEASE="${SYSTEM_RELEASE} - $GIT_BRANCH$GIT_STATUS"
 		;;
 	*)
 		SYSTEM_RELEASE="${SYSTEM_RELEASE} - Development Build: $GIT_BRANCH/$GIT_LASTCOMMIT$GIT_STATUS"
 		;;
-    esac
+	esac
 }
 
+enterchroot() {
+	# Install QEMU helper, if needed
+	qemu_install_helper
+
+	local PATH="${TOOLS_DIR}/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin:${TOOLS_DIR}/bin"
+
+	PATH="${PATH}" chroot ${LFS} env -i \
+		HOME="/root" \
+		TERM="${TERM}" \
+		PS1="${PS1}" \
+		PATH="${PATH}" \
+		SYSTEM_RELEASE="${SYSTEM_RELEASE}" \
+		PAKFIRE_CORE="${PAKFIRE_CORE}" \
+		NAME="${NAME}" \
+		SNAME="${SNAME}" \
+		VERSION="${VERSION}" \
+		CORE="${CORE}" \
+		SLOGAN="${SLOGAN}" \
+		TOOLS_DIR="${TOOLS_DIR}" \
+		CONFIG_ROOT="${CONFIG_ROOT}" \
+		CFLAGS="${CFLAGS} ${HARDENING_CFLAGS}" \
+		CXXFLAGS="${CXXFLAGS} ${HARDENING_CFLAGS}" \
+		BUILDTARGET="${BUILDTARGET}" \
+		CROSSTARGET="${CROSSTARGET}" \
+		BUILD_ARCH="${BUILD_ARCH}" \
+		BUILD_PLATFORM="${BUILD_PLATFORM}" \
+		CCACHE_DIR=/usr/src/ccache \
+		CCACHE_COMPRESS="${CCACHE_COMPRESS}" \
+		CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
+		KVER="${KVER}" \
+		$(fake_environ) \
+		$(qemu_environ) \
+		"$@"
+}
+
+entershell() {
+	if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
+		exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
+	fi
+
+	echo "Entering to a shell inside LFS chroot, go out with exit"
+	local PS1="ipfire build chroot ($(uname -m)) \u:\w\$ "
+
+	if enterchroot bash -i; then
+		stdumount
+	else
+		print_status FAIL
+		exiterror "chroot error"
+	fi
+}
+
+lfsmakecommoncheck() {
+	# Script present?
+	if [ ! -f $BASEDIR/lfs/$1 ]; then
+		exiterror "No such file or directory: $BASEDIR/$1"
+	fi
+
+	# Print package name and version
+	print_package $@
+
+	# Check if this package is supported by our architecture.
+	# If no SUP_ARCH is found, we assume the package can be built for all.
+	if grep "^SUP_ARCH" ${BASEDIR}/lfs/${1} >/dev/null; then
+		# Check if package supports ${BUILD_ARCH} or all architectures.
+		if ! grep -E "^SUP_ARCH.*${BUILD_ARCH}|^SUP_ARCH.*all" ${BASEDIR}/lfs/${1} >/dev/null; then
+			print_status SKIP
+			return 1
+		fi
+	fi
+
+	# Script slipped?
+	local i
+	for i in $SKIP_PACKAGE_LIST
+	do
+		if [ "$i" == "$1" ]; then
+			print_status SKIP
+			return 1;
+		fi
+	done
+
+	echo -ne "`date -u '+%b %e %T'`: Building $* " >> $LOGFILE
+
+	cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \
+		MESSAGE="$1\t " download  >> $LOGFILE 2>&1
+	if [ $? -ne 0 ]; then
+		exiterror "Download error in $1"
+	fi
+
+	cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \
+		MESSAGE="$1\t md5sum" md5  >> $LOGFILE 2>&1
+	if [ $? -ne 0 ]; then
+		exiterror "md5sum error in $1, check file in cache or signature"
+	fi
+
+	return 0	# pass all!
+}
+
+lfsmake1() {
+	lfsmakecommoncheck $*
+	[ $? == 1 ] && return 0
+
+	cd $BASEDIR/lfs && env -i \
+		PATH="${TOOLS_DIR}/ccache/bin:${TOOLS_DIR}/bin:$PATH" \
+		CCACHE_DIR="${CCACHE_DIR}" \
+		CCACHE_COMPRESS="${CCACHE_COMPRESS}" \
+		CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
+		CFLAGS="${CFLAGS}" \
+		CXXFLAGS="${CXXFLAGS}" \
+		MAKETUNING="${MAKETUNING}" \
+		make -f $* \
+			TOOLCHAIN=1 \
+			TOOLS_DIR="${TOOLS_DIR}" \
+			CROSSTARGET="${CROSSTARGET}" \
+			BUILDTARGET="${BUILDTARGET}" \
+			BUILD_ARCH="${BUILD_ARCH}" \
+			BUILD_PLATFORM="${BUILD_PLATFORM}" \
+			LFS_BASEDIR="${BASEDIR}" \
+			ROOT="${LFS}" \
+			KVER="${KVER}" \
+			install >> $LOGFILE 2>&1 &
+
+	if ! wait_until_finished $!; then
+		print_status FAIL
+		exiterror "Building $*"
+	fi
+
+	print_status DONE
+}
+
+lfsmake2() {
+	lfsmakecommoncheck $*
+	[ $? == 1 ] && return 0
+
+	local PS1='\u:\w$ '
+
+	enterchroot \
+		bash -x -c "cd /usr/src/lfs && \
+			MAKETUNING=${MAKETUNING} \
+			make -f $* \
+			LFS_BASEDIR=/usr/src install" \
+		>> ${LOGFILE} 2>&1 &
+
+	if ! wait_until_finished $!; then
+		print_status FAIL
+		exiterror "Building $*"
+	fi
+
+	print_status DONE
+}
+
+ipfiredist() {
+	lfsmakecommoncheck $*
+	[ $? == 1 ] && return 0
+
+	local PS1='\u:\w$ '
+
+	enterchroot \
+		bash -x -c "cd /usr/src/lfs && make -f $* LFS_BASEDIR=/usr/src dist" \
+		>> ${LOGFILE} 2>&1 &
+
+	if ! wait_until_finished $!; then
+		print_status FAIL
+		exiterror "Packaging $*"
+	fi
+
+	print_status DONE
+}
+
+wait_until_finished() {
+	local pid=${1}
+
+	local start_time=$(now)
+
+	# Show progress
+	if ${INTERACTIVE}; then
+		# Wait a little just in case the process
+		# has finished very quickly.
+		sleep 0.1
+
+		local runtime
+		while kill -0 ${pid} 2>/dev/null; do
+			print_runtime $(( $(now) - ${start_time} ))
+
+			# Wait a little
+			sleep 1
+		done
+	fi
+
+	# Returns the exit code of the child process
+	wait ${pid}
+	local ret=$?
+
+	if ! ${INTERACTIVE}; then
+		print_runtime $(( $(now) - ${start_time} ))
+	fi
+
+	return ${ret}
+}
+
+fake_environ() {
+	[ -e "${BASEDIR}/build${TOOLS_DIR}/lib/libpakfire_preload.so" ] || return
+
+	local env="LD_PRELOAD=${TOOLS_DIR}/lib/libpakfire_preload.so"
+
+	# Fake kernel version, because some of the packages do not compile
+	# with kernel 3.0 and later.
+	env="${env} UTS_RELEASE=${KVER}"
+
+	# Fake machine version.
+	env="${env} UTS_MACHINE=${BUILD_ARCH}"
+
+	echo "${env}"
+}
+
+qemu_environ() {
+	local env
+
+	# Don't add anything if qemu is not used.
+	if ! qemu_is_required; then
+		return
+	fi
+
+	# Set default qemu options
+	case "${BUILD_ARCH}" in
+		arm*)
+			QEMU_CPU="${QEMU_CPU:-cortex-a9}"
+
+			env="${env} QEMU_CPU=${QEMU_CPU}"
+			;;
+	esac
+
+	# Enable QEMU strace
+	#env="${env} QEMU_STRACE=1"
+
+	echo "${env}"
+}
+
+qemu_is_required() {
+	local build_arch="${1}"
+
+	if [ -z "${build_arch}" ]; then
+		build_arch="${BUILD_ARCH}"
+	fi
+
+	case "${HOST_ARCH},${build_arch}" in
+		x86_64,arm*|i?86,arm*|i?86,x86_64)
+			return 0
+			;;
+		*)
+			return 1
+			;;
+	esac
+}
+
+qemu_install_helper() {
+	# Do nothing, if qemu is not required
+	if ! qemu_is_required; then
+		return 0
+	fi
+
+	if [ ! -e /proc/sys/fs/binfmt_misc/status ]; then
+		exiterror "binfmt_misc not mounted. QEMU_TARGET_HELPER not useable."
+	fi
+
+	if [ ! $(cat /proc/sys/fs/binfmt_misc/status) = 'enabled' ]; then
+		exiterror "binfmt_misc not enabled. QEMU_TARGET_HELPER not useable."
+	fi
+
+
+	if [ -z "${QEMU_TARGET_HELPER}" ]; then
+		exiterror "QEMU_TARGET_HELPER not set"
+	fi
+
+	# Check if the helper is already installed.
+	if [ -x "${LFS}${QEMU_TARGET_HELPER}" ]; then
+		return 0
+	fi
+
+	# Try to find a suitable binary that we can install
+	# to the build environment.
+	local file
+	for file in "${QEMU_TARGET_HELPER}" "${QEMU_TARGET_HELPER}-static"; do
+		# file must exist and be executable.
+		[ -x "${file}" ] || continue
+
+		# Must be static.
+		file_is_static "${file}" || continue
+
+		local dirname="${LFS}$(dirname "${file}")"
+		mkdir -p "${dirname}"
+
+		install -m 755 "${file}" "${LFS}${QEMU_TARGET_HELPER}"
+		return 0
+	done
+
+	exiterror "Could not find a statically-linked QEMU emulator: ${QEMU_TARGET_HELPER}"
+}
+
+qemu_find_build_helper_name() {
+	local build_arch="${1}"
+
+	local magic
+	case "${build_arch}" in
+		arm*)
+			magic="7f454c4601010100000000000000000002002800"
+			;;
+		x86_64)
+			magic="7f454c4602010100000000000000000002003e00"
+			;;
+	esac
+
+	[ -z "${magic}" ] && return 1
+
+	local file
+	for file in /proc/sys/fs/binfmt_misc/*; do
+		# skip write only register entry
+		[ $(basename "${file}") = "register" ] && continue
+		# Search for the file with the correct magic value.
+		grep -qE "^magic ${magic}$" "${file}" || continue
+
+		local interpreter="$(grep "^interpreter" "${file}" | awk '{ print $2 }')"
+
+		[ -n "${interpreter}" ] || continue
+		[ "${interpreter:0:1}" = "/" ] || continue
+		[ -x "${interpreter}" ] || continue
+
+		echo "${interpreter}"
+		return 0
+	done
+
+	return 1
+}
+
+file_is_static() {
+	local file="${1}"
+
+	file ${file} 2>/dev/null | grep -q "statically linked"
+}
+
+update_language_list() {
+	local path="${1}"
+
+	local lang
+	for lang in ${path}/*.po; do
+		lang="$(basename "${lang}")"
+		echo "${lang%*.po}"
+	done | sort -u > "${path}/LINGUAS"
+}
+
+# Load configuration file
+if [ -f .config ]; then
+	. .config
+fi
+
+# TARGET_ARCH is BUILD_ARCH now
+if [ -n "${TARGET_ARCH}" ]; then
+	BUILD_ARCH="${TARGET_ARCH}"
+	unset TARGET_ARCH
+fi
+
+# Get the amount of memory in this build system
+HOST_MEM=$(system_memory)
+
+if [ -n "${BUILD_ARCH}" ]; then
+	configure_build "${BUILD_ARCH}"
+else
+	configure_build "default"
+fi
+
 buildtoolchain() {
-    local error=false
-    case "${BUILD_ARCH}:${HOST_ARCH}" in
-        # x86_64
-        x86_64:x86_64)
-             # This is working.
-             ;;
-
-        # x86
-        i586:i586|i586:i686|i586:x86_64)
-            # These are working.
-            ;;
-        i586:*)
-            error=true
-            ;;
-
-        # ARM
-        arvm7hl:armv7hl|armv7hl:armv7l)
-            # These are working.
-            ;;
-
-        armv5tel:armv5tel|armv5tel:armv5tejl|armv5tel:armv6l|armv5tel:armv7l|armv5tel:aarch64)
-            # These are working.
-            ;;
-        armv5tel:*)
-            error=true
-            ;;
-    esac
-
-    ${error} && \
-        exiterror "Cannot build ${BUILD_ARCH} toolchain on $(uname -m). Please use the download if any."
-
-    local gcc=$(type -p gcc)
-    if [ -z "${gcc}" ]; then
-        exiterror "Could not find GCC. You will need a working build enviroment in order to build the toolchain."
-    fi
-
-    LOGFILE="$BASEDIR/log/_build.toolchain.log"
-    export LOGFILE
-
-    lfsmake1 stage1
-    lfsmake1 ccache			PASS=1
-    lfsmake1 binutils			PASS=1
-    lfsmake1 gcc			PASS=1
-    lfsmake1 linux			KCFG="-headers"
-    lfsmake1 glibc
-    lfsmake1 gcc			PASS=L
-    lfsmake1 binutils			PASS=2
-    lfsmake1 gcc			PASS=2
-    lfsmake1 ccache			PASS=2
-    lfsmake1 tcl
-    lfsmake1 expect
-    lfsmake1 dejagnu
-    lfsmake1 pkg-config
-    lfsmake1 ncurses
-    lfsmake1 bash
-    lfsmake1 bzip2
-    lfsmake1 automake
-    lfsmake1 coreutils
-    lfsmake1 diffutils
-    lfsmake1 findutils
-    lfsmake1 gawk
-    lfsmake1 gettext
-    lfsmake1 grep
-    lfsmake1 gzip
-    lfsmake1 m4
-    lfsmake1 make
-    lfsmake1 patch
-    lfsmake1 perl
-    lfsmake1 sed
-    lfsmake1 tar
-    lfsmake1 texinfo
-    lfsmake1 xz
-    lfsmake1 fake-environ
-    lfsmake1 cleanup-toolchain
+	local error=false
+	case "${BUILD_ARCH}:${HOST_ARCH}" in
+		# x86_64
+		x86_64:x86_64)
+			 # This is working.
+			 ;;
+
+		# x86
+		i586:i586|i586:i686|i586:x86_64)
+			# These are working.
+			;;
+		i586:*)
+			error=true
+			;;
+
+		# ARM
+		arvm7hl:armv7hl|armv7hl:armv7l)
+			# These are working.
+			;;
+
+		armv5tel:armv5tel|armv5tel:armv5tejl|armv5tel:armv6l|armv5tel:armv7l|armv5tel:aarch64)
+			# These are working.
+			;;
+		armv5tel:*)
+			error=true
+			;;
+	esac
+
+	${error} && \
+		exiterror "Cannot build ${BUILD_ARCH} toolchain on $(uname -m). Please use the download if any."
+
+	local gcc=$(type -p gcc)
+	if [ -z "${gcc}" ]; then
+		exiterror "Could not find GCC. You will need a working build enviroment in order to build the toolchain."
+	fi
+
+	LOGFILE="$BASEDIR/log/_build.toolchain.log"
+	export LOGFILE
+
+	lfsmake1 stage1
+	lfsmake1 ccache			PASS=1
+	lfsmake1 binutils			PASS=1
+	lfsmake1 gcc			PASS=1
+	lfsmake1 linux			KCFG="-headers"
+	lfsmake1 glibc
+	lfsmake1 gcc			PASS=L
+	lfsmake1 binutils			PASS=2
+	lfsmake1 gcc			PASS=2
+	lfsmake1 ccache			PASS=2
+	lfsmake1 tcl
+	lfsmake1 expect
+	lfsmake1 dejagnu
+	lfsmake1 pkg-config
+	lfsmake1 ncurses
+	lfsmake1 bash
+	lfsmake1 bzip2
+	lfsmake1 automake
+	lfsmake1 coreutils
+	lfsmake1 diffutils
+	lfsmake1 findutils
+	lfsmake1 gawk
+	lfsmake1 gettext
+	lfsmake1 grep
+	lfsmake1 gzip
+	lfsmake1 m4
+	lfsmake1 make
+	lfsmake1 patch
+	lfsmake1 perl
+	lfsmake1 sed
+	lfsmake1 tar
+	lfsmake1 texinfo
+	lfsmake1 xz
+	lfsmake1 fake-environ
+	lfsmake1 cleanup-toolchain
 }
 
 buildbase() {
-    LOGFILE="$BASEDIR/log/_build.base.log"
-    export LOGFILE
-    lfsmake2 stage2
-    lfsmake2 linux			KCFG="-headers"
-    lfsmake2 man-pages
-    lfsmake2 glibc
-    lfsmake2 tzdata
-    lfsmake2 cleanup-toolchain
-    lfsmake2 zlib
-    lfsmake2 binutils
-    lfsmake2 gmp
-    lfsmake2 gmp-compat
-    lfsmake2 mpfr
-    lfsmake2 libmpc
-    lfsmake2 file
-    lfsmake2 gcc
-    lfsmake2 sed
-    lfsmake2 autoconf
-    lfsmake2 automake
-    lfsmake2 berkeley
-    lfsmake2 coreutils
-    lfsmake2 iana-etc
-    lfsmake2 m4
-    lfsmake2 bison
-    lfsmake2 ncurses-compat
-    lfsmake2 ncurses
-    lfsmake2 procps
-    lfsmake2 libtool
-    lfsmake2 perl
-    lfsmake2 readline
-    lfsmake2 readline-compat
-    lfsmake2 bzip2
-    lfsmake2 pcre
-    lfsmake2 pcre-compat
-    lfsmake2 bash
-    lfsmake2 diffutils
-    lfsmake2 e2fsprogs
-    lfsmake2 ed
-    lfsmake2 findutils
-    lfsmake2 flex
-    lfsmake2 gawk
-    lfsmake2 gettext
-    lfsmake2 grep
-    lfsmake2 groff
-    lfsmake2 gperf
-    lfsmake2 gzip
-    lfsmake2 hostname
-    lfsmake2 iproute2
-    lfsmake2 jwhois
-    lfsmake2 kbd
-    lfsmake2 less
-    lfsmake2 make
-    lfsmake2 man
-    lfsmake2 kmod
-    lfsmake2 net-tools
-    lfsmake2 patch
-    lfsmake2 psmisc
-    lfsmake2 shadow
-    lfsmake2 sysklogd
-    lfsmake2 sysvinit
-    lfsmake2 tar
-    lfsmake2 texinfo
-    lfsmake2 util-linux
-    lfsmake2 udev
-    lfsmake2 vim
-    lfsmake2 xz
-    lfsmake2 paxctl
+	LOGFILE="$BASEDIR/log/_build.base.log"
+	export LOGFILE
+	lfsmake2 stage2
+	lfsmake2 linux			KCFG="-headers"
+	lfsmake2 man-pages
+	lfsmake2 glibc
+	lfsmake2 tzdata
+	lfsmake2 cleanup-toolchain
+	lfsmake2 zlib
+	lfsmake2 binutils
+	lfsmake2 gmp
+	lfsmake2 gmp-compat
+	lfsmake2 mpfr
+	lfsmake2 libmpc
+	lfsmake2 file
+	lfsmake2 gcc
+	lfsmake2 sed
+	lfsmake2 autoconf
+	lfsmake2 automake
+	lfsmake2 berkeley
+	lfsmake2 coreutils
+	lfsmake2 iana-etc
+	lfsmake2 m4
+	lfsmake2 bison
+	lfsmake2 ncurses-compat
+	lfsmake2 ncurses
+	lfsmake2 procps
+	lfsmake2 libtool
+	lfsmake2 perl
+	lfsmake2 readline
+	lfsmake2 readline-compat
+	lfsmake2 bzip2
+	lfsmake2 pcre
+	lfsmake2 pcre-compat
+	lfsmake2 bash
+	lfsmake2 diffutils
+	lfsmake2 e2fsprogs
+	lfsmake2 ed
+	lfsmake2 findutils
+	lfsmake2 flex
+	lfsmake2 gawk
+	lfsmake2 gettext
+	lfsmake2 grep
+	lfsmake2 groff
+	lfsmake2 gperf
+	lfsmake2 gzip
+	lfsmake2 hostname
+	lfsmake2 iproute2
+	lfsmake2 jwhois
+	lfsmake2 kbd
+	lfsmake2 less
+	lfsmake2 make
+	lfsmake2 man
+	lfsmake2 kmod
+	lfsmake2 net-tools
+	lfsmake2 patch
+	lfsmake2 psmisc
+	lfsmake2 shadow
+	lfsmake2 sysklogd
+	lfsmake2 sysvinit
+	lfsmake2 tar
+	lfsmake2 texinfo
+	lfsmake2 util-linux
+	lfsmake2 udev
+	lfsmake2 vim
+	lfsmake2 xz
+	lfsmake2 paxctl
 }
 
 buildipfire() {
@@ -907,7 +1548,7 @@ buildpackages() {
 	$BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
   rm -f $BASEDIR/doc/packages-list
   # packages-list.txt is ready to be displayed for wiki page
-  beautify message DONE
+  print_status DONE
   
   # Update changelog
   cd $BASEDIR
@@ -957,7 +1598,7 @@ buildpackages() {
 		cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
 	fi
   done
-  beautify message DONE
+  print_status DONE
 
   cd $PWD
 }
@@ -972,7 +1613,7 @@ ipfirepackages() {
 			ipfiredist $i
 		else
 			echo -n $i
-			beautify message SKIP
+			print_status SKIP
 		fi
 	done
   test -d $BASEDIR/packages || mkdir $BASEDIR/packages
@@ -999,51 +1640,52 @@ done
 # See what we're supposed to do
 case "$1" in 
 build)
-	clear
-	PACKAGE=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz 2> /dev/null | head -n 1`
+	START_TIME=$(now)
+
+	# Clear screen
+	${INTERACTIVE} && clear
+
+	PACKAGE=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.xz 2> /dev/null | head -n 1`
 	#only restore on a clean disk
-	if [ ! -e "${BASEDIR}/build/tools/.toolchain-successful" ]; then
+	if [ ! -e "${BASEDIR}/build${TOOLS_DIR}/.toolchain-successful" ]; then
 		if [ ! -n "$PACKAGE" ]; then
-			beautify build_stage "Full toolchain compilation"
+			print_build_stage "Full toolchain compilation"
 			prepareenv
 			buildtoolchain
 		else
-			PACKAGENAME=${PACKAGE%.tar.gz}
-			beautify build_stage "Packaged toolchain compilation"
+			PACKAGENAME=${PACKAGE%.tar.xz}
+			print_build_stage "Packaged toolchain compilation"
 			if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
-				tar zxf $PACKAGE
+				tar axf $PACKAGE
 				prepareenv
 			else
 				exiterror "$PACKAGENAME md5 did not match, check downloaded package"
 			fi
 		fi
 	else
-		echo -n "Using installed toolchain" | tee -a $LOGFILE
-		beautify message SKIP
 		prepareenv
 	fi
 
-	beautify build_start
-	beautify build_stage "Building LFS"
+	print_build_stage "Building LFS"
 	buildbase
 
-	beautify build_stage "Building IPFire"
+	print_build_stage "Building IPFire"
 	buildipfire
 
-	beautify build_stage "Building installer"
+	print_build_stage "Building installer"
 	buildinstaller
 
-	beautify build_stage "Building packages"
+	print_build_stage "Building packages"
 	buildpackages
 	
-	beautify build_stage "Checking Logfiles for new Files"
+	print_build_stage "Checking Logfiles for new Files"
 
 	cd $BASEDIR
 	tools/checknewlog.pl
 	tools/checkrootfiles
 	cd $PWD
 
-	beautify build_end
+	print_build_summary $(( $(now) - ${START_TIME} ))
 	;;
 shell)
 	# enter a shell inside LFS chroot
@@ -1052,7 +1694,8 @@ shell)
 	entershell
 	;;
 clean)
-	echo -en "${BOLD}Cleaning build directory...${NORMAL}"
+	print_line "Cleaning build directory..."
+
 	for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
 		$LOSETUP -d $i 2>/dev/null
 	done
@@ -1061,20 +1704,20 @@ clean)
 	done
 	stdumount
 	for i in `seq 0 7`; do
-	    if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
+		if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
 		umount /dev/loop${i}     2>/dev/null;
 		losetup -d /dev/loop${i} 2>/dev/null;
-	    fi;
+		fi;
 	done
 	rm -rf $BASEDIR/build
 	rm -rf $BASEDIR/cdrom
 	rm -rf $BASEDIR/packages
 	rm -rf $BASEDIR/log
-	if [ -h /tools ]; then
-		rm -f /tools
+	if [ -h "${TOOLS_DIR}" ]; then
+		rm -f "${TOOLS_DIR}"
 	fi
 	rm -f $BASEDIR/ipfire-*
-	beautify message DONE
+	print_status DONE
 	;;
 downloadsrc)
 	if [ ! -d $BASEDIR/cache ]; then
@@ -1097,11 +1740,11 @@ downloadsrc)
 				make -s -f $i LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \
 					MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
 				if [ $? -ne 0 ]; then
-					beautify message FAIL
+					print_status FAIL
 					FINISHED=0
 				else
 					if [ $c -eq 1 ]; then
-					beautify message DONE
+					print_status DONE
 					fi
 				fi
 			fi
@@ -1116,46 +1759,48 @@ downloadsrc)
 				MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
 			if [ $? -ne 0 ]; then
 				echo -ne "MD5 difference in lfs/$i"
-				beautify message FAIL
+				print_status FAIL
 				ERROR=1
 			fi
 		fi
 	done
 	if [ $ERROR -eq 0 ]; then
 		echo -ne "${BOLD}all files md5sum match${NORMAL}"
-		beautify message DONE
+		print_status DONE
 	else
 		echo -ne "${BOLD}not all files were correctly download${NORMAL}"
-		beautify message FAIL
+		print_status FAIL
 	fi
 	cd - >/dev/null 2>&1
 	;;
 toolchain)
-	clear
+	# Clear screen
+	${INTERACTIVE} && clear
+
 	prepareenv
-	beautify build_stage "Toolchain compilation"
+	print_build_stage "Toolchain compilation"
 	buildtoolchain
-	echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for ${BUILD_ARCH}" | tee -a $LOGFILE
+	echo "`date -u '+%b %e %T'`: Create toolchain image for ${BUILD_ARCH}" | tee -a $LOGFILE
 	test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
-	cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz \
-		build/tools build/bin/sh log >> $LOGFILE
-	md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz \
+	cd $BASEDIR && XZ_OPT="-T0 -8" tar -Jc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.xz \
+		build/${TOOLS_DIR} build/bin/sh log >> $LOGFILE
+	md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.xz \
 		> cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5
 	stdumount
 	;;
 gettoolchain)
 	# arbitrary name to be updated in case of new toolchain package upload
 	PACKAGE=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}
-	if [ ! -f $BASEDIR/cache/toolchains/$PACKAGE.tar.gz ]; then
+	if [ ! -f $BASEDIR/cache/toolchains/$PACKAGE.tar.xz ]; then
 		URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'`
 		test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
-		echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for ${BUILD_ARCH}" | tee -a $LOGFILE
+		echo "`date -u '+%b %e %T'`: Load toolchain image for ${BUILD_ARCH}" | tee -a $LOGFILE
 		cd $BASEDIR/cache/toolchains
-		wget -U "IPFireSourceGrabber/2.x" $URL_TOOLCHAIN/$PACKAGE.tar.gz $URL_TOOLCHAIN/$PACKAGE.md5 >& /dev/null
+		wget -U "IPFireSourceGrabber/2.x" $URL_TOOLCHAIN/$PACKAGE.tar.xz $URL_TOOLCHAIN/$PACKAGE.md5 >& /dev/null
 		if [ $? -ne 0 ]; then
 			echo "`date -u '+%b %e %T'`: error downloading $PACKAGE toolchain for ${BUILD_ARCH} machine" | tee -a $LOGFILE
 		else
-			if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
+			if [ "`md5sum $PACKAGE.tar.xz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
 				echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
 			else
 				exiterror "$PACKAGE.md5 did not match, check downloaded package"
@@ -1165,27 +1810,11 @@ gettoolchain)
 		echo "Toolchain is already downloaded. Exiting..."
 	fi
 	;;
-othersrc)
-	prepareenv
-	echo -ne "`date -u '+%b %e %T'`: Build sources iso for ${BUILD_ARCH}" | tee -a $LOGFILE
-	chroot $LFS /tools/bin/env -i   HOME=/root \
-	TERM=$TERM PS1='\u:\w\$ ' \
-	PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
-	VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" BUILD_ARCH="${BUILD_ARCH}" \
-	/bin/bash -x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
-	mv $LFS/install/images/ipfire-* $BASEDIR >> $LOGFILE 2>&1
-	if [ $? -eq "0" ]; then
-		beautify message DONE
-	else
-		beautify message FAIL
-	fi
-	stdumount
-	;;
 uploadsrc)
 	PWD=`pwd`
 	if [ -z $IPFIRE_USER ]; then
 		echo -n "You have to setup IPFIRE_USER first. See .config for details."
-		beautify message FAIL
+		print_status FAIL
 		exit 1
 	fi
 
@@ -1203,7 +1832,33 @@ uploadsrc)
 	exit 0
 	;;
 lang)
-	update_langs
+	echo -ne "Checking the translations for missing or obsolete strings..."
+	chmod 755 $BASEDIR/tools/{check_strings.pl,sort_strings.pl,check_langs.sh}
+	$BASEDIR/tools/sort_strings.pl en
+	$BASEDIR/tools/sort_strings.pl de
+	$BASEDIR/tools/sort_strings.pl fr
+	$BASEDIR/tools/sort_strings.pl es
+	$BASEDIR/tools/sort_strings.pl pl
+	$BASEDIR/tools/sort_strings.pl ru
+	$BASEDIR/tools/sort_strings.pl nl
+	$BASEDIR/tools/sort_strings.pl tr
+	$BASEDIR/tools/sort_strings.pl it
+	$BASEDIR/tools/check_strings.pl en > $BASEDIR/doc/language_issues.en
+	$BASEDIR/tools/check_strings.pl de > $BASEDIR/doc/language_issues.de
+	$BASEDIR/tools/check_strings.pl fr > $BASEDIR/doc/language_issues.fr
+	$BASEDIR/tools/check_strings.pl es > $BASEDIR/doc/language_issues.es
+	$BASEDIR/tools/check_strings.pl es > $BASEDIR/doc/language_issues.pl
+	$BASEDIR/tools/check_strings.pl ru > $BASEDIR/doc/language_issues.ru
+	$BASEDIR/tools/check_strings.pl nl > $BASEDIR/doc/language_issues.nl
+	$BASEDIR/tools/check_strings.pl tr > $BASEDIR/doc/language_issues.tr
+	$BASEDIR/tools/check_strings.pl it > $BASEDIR/doc/language_issues.it
+	$BASEDIR/tools/check_langs.sh > $BASEDIR/doc/language_missings
+	print_status DONE
+
+	echo -ne "Updating language lists..."
+	update_language_list ${BASEDIR}/src/installer/po
+	update_language_list ${BASEDIR}/src/setup/po
+	print_status DONE
 	;;
 *)
 	echo "Usage: $0 {build|changelog|clean|gettoolchain|downloadsrc|shell|sync|toolchain}"
diff --git a/src/stripper b/src/stripper
index d73848f..f121d35 100755
--- a/src/stripper
+++ b/src/stripper
@@ -1,4 +1,4 @@
-#!/tools/bin/bash
+#!/usr/bin/env bash
 
 dirs=""
 excludes="/dev /proc /sys /run"
diff --git a/tools/make-functions b/tools/make-functions
deleted file mode 100644
index 439298b..0000000
--- a/tools/make-functions
+++ /dev/null
@@ -1,762 +0,0 @@
-#!/bin/bash
-###############################################################################
-#                                                                             #
-# IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2016  IPFire Team  <info(a)ipfire.org>                     #
-#                                                                             #
-# This program is free software: you can redistribute it and/or modify        #
-# it under the terms of the GNU General Public License as published by        #
-# the Free Software Foundation, either version 3 of the License, or           #
-# (at your option) any later version.                                         #
-#                                                                             #
-# This program is distributed in the hope that it will be useful,             #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
-# GNU General Public License for more details.                                #
-#                                                                             #
-# You should have received a copy of the GNU General Public License           #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
-#                                                                             #
-###############################################################################
-###############################################################################
-#
-# Beautifying variables & presentation & input output interface
-#
-###############################################################################
-
-## Screen Dimentions
-# Find current screen size
-if [ -z "${COLUMNS}" ]; then
-	COLUMNS=$(stty size)
-	COLUMNS=${COLUMNS##* }
-fi
-
-# When using remote connections, such as a serial port, stty size returns 0
-if [ "${COLUMNS}" = "0" ]; then
-	COLUMNS=80
-fi
-
-## Measurements for positioning result messages
-RESULT_WIDTH=4
-TIME_WIDTH=8
-OPT_WIDTH=6
-VER_WIDTH=10
-RESULT_COL=$((${COLUMNS} - $RESULT_WIDTH - 4))
-TIME_COL=$((${RESULT_COL} - $TIME_WIDTH - 5))
-OPT_COL=$((${TIME_COL} - $OPT_WIDTH - 5))
-VER_COL=$((${OPT_COL} - $VER_WIDTH - 5))
-
-## Set Cursur Position Commands, used via echo -e
-SET_RESULT_COL="\\033[${RESULT_COL}G"
-SET_TIME_COL="\\033[${TIME_COL}G"
-SET_OPT_COL="\\033[${OPT_COL}G"
-SET_VER_COL="\\033[${VER_COL}G"
-
-# Define color for messages
-BOLD="\\033[1;39m"
-DONE="\\033[1;32m"
-SKIP="\\033[1;34m"
-WARN="\\033[1;35m"
-FAIL="\\033[1;31m"
-NORMAL="\\033[0;39m"
-
-system_processors() {
-	getconf _NPROCESSORS_ONLN 2>/dev/null || echo "1"
-}
-
-system_memory() {
-	local key val unit
-
-	while read -r key val unit; do
-		case "${key}" in
-			MemTotal:*)
-				# Convert to MB
-				echo "$(( ${val} / 1024 ))"
-				break
-				;;
-		esac
-	done < /proc/meminfo
-}
-
-configure_build() {
-	local build_arch="${1}"
-
-	if [ "${build_arch}" = "default" ]; then
-		build_arch="$(configure_build_guess)"
-	fi
-
-	case "${build_arch}" in
-		x86_64)
-			BUILDTARGET="${build_arch}-unknown-linux-gnu"
-			CROSSTARGET="${build_arch}-cross-linux-gnu"
-			BUILD_PLATFORM="x86"
-			CFLAGS_ARCH="-m64 -mtune=generic"
-			;;
-
-		i586)
-			BUILDTARGET="${build_arch}-pc-linux-gnu"
-			CROSSTARGET="${build_arch}-cross-linux-gnu"
-			BUILD_PLATFORM="x86"
-			CFLAGS_ARCH="-march=i586 -mtune=generic -fomit-frame-pointer"
-			;;
-
-		aarch64)
-			BUILDTARGET="${build_arch}-unknown-linux-gnu"
-			CROSSTARGET="${build_arch}-cross-linux-gnu"
-			BUILD_PLATFORM="arm"
-			CFLAGS_ARCH=""
-			;;
-
-		armv7hl)
-			BUILDTARGET="${build_arch}-unknown-linux-gnueabi"
-			CROSSTARGET="${build_arch}-cross-linux-gnueabi"
-			BUILD_PLATFORM="arm"
-			CFLAGS_ARCH="-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
-			;;
-
-		armv5tel)
-			BUILDTARGET="${build_arch}-unknown-linux-gnueabi"
-			CROSSTARGET="${build_arch}-cross-linux-gnueabi"
-			BUILD_PLATFORM="arm"
-			CFLAGS_ARCH="-march=armv5te -mfloat-abi=soft -fomit-frame-pointer"
-			;;
-
-		*)
-			exiterror "Cannot build for architure ${build_arch}"
-			;;
-	esac
-
-	# Check if the QEMU helper is available if needed.
-	if qemu_is_required "${build_arch}"; then
-		local qemu_build_helper="$(qemu_find_build_helper_name "${build_arch}")"
-
-		if [ -n "${qemu_build_helper}" ]; then
-			QEMU_TARGET_HELPER="${qemu_build_helper}"
-		else
-			exiterror "Could not find a binfmt_misc helper entry for ${build_arch}"
-		fi
-	fi
-
-	BUILD_ARCH="${build_arch}"
-
-	# Enables hardening
-	HARDENING_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4"
-
-	CFLAGS="-O2 -pipe -Wall -fexceptions -fPIC ${CFLAGS_ARCH}"
-	CXXFLAGS="${CFLAGS}"
-
-	# Determine parallelism
-	if [ -z "${MAKETUNING}" ]; then
-		# We assume that each process consumes about
-		# 192MB of memory. Therefore we find out how
-		# many processes fit into memory.
-		local mem_max=$(( ${HOST_MEM} / 192 ))
-
-		local processors="$(system_processors)"
-		local cpu_max=$(( ${processors} * 2 ))
-
-		local parallelism
-		if [ ${mem_max} -lt ${cpu_max} ]; then
-			parallelism=${mem_max}
-		else
-			parallelism=${cpu_max}
-		fi
-
-		MAKETUNING="-j${parallelism}"
-	fi
-}
-
-configure_build_guess() {
-	case "${HOST_ARCH}" in
-		x86_64|i686|i586)
-			echo "i586"
-			;;
-
-		aarch64)
-			echo "aarch64"
-			;;
-
-		armv7*|armv6*|armv5*)
-			echo "armv5tel"
-			;;
-
-		*)
-			exiterror "Cannot guess build architecture"
-			;;
-	esac
-}
-
-evaluate() {
-	if [ "$?" -eq "0" ]; then
-		beautify message DONE
-	else
-		EXITCODE=$1
-		shift 1
-		beautify message FAIL
-		$*
-		if [ $EXITCODE -ne "0" ]; then
-			exit $EXITCODE
-		fi
-	fi
-}
-
-position_cursor()
-{
-	# ARG1=starting position on screen
-	# ARG2=string to be printed
-	# ARG3=offset, negative for left movement, positive for right movement, relative to ARG1
-	# For example if your starting position is column 50 and you want to print Hello three columns to the right
-	# of your starting position, your call will look like this:
-	# position_cursor 50 "Hello" 3 (you'll get the string Hello at position 53 (= 50 + 3)
-	# If on the other hand you want your string "Hello" to end three columns to the left of position 50,
-	# your call will look like this:
-	# position_cursor 50 "Hello" -3 (you'll get the string Hello at position 42 (= 50 - 5 -3)
-	# If you want to start printing at the exact starting location, use offset 0
-
-	START=$1
-	STRING=$2
-	OFFSET=$3
-
-	STRING_LENGTH=${#STRING}
-
-	if [ ${OFFSET} -lt 0 ]; then
-		COL=$((${START} + ${OFFSET} - ${STRING_LENGTH}))
-	else
-		COL=$((${START} + ${OFFSET}))
-	fi
-
-	SET_COL="\\033[${COL}G"
-
-	echo $SET_COL
-} # End of position_cursor()
-
-
-beautify()
-{
-	# Commands: build_stage, make_pkg, message, result
-	case "$1" in
-		message)
-			case "$2" in
-				DONE)
-					echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n"
-					;;
-				WARN)
-					echo -ne "${WARN}${3}${NORMAL}${SET_RESULT_COL}[${WARN} WARN ${NORMAL}]\n"
-					;;	
-				FAIL)
-					echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n"
-					;;
-				SKIP)
-					echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n"
-					;;
-			esac
-			;;
-		build_stage)
-			MESSAGE=$2
-			if [ "$STAGE_TIME_START" ]; then
-				LAST_STAGE_TIME=$[ `date +%s` - $STAGE_TIME_START ]
-			fi
-			STAGE_TIME_START=`date +%s`
-			echo -ne "${BOLD}*** (${BUILD_ARCH}) ${MESSAGE}${NORMAL}"
-			if [ "$LAST_STAGE_TIME" ]; then
-				echo -ne "${DONE} (Last stage took $LAST_STAGE_TIME secs)${NORMAL}\n"
-			fi
-			echo -ne "${BOLD}${SET_VER_COL}      version${SET_OPT_COL} options${SET_TIME_COL} time (sec)${SET_RESULT_COL} status${NORMAL}\n"
-			;;
-		build_start)
-			BUILD_TIME_START=`date +%s`
-			;;
-		build_end)
-			BUILD_TIME_END=`date +%s`
-			seconds=$[ $BUILD_TIME_END - $BUILD_TIME_START ]
-			hours=$((seconds / 3600))
-			seconds=$((seconds % 3600))
-			minutes=$((seconds / 60))
-			seconds=$((seconds % 60))
-
-			echo -ne "${DONE}***Build is finished now and took $hours hour(s) $minutes minute(s) $seconds second(s)!${NORMAL}\n"
-			;;
-		make_pkg)
-			echo "$2" | while read PKG_VER PROGRAM OPTIONS
-			do
-				SET_VER_COL_REAL=`position_cursor $OPT_COL $PKG_VER -3`
-
-				if [ "$OPTIONS" == "" ]; then
-					echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
-					echo -ne "${NORMAL} ]${SET_RESULT_COL}"
-				else
-					echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
-					echo -ne "${NORMAL} ]${SET_OPT_COL}[ ${BOLD}${OPTIONS}"
-					echo -ne "${NORMAL} ]${SET_RESULT_COL}"
-				fi
-			done
-			;;
-		result)
-			RESULT=$2
-
-			if [ ! $3 ]; then
-				PKG_TIME=0
-			else
-				PKG_TIME=$3
-			fi
-
-			SET_TIME_COL_REAL=`position_cursor $RESULT_COL $PKG_TIME -3`
-			case "$RESULT" in
-				DONE)
-					echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
-					echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n"
-					;;
-				FAIL)
-					echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
-					echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n"
-					;;
-				SKIP)
-					echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n"
-					;;
-			esac
-			;;
-	esac
-} # End of beautify()
-
-
-get_pkg_ver()
-{
-	PKG_VER=`grep -E "^VER |^VER=|^VER	" $1 | awk '{print $3}'`
-
-	if [ -z $PKG_VER ]; then
-		PKG_VER=`grep "Exp " $1 | awk '{print $4}'`
-	fi
-	if [ -z $PKG_VER ]; then
-		PKG_VER="?"
-	fi
-	if [ ${#PKG_VER} -gt $VER_WIDTH ]; then
-		# If a package version number is greater than $VER_WIDTH, we keep the first 4 characters
-		# and replace enough characters to fit the resulting string on the screen.  We'll replace
-		# the extra character with .. (two dots).  That's why the "+ 2" in the formula below.
-		# Example: if we have a 21-long version number that we want to fit into a 10-long space,
-		# we have to remove 11 characters.  But if we replace 11 characters with 2 characters, we'll
-		# end up with a 12-character long string.  That's why we replace 12 characters with ..
-		REMOVE=`expr substr "$PKG_VER" 4 $[ ${#PKG_VER} - $VER_WIDTH + 2 ]`
-		PKG_VER=`echo ${PKG_VER/$REMOVE/..}`
-	fi
-
-	echo "$PKG_VER"
-} # End of get_pkg_ver()
-
-# Define immediately
-stdumount() {
-	umount $BASEDIR/build/sys			2>/dev/null;
-	umount $BASEDIR/build/dev/shm		2>/dev/null;
-	umount $BASEDIR/build/dev/pts		2>/dev/null;
-	umount $BASEDIR/build/dev			2>/dev/null;
-	umount $BASEDIR/build/proc			2>/dev/null;
-	umount $BASEDIR/build/install/mnt		2>/dev/null;
-	umount $BASEDIR/build/usr/src/cache	2>/dev/null;
-	umount $BASEDIR/build/usr/src/ccache	2>/dev/null;
-	umount $BASEDIR/build/usr/src/config	2>/dev/null;
-	umount $BASEDIR/build/usr/src/doc		2>/dev/null;
-	umount $BASEDIR/build/usr/src/html		2>/dev/null;
-	umount $BASEDIR/build/usr/src/langs	2>/dev/null;
-	umount $BASEDIR/build/usr/src/lfs		2>/dev/null;
-	umount $BASEDIR/build/usr/src/log		2>/dev/null;
-	umount $BASEDIR/build/usr/src/src		2>/dev/null;
-}
-
-exiterror() {
-	stdumount
-	for i in `seq 0 7`; do
-	    if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
-		losetup -d /dev/loop${i} 2>/dev/null
-	    fi;
-	done
-
-	if [ -n "${LOGFILE}" ]; then
-		echo # empty line
-
-		local line
-		while read -r line; do
-			echo "    ${line}"
-		done <<< "$(tail -n30 ${LOGFILE})"
-	fi
-
-	echo -e "\nERROR: $*"
-	echo "       Check $LOGFILE for errors if applicable"
-	exit 1
-}
-
-fake_environ() {
-	[ -e "${BASEDIR}/build/tools/lib/libpakfire_preload.so" ] || return
-
-	local env="LD_PRELOAD=/tools/lib/libpakfire_preload.so"
-
-	# Fake kernel version, because some of the packages do not compile
-	# with kernel 3.0 and later.
-	env="${env} UTS_RELEASE=${KVER}"
-
-	# Fake machine version.
-	env="${env} UTS_MACHINE=${BUILD_ARCH}"
-
-	echo "${env}"
-}
-
-qemu_environ() {
-	local env
-
-	# Don't add anything if qemu is not used.
-	if ! qemu_is_required; then
-		return
-	fi
-
-	# Set default qemu options
-	case "${BUILD_ARCH}" in
-		arm*)
-			QEMU_CPU="${QEMU_CPU:-cortex-a9}"
-
-			env="${env} QEMU_CPU=${QEMU_CPU}"
-			;;
-	esac
-
-	# Enable QEMU strace
-	#env="${env} QEMU_STRACE=1"
-
-	echo "${env}"
-}
-
-qemu_is_required() {
-	local build_arch="${1}"
-
-	if [ -z "${build_arch}" ]; then
-		build_arch="${BUILD_ARCH}"
-	fi
-
-	case "${HOST_ARCH},${build_arch}" in
-		x86_64,arm*|i?86,arm*|i?86,x86_64)
-			return 0
-			;;
-		*)
-			return 1
-			;;
-	esac
-}
-
-qemu_install_helper() {
-	# Do nothing, if qemu is not required
-	if ! qemu_is_required; then
-		return 0
-	fi
-
-	if [ ! -e /proc/sys/fs/binfmt_misc/status ]; then
-		exiterror "binfmt_misc not mounted. QEMU_TARGET_HELPER not useable."
-	fi
-
-	if [ ! $(cat /proc/sys/fs/binfmt_misc/status) = 'enabled' ]; then
-		exiterror "binfmt_misc not enabled. QEMU_TARGET_HELPER not useable."
-	fi
-
-
-	if [ -z "${QEMU_TARGET_HELPER}" ]; then
-		exiterror "QEMU_TARGET_HELPER not set"
-	fi
-
-	# Check if the helper is already installed.
-	if [ -x "${LFS}${QEMU_TARGET_HELPER}" ]; then
-		return 0
-	fi
-
-	# Try to find a suitable binary that we can install
-	# to the build environment.
-	local file
-	for file in "${QEMU_TARGET_HELPER}" "${QEMU_TARGET_HELPER}-static"; do
-		# file must exist and be executable.
-		[ -x "${file}" ] || continue
-
-		# Must be static.
-		file_is_static "${file}" || continue
-
-		local dirname="${LFS}$(dirname "${file}")"
-		mkdir -p "${dirname}"
-
-		install -m 755 "${file}" "${LFS}${QEMU_TARGET_HELPER}"
-		return 0
-	done
-
-	exiterror "Could not find a statically-linked QEMU emulator: ${QEMU_TARGET_HELPER}"
-}
-
-qemu_find_build_helper_name() {
-	local build_arch="${1}"
-
-	local magic
-	case "${build_arch}" in
-		arm*)
-			magic="7f454c4601010100000000000000000002002800"
-			;;
-		x86_64)
-			magic="7f454c4602010100000000000000000002003e00"
-			;;
-	esac
-
-	[ -z "${magic}" ] && return 1
-
-	local file
-	for file in /proc/sys/fs/binfmt_misc/*; do
-		# skip write only register entry
-		[ $(basename "${file}") = "register" ] && continue
-		# Search for the file with the correct magic value.
-		grep -qE "^magic ${magic}$" "${file}" || continue
-
-		local interpreter="$(grep "^interpreter" "${file}" | awk '{ print $2 }')"
-
-		[ -n "${interpreter}" ] || continue
-		[ "${interpreter:0:1}" = "/" ] || continue
-		[ -x "${interpreter}" ] || continue
-
-		echo "${interpreter}"
-		return 0
-	done
-
-	return 1
-}
-
-file_is_static() {
-	local file="${1}"
-
-	file ${file} 2>/dev/null | grep -q "statically linked"
-}
-
-enterchroot() {
-	# Install QEMU helper, if needed
-	qemu_install_helper
-
-	local PATH="/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin"
-
-	PATH="${PATH}" chroot ${LFS} env -i \
-		HOME="/root" \
-		TERM="${TERM}" \
-		PS1="${PS1}" \
-		PATH="${PATH}" \
-		SYSTEM_RELEASE="${SYSTEM_RELEASE}" \
-		PAKFIRE_CORE="${PAKFIRE_CORE}" \
-		NAME="${NAME}" \
-		SNAME="${SNAME}" \
-		VERSION="${VERSION}" \
-		CORE="${CORE}" \
-		SLOGAN="${SLOGAN}" \
-		CONFIG_ROOT="${CONFIG_ROOT}" \
-		CFLAGS="${CFLAGS} ${HARDENING_CFLAGS}" \
-		CXXFLAGS="${CXXFLAGS} ${HARDENING_CFLAGS}" \
-		BUILDTARGET="${BUILDTARGET}" \
-		CROSSTARGET="${CROSSTARGET}" \
-		BUILD_ARCH="${BUILD_ARCH}" \
-		BUILD_PLATFORM="${BUILD_PLATFORM}" \
-		CCACHE_DIR=/usr/src/ccache \
-		CCACHE_COMPRESS="${CCACHE_COMPRESS}" \
-		CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
-		KVER="${KVER}" \
-		$(fake_environ) \
-		$(qemu_environ) \
-		"$@"
-}
-
-entershell() {
-	if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
-		exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
-	fi
-
-	echo "Entering to a shell inside LFS chroot, go out with exit"
-	local PS1="ipfire build chroot ($(uname -m)) \u:\w\$ "
-
-	if enterchroot bash -i; then
-		stdumount
-	else
-		beautify message FAIL
-		exiterror "chroot error"
-	fi
-}
-
-############################################################################
-#                                                                          #
-# Necessary shell functions                                                #
-#                                                                          #
-############################################################################
-#
-# Common checking before entering the chroot and compilling
-#
-# Return:0 caller can continue
-#	:1 skip (nothing to do)
-#	or fail if no script file found
-#
-lfsmakecommoncheck()
-{
-	# Script present?
-	if [ ! -f $BASEDIR/lfs/$1 ]; then
-		exiterror "No such file or directory: $BASEDIR/$1"
-	fi
-
-	local PKG_VER=`get_pkg_ver $BASEDIR/lfs/$1`
-	beautify make_pkg "$PKG_VER $*"
-
-	# Check if this package is supported by our architecture.
-	# If no SUP_ARCH is found, we assume the package can be built for all.
-	if grep "^SUP_ARCH" ${BASEDIR}/lfs/${1} >/dev/null; then
-		# Check if package supports ${BUILD_ARCH} or all architectures.
-		if ! grep -E "^SUP_ARCH.*${BUILD_ARCH}|^SUP_ARCH.*all" ${BASEDIR}/lfs/${1} >/dev/null; then
-			beautify result SKIP
-			return 1
-		fi
-	fi
-
-	# Script slipped?
-	local i
-	for i in $SKIP_PACKAGE_LIST
-	do
-		if [ "$i" == "$1" ]; then
-			beautify result SKIP
-			return 1;
-		fi 
-	done
-
-	echo -ne "`date -u '+%b %e %T'`: Building $* " >> $LOGFILE
-
-	cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \
-		MESSAGE="$1\t " download  >> $LOGFILE 2>&1
-	if [ $? -ne 0 ]; then
-		exiterror "Download error in $1"
-	fi
-
-	cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \
-		MESSAGE="$1\t md5sum" md5  >> $LOGFILE 2>&1
-	if [ $? -ne 0 ]; then
-		exiterror "md5sum error in $1, check file in cache or signature"
-	fi
-
-	return 0	# pass all!
-} # End of lfsmakecommoncheck()
-
-lfsmake1() {
-	lfsmakecommoncheck $*
-	[ $? == 1 ] && return 0
-
-	local PKG_TIME_START=`date +%s`
-
-	cd $BASEDIR/lfs && env -i \
-		PATH="/tools/ccache/bin:/tools/bin:$PATH" \
-		CCACHE_DIR="${CCACHE_DIR}" \
-		CCACHE_COMPRESS="${CCACHE_COMPRESS}" \
-		CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
-		CFLAGS="${CFLAGS}" \
-		CXXFLAGS="${CXXFLAGS}" \
-		MAKETUNING="${MAKETUNING}" \
-		make -f $* \
-			TOOLCHAIN=1 \
-			CROSSTARGET="${CROSSTARGET}" \
-			BUILDTARGET="${BUILDTARGET}" \
-			BUILD_ARCH="${BUILD_ARCH}" \
-			BUILD_PLATFORM="${BUILD_PLATFORM}" \
-			LFS_BASEDIR="${BASEDIR}" \
-			ROOT="${LFS}" \
-			KVER="${KVER}" \
-			install >> $LOGFILE 2>&1
-
-	local COMPILE_SUCCESS=$?
-	local PKG_TIME_END=`date +%s`
-
-	if [ $COMPILE_SUCCESS -ne 0 ]; then
-		beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
-		exiterror "Building $*";
-	else
-		beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
-	fi
-
-	return 0
-}
-
-lfsmake2() {
-	lfsmakecommoncheck $*
-	[ $? == 1 ] && return 0
-
-	local PKG_TIME_START=`date +%s`
-	local PS1='\u:\w$ '
-
-	enterchroot \
-		bash -x -c "cd /usr/src/lfs && \
-			MAKETUNING=${MAKETUNING} \
-			make -f $* \
-			LFS_BASEDIR=/usr/src install" \
-		>> ${LOGFILE} 2>&1
-
-	local COMPILE_SUCCESS=$?
-	local PKG_TIME_END=`date +%s`
-
-	if [ $COMPILE_SUCCESS -ne 0 ]; then
-		beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
-		exiterror "Building $*";
-	else
-		beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
-	fi
-
-	return 0
-}
-
-ipfiredist() {
-	lfsmakecommoncheck $*
-	[ $? == 1 ] && return 0
-
-	local PKG_TIME_START=`date +%s`
-	local PS1='\u:\w$ '
-
-	enterchroot \
-		bash -x -c "cd /usr/src/lfs && make -f $* LFS_BASEDIR=/usr/src dist" \
-		>> ${LOGFILE} 2>&1
-
-	local COMPILE_SUCCESS=$?
-	local PKG_TIME_END=`date +%s`
-
-	if [ $COMPILE_SUCCESS -ne 0 ]; then
-		beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
-		exiterror "Packaging $*";
-	else
-		beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
-	fi
-	return 0
-}
-
-update_langs() {
-		echo -ne "Checking the translations for missing or obsolete strings..."
-		chmod 755 $BASEDIR/tools/{check_strings.pl,sort_strings.pl,check_langs.sh}
-		$BASEDIR/tools/sort_strings.pl en
-		$BASEDIR/tools/sort_strings.pl de
-		$BASEDIR/tools/sort_strings.pl fr
-		$BASEDIR/tools/sort_strings.pl es
-		$BASEDIR/tools/sort_strings.pl pl
-		$BASEDIR/tools/sort_strings.pl ru
-		$BASEDIR/tools/sort_strings.pl nl
-		$BASEDIR/tools/sort_strings.pl tr
-		$BASEDIR/tools/sort_strings.pl it
-		$BASEDIR/tools/check_strings.pl en > $BASEDIR/doc/language_issues.en
-		$BASEDIR/tools/check_strings.pl de > $BASEDIR/doc/language_issues.de
-		$BASEDIR/tools/check_strings.pl fr > $BASEDIR/doc/language_issues.fr
-		$BASEDIR/tools/check_strings.pl es > $BASEDIR/doc/language_issues.es
-		$BASEDIR/tools/check_strings.pl es > $BASEDIR/doc/language_issues.pl
-		$BASEDIR/tools/check_strings.pl ru > $BASEDIR/doc/language_issues.ru
-		$BASEDIR/tools/check_strings.pl nl > $BASEDIR/doc/language_issues.nl
-		$BASEDIR/tools/check_strings.pl tr > $BASEDIR/doc/language_issues.tr
-		$BASEDIR/tools/check_strings.pl it > $BASEDIR/doc/language_issues.it
-		$BASEDIR/tools/check_langs.sh > $BASEDIR/doc/language_missings
-		beautify message DONE
-
-		echo -ne "Updating language lists..."
-		update_language_list ${BASEDIR}/src/installer/po
-		update_language_list ${BASEDIR}/src/setup/po
-		beautify message DONE
-}
-
-update_language_list() {
-	local path="${1}"
-
-	local lang
-	for lang in ${path}/*.po; do
-		lang="$(basename "${lang}")"
-		echo "${lang%*.po}"
-	done | sort -u > "${path}/LINGUAS"
-}


hooks/post-receive
--
IPFire 2.x development tree

                 reply	other threads:[~2017-11-23 16:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171123160318.4DAE01081BCF@git01.ipfire.org \
    --to=git@ipfire.org \
    --cc=ipfire-scm@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox