File: 73-makesh.txt

package info (click to toggle)
debmake-doc 1.22-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,952 kB
  • sloc: makefile: 916; sh: 692; python: 202; ansic: 114; sed: 16
file content (72 lines) | stat: -rw-r--r-- 2,303 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// vim:set filetype=asciidoc:
[[makefile-sh]]
=== Makefile (shell, CLI)

Here is an example of creating a simple Debian package from a POSIX shell CLI program using the *Makefile* as its build system.

Let's assume its upstream tarball to be *debhello-1.0.tar.gz*.

This type of source is meant to be installed as a non-system file as:

----
 $ tar -xzmf debhello-1.0.tar.gz
 $ cd debhello-1.0
 $ make install
----

Debian packaging requires changing this "`*make install*`" process to install files to the target system image location instead of the normal location under */usr/local*.

Let's get the source and make the Debian package.

.Download *debhello-1.0.tar.gz*
----
include::../examples/debhello-1.0_build-1/step000.slog[]
----

Here, the *Makefile* uses *$(DESTDIR)* and *$(prefix)* properly.  All other files are the same as in "`<<nomakefile>>`" and most of the packaging activities are the same.

.*Makefile* (v=1.0)
----
include::../examples/debhello-1.0_build-1/step102.slog[]
----

Let's package this with the *debmake* command.  Here, the **-b':sh'** option is used to specify that the generated binary package is a shell script.

----
include::../examples/debhello-1.0_build-1/step200.slog[lines=1..3]
 ...
include::../examples/debhello-1.0_build-1/step200.slog-sanity[]
 ...
----

Let's inspect the notable template files generated.

// .The source tree after the basic *debmake* execution. (v=1.0)
// ----
// include::../examples/debhello-1.0_build-1/step201.slog[]
// ----

.*debian/rules* (template file, v=1.0):
----
include::../examples/debhello-1.0_build-1/step202.slog[]
----

Let's make this Debian package better as the maintainer.

.*debian/rules* (maintainer version, v=1.0):
----
include::../examples/debhello-1.0_build-1/step301.slog[]
----

Since this upstream source has the proper upstream *Makefile*, there is no need to create *debian/install* and *debian/manpages* files.

The *debian/control* file is exactly the same as the one in "`<<nomakefile>>`".

There are several other template files under the *debian/* directory.  These also need to be updated.

.Template files under *debian/*. (v=1.0):
----
include::../examples/debhello-1.0_build-1/step400.slog[]
----

The rest of the packaging activities are practically the same as the ones in "`<<nomakefile>>`".