From patchwork Fri Jan 3 10:39:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 8377 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4YPg7D06zKz3x5M for ; Fri, 3 Jan 2025 10:39:36 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4YPg792Ldjz12m; Fri, 3 Jan 2025 10:39:33 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4YPg790jTvz345s; Fri, 3 Jan 2025 10:39:33 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4YPg763wbnz2y1F for ; Fri, 3 Jan 2025 10:39:30 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "michael.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4YPg760Kpmzys; Fri, 3 Jan 2025 10:39:30 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4YPg7565NLzTjf2; Fri, 3 Jan 2025 10:39:29 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH] zlib-ng: Migrate to zlib-ng Date: Fri, 3 Jan 2025 10:39:28 +0000 Message-Id: <20250103103928.3792391-1-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Message-ID-Hash: 3IHDJFDZX4J4S6PL5E33CCDHRNQCKTDX X-Message-ID-Hash: 3IHDJFDZX4J4S6PL5E33CCDHRNQCKTDX X-MailFrom: root@michael.haj.ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Michael Tremer X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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