0001-Add-a-CMakeFile.txt-to-ease-cross-compilation.patch 1.8 KB

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