1*4882a593SmuzhiyunFrom 992a497e9c5c421d3931e02a01e9d7c159f27135 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Luca Ceresoli <luca@lucaceresoli.net>
3*4882a593SmuzhiyunDate: Thu, 26 Nov 2015 12:49:10 +0100
4*4882a593SmuzhiyunSubject: [PATCH] Add a CMakeFile.txt to ease cross-compilation
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunInfo-ZIP's UnZip 6.0 has a complex, hand-crafted Makefile with a
7*4882a593Smuzhiyuncompanion configure script which try to support an extremely wide
8*4882a593Smuzhiyunrange of UNIX-like operating systems. The result is an overly complex
9*4882a593Smuzhiyunmass of code that does not support cross-compilation in several ways.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunZip 3.0 has a similar build system, and has as many as 6 patches in
12*4882a593SmuzhiyunBuildroot to cross-compile [0]. UnZip fails at building even with
13*4882a593Smuzhiyunthese patches adapted and a few more on top of them.
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunInstead of tweaking and fixing a huge and complex build system, skip
16*4882a593Smuzhiyunit entirely and add a pretty simple CMakeLists.txt that cross-compiles
17*4882a593Smuzhiyunsmoothly using CMake. It also preserves all of the Buildroot-provided
18*4882a593Smuzhiyunbuild options and flags as the original Makefile does.
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun[0] http://git.buildroot.net/buildroot/tree/package/infozip?id=2015.11-rc3
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunSigned-off-by: Luca Ceresoli <luca@lucaceresoli.net>
23*4882a593Smuzhiyun---
24*4882a593Smuzhiyun CMakeLists.txt | 17 +++++++++++++++++
25*4882a593Smuzhiyun 1 file changed, 17 insertions(+)
26*4882a593Smuzhiyun create mode 100644 CMakeLists.txt
27*4882a593Smuzhiyun
28*4882a593Smuzhiyundiff --git a/CMakeLists.txt b/CMakeLists.txt
29*4882a593Smuzhiyunnew file mode 100644
30*4882a593Smuzhiyunindex 0000000..27951b4
31*4882a593Smuzhiyun--- /dev/null
32*4882a593Smuzhiyun+++ b/CMakeLists.txt
33*4882a593Smuzhiyun@@ -0,0 +1,17 @@
34*4882a593Smuzhiyun+cmake_minimum_required(VERSION 2.8)
35*4882a593Smuzhiyun+INCLUDE(CheckFunctionExists)
36*4882a593Smuzhiyun+
37*4882a593Smuzhiyun+project(unzip C)
38*4882a593Smuzhiyun+
39*4882a593Smuzhiyun+CHECK_FUNCTION_EXISTS(lchmod HAVE_LCHMOD)
40*4882a593Smuzhiyun+if(NOT HAVE_LCHMOD)
41*4882a593Smuzhiyun+add_definitions("-DNO_LCHMOD")
42*4882a593Smuzhiyun+endif()
43*4882a593Smuzhiyun+
44*4882a593Smuzhiyun+set(UNZIP_SOURCES unzip.c crc32.c crypt.c envargs.c explode.c
45*4882a593Smuzhiyun+  extract.c fileio.c globals.c inflate.c list.c match.c process.c
46*4882a593Smuzhiyun+  ttyio.c ubz2err.c unreduce.c unshrink.c zipinfo.c unix/unix.c)
47*4882a593Smuzhiyun+
48*4882a593Smuzhiyun+include_directories(.)
49*4882a593Smuzhiyun+add_executable(unzip ${UNZIP_SOURCES})
50*4882a593Smuzhiyun+install(TARGETS unzip DESTINATION bin)
51*4882a593Smuzhiyun--
52*4882a593Smuzhiyun1.9.1
53*4882a593Smuzhiyun
54