1.Create a new temporary directory
ubuntu@ubuntu:~$ mkdir newdeb
2.Create our new program directory
ubuntu@ubuntu:~$ mkdir hello
3.Write HelloWorld program, hello.c code is as follows
#include <stdio.h> int main(int argc, char* argv[]) { printf("Hello world!\n"); return 0; }
Makefile
OBJS=hello.o CC=gcc -g all:$(OBJS) $(CC) -o hello $(OBJS) clean: rm -f *.o hello .PHONY:all clean
4.Running ‘make”, compiling and testing programs, to see whether there is a problem, and then. / Hello check whether the program executed correctly 5.If there is a problem, check program code,if not , move on to the next step 6. make clean 7.Enter the command, switch back to the parent directory
ubuntu@ubuntu:~$ cd ../
8.Compress and pack once Rename: Because the file name must include the file name as well as the version number
ubuntu@ubuntu:~$ mv hello hello-1.0
Note: The file name must use -, can not be used _
ubuntu@ubuntu:~$ tar zcvf hello_1.0.orig.tar.gz hello-1.0
Note: Zip file name must contain the file name and version number 9.Enter our hello-1.0 directory
ubuntu@ubuntu:~$cd hello-1.0
10.If you want to configure the package before the package, can install dh-make to configure, dh-make installation method:
ubuntu@ubuntu:~$sudo apt-get install dh-make
modify the mailbox
ubuntu@ubuntu:~$dh_make -e 619137943@qq.com
11. Enter s view configuration information 12. Input” Enter” ,confirm the configuration information 13. start packing
ubuntu@ubuntu:~$dpkg-buildpackage
14. pack successfully, go back to the parent directory can see our hello_1.0-1_i386.deb
Leave a Reply
You must be logged in to post a comment.