Create Debian package from souce
Post on: 2017-06-28 22:15:10
1. Install build tools
sudo apt-get install devscripts dh-make
2. Prepare source code
mkdir -p ~/tmp/testdeb/debian && cd ~/tmp/testdeb
touch testhello.c Makefile
touch debian/{changelog,compat,control,rules}
echo 9 > debian/compat
testhello.c
#include <stdio.h>
int main (int argc, char *argv[])
{
("Hello\n");
printf
return 0;
}
Makefile
OBJS = testhello.o
CC = gcc -g
all:$(OBJS)
$(CC) -o testhello $(OBJS)
clean:
rm -f *.o testhello
.PHONY:all clean
debian/changelog
testhello (1.0-1) unstable; urgency=medium
* init
-- xxx <[email protected]> Mon, 26 Jun 2017 17:25:36 +0800
debian/control
Source: testhello
Priority: optional
Maintainer: xxx <[email protected]>
Build-Depends: debhelper (>=9)
Standards-Version: 3.9.6
Package: testhello
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: testhello
debian/rules
#!/usr/bin/make -f
%:
dh $@
Final directory tree
./testhello.c
./debian
./debian/compat
./debian/changelog
./debian/control
./debian/rules
./Makefile
3. Build
debuild -us -uc -b