I have the source code and need to crate a .deb package. When it is installed.., it shld compile the source code and install the resulting binaries when the deb package is installed.

I know creating the package when we already have the binaries.

I just have a abstract idea. Has it something to do with creating a PRE_INSTALL script which would compile the source code to give the binaries.., which later would be installed ?


It is possible to do this by specifying your package as "all" architectures and using post-install and pre-remove scripts (not pre-install). But this is a very bad idea. It undermines a lot of what .deb files are intended to be.

You will need to make your .deb file dependent on the compiler (gcc?) as well as the development package for any libraries your code depends on, not just the library themselves.

You will need to create a post-install script to compile the code, and put the binaries in the right places. You will need to create a pre-remove script to delete all the installed binaries when the package is deleted.

Even after that, you will be left with a package that doesn't correctly inform the dpkg installer where all the binaries are. It will not be able to detect collisions between your package and others.

This is a really bad idea, I strongly suggest you don't do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.