Merge lp:~qcumber-some/widelands/minizip into lp:widelands

Proposed by Jens Beyer
Status: Merged
Merged at revision: 6389
Proposed branch: lp:~qcumber-some/widelands/minizip
Merge into: lp:widelands
Diff against target: 123 lines (+61/-2)
6 files modified
CMakeLists.txt (+6/-0)
cmake/Modules/FindMinizip.cmake (+37/-0)
src/CMakeLists.txt (+8/-0)
src/io/filesystem/zip_filesystem.h (+2/-2)
src/minizip/CMakeLists.txt (+3/-0)
src/minizip/README.txt (+5/-0)
To merge this branch: bzr merge lp:~qcumber-some/widelands/minizip
Reviewer Review Type Date Requested Status
Jens Beyer Needs Resubmitting
Review via email: mp+101180@code.launchpad.net

Description of the change

Try to detect Minizip library, if found use this one, if not, issue a warning in CMake run and include the widelands shipped ones (no source changes there).

To post a comment you must log in.
Revision history for this message
Jens Beyer (qcumber-some) wrote :

I updated this branch from trunk to get rid of the conflicts.
Please re-evaluate :-)

review: Needs Resubmitting
Revision history for this message
Jens Beyer (qcumber-some) wrote :

Gentoo now bundles zlib-1.2.5 with minizip library, so this might als be validated by someone with a stable Gentoo system :-)

Revision history for this message
Peter Waller (peter.waller) wrote :

As requested, tested working ingame with zlib-1.2.5 on an x86_64 Gentoo system, with and without minizip enabled.

I get the warning when minizip is disabled, as expected.

Revision history for this message
SirVer (sirver) wrote :

Jens, can we not go ahead and merge this now?

Revision history for this message
Jens Beyer (qcumber-some) wrote :

Well...
It works on my system (Gentoo 32bit with zlib-1.2.6), and it works on Peter's system (Gentoo 64bit with zlib-1.2.5) with and without minizip. Nobody else mentioned if it works or not.

I'm not sure if that's enough for a merge...

We could merge this and wait for bugs stating "I have minizip installed but CMake says I don't". Not finding minizip will result in a statically linked minizip library out of the same sources we used up to now, so this should be pretty harmless...

Your choice :-)

Revision history for this message
SirVer (sirver) wrote :

>Your choice :-)
I'd say, merge and wait for crying people to complain ;). Could you do
it?

Revision history for this message
Jens Beyer (qcumber-some) wrote :

Merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2012-05-05 11:32:38 +0000
3+++ CMakeLists.txt 2012-05-05 19:52:19 +0000
4@@ -391,6 +391,12 @@
5 find_package(ZLIB REQUIRED)
6 include_directories(${ZLIB_INCLUDE_DIR})
7
8+# Check if we have a working minizip library
9+find_package(Minizip)
10+if (MINIZIP_FOUND)
11+ include_directories(${MINIZIP_INCLUDE_DIR})
12+endif (MINIZIP_FOUND)
13+
14 if (APPLE OR WIN32)
15 find_package(intl REQUIRED)
16 include_directories(${INTL_INCLUDE_DIR})
17
18=== added file 'cmake/Modules/FindMinizip.cmake'
19--- cmake/Modules/FindMinizip.cmake 1970-01-01 00:00:00 +0000
20+++ cmake/Modules/FindMinizip.cmake 2012-05-05 19:52:19 +0000
21@@ -0,0 +1,37 @@
22+# - Try to find Minizip
23+# Once done this will define
24+#
25+# MINIZIP_FOUND - system has MINIZIP
26+# MINIZIP_INCLUDE_DIR - the MINIZIP include directory
27+# MINIZIP_LIBRARY_DIR - where the libraries are
28+# MINIZIP_LIBRARY - Link these to use MINIZIP
29+#
30+
31+IF (MINIZIP_INCLUDE_DIR)
32+ # Already in cache, be silent
33+ SET(MINIZIP_FIND_QUIETLY TRUE)
34+ENDIF (MINIZIP_INCLUDE_DIR)
35+
36+FIND_PATH( MINIZIP_INCLUDE_DIR
37+ NAMES zip.h unzip.h ioapi.h
38+ PATHS /usr/local/include /usr/include
39+ PATH_SUFFIXES minizip/ )
40+SET( MINIZIP_NAMES minizip MINIZIP )
41+FIND_LIBRARY( MINIZIP_LIBRARY
42+ NAMES ${MINIZIP_NAMES}
43+ PATHS /usr/lib /usr/local/lib )
44+
45+GET_FILENAME_COMPONENT( MINIZIP_LIBRARY_DIR ${MINIZIP_LIBRARY} PATH )
46+
47+IF (MINIZIP_INCLUDE_DIR AND MINIZIP_LIBRARY)
48+ SET(MINIZIP_FOUND TRUE)
49+ SET(MINIZIP_LIBRARY_DIR ${MINIZIP_LIBRARY} )
50+ IF (NOT MINIZIP_FIND_QUIETLY)
51+ MESSAGE (STATUS "Found Minizip: ${MINIZIP_LIBRARY} ${MINIZIP_INCLUDE_DIR}")
52+ ENDIF (NOT MINIZIP_FIND_QUIETLY)
53+ELSE (MINIZIP_INCLUDE_DIR AND MINIZIP_LIBRARY)
54+ SET( MINIZIP_FOUND FALSE )
55+ SET( MINIZIP_LIBRARY_DIR )
56+ SET( MINIZIP_EXTRA_DEFINITIONS )
57+ENDIF (MINIZIP_INCLUDE_DIR AND MINIZIP_LIBRARY)
58+
59
60=== modified file 'src/CMakeLists.txt' (properties changed: +x to -x)
61--- src/CMakeLists.txt 2012-05-05 11:31:13 +0000
62+++ src/CMakeLists.txt 2012-05-05 19:52:19 +0000
63@@ -98,6 +98,11 @@
64 add_subdirectory(scripting)
65 endif (WL_UNIT_TESTS)
66
67+if (NOT MINIZIP_FOUND)
68+ add_subdirectory(minizip)
69+ target_link_libraries(widelands_all wl_minizip)
70+endif (NOT MINIZIP_FOUND)
71+
72 target_link_libraries(widelands_all ${SDLIMAGE_LIBRARY})
73 target_link_libraries(widelands_all ${SDLMIXER_LIBRARY})
74 target_link_libraries(widelands_all ${SDLNET_LIBRARY})
75@@ -109,6 +114,9 @@
76 target_link_libraries(widelands_all ${OPENGL_gl_LIBRARY})
77 target_link_libraries(widelands_all ${GLEW_LIBRARY})
78 target_link_libraries(widelands_all ${Boost_SIGNALS_LIBRARY})
79+if (MINIZIP_FOUND)
80+ target_link_libraries(widelands_all ${MINIZIP_LIBRARY})
81+endif (MINIZIP_FOUND)
82 if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
83 target_link_libraries(widelands_all ${EXECINFO_LIBRARY})
84 endif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
85
86=== modified file 'src/io/filesystem/zip_filesystem.h'
87--- src/io/filesystem/zip_filesystem.h 2012-04-28 17:43:58 +0000
88+++ src/io/filesystem/zip_filesystem.h 2012-05-05 19:52:19 +0000
89@@ -21,8 +21,8 @@
90 #define ZIP_FILESYSTEM_H
91
92 #include "filesystem.h"
93-#include "unzip.h"
94-#include "zip.h"
95+#include <minizip/unzip.h>
96+#include <minizip/zip.h>
97
98 #include <string>
99 #include <cstring>
100
101=== added directory 'src/minizip'
102=== added file 'src/minizip/CMakeLists.txt'
103--- src/minizip/CMakeLists.txt 1970-01-01 00:00:00 +0000
104+++ src/minizip/CMakeLists.txt 2012-05-05 19:52:19 +0000
105@@ -0,0 +1,3 @@
106+add_library(wl_minizip STATIC EXCLUDE_FROM_ALL "unzip.cc")
107+
108+message(WARNING "You are using widelands-bundled minizip sources. Please install your distribution's minizip library or urge your distribution maintainer to include the minizip library in your package repository. Thank you.")
109
110=== added file 'src/minizip/README.txt'
111--- src/minizip/README.txt 1970-01-01 00:00:00 +0000
112+++ src/minizip/README.txt 2012-05-05 19:52:19 +0000
113@@ -0,0 +1,5 @@
114+The files in this directory are either original or derived sources from zlib's minizip examples.
115+
116+The sources are only included in Widelands if you don't have Minizip installed.
117+Please install your distribution's minizip library or urge your distribution maintainer
118+to include the minizip library in your package repository. Thank you.
119
120=== renamed file 'src/io/filesystem/ioapi.h' => 'src/minizip/ioapi.h'
121=== renamed file 'src/io/filesystem/unzip.cc' => 'src/minizip/unzip.cc'
122=== renamed file 'src/io/filesystem/unzip.h' => 'src/minizip/unzip.h'
123=== renamed file 'src/io/filesystem/zip.h' => 'src/minizip/zip.h'

Subscribers

People subscribed via source and target branches

to status/vote changes: