Build .deb package from source, without installing it
Solution 1
You might want to try out debuild
to create a binary (deb) file out of source. You would have to prepare the debian folder like you are packaging it. Once you got it right, run the command debuild -b
from inside the source directory and it will create a deb file for you.
You would also want to take a look at Introduction to Debian packaging.
If all that is crazy stuff, you would have to just make do with checkinstall
messing with system files.
Solution 2
I found an answer in a Linux Journal article called Using Checkinstall To Build Packages From Source:
If you merely want to create the .deb without carrying out the installation, use the command line switch
sudo checkinstall --install=no
Mechanical snail
🐌. Native speaker of American English. Linux user. Familiar with several programming languages in the procedural, OO, and functional paradigms. Worst Code Golf ever New badge proposals! Shakespeare bug in Ubuntu The Great Question Deletion Audit of 2012 Chat Horrible spiders Adorable fluffy things LASERS! Link rot is evil. Archive everything. The keyboard is king. Correctness over performance. Canonicalize, normalize, deduplicate. Don't repeat yourself. UTF-8 > UTF-16. Use static typing: good for tooling. Re-use; don't re-invent. Correctness, then clarity, then concision and elegance. Play devil's advocate. First understand opponents' positions.
Updated on September 18, 2022Comments
-
Mechanical snail over 1 year
Suppose I have an installer program or source tarball for some program I want to install. (There is no Debian package available.) First I want to create a
.deb
package out of it, in order to be able to cleanly remove the installed program in the future (see Uninstalling application built from source, If I build a package from source how can I uninstall or remove completely?). Also, installing using a package prevents it from clobbering files from other packages, which cannot be guaranteed if you run the installer orsudo make install
.Checkinstall
From reading the answers there and elsewhere, I gather the usual solution is to use
checkinstall
to build the package. Unfortunately, it seemscheckinstall
does not preventmake install
from clobbering system files from other packages. For example, according to Reverting problems caused by checkinstall with gcc build:I created a Debian package from the install using
sudo checkinstall -D make install
.[...] I removed it using Synaptic Package Manager. As it turns out, [removing] the package checkinstall created from
make install
tried to remove every single file the installation process touched, including shared gcc libraries like /lib64/libgcc_s.so.I then tried to tell
checkinstall
to build the package without installing it, in the hope of bypassing the issue. I created a dummy Makefile:install: echo "Bogus" > /bin/qwertyuiop
and ran
sudo checkinstall --install=no
. The file/bin/qwertyuiop
was created, even though the package was not installed.In my case, I do not trust the installer /
make install
to not overwrite system files, so this use ofcheckinstall
is ruled out.How can I build the package, without installing it or letting it touch system files?
Is it possible to run Checkinstall in a
fakechroot
ed debootstrap environment to achieve this? Preferably the build should be done as a normal user rather than root, which would prevent the process from overwriting system files if it goes wrong.