diff mbox series

[6/7] tools: add 7z host package

Message ID 20220723205319.3326374-7-jan@3e8.eu
State Accepted
Delegated to: Daniel Golle
Headers show
Series realtek: add HPE 1920 support | expand

Commit Message

Jan Hoffmann July 23, 2022, 8:53 p.m. UTC
Add the 7zr command line tool, which is a version of the 7z application
that only supports 7z archives.

7z is one of the two compression formats supported in H3C firmware
images (the alternative would be ARJ).

(Alternatively, the 7zr command line tool could also be built from a
current version of the public-domain LZMA SDK. That would require
repackaging the source package, as it is only provided in 7z format.)

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
---
 tools/7z/Makefile | 36 ++++++++++++++++++++++++++++++++++++
 tools/Makefile    |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 tools/7z/Makefile

Comments

Sander Vanheule July 31, 2022, 1:36 p.m. UTC | #1
On Sat, 2022-07-23 at 22:53 +0200, Jan Hoffmann wrote:
> Add the 7zr command line tool, which is a version of the 7z application
> that only supports 7z archives.
> 
> 7z is one of the two compression formats supported in H3C firmware
> images (the alternative would be ARJ).
> 
> (Alternatively, the 7zr command line tool could also be built from a
> current version of the public-domain LZMA SDK. That would require
> repackaging the source package, as it is only provided in 7z format.)
> 
> Signed-off-by: Jan Hoffmann <jan@3e8.eu>

This caused builds to fail on systems with GCC 12 (Arch, Fedora 36).

Pushed out a fix by bumping the package to version 22.01 (released two weeks
ago) with commit 101190419969 ("tools: bump 7z package to 22.01"). Thanks to
Tomasz for pointing out that the latest version would fix the issue.

Best,
Sander
Daniel Golle July 31, 2022, 1:54 p.m. UTC | #2
On Sun, Jul 31, 2022 at 03:36:32PM +0200, Sander Vanheule wrote:
> On Sat, 2022-07-23 at 22:53 +0200, Jan Hoffmann wrote:
> > Add the 7zr command line tool, which is a version of the 7z application
> > that only supports 7z archives.
> > 
> > 7z is one of the two compression formats supported in H3C firmware
> > images (the alternative would be ARJ).
> > 
> > (Alternatively, the 7zr command line tool could also be built from a
> > current version of the public-domain LZMA SDK. That would require
> > repackaging the source package, as it is only provided in 7z format.)
> > 
> > Signed-off-by: Jan Hoffmann <jan@3e8.eu>
> 
> This caused builds to fail on systems with GCC 12 (Arch, Fedora 36).

Strange, I'm on archlinux with gcc 12.1.0 and it worked for me.
Maybe it only fails in silent mode when warnings are treated as errors?

Anyway, thanks for taking care of that!

> 
> Pushed out a fix by bumping the package to version 22.01 (released two weeks
> ago) with commit 101190419969 ("tools: bump 7z package to 22.01"). Thanks to
> Tomasz for pointing out that the latest version would fix the issue.
> 
> Best,
> Sander
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Luiz Angelo Daros de Luca Aug. 17, 2022, 9:04 p.m. UTC | #3
> On Sun, Jul 31, 2022 at 03:36:32PM +0200, Sander Vanheule wrote:
> > On Sat, 2022-07-23 at 22:53 +0200, Jan Hoffmann wrote:
> > > Add the 7zr command line tool, which is a version of the 7z application
> > > that only supports 7z archives.
> > >
> > > 7z is one of the two compression formats supported in H3C firmware
> > > images (the alternative would be ARJ).
> > >
> > > (Alternatively, the 7zr command line tool could also be built from a
> > > current version of the public-domain LZMA SDK. That would require
> > > repackaging the source package, as it is only provided in 7z format.)
> > >
> > > Signed-off-by: Jan Hoffmann <jan@3e8.eu>
> >
> > This caused builds to fail on systems with GCC 12 (Arch, Fedora 36).
>
> Strange, I'm on archlinux with gcc 12.1.0 and it worked for me.
> Maybe it only fails in silent mode when warnings are treated as errors?
>
> Anyway, thanks for taking care of that!

It seems the issue is back. Tested with OpenSUSE Tumbleweed 20220813,
gcc (SUSE Linux) 12.1.1 20220721 [revision
4f15d2234608e82159d030dadb17af678cfad626],
even with 7z 22.01 version:

cc x86_64     -O2 -c -Wall -Werror -Wextra  -DNDEBUG -D_REENTRANT
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -f
PIC  -o _o/7zStream.o ../../../../C/7zStream.c
cc: warning: x86_64: linker input file unused because linking not done
cc: error: x86_64: linker input file not found: No such file or directory
make[3]: *** [../../7zip_gcc.mak:1070: _o/7zStream.o] Error 1

Regards,

Luiz
diff mbox series

Patch

diff --git a/tools/7z/Makefile b/tools/7z/Makefile
new file mode 100644
index 000000000000..c94d746c6489
--- /dev/null
+++ b/tools/7z/Makefile
@@ -0,0 +1,36 @@ 
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=7z
+PKG_VERSION:=22.00
+PKG_SOURCE_VERSION:=2200
+
+PKG_SOURCE:=$(PKG_NAME)$(PKG_SOURCE_VERSION)-src.tar.xz
+PKG_SOURCE_URL:=https://7-zip.org/a/
+PKG_HASH:=40969f601e86aff49aaa0ba0df5ce6fd397cf7e2683a84b591b0081e461ef675
+
+# This builds the 7zr variant which supports only 7z, so no non-LGPL code should be included
+PKG_LICENSE:=LGPL-2.1-or-later
+PKG_LICENSE_FILES:=DOC/License.txt DOC/copying.txt
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/host-build.mk
+
+TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
+
+ALONE_DIR=$(HOST_BUILD_DIR)/CPP/7zip/Bundles/Alone7z
+
+define Host/Compile
+	$(MAKE) -C $(ALONE_DIR) -f makefile.gcc
+endef
+
+define Host/Install
+	$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
+	$(INSTALL_BIN) $(ALONE_DIR)/_o/7zr $(STAGING_DIR_HOST)/bin/7zr
+endef
+
+define Host/Clean
+	rm -f $(STAGING_DIR_HOST)/bin/7zr
+endef
+
+$(eval $(call HostBuild))
diff --git a/tools/Makefile b/tools/Makefile
index be1a23ed512f..0d6e675d4ceb 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -32,6 +32,7 @@  tools-$(BUILD_TOOLCHAIN) += expat gmp mpc mpfr
 tools-$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini) += genext2fs
 tools-$(CONFIG_TARGET_ath79) += lzma-old squashfs
 tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
+tools-$(CONFIG_TARGET_realtek) += 7z
 tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs
 tools-$(CONFIG_USES_MINOR) += kernel2minor
 tools-$(CONFIG_USE_SPARSE) += sparse