// vim:set filetype=asciidoc:
[[nomakefile]]
=== No Makefile (shell, CLI)

Here is an example of creating a simple Debian package from a POSIX shell CLI program without its build system.

Let's assume this upstream tarball to be *debhello-0.2.tar.gz*.

This type of source has no automated means and files must be installed manually.

For example:
----
 $ tar -xzmf debhello-0.2.tar.gz
 $ cd debhello-0.2
 $ sudo cp scripts/hello /bin/hello
 ...
----

Let's get this source as tar file from a remote site and make it the Debian package.

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

Here, the POSIX shell script *hello* is a very simple one.

.*hello* (v=0.2)
----
include::../examples/debhello-0.2_build-1/step101.slog[]
----

Here, *hello.desktop* supports the "`https://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/[Desktop Entry Specification]`".

.*hello.desktop* (v=0.2)
----
include::../examples/debhello-0.2_build-1/step102.slog[]
----

Here, *hello.png* is the icon graphics file.

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-0.2_build-1/step200.slog[lines=1..3]
 ...
include::../examples/debhello-0.2_build-1/step200.slog-sanity[]
 ...
----

Let's inspect notable template files generated.

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

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

This is essentially the standard *debian/rules* file with the *dh* command. Since this is the script package, this template *debian/rules* file has no build flag related contents.

.*debian/control* (template file, v=0.2):
----
include::../examples/debhello-0.2_build-1/step203.slog[]
----

Since this is the shell script package, the *debmake* command sets "`*Architecture: all*`" and "`*Multi-Arch: foreign*`".  Also, it sets required *substvar* parameters as "`*Depends: ${misc:Depends}*`".  These are explained in "`<<basics>>`".

Since this upstream source lacks the upstream *Makefile*, that functionality needs to be provided by the maintainer.  This upstream source contains only a script file and data files and no C source files; the *build* process can be skipped but the *install* process needs to be implemented.  For this case, this is achieved cleanly by adding the *debian/install* and *debian/manpages* files without complicating the *debian/rules* file.

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

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

.*debian/control* (maintainer version, v=0.2):
----
include::../examples/debhello-0.2_build-1/step302.slog[]
----

WARNING: If you leave "`*Section: unknown*`" in the template *debian/control* file unchanged, the *lintian* error may cause a build failure.

.*debian/install* (maintainer version, v=0.2):
----
include::../examples/debhello-0.2_build-1/step304.slog[]
----

.*debian/manpages* (maintainer version, v=0.2):
----
include::../examples/debhello-0.2_build-1/step305.slog[]
----

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

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

You can create a non-native Debian package using the *debuild* command (or its equivalents) in this source tree.  The command output is very verbose and explains what it does as follows.

----
include::../examples/debhello-0.2_build-1/step500.slog[lines=1..13]
 ...
include::../examples/debhello-0.2_build-1/step500.slog-binary[]
 ...
include::../examples/debhello-0.2_build-1/step500.slog-tail[]
----

Let's inspect the result.

.The generated files of *debhello* version *0.2* by the *debuild* command:
----
include::../examples/debhello-0.2_build-1/step600.slog[]
----

You see all the generated files.

* The *debhello_0.2.orig.tar.gz* file is a symlink to the upstream tarball.
* The *debhello_0.2-1.debian.tar.xz* file contains the maintainer generated contents.
* The *debhello_0.2-1.dsc* file is the meta data file for the Debian source package.
* The *debhello_0.2-1_all.deb* file is the Debian binary package.
* The *debhello_0.2-1_amd64.build* file is the build log file.
* The *debhello_0.2-1_amd64.buildinfo* file is the meta data file generated by *dpkg-genbuildinfo*(1).
* The *debhello_0.2-1_amd64.changes* file is the meta data file for the Debian binary package.

The *debhello_0.2-1.debian.tar.xz* file contains the Debian changes to the upstream source as follows.

.The compressed archive contents of *debhello_0.2-1.debian.tar.xz*:
----
include::../examples/debhello-0.2_build-1/step701.slog[]
----

The *debhello_0.2-1_amd64.deb* file contains the files to be installed as follows.

.The binary package contents of *debhello_0.2-1_all.deb*:
----
include::../examples/debhello-0.2_build-1/step700.slog[]
----

Here is the generated dependency list of *debhello_0.2-1_all.deb*.

.The generated dependency list of *debhello_0.2-1_all.deb*:
----
include::../examples/debhello-0.2_build-1/step702.slog[]
----
(No extra dependency packages required since this is a POSIX shell program.)

NOTE: If you wish to replace upstream provided PNG file *data/hello.png* with maintainer provided one *debian/hello.png*, editing *debian/install* isn't enough.  When you add *debian/hello.png*, you need to add a line "`include-binaries`" to *debian/source/options* since PNG is a binary file. See *dpkg-source*(1).
