Merge lp:~ralsina/u1db/cmake3 into lp:u1db

Proposed by Roberto Alsina
Status: Merged
Approved by: dobey
Approved revision: 357
Merged at revision: 340
Proposed branch: lp:~ralsina/u1db/cmake3
Merge into: lp:u1db
Prerequisite: lp:~ralsina/u1db/cmake2
Diff against target: 125 lines (+46/-12)
3 files modified
CMakeLists.txt (+30/-2)
setup.py (+6/-10)
src/CMakeLists.txt (+10/-0)
To merge this branch: bzr merge lp:~ralsina/u1db/cmake3
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve
dobey (community) Approve
Review via email: mp+112633@code.launchpad.net

Commit message

Implement the install/dist targets.

Description of the change

Implement the install/dist targets.

With this branch you can do:

"make install" which installs everything in (hopefully) the right places.

"make dist" which creates a source tarball.

You can change the installation prefix by setting CMAKE_INSTALL_PREFIX via ccmake or through any other means. It also supports DESTDIR. If anything doesn't work or is not done according to what's needed to package it, well, that's why it's up for review :-)

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

Did cmake . && make check which worked fine, then got this:

[dobey@lunatari:cmake3]: make dist
make: *** No rule to make target `dist'. Stop.
[dobey@lunatari:cmake3]: make DESTDIR=/tmp/foo install
[ 0%] Built target ReplicatePythonSourceTree
[100%] Built target u1db
Install the project...
-- Install configuration: ""
CMake Error at cmake_install.cmake:36 (FILE):
  file INSTALL cannot find
  "/home/dobey/Projects/canonical/u1db/cmake3/temp//usr/local".

make: *** [install] Error 1

review: Needs Fixing
Revision history for this message
dobey (dobey) wrote :

The built cython module is getting installed it seems: /tmp/foo/usr/local/lib/python2.7/dist-packages/u1db/tests/c_backend_wrapper.so

And the installed u1db-client and u1db-server scripts seem to not have the executable bit set.

I suppose this is because you're doing the python install into temp/ and then copying everything out. It should probably only install the C bits and the install-python target should have setup.py install to the specified place using "--root ${DESTDIR} --prefix ${CMAKE_INSTALL_PREFIX}" as arguments.

review: Needs Fixing
Revision history for this message
Roberto Alsina (ralsina) wrote :

> The built cython module is getting installed it seems:
> /tmp/foo/usr/local/lib/python2.7/dist-packages/u1db/tests/c_backend_wrapper.so
>
> And the installed u1db-client and u1db-server scripts seem to not have the
> executable bit set.
>
> I suppose this is because you're doing the python install into temp/ and then
> copying everything out. It should probably only install the C bits and the
> install-python target should have setup.py install to the specified place
> using "--root ${DESTDIR} --prefix ${CMAKE_INSTALL_PREFIX}" as arguments.

Fixed in revno 354

Revision history for this message
dobey (dobey) wrote :

We should pull the version in cmake, by doing python setup.py --version I think, to avoid duplicating the version in multiple places.

Also, I get this error when trying to build the shlib version:

[dobey@lunatari:cmake3]: cmake -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX:PATH=/usr .
CMake Error at src/CMakeLists.txt:26 (INSTALL):
  install TARGETS given no LIBRARY DESTINATION for shared library target
  "u1db".

-- Configuring incomplete, errors occurred!

review: Needs Fixing
Revision history for this message
Roberto Alsina (ralsina) wrote :

> We should pull the version in cmake, by doing python setup.py --version I
> think, to avoid duplicating the version in multiple places.

Fixed in revno 355

> Also, I get this error when trying to build the shlib version:
>
> [dobey@lunatari:cmake3]: cmake -DBUILD_SHARED_LIBS=1
> -DCMAKE_INSTALL_PREFIX:PATH=/usr .
> CMake Error at src/CMakeLists.txt:26 (INSTALL):
> install TARGETS given no LIBRARY DESTINATION for shared library target
> "u1db".
>
>
> -- Configuring incomplete, errors occurred!

And fixed in revno 356

Revision history for this message
dobey (dobey) wrote :

I still don't like it, but all these points are at least somewhat workable now.

review: Approve
Revision history for this message
Eric Casteleijn (thisfred) wrote :

cmake . && make check works

touching any .c file and then running make check again still does not rebuild the c_backend_wrapper though...

review: Needs Fixing
Revision history for this message
Roberto Alsina (ralsina) wrote :

> cmake . && make check works
>
> touching any .c file and then running make check again still does not rebuild
> the c_backend_wrapper though...

"fixed" in revno 357

Revision history for this message
Eric Casteleijn (thisfred) wrote :

+1

review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

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-06-28 11:10:06 +0000
3+++ CMakeLists.txt 2012-07-03 17:38:14 +0000
4@@ -4,6 +4,15 @@
5 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
6 include_directories(${CMAKE_SOURCE_DIR}/include)
7
8+execute_process(COMMAND python setup.py --version
9+ OUTPUT_VARIABLE PROJECT_VERSION)
10+
11+set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
12+add_custom_target(dist
13+ COMMAND bzr export --root=${ARCHIVE_NAME}
14+ ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
15+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
16+
17 find_package(Cython REQUIRED)
18
19 find_package(CURL REQUIRED)
20@@ -37,12 +46,12 @@
21 )
22
23 add_custom_target(build-inplace
24- COMMAND python setup.py build_ext -i -I "${CMAKE_SOURCE_DIR}/include"
25+ COMMAND python setup.py clean build_ext -i -f
26 DEPENDS ReplicatePythonSourceTree u1db
27 )
28
29 add_custom_target(build-debug
30- COMMAND python-dbg setup.py build_ext -i -I "${CMAKE_SOURCE_DIR}/include"
31+ COMMAND python-dbg setup.py build_ext -i
32 DEPENDS ReplicatePythonSourceTree u1db
33 )
34
35@@ -65,4 +74,23 @@
36 COMMAND cd ${CMAKE_SOURCE_DIR}/html-docs; make html
37 )
38
39+SET(CPACK_GENERATOR "TGZ")
40+SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Noone")
41+INCLUDE(CPack)
42+
43+add_custom_target(install-python ALL
44+ COMMAND python setup.py install --prefix=${CMAKE_INSTALL_PREFIX} --root=${CMAKE_CURRENT_BINARY_DIR}/temp
45+ DEPENDS ReplicatePythonSourceTree
46+)
47+
48+install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp/${CMAKE_INSTALL_PREFIX}/
49+ DESTINATION "."
50+ PATTERN "*.pyc" EXCLUDE
51+ PATTERN "tests" EXCLUDE
52+ PATTERN "u1db-client"
53+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
54+ PATTERN "u1db-server"
55+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
56+)
57+
58 add_subdirectory(src)
59\ No newline at end of file
60
61=== modified file 'setup.py'
62--- setup.py 2012-06-28 11:10:06 +0000
63+++ setup.py 2012-07-03 17:38:14 +0000
64@@ -20,6 +20,10 @@
65
66
67 def config():
68+ try:
69+ from setuptools import setup, Extension, find_packages
70+ except ImportError:
71+ from distutils.core import setup, Extension, find_packages
72 import u1db
73 ext = []
74 kwargs = {
75@@ -31,8 +35,8 @@
76 "author": "Ubuntu One team",
77 "author_email": "u1db-discuss@lists.launchpad.net",
78 "download_url": "https://launchpad.net/u1db/+download",
79- "packages": ["u1db", "u1db.backends", "u1db.remote",
80- "u1db.commandline", "u1db.compat"],
81+ "packages": find_packages(exclude=["u1db.tests",
82+ "u1db.tests.commandline", "u1todo"]),
83 "package_data": {'': ["*.sql"]},
84 "scripts": ['u1db-client', 'u1db-serve'],
85 "ext_modules": ext,
86@@ -60,12 +64,6 @@
87 synchronize them with other stores.
88 """
89 }
90-
91- try:
92- from setuptools import setup, Extension
93- except ImportError:
94- from distutils.core import setup, Extension
95-
96 try:
97 from Cython.Distutils import build_ext
98 except ImportError, e:
99@@ -91,8 +89,6 @@
100 libraries=['u1db', 'sqlite3', 'oauth'] + extra_libs,
101 define_macros=[] + extra_defines,
102 ))
103-
104-
105 setup(**kwargs)
106
107 if __name__ == "__main__":
108
109=== modified file 'src/CMakeLists.txt'
110--- src/CMakeLists.txt 2012-06-27 16:27:19 +0000
111+++ src/CMakeLists.txt 2012-07-03 17:38:14 +0000
112@@ -22,3 +22,13 @@
113 PROPERTIES SOVERSION 1
114 COMPILE_FLAGS -fPIC
115 )
116+
117+INSTALL (
118+ TARGETS u1db
119+ ARCHIVE DESTINATION lib
120+ LIBRARY DESTINATION lib
121+)
122+
123+install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/u1db DESTINATION include
124+ FILES_MATCHING PATTERN "*.h"
125+)

Subscribers

People subscribed via source and target branches