Do Thanh Tung
Do Thanh Tung

Reputation: 1323

Create .deb file from c source file

I have a C program and I want to build it into a deb file to install it. Can you show me how to do it? Thanks so much for helping.

Upvotes: 2

Views: 2479

Answers (2)

Evhz
Evhz

Reputation: 9246

Generate a gpg key. Remember the NAME and the EMAIL_ADDRESS you enter.

 gpg --gen-key
 gpg -a --output ~/.gnupg/ANY_NAME.gpg --export 'YOUR NAME'
 gpg --import ~/.gnupg/ANY_NAME.gpg

Then, having installed the necessary packages for building C libraries:

sudo apt-get install build-essential autoconf automake \
autotools-dev dh-make debhelper devscripts fakeroot \
xutils lintian pbuilder pkg-config

move to your C project folder. And run: (enter -s for single binary pkg when prompted )

dh_make -e EMAIL_ADDRESS -f path/to/file.orig.tar.gz

You will see a debian folder with generated files. From those,you should edit as your pkg needs the files control, copyright and changelog files.
Then build the package:

dpkg-buildpackage -rfakeroot

If no errors the package .deb is generated.

Further guides on how to do this here:
- https://askubuntu.com/questions/1345/what-is-the-simplest-debian-packaging-guide
- https://linuxconfig.org/easy-way-to-create-a-debian-package-and-local-package-repository
- https://coderwall.com/p/urkybq/how-to-create-debian-package-from-source

Upvotes: 1

Trinopoty
Trinopoty

Reputation: 423

This guide demonstrates how to create a debian package https://wiki.debian.org/HowToPackageForDebian

Upvotes: 4

Related Questions