Files
buildroot/package/unzip/0101-Add-a-CMakeFile.txt-to-ease-cross-compilation.patch
Thomas Perale fb8958e3dc package/unzip: import patches from Debian
In Buildroot there are multiple way to apply patches on a package [1]

- Adding `.patch` file in the package directory.
- Define `<pkg>_PATCH` variable with the location of the patch tar.gz.
  It used to download Debian patches tarball.
- Implement custom patching logic with `PRE`/`POST` patches hooks.

To make the CycloneDX SBOM generation not dependant on downloading the
packages, the two last options have the downside of not appearing on the
generated SBOM.

The unzip package is downloading a tarball from the Debian mirror with
the `<pkg>_PATCH` method [2].

To improve the tracking of the patched vulnerabilities for the unzip
package this commit import the patches previously downloaded with the
`_PATCH` variable in the Buildroot tree.
This allows to add the `CVE:` trailer [3] on the patches that fix
vulnerabilities to better track which patch is fixing the vulnerability.

[1] https://buildroot.org/downloads/manual/manual.html#patch-policy
[2] https://snapshot.debian.org/archive/debian/20250311T215724Z/pool/main/u/unzip/unzip_6.0-29.debian.tar.xz
[3] 1167d0ff3d docs/manual: mention CVE trailer

Signed-off-by: Thomas Perale <thomas.perale@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2026-05-29 11:15:30 +02:00

55 lines
1.8 KiB
Diff

From 992a497e9c5c421d3931e02a01e9d7c159f27135 Mon Sep 17 00:00:00 2001
From: Luca Ceresoli <luca@lucaceresoli.net>
Date: Thu, 26 Nov 2015 12:49:10 +0100
Subject: [PATCH] Add a CMakeFile.txt to ease cross-compilation
Info-ZIP's UnZip 6.0 has a complex, hand-crafted Makefile with a
companion configure script which try to support an extremely wide
range of UNIX-like operating systems. The result is an overly complex
mass of code that does not support cross-compilation in several ways.
Zip 3.0 has a similar build system, and has as many as 6 patches in
Buildroot to cross-compile [0]. UnZip fails at building even with
these patches adapted and a few more on top of them.
Instead of tweaking and fixing a huge and complex build system, skip
it entirely and add a pretty simple CMakeLists.txt that cross-compiles
smoothly using CMake. It also preserves all of the Buildroot-provided
build options and flags as the original Makefile does.
[0] http://git.buildroot.net/buildroot/tree/package/infozip?id=2015.11-rc3
Upstream: N/A
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
---
CMakeLists.txt | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
create mode 100644 CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..27951b4
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.5)
+INCLUDE(CheckFunctionExists)
+
+project(unzip C)
+
+CHECK_FUNCTION_EXISTS(lchmod HAVE_LCHMOD)
+if(NOT HAVE_LCHMOD)
+add_definitions("-DNO_LCHMOD")
+endif()
+
+set(UNZIP_SOURCES unzip.c crc32.c crypt.c envargs.c explode.c
+ extract.c fileio.c globals.c inflate.c list.c match.c process.c
+ ttyio.c ubz2err.c unreduce.c unshrink.c zipinfo.c unix/unix.c)
+
+include_directories(.)
+add_executable(unzip ${UNZIP_SOURCES})
+install(TARGETS unzip DESTINATION bin)
--
1.9.1