Re: [LEDE-DEV] [PATCH v2 1/5] tools/zlib: move zlib build to tools

2018-04-22 Thread Hauke Mehrtens
On 04/20/2018 12:12 AM, Hauke Mehrtens wrote:
> 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 
> ---
> 
> changes since v1:
> * add HOST_CFLAGS +=-fPIC
> 
>  include/prereq-build.mk |  5 ---
>  package/libs/zlib/Makefile  |  2 --
>  tools/Makefile  | 14 ++---
>  tools/lzma-old/Makefile |  2 ++
>  tools/lzma-old/patches/120-add-cflags.patch | 11 +++
>  tools/make-ext4fs/Makefile  |  8 +
>  tools/make-ext4fs/patches/100-add-ldflags.patch | 11 +++
>  tools/squashfs4/Makefile|  2 +-
>  tools/zlib/Makefile | 41 
> +
>  9 files changed, 76 insertions(+), 20 deletions(-)
>  create mode 100644 tools/lzma-old/patches/120-add-cflags.patch
>  create mode 100644 tools/make-ext4fs/patches/100-add-ldflags.patch
>  create mode 100644 tools/zlib/Makefile
> 
> diff --git a/include/prereq-build.mk b/include/prereq-build.mk
> index 6917716342..5b9a7e049d 100644
> --- a/include/prereq-build.mk
> +++ b/include/prereq-build.mk
> @@ -76,11 +76,6 @@ else
>zlib_link_flags := -lz
>  endif
>  
> -$(eval $(call TestHostCommand,zlib, \
> - Please install a static zlib. (Missing libz.a or zlib.h), \
> - echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' 
> | \
> - gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - 
> $(zlib_link_flags)))
> -
>  $(eval $(call TestHostCommand,perl-thread-queue, \
>   Please install the Perl Thread::Queue module, \
>   perl -MThread::Queue -e 1))
> diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile
> index a7c61f7dd0..4a2a0e53b0 100644
> --- a/package/libs/zlib/Makefile
> +++ b/package/libs/zlib/Makefile
> @@ -21,7 +21,6 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
>  
>  PKG_CONFIG_DEPENDS:= CONFIG_ZLIB_OPTIMIZE_SPEED
>  
> -include $(INCLUDE_DIR)/host-build.mk
>  include $(INCLUDE_DIR)/package.mk
>  include $(INCLUDE_DIR)/cmake.mk
>  
> @@ -95,6 +94,5 @@ define Package/zlib-dev/install
> $(1)/usr/lib/pkgconfig/
>  endef
>  
> -$(eval $(call HostBuild))
>  $(eval $(call BuildPackage,zlib))
>  $(eval $(call BuildPackage,zlib-dev))
> 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
> 

Re: [LEDE-DEV] [PATCH v2 1/5] tools/zlib: move zlib build to tools

2018-04-21 Thread Koen Vandeputte

Tested-by: Koen Vandeputte 


Tested on imx6, also using the imagebuilder afterwards.



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH v2 1/5] tools/zlib: move zlib build to tools

2018-04-19 Thread Hauke Mehrtens
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 
---

changes since v1:
* add HOST_CFLAGS +=-fPIC

 include/prereq-build.mk |  5 ---
 package/libs/zlib/Makefile  |  2 --
 tools/Makefile  | 14 ++---
 tools/lzma-old/Makefile |  2 ++
 tools/lzma-old/patches/120-add-cflags.patch | 11 +++
 tools/make-ext4fs/Makefile  |  8 +
 tools/make-ext4fs/patches/100-add-ldflags.patch | 11 +++
 tools/squashfs4/Makefile|  2 +-
 tools/zlib/Makefile | 41 +
 9 files changed, 76 insertions(+), 20 deletions(-)
 create mode 100644 tools/lzma-old/patches/120-add-cflags.patch
 create mode 100644 tools/make-ext4fs/patches/100-add-ldflags.patch
 create mode 100644 tools/zlib/Makefile

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 6917716342..5b9a7e049d 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -76,11 +76,6 @@ else
   zlib_link_flags := -lz
 endif
 
-$(eval $(call TestHostCommand,zlib, \
-   Please install a static zlib. (Missing libz.a or zlib.h), \
-   echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' 
| \
-   gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - 
$(zlib_link_flags)))
-
 $(eval $(call TestHostCommand,perl-thread-queue, \
Please install the Perl Thread::Queue module, \
perl -MThread::Queue -e 1))
diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile
index a7c61f7dd0..4a2a0e53b0 100644
--- a/package/libs/zlib/Makefile
+++ b/package/libs/zlib/Makefile
@@ -21,7 +21,6 @@ PKG_CPE_ID:=cpe:/a:gnu:zlib
 
 PKG_CONFIG_DEPENDS:= CONFIG_ZLIB_OPTIMIZE_SPEED
 
-include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/cmake.mk
 
@@ -95,6 +94,5 @@ define Package/zlib-dev/install
  $(1)/usr/lib/pkgconfig/
 endef
 
-$(eval $(call HostBuild))
 $(eval $(call BuildPackage,zlib))
 $(eval $(call BuildPackage,zlib-dev))
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