writing an install file for my code
I have written a C code on ubuntu linux and would like to make an install file for it. Unfortunatel开发者_开发知识库y I don't know where to start :(
my code using other packages found online, I want the install file to check if the package is found on the system, if not it should install it from an online source then compile the source code.
Any help on how to start?
Thanks :)
You need to decide whether you want to publish your package as an Ubuntu-specific binary or source package (as a .deb), or want to publish it as system-independent source code (most commonly a .tar.gz package). The best way is to go both, of course :-).
For the source package distribution, to make your program distributable with source code, write autoconf and automake headers for it. That is, write a configure.ac (that checks if all necessary libs are on the system) and a Makefile.am that compile your program, and then build a tarball from it with
make dist
At this point, you don't care which packages are installed on the target system, and don't include anything like aptitude commands. That is explicitely left to be the responsibility of the person building your software. This seems weird when you are new to these concepts, but keeps a lot of problems from your back.
In the second step, you debianize the tarball you just created. There you specify the packages you need for building and for installing your package, and create a binary package ready for distribution. The excellent Debian new maintainer guide describes the process in detail. This binary package can then be installed via dpkg on any Ubuntu (and most Debian) systems.
have a look at autotools.
精彩评论