Merge lp:~linuxjedi/mydumper/mydumper-cmake into lp:~mydumper/mydumper/trunk
- mydumper-cmake
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~linuxjedi/mydumper/mydumper-cmake |
Merge into: | lp:~mydumper/mydumper/trunk |
Diff against target: |
297 lines (+187/-50) 8 files modified
CMakeLists.txt (+31/-0) Makefile (+0/-48) README (+1/-0) cmake/modules/FindGLIB2.cmake (+22/-0) cmake/modules/FindMySQL.cmake (+81/-0) cmake/modules/FindPCRE.cmake (+45/-0) config.h.in (+6/-0) mydumper.c (+1/-2) |
To merge this branch: | bzr merge lp:~linuxjedi/mydumper/mydumper-cmake |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Leith | Approve | ||
Andrew Hutchings | Pending | ||
Review via email: mp+21900@code.launchpad.net |
This proposal supersedes a proposal from 2010-03-21.
Commit message
Description of the change
Build using CMAKE, checks required dependencies first
Moved version number to CMakeLists.txt which gets added to mydumper.c via config.h
Lenz Grimmer (lenzgr) wrote : Posted in a previous version of this proposal | # |
Andrew Hutchings (linuxjedi) wrote : Posted in a previous version of this proposal | # |
Hey Lenz,
> Good idea, my Makefile improvements were a bit hacky anyway :)
Thanks :)
Your Makefile improvements were really necessary and gave me the idea to do this :) I thought it would be a good idea so that we can keep things simple as the code gets more features and users should have an easier time building.
Lenz Grimmer (lenzgr) wrote : Posted in a previous version of this proposal | # |
Hi,
On 03/22/2010 04:33 PM, LinuxJedi wrote:
> Your Makefile improvements were really necessary and gave me the idea to do
> this :) I thought it would be a good idea so that we can keep things
> simple as the code gets more features and users should have an easier time
> building.
Good idea.
I tested your changes and noticed some warnings when running "cmake ." on my
openSUSE system (cmake version 2.6-patch 4):
lenz@thebe:
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found MySQL: /usr/include/mysql, /usr/lib/
-- WARNING: you are using the obsolete 'PKGCONFIG' macro use FindPkgConfig
-- WARNING: you are using the obsolete 'PKGCONFIG' macro use FindPkgConfig
-- Found GLIB2: /usr/lib/
-- checking for modules 'QUIET;libpcre'
-- package 'QUIET' not found
-- Found PCRE: /usr/include
-- Configuring done
-- Generating done
-- Build files have been written to:
/home/lenz/
(Not sure if they are urgent to fix, though)
Bye,
LenZ
--
Lenz Grimmer <email address hidden> - http://
Lenz Grimmer (lenzgr) wrote : Posted in a previous version of this proposal | # |
Hi,
On 03/22/2010 04:57 PM, LenZ wrote:
> On 03/22/2010 04:33 PM, LinuxJedi wrote:
>
>> Your Makefile improvements were really necessary and gave me the idea to do
>> this :) I thought it would be a good idea so that we can keep things
>> simple as the code gets more features and users should have an easier time
>> building.
>
> I tested your changes and noticed some warnings when running "cmake ." on my
> openSUSE system (cmake version 2.6-patch 4):
Also, "make install" currently uses a strange default path
(/usr/local/
/usr/local/bin instead.
Also, where's my "make dist" target? :)
To my knowledge, CMake provides a built-in packaging mechanism:
http://
Bye,
LenZ
--
Lenz Grimmer <email address hidden> - http://
Andrew Hutchings (linuxjedi) wrote : Posted in a previous version of this proposal | # |
I was aware of the deprecation warning, but not of CPack (which looks really cool). I'll sort that out tonight and re-propose the merge.
Andrew Hutchings (linuxjedi) wrote : Posted in a previous version of this proposal | # |
Need to fix due to Lenz's commens
Lenz Grimmer (lenzgr) wrote : Posted in a previous version of this proposal | # |
Hi,
On 03/22/2010 05:19 PM, LinuxJedi wrote:
> I was aware of the deprecation warning, but not of CPack (which looks
> really cool).
Yes, it looks like it will come in handy for building binary distributions.
> I'll sort that out tonight and re-propose the merge.
I've committed a fix for the "make dist" stuff (not using CPack, as it's quite
clumsy to use):
bzr+ssh:
Bye,
LenZ
--
Lenz Grimmer <email address hidden> - http://
Andrew Hutchings (linuxjedi) wrote : | # |
Resubmitted branch:
1. Merged in LenZ's fixes
2. Fixed deprecation warnings in the GLIB2 search
3. Fixed bug in PCRE search
Note: we can set required versions of these libraries really easily in this now. Not sure if we have a required minimum version of libs yet.
Leith (mleith) wrote : | # |
This doesn't seem to work for me on OSX:
Cerberus:
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found MySQL: /usr/local/
-- checking for one of the modules 'glib-2.0'
-- found glib-2.0, version 2.20.2
-- checking for one of the modules 'gthread-2.0'
-- found gthread-2.0, version 2.20.2
-- checking for module 'libpcre'
-- found libpcre, version 7.9
-- Found PCRE: /opt/local/include
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/
Cerberus:
Scanning dependencies of target mydumper
[100%] Building C object CMakeFiles/
Linking C executable mydumper
ld: library not found for -lglib-2.0
collect2: ld returned 1 exit status
make[2]: *** [mydumper] Error 1
make[1]: *** [CMakeFiles/
make: *** [all] Error 2
Leith (mleith) wrote : | # |
Also, I believe we were using 0.1.8 as the version from the last push, not sure why we go back to 0.1.7 here.
Leith (mleith) wrote : | # |
All looks good now - approved! Merging now.
Preview Diff
1 | === added file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 1970-01-01 00:00:00 +0000 |
3 | +++ CMakeLists.txt 2010-03-24 09:46:28 +0000 |
4 | @@ -0,0 +1,31 @@ |
5 | +cmake_minimum_required(VERSION 2.6) |
6 | +project(mydumper) |
7 | +set(VERSION 0.1.8) |
8 | +set(ARCHIVE_NAME "${CMAKE_PROJECT_NAME}-${VERSION}") |
9 | + |
10 | +#Required packages |
11 | +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) |
12 | +find_package(MySQL) |
13 | +find_package(ZLIB) |
14 | +find_package(GLIB2) |
15 | +find_package(PCRE) |
16 | + |
17 | +set(CMAKE_C_FLAGS "-Wall -Werror -O3 -g") |
18 | + |
19 | +include_directories(${MYDUMPER_SOURCE_DIR} ${MYSQL_INCLUDE_DIR} ${GLIB2_INCLUDE_DIR} ${PCRE_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS}) |
20 | + |
21 | +SET(CMAKE_INSTALL_PREFIX "/usr/local" CACHE STRING "Install path" FORCE) |
22 | +MARK_AS_ADVANCED(CMAKE) |
23 | + |
24 | +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) |
25 | + |
26 | +add_executable(mydumper mydumper.c) |
27 | +target_link_libraries(mydumper ${MYSQL_LIBRARIES} ${GLIB2_LIBRARIES} ${GTHREAD2_LIBRARIES} ${PCRE_PCRE_LIBRARY} ${ZLIB_LIBRARIES}) |
28 | +INSTALL(TARGETS mydumper |
29 | + RUNTIME DESTINATION bin |
30 | +) |
31 | + |
32 | +add_custom_target(dist |
33 | + COMMAND bzr export --root=${ARCHIVE_NAME} |
34 | + ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.gz |
35 | + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) |
36 | |
37 | === removed file 'Makefile' |
38 | --- Makefile 2010-03-18 17:07:25 +0000 |
39 | +++ Makefile 1970-01-01 00:00:00 +0000 |
40 | @@ -1,48 +0,0 @@ |
41 | -# Build flags |
42 | -CFLAGS=-Wall -Werror `mysql_config --cflags` `pkg-config --cflags glib-2.0 gthread-2.0` `pcre-config --cflags` |
43 | -LDFLAGS=`mysql_config --libs_r` `pkg-config --libs glib-2.0 gthread-2.0` `pcre-config --libs` |
44 | -OPTFLAGS=-O3 -g |
45 | - |
46 | -# Various defines |
47 | -NAME=mydumper |
48 | -VERSION = $(shell grep 'define VERSION' mydumper.c | cut -d'"' -f2) |
49 | -CLEANFILES= $(NAME) dump *~ *BAK *.dSYM *.o |
50 | -DISTFILES = Makefile $(NAME).c README |
51 | -bindir = $(prefix)/bin |
52 | -distdir = $(NAME)-$(VERSION) |
53 | -prefix = /usr/local |
54 | - |
55 | -# Required programs |
56 | -CP = /bin/cp |
57 | -GZIP = /bin/gzip |
58 | -INSTALL = /usr/bin/install |
59 | -INSTALL_PROGRAM = $(INSTALL) -m 755 |
60 | -RM = /bin/rm |
61 | -TAR = /bin/tar |
62 | - |
63 | -all: $(NAME) |
64 | - |
65 | -mydumper: mydumper.o |
66 | - $(CC) $(CFLAGS) $(OPTFLAGS) -o $(NAME) $(NAME).o $(LDFLAGS) |
67 | - |
68 | -install: all |
69 | - test -d $(DESTDIR)$(bindir) || $(INSTALL) -d $(DESTDIR)$(bindir) |
70 | - $(INSTALL_PROGRAM) $(NAME) $(DESTDIR)$(bindir) |
71 | - |
72 | -distdir: |
73 | - if test -d $(distdir) ; then $(RM) -rf $(distdir) ; fi |
74 | - mkdir $(distdir) |
75 | - $(CP) -a $(DISTFILES) $(distdir) |
76 | - |
77 | -dist: distdir |
78 | - $(TAR) chof - $(distdir) | $(GZIP) -c > $(distdir).tar.gz |
79 | - $(RM) -rf $(distdir) |
80 | - |
81 | -uninstall: |
82 | - $(RM) -f $(DESTDIR)$(bindir)/$(NAME) |
83 | - |
84 | -clean: |
85 | - $(RM) -f $(CLEANFILES) |
86 | - |
87 | -maintainer-clean: clean |
88 | - $(RM) -f $(distdir).tar.gz |
89 | |
90 | === modified file 'README' |
91 | --- README 2010-03-18 16:32:53 +0000 |
92 | +++ README 2010-03-24 09:46:28 +0000 |
93 | @@ -10,6 +10,7 @@ |
94 | == How to build it? == |
95 | |
96 | Run: |
97 | + cmake . |
98 | make |
99 | |
100 | One needs to install development versions of required libaries (MySQL, GLib, ZLib, PCRE): |
101 | |
102 | === added directory 'cmake' |
103 | === added directory 'cmake/modules' |
104 | === added file 'cmake/modules/FindGLIB2.cmake' |
105 | --- cmake/modules/FindGLIB2.cmake 1970-01-01 00:00:00 +0000 |
106 | +++ cmake/modules/FindGLIB2.cmake 2010-03-24 09:46:28 +0000 |
107 | @@ -0,0 +1,22 @@ |
108 | +# - Try to find the GLIB2 libraries |
109 | + |
110 | +if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES AND GTHREAD2_LIBRARIES) |
111 | + # Already in cache, be silent |
112 | + set(GLIB2_FIND_QUIETLY TRUE) |
113 | +endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES AND GTHREAD2_LIBRARIES) |
114 | + |
115 | +if (NOT WIN32) |
116 | + include(FindPkgConfig) |
117 | + pkg_search_module(PC_GLIB2 REQUIRED glib-2.0) |
118 | + pkg_search_module(PC_GTHREAD2 REQUIRED gthread-2.0) |
119 | +endif(NOT WIN32) |
120 | + |
121 | +set(GLIB2_INCLUDE_DIR ${PC_GLIB2_INCLUDE_DIRS}) |
122 | + |
123 | +find_library(GLIB2_LIBRARIES NAMES glib-2.0 HINTS ${PC_GLIB2_LIBDIR} ${PC_GLIB2_LIBRARY_DIRS}) |
124 | + |
125 | +find_library(GTHREAD2_LIBRARIES NAMES gthread-2.0 HINTS ${PC_GTHREAD2_LIBDIR} ${PC_GTHREAD2_LIBRARY_DIRS}) |
126 | + |
127 | + |
128 | +mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES GTHREAD2_LIBRARIES) |
129 | + |
130 | |
131 | === added file 'cmake/modules/FindMySQL.cmake' |
132 | --- cmake/modules/FindMySQL.cmake 1970-01-01 00:00:00 +0000 |
133 | +++ cmake/modules/FindMySQL.cmake 2010-03-24 09:46:28 +0000 |
134 | @@ -0,0 +1,81 @@ |
135 | +# - Try to find MySQL / MySQL Embedded library |
136 | +# Find the MySQL includes and client library |
137 | +# This module defines |
138 | +# MYSQL_INCLUDE_DIR, where to find mysql.h |
139 | +# MYSQL_LIBRARIES, the libraries needed to use MySQL. |
140 | +# MYSQL_LIB_DIR, path to the MYSQL_LIBRARIES |
141 | +# MYSQL_EMBEDDED_LIBRARIES, the libraries needed to use MySQL Embedded. |
142 | +# MYSQL_EMBEDDED_LIB_DIR, path to the MYSQL_EMBEDDED_LIBRARIES |
143 | +# MYSQL_FOUND, If false, do not try to use MySQL. |
144 | +# MYSQL_EMBEDDED_FOUND, If false, do not try to use MySQL Embedded. |
145 | + |
146 | +# Copyright (c) 2006-2008, Jarosław Staniek <staniek@kde.org> |
147 | +# |
148 | +# Redistribution and use is allowed according to the terms of the BSD license. |
149 | +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
150 | + |
151 | +include(CheckCXXSourceCompiles) |
152 | + |
153 | +if(WIN32) |
154 | + find_path(MYSQL_INCLUDE_DIR mysql.h |
155 | + PATHS |
156 | + $ENV{MYSQL_INCLUDE_DIR} |
157 | + $ENV{MYSQL_DIR}/include |
158 | + $ENV{ProgramFiles}/MySQL/*/include |
159 | + $ENV{SystemDrive}/MySQL/*/include |
160 | + ) |
161 | +else(WIN32) |
162 | + find_path(MYSQL_INCLUDE_DIR mysql.h |
163 | + PATHS |
164 | + $ENV{MYSQL_INCLUDE_DIR} |
165 | + $ENV{MYSQL_DIR}/include |
166 | + /usr/local/mysql/include |
167 | + /opt/mysql/mysql/include |
168 | + PATH_SUFFIXES |
169 | + mysql |
170 | + ) |
171 | +endif(WIN32) |
172 | + |
173 | +if(WIN32) |
174 | + set(MYSQL_LIB_PATHS |
175 | + $ENV{MYSQL_DIR}/lib/opt |
176 | + $ENV{MYSQL_DIR}/client/release |
177 | + $ENV{ProgramFiles}/MySQL/*/lib/opt |
178 | + $ENV{SystemDrive}/MySQL/*/lib/opt |
179 | + ) |
180 | + find_library(MYSQL_LIBRARIES NAMES mysqlclient_r |
181 | + PATHS |
182 | + ${MYSQL_LIB_PATHS} |
183 | + ) |
184 | +else(WIN32) |
185 | + set(MYSQL_LIB_PATHS |
186 | + $ENV{MYSQL_DIR}/libmysql_r/.libs |
187 | + $ENV{MYSQL_DIR}/lib |
188 | + $ENV{MYSQL_DIR}/lib/mysql |
189 | + /usr/local/mysql/lib |
190 | + /opt/mysql/mysql/lib |
191 | + PATH_SUFFIXES |
192 | + mysql |
193 | + ) |
194 | + find_library(MYSQL_LIBRARIES NAMES mysqlclient_r |
195 | + PATHS |
196 | + ${MYSQL_LIB_PATHS} |
197 | + ) |
198 | +endif(WIN32) |
199 | + |
200 | +if(MYSQL_LIBRARIES) |
201 | + get_filename_component(MYSQL_LIB_DIR ${MYSQL_LIBRARIES} PATH) |
202 | +endif(MYSQL_LIBRARIES) |
203 | + |
204 | +set( CMAKE_REQUIRED_INCLUDES ${MYSQL_INCLUDE_DIR} ) |
205 | + |
206 | +if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) |
207 | + set(MYSQL_FOUND TRUE) |
208 | + message(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}") |
209 | +else(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) |
210 | + set(MYSQL_FOUND FALSE) |
211 | + message(STATUS "MySQL not found.") |
212 | +endif(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) |
213 | + |
214 | +mark_as_advanced(MYSQL_INCLUDE_DIR MYSQL_LIBRARIES) |
215 | + |
216 | |
217 | === added file 'cmake/modules/FindPCRE.cmake' |
218 | --- cmake/modules/FindPCRE.cmake 1970-01-01 00:00:00 +0000 |
219 | +++ cmake/modules/FindPCRE.cmake 2010-03-24 09:46:28 +0000 |
220 | @@ -0,0 +1,45 @@ |
221 | +# - Try to find the PCRE regular expression library |
222 | +# Once done this will define |
223 | +# |
224 | +# PCRE_FOUND - system has the PCRE library |
225 | +# PCRE_INCLUDE_DIR - the PCRE include directory |
226 | +# PCRE_LIBRARIES - The libraries needed to use PCRE |
227 | + |
228 | +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> |
229 | +# |
230 | +# Redistribution and use is allowed according to the terms of the BSD license. |
231 | +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
232 | + |
233 | + |
234 | +if (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY) |
235 | + # Already in cache, be silent |
236 | + set(PCRE_FIND_QUIETLY TRUE) |
237 | +endif (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY) |
238 | + |
239 | + |
240 | +if (NOT WIN32) |
241 | + # use pkg-config to get the directories and then use these values |
242 | + # in the FIND_PATH() and FIND_LIBRARY() calls |
243 | + find_package(PkgConfig) |
244 | + |
245 | + pkg_check_modules(PC_PCRE REQUIRED libpcre) |
246 | + |
247 | + set(PCRE_DEFINITIONS ${PC_PCRE_CFLAGS_OTHER}) |
248 | + |
249 | +endif (NOT WIN32) |
250 | + |
251 | +find_path(PCRE_INCLUDE_DIR pcre.h |
252 | + HINTS ${PC_PCRE_INCLUDEDIR} ${PC_PCRE_INCLUDE_DIRS} |
253 | + PATH_SUFFIXES pcre) |
254 | + |
255 | +find_library(PCRE_PCRE_LIBRARY NAMES pcre HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS}) |
256 | + |
257 | +find_library(PCRE_PCREPOSIX_LIBRARY NAMES pcreposix HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS}) |
258 | + |
259 | +include(FindPackageHandleStandardArgs) |
260 | +find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY PCRE_PCREPOSIX_LIBRARY ) |
261 | + |
262 | +set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} ${PCRE_PCREPOSIX_LIBRARY}) |
263 | + |
264 | +mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCREPOSIX_LIBRARY PCRE_PCRE_LIBRARY) |
265 | + |
266 | |
267 | === added file 'config.h.in' |
268 | --- config.h.in 1970-01-01 00:00:00 +0000 |
269 | +++ config.h.in 2010-03-24 09:46:28 +0000 |
270 | @@ -0,0 +1,6 @@ |
271 | +#ifndef CONFIG_H |
272 | +#define CONFIG_H |
273 | + |
274 | +#cmakedefine VERSION "@VERSION@" |
275 | + |
276 | +#endif |
277 | |
278 | === modified file 'mydumper.c' |
279 | --- mydumper.c 2010-03-19 12:57:57 +0000 |
280 | +++ mydumper.c 2010-03-24 09:46:28 +0000 |
281 | @@ -16,8 +16,6 @@ |
282 | Mark Leith, Sun Microsystems (leith at sun dot com) |
283 | */ |
284 | |
285 | -#define VERSION "0.1.8" |
286 | - |
287 | #define _LARGEFILE64_SOURCE |
288 | #define _FILE_OFFSET_BITS 64 |
289 | |
290 | @@ -32,6 +30,7 @@ |
291 | #include <zlib.h> |
292 | #include <pcre.h> |
293 | #include <glib/gstdio.h> |
294 | +#include "config.h" |
295 | |
296 | struct configuration { |
297 | char use_any_index; |
Hi,
On 03/21/2010 11:45 AM, LinuxJedi wrote:
> LinuxJedi has proposed merging lp:~thelinuxjedi/mydumper/mydumper-cmake into lp:mydumper.
>
> Requested reviews:
> MySQL Data Dumper Team (mydumper)
>
>
> Build using CMAKE, checks required dependencies first
> Moved version number to CMakeLists.txt which gets added to mydumper.c via config.h
Good idea, my Makefile improvements were a bit hacky anyway :)
Bye, www.lenzg. net/
LenZ
--
Lenz Grimmer <email address hidden> - http://