Checkinstall DEBs done the CMake way…

CMake can by default build binary packages in DEB, RPM, EXE… Using the all famous CPack (yeah right, you probably never heared of it ;-))

Making use of CPack is in most cases actually quite easy and just involves a bit of copy and paste.
Lets use rekonq as example:
First you’ll need to get the source from kde-apps and extract it, then edit the CMakeLists.txt file in the main directory and add the following at the very end:
SET(CPACK_GENERATOR “DEB”)
SET(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
SET(CPACK_SET_DESTDIR TRUE)
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER “me”)
SET(CPACK_PACKAGE_VERSION_MAJOR “0”)
SET(CPACK_PACKAGE_VERSION_MINOR “0”)
SET(CPACK_PACKAGE_VERSION_PATCH “1~alpha1”)
include(CPack)
You can use this portion for about every application, though you might want to change the VERSION parts accordingly😉
Once you are done editing, just continue with the normal build process (i.e. mkdir build; cd build; cmake ..; make). When/If make finishes just run cpack or make package. If everything went well this should place rekonq-0.0.1~alpha1-Linux.deb in the build directory, waiting for you to install it.
Disclaimer: This package does, just like a checkinstall created one, not list dependencies, nor does it meet all requirements of a sensible debian package and thus should not be distributed. So, if you create a package using CPack, don’t distribute them, it might very well cause problems for the people who want to use it. Instead I’d recommend to learn packaging, neither debian packaging nor RPM packaging are difficult to learn (mastering them takes a live time though, or so I have been told ;-)).
Also note that it is indeed possible to create sensible packages using CPack (after all that is it’s primary usecase), it requires a bit more work than just adding the lines listed above though.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s