From scratch, an instance that creates a Deb package -- the Linux Release Technology-Debian information. For more information, see the following. I want to create a Deb package from scratch, which means that even the source code of the software is written by myself, similar to deb from scratch, such a production process consists of three parts:
1. coding and testing of source code
2. Use autotools to generate related files that comply with Gnu programming standards, such as configure and makefile.
3. Create the Deb package file In Debian mode.
Now I have written a small software hb-0.01, which means hyperbolic, is a small software written by myself for hyperbolic and antihyperbolic functions. There are only three files in total, in the/home/wen1/hb-0.01/directory, the entire process of making the hb software deb package is:
Step 1: Compile the source code
This step is compiled by the user. My small software has only three files, one is the header file, the other is the C file implemented by the function, and the other is the main program C file. The system displays:
Wen1 @ lenny :~ /Hb-0.01 $ ls-l
Total 12
-Rw-r -- 1 wen1 wen1 140 bolic. h
-Rw-r -- 1 wen1 wen1 369 boliclib. c
-Rw-r -- 1 wen1 wen1 300 hb. c
Step 2: Use Autotools to generate all configuration files that comply with Gnu programming standards.
This process involves many steps, including:
1. Use the autoscan command to generate a configure template file. System Operation:
2. Rename the configure. scan file to configure. in and modify the file accordingly. Mine is:
AC_PREREQ (2.61)
AC_INIT (hb, 0.01, wenheping@tom.com)
AM_INIT_AUTOMAKE (HBr, 0.01)
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CHECK_FUNCS ([sqrt])
AC_OUTPUT (Makefile)
Generally, only three parameters, AC_INIT, AC_OUTPUT, and AM_INIT_AUTOMAKE, need to be modified according to your own situation. Other automatically generated items do not move.
3. Execute the commands aclocal and autoconf to generate the configure file:
4. Create a Makefile. am file, and then the automake tool automatically generates the Makefile. in File Based on the Makefile. am file.
Makefile. am files generally define the name of the executable program generated by your software and the library to be connected. The content of this file is:
AUTOMAKE_OPTIONS = foreign #
Bin_PROGRAMS = hb # Name of the last generated Executable File
Hb_SOURCES = hb. c bolic. h boliclib. c # all source code files
LIBS =-lm # connect to the math Library
Then use automake to generate the Makefile. in file. to comply with the specifications, first:
Aclocal. m4 bolic. h configure. in INSTALL missing
AUTHORS boliclib. c COPYING install-sh NEWS
Autom4te. cache ChangeLog depcomp Makefile. am README
Autoscan. log configure hb. c Makefile. in
5. Execute configure to generate Makefile
This step is very simple. After the Makefile is generated, you can use other make commands, such as make clean, make install, and make dist, to see what effect they will give you.
Step 3: generate the Deb package.
There are two methods to generate the deb package: one is very simple. Simply run checkinstall in the software source code directory and then answer a few simple questions. However, this method is generally not recommended; second, follow the New Maintainer Guide of Debian to create the deb package step by step. For detailed procedures, see:
Debian requires that the executable file cannot be installed in the/usr/local directory. Therefore, check the corresponding installation location of the Makefile file, my small software was originally installed under/usr/bin, so you do not need to modify the Makefile file.
For control copyright and other files, if you just create a deb package file for your own use, you can do it without modifying it. However, if you are preparing to upload the file for Debian to the Debian apt source, it must be carefully entered in accordance with the specifications.
5. Generate the deb package file, which is like this:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.