Page 1 of 1

How to make your own packages with Checkinstall. Rate Topic: -----

#1 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Posted 06 January 2008 - 12:45 PM

What is Checkinstall and why would I want to use it?

Checkinstall is a wonderful program that generates packages for you from source code.

This might not sound so great, but think of the last time you were looking for a piece of software but it wasn't in your distribution's package manager (or it was in the package manager, but the version was too old). You could always compile that software on your own, but then it would make a mess of your nice clean system when you installed it.

What if you later wanted to remove that software? You would have to track down all the pieces of it, and manually remove them. And what's the point in having a package manager if you aren't going to use it?

That's where Checkinstall comes in, and aside from keeping your system organized, it makes an easy way to generate packages from your own programs, and for your less technically adept friends. :)

Where can I get it?

Checkinstall can be downloaded from here. There are packages for Slackware, Debian, and RPM based distros. There's also a source package.

If you really want, you can compile the source package, and then use the instructions below to make a package from Checkinstall to install!

How do I use it?

First off, you need to compile your source code. This usually involves a ./configure, followed by a make (you don't want to do make install, as that will install the program).

Now comes the tricky part. Checkinstall doesn't work on some source packages properly, as it looks for a "install:" section in the makefile, and sometimes that's omitted. For now we will just assume the "install:" section is included in the makefile (skip to the next section if it's not).

Checkinstall requires root privileges to run, so either become root first or use sudo, then run checkinstall in the source directory of the program you're trying to make a package for.

It should look something like this:
tom@midnight:/tmp$ sudo checkinstall

checkinstall 1.6.1, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
		   This software is released under the GNU GPL.

The checkinstallrc file was not found at:
/usr/local/lib/checkinstall/checkinstallrc

Assuming default values.

The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs?  [y]:

Preparing package documentation...OK

*** No known documentation files were found. The new package
*** won't include a documentation directory.

Please choose the packaging method you want to use.
Slackware [S], RPM [R] or Debian [D]?



When presented with this choice, I typically pick Debian, as that's the system I use. Picking Slackware or RPM doesn't change much aside from the package produced, and the necessary "Group" field you have to fill out. However for this tutorial, I'm just going to type "D" for Debian.

You should then be presented with something that looks like this:
*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values:

0 -  Maintainer: [ root@midnight ]
1 -  Summary: [ Package created with checkinstall 1.6.1 ]
2 -  Name:	[ tmp ]
3 -  Version: [ 20080106 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ tmp ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]

Enter a number to change any of them or press ENTER to continue:



This section is pretty easy, enter a number and press enter to edit a field.

The fields you're probably going to want to edit are:
  • Maintainer - "Your name - <your_email@a_server.com>"
  • Summary - "This package does things."
  • Name - "Example-package"
  • Version -"0.1"
  • Group - "Games and Amusements"

I usually leave the others blank, if you feel the need you can change them though. Press enter when you're done entering things, and your package will be generated. If you made a Debian package, install it with the command dpkg -i your_package.deb.

What to do if Checkinstall can't find an "install:" section in the makefile?

or

How to write the "install:" section in the makefile.

I really can't give specific instructions for this section. Every program is different. However there are a few common things I can cover...
  • The "install:" section in the makefile (which is just a plain text file, called "makefile" by the way) contains commands to copy the compiled program into the proper places in the file system.
  • It will usually consist of simple commands involved "cp" and "mkdir".

Here is an example makefile (just the "install:" section) for a hypothetical program. The program's binary is called "example".
install:
		cp example /usr/bin/



That's all there is to it! The tricky part is just finding out where everything is supposed to go, and that I leave up to you. :)

Is This A Good Question/Topic? 0
  • +

Page 1 of 1