aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2018-04-15 19:24:02 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2018-04-28 15:28:59 +0200
commit8dcd941d8b934891676a8d4bbef1ee78e89a4bf7 (patch)
tree8889465aa25467269f09f9b39ef9e5fe5a519fa0 /tools
parentafdca53acee25f452bd2c405cb3943db34492585 (diff)
downloadupstream-8dcd941d8b934891676a8d4bbef1ee78e89a4bf7.tar.gz
upstream-8dcd941d8b934891676a8d4bbef1ee78e89a4bf7.tar.bz2
upstream-8dcd941d8b934891676a8d4bbef1ee78e89a4bf7.zip
tools/zlib: move zlib build to tools
This allows us to link the other tools against our libz and we do not need the system zlib any more. Only the static linked library is copied to the staging directory so we have a statically linked library on all systems and not only on Linux. This also adds the new dependencies of the packages which are depending on zlib. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile14
-rw-r--r--tools/lzma-old/Makefile2
-rw-r--r--tools/lzma-old/patches/120-add-cflags.patch11
-rw-r--r--tools/make-ext4fs/Makefile8
-rw-r--r--tools/make-ext4fs/patches/100-add-ldflags.patch11
-rw-r--r--tools/squashfs4/Makefile2
-rw-r--r--tools/zlib/Makefile41
7 files changed, 76 insertions, 13 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 50bd552d75..8dfab9892b 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -22,7 +22,7 @@ ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_b43legacy-firmwar
endif
tools-$(BUILD_TOOLCHAIN) += gmp mpfr mpc libelf expat
-tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs
+tools-y += m4 libtool autoconf automake flex bison pkg-config mklibs zlib
tools-y += sstrip make-ext4fs e2fsprogs mtd-utils mkimage
tools-y += firmware-utils patch-image quilt padjffs2
tools-y += mm-macros missing-macros cmake scons bc findutils gengetopt patchelf
@@ -43,16 +43,16 @@ $(curdir)/bison/compile := $(curdir)/flex/compile
$(curdir)/flex/compile := $(curdir)/libtool/compile
$(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
$(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
-$(curdir)/squashfs4/compile := $(curdir)/xz/compile
+$(curdir)/squashfs4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile
$(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile
$(curdir)/autoconf/compile := $(curdir)/m4/compile
$(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkg-config/compile $(curdir)/xz/compile
$(curdir)/gmp/compile := $(curdir)/libtool/compile
$(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile
$(curdir)/mpfr/compile := $(curdir)/gmp/compile
-$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile
+$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile
$(curdir)/mklibs/compile := $(curdir)/libtool/compile
-$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile
+$(curdir)/qemu/compile := $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile
$(curdir)/upslug2/compile := $(curdir)/libtool/compile
$(curdir)/mm-macros/compile := $(curdir)/libtool/compile
$(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
@@ -69,8 +69,12 @@ $(curdir)/patchelf/compile := $(curdir)/libtool/compile
$(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile
$(curdir)/libressl/compile := $(curdir)/pkg-config/compile
$(curdir)/mkimage/compile += $(curdir)/libressl/compile
-$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile
+$(curdir)/firmware-utils/compile += $(curdir)/libressl/compile $(curdir)/zlib/compile
$(curdir)/cmake/compile += $(curdir)/libressl/compile
+$(curdir)/zlib/compile := $(curdir)/cmake/compile
+$(curdir)/wrt350nv2-builder/compile := $(curdir)/zlib/compile
+$(curdir)/lzma-old/compile := $(curdir)/zlib/compile
+$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
ifneq ($(HOST_OS),Linux)
tools-y += coreutils
diff --git a/tools/lzma-old/Makefile b/tools/lzma-old/Makefile
index 5982eab5db..5204127a80 100644
--- a/tools/lzma-old/Makefile
+++ b/tools/lzma-old/Makefile
@@ -21,7 +21,9 @@ LIB_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Lib
ALONE_DIR=$(HOST_BUILD_DIR)/C/7zip/Compress/LZMA_Alone
define Host/Compile
+ +$(HOST_MAKE_VARS) \
$(MAKE) -C $(LIB_DIR)
+ +$(HOST_MAKE_VARS) \
$(MAKE) -f makefile.gcc -C $(ALONE_DIR)
endef
diff --git a/tools/lzma-old/patches/120-add-cflags.patch b/tools/lzma-old/patches/120-add-cflags.patch
new file mode 100644
index 0000000000..9022e7cd27
--- /dev/null
+++ b/tools/lzma-old/patches/120-add-cflags.patch
@@ -0,0 +1,11 @@
+--- a/C/7zip/Compress/LZMA_Lib/makefile
++++ b/C/7zip/Compress/LZMA_Lib/makefile
+@@ -2,7 +2,7 @@ PROG = liblzma.a
+ CXX = g++ -O3 -Wall
+ AR = ar
+ RM = rm -f
+-CFLAGS = -c -I ../../../
++CFLAGS += -c -I ../../../
+
+ OBJS = \
+ ZLib.o \
diff --git a/tools/make-ext4fs/Makefile b/tools/make-ext4fs/Makefile
index f140101c8e..97f9e6369c 100644
--- a/tools/make-ext4fs/Makefile
+++ b/tools/make-ext4fs/Makefile
@@ -17,13 +17,7 @@ PKG_MIRROR_HASH:=d7ccd5e426b1d15331ff000a37dc15161f6eef594453e970fd584fcde5a2507
include $(INCLUDE_DIR)/host-build.mk
-ifeq ($(HOST_OS),Linux)
- MAKE_STATIC := STATIC=1
-endif
-
-define Host/Compile
- $(MAKE) -C $(HOST_BUILD_DIR) make_ext4fs $(MAKE_STATIC)
-endef
+HOST_MAKE_FLAGS += STATIC=1
define Host/Install
$(INSTALL_BIN) $(HOST_BUILD_DIR)/make_ext4fs $(STAGING_DIR_HOST)/bin/
diff --git a/tools/make-ext4fs/patches/100-add-ldflags.patch b/tools/make-ext4fs/patches/100-add-ldflags.patch
new file mode 100644
index 0000000000..d9ce47bb80
--- /dev/null
+++ b/tools/make-ext4fs/patches/100-add-ldflags.patch
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -27,7 +27,7 @@ OBJ := \
+ $(CC) $(CFLAGS) -c -o $@ $^
+
+ make_ext4fs: $(OBJ) libsparse/libsparse.a
+- $(CC) -o $@ $^ $(ZLIB)
++ $(CC) $(LDFLAGS)-o $@ $^ $(ZLIB)
+
+ libsparse/libsparse.a:
+ $(MAKE) -C libsparse/ libsparse.a
diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile
index e9e2b7ca9a..409b1b5a23 100644
--- a/tools/squashfs4/Makefile
+++ b/tools/squashfs4/Makefile
@@ -20,8 +20,8 @@ HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/squashfs$(PKG_VERSION)
include $(INCLUDE_DIR)/host-build.mk
define Host/Compile
+ +$(HOST_MAKE_VARS) \
$(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \
- CC="$(HOSTCC)" \
XZ_SUPPORT=1 \
LZMA_XZ_SUPPORT=1 \
XATTR_SUPPORT= \
diff --git a/tools/zlib/Makefile b/tools/zlib/Makefile
new file mode 100644
index 0000000000..279851f758
--- /dev/null
+++ b/tools/zlib/Makefile
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2006-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=zlib
+PKG_VERSION:=1.2.11
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@SF/libpng http://www.zlib.net
+PKG_HASH:=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
+
+PKG_LICENSE:=Zlib
+PKG_LICENSE_FILES:=README
+PKG_CPE_ID:=cpe:/a:gnu:zlib
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+HOST_CFLAGS +=-fPIC
+
+define Host/Install
+ $(CP) $(HOST_BUILD_DIR)/libz.a $(STAGING_DIR_HOST)/lib/
+ $(CP) $(HOST_BUILD_DIR)/zconf.h $(STAGING_DIR_HOST)/include/
+ $(CP) $(HOST_BUILD_DIR)/zlib.h $(STAGING_DIR_HOST)/include/
+ $(CP) $(HOST_BUILD_DIR)/zlib.pc $(STAGING_DIR_HOST)/lib/pkgconfig/
+endef
+
+define Host/Clean
+ rm -f $(STAGING_DIR_HOST)/lib/libz.a
+ rm -f $(STAGING_DIR_HOST)/include/zconf.h
+ rm -f $(STAGING_DIR_HOST)/include/zlib.h
+ rm -f $(STAGING_DIR_HOST)/lib/pkgconfig//zlib.pc
+endef
+
+$(eval $(call HostBuild))