public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH] zlib-ng: Migrate to zlib-ng
Date: Fri, 03 Jan 2025 10:39:28 +0000	[thread overview]
Message-ID: <20250103103928.3792391-1-michael.tremer@ipfire.org> (raw)

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

This is a new and improved version of zlib that merges various fixes and
optimizations from various contributors.

Amonst those are taking advantage of AVX and instruction sets if they
are available.

This patch adds the new API and a compat library that is a drop-in
replacement for the legacy version of zlib.

Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
---
 config/rootfiles/common/zlib    |  9 -------
 config/rootfiles/common/zlib-ng | 17 +++++++++++++
 lfs/{zlib => zlib-ng}           | 42 ++++++++++++++++++---------------
 make.sh                         |  4 ++--
 4 files changed, 42 insertions(+), 30 deletions(-)
 delete mode 100644 config/rootfiles/common/zlib
 create mode 100644 config/rootfiles/common/zlib-ng
 rename lfs/{zlib => zlib-ng} (80%)

diff --git a/config/rootfiles/common/zlib b/config/rootfiles/common/zlib
deleted file mode 100644
index ae2bd9e85..000000000
--- a/config/rootfiles/common/zlib
+++ /dev/null
@@ -1,9 +0,0 @@
-lib/libz.so
-lib/libz.so.1
-lib/libz.so.1.3.1
-#usr/include/zconf.h
-#usr/include/zlib.h
-#usr/lib/libz.a
-#usr/lib/pkgconfig
-#usr/lib/pkgconfig/zlib.pc
-#usr/share/man/man3/zlib.3
diff --git a/config/rootfiles/common/zlib-ng b/config/rootfiles/common/zlib-ng
new file mode 100644
index 000000000..0e6cf18c5
--- /dev/null
+++ b/config/rootfiles/common/zlib-ng
@@ -0,0 +1,17 @@
+#usr/include/zconf-ng.h
+#usr/include/zconf.h
+#usr/include/zlib-ng.h
+#usr/include/zlib.h
+#usr/include/zlib_name_mangling-ng.h
+#usr/include/zlib_name_mangling.h
+#usr/lib/libz-ng.a
+#usr/lib/libz-ng.so
+usr/lib/libz-ng.so.2
+usr/lib/libz-ng.so.2.2.3
+#usr/lib/libz.a
+#usr/lib/libz.so
+usr/lib/libz.so.1
+usr/lib/libz.so.1.3.1.zlib-ng
+#usr/lib/pkgconfig
+#usr/lib/pkgconfig/zlib-ng.pc
+#usr/lib/pkgconfig/zlib.pc
diff --git a/lfs/zlib b/lfs/zlib-ng
similarity index 80%
rename from lfs/zlib
rename to lfs/zlib-ng
index d7c723914..5310c6051 100644
--- a/lfs/zlib
+++ b/lfs/zlib-ng
@@ -24,30 +24,28 @@
 
 include Config
 
-VER        = 1.3.1
+VER        = 2.2.3
 
-THISAPP    = zlib-$(VER)
-DL_FILE    = $(THISAPP).tar.xz
+THISAPP    = zlib-ng-$(VER)
+DL_FILE    = $(THISAPP).tar.gz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
 ifeq "$(TOOLCHAIN)" "1"
   TARGET = $(DIR_INFO)/$(THISAPP)-tools
-  CROSS_PREFIX = $(CROSSTARGET)-
 else
   TARGET = $(DIR_INFO)/$(THISAPP)
 endif
 
-CFLAGS    += -fPIC -DPIC
-
 ###############################################################################
 # Top-level Rules
 ###############################################################################
+
 objects = $(DL_FILE)
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
 
-$(DL_FILE)_BLAKE2 = 42d109223801a493de6d52e7343403d7fc3234a6ca816425fe41ac9c18019b01b93841acd28a235e99f2256a6a17f93624e96b2ddb58d588c8190a6bedb82910
+$(DL_FILE)_BLAKE2 = 65cd976d559dcc31f34861a01b2eb0ce0439dd6412553a5a9842d2d937d4a0d1194aec98f478f5def4a0401e65a7c97b6843122bae49a35f96c7e2c59e79cc64
 
 install : $(TARGET)
 
@@ -77,18 +75,24 @@ $(subst %,%_BLAKE2,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
-	
-	cd $(DIR_APP) && CROSS_PREFIX=$(CROSS_PREFIX) ./configure --prefix=$(PREFIX) --shared
-	cd $(DIR_APP) && make $(MAKETUNING)
-	cd $(DIR_APP) && make install
-
-ifneq "$(TOOLCHAIN)" "1"
-	mv -v /usr/lib/libz.so.$(VER) /lib/libz.so.$(VER)
-	ln -svf libz.so.$(VER) /lib/libz.so.1
-	ln -svf libz.so.$(VER) /lib/libz.so
-	rm -vf /usr/lib/libz.so.1
-	rm -vf /usr/lib/libz.so
-endif
+
+	# Build the regular version
+	cd $(DIR_APP) && mkdir -pv build
+	cd $(DIR_APP)/build && ../configure \
+		--prefix=$(PREFIX)
+	cd $(DIR_APP)/build && make $(MAKETUNING) VERBOSE=1
+
+	# Build the compat version
+	cd $(DIR_APP) && mkdir -pv compat
+	cd $(DIR_APP)/compat && ../configure \
+		--prefix=$(PREFIX) \
+		--zlib-compat \
+		--without-new-strategies
+	cd $(DIR_APP)/compat && make $(MAKETUNING) VERBOSE=1
+
+	# Install both versions
+	cd $(DIR_APP)/build  && make install
+	cd $(DIR_APP)/compat && make install
 
 	@rm -rf $(DIR_APP)
 	@$(POSTBUILD)
diff --git a/make.sh b/make.sh
index 41bb1ea93..e4c526be6 100755
--- a/make.sh
+++ b/make.sh
@@ -1363,7 +1363,7 @@ build_toolchain() {
 	lfsmake1 glibc
 	lfsmake1 libxcrypt
 	lfsmake1 gcc			PASS=L
-	lfsmake1 zlib
+	lfsmake1 zlib-ng
 	lfsmake1 binutils			PASS=2
 	lfsmake1 gcc			PASS=2
 	lfsmake1 zstd
@@ -1408,7 +1408,7 @@ build_system() {
 	lfsmake2 glibc
 	lfsmake2 tzdata
 	lfsmake2 cleanup-toolchain
-	lfsmake2 zlib
+	lfsmake2 zlib-ng
 	[ "${BUILD_ARCH}" = "riscv64" ] && lfsmake2 gcc PASS=A
 	lfsmake2 zstd
 	lfsmake2 autoconf
-- 
2.39.5


                 reply	other threads:[~2025-01-03 10:39 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=20250103103928.3792391-1-michael.tremer@ipfire.org \
    --to=michael.tremer@ipfire.org \
    --cc=development@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