[[modpkg]]
=== Modifications

Let's assume we have an older upstream source tarball *hello-c-0.9.tar.gz* than the *hello-c-1.0.tar.gz* in <<simple>>.  The *Makefile* of version 0.9 installs its binary to the fixed location */usr/local/bin/hello* and does not support *$(DESTDIR)*.

There are several methods (see <<patchapproach>>) to prepare the *-p1* patch needed for applying modifications to this *0.9* upstream source.  Let's use the *dquilt* command.


[[dquiltex]]
==== Patch file by the *dquilt* command

Here we show the method with the *dquilt* command.

The packaging procedure is the same as that of version 1.0 up to running the *debmake* command.

----
sys::[head -n5  ../hello-c-0.9_q/ref/step200.log]
 ...
 ... (snip)
 ...
sys::[tail -n2  ../hello-c-0.9_q/ref/step200.log]
----

The "*dquilt new* ..." command sets the name of the patch.

The "*dquilt add* ..." command sets the files to be modified.

----
include::../hello-c-0.9_q/ref/step300.log[]
----

The *vim* command edits the *Makefile* to support *$(DESTDIR)*..

The "*dquilt refresh* ..." command records the modification as the *-p1* patch in the *debian/patches/* directory.

----
include::../hello-c-0.9_q/ref/step301.log[]
----

The "*dquilt header -e* ..." command adds the http://dep.debian.net/deps/dep3/[DEP-3: Patch Tagging Guidelines] compatible patch header.

The "*dquilt pop -a*" command removes all applied patches from the source.

----
include::../hello-c-0.9_q/ref/step302.log[]
----

For the proper packaging, you are required to make further modification here. 

For learning purpose, let's leave such details and move on. You can create a non-native Debian package using the *debuild* command (or its equivalents) in this source tree.

----
sys::[head -n3  ../hello-c-0.9_q/ref/step500.log]
 ...
sys::[grep -B 1 -A 1 -e '^ fakeroot debian/rules clean' ../hello-c-0.9_q/ref/step500.log]
 ...
sys::[grep -A 1 -e '^ debian/rules build' ../hello-c-0.9_q/ref/step500.log]
 ...
sys::[grep -A 1 -e '^ fakeroot debian/rules binary' ../hello-c-0.9_q/ref/step500.log]
 ...
sys::[tail -n1  ../hello-c-0.9_q/ref/step500.log]
----

Let’s inspect files.

.The generated files of version 0.9 by the debuild command:
----
include::../hello-c-0.9_q/ref/step600.log[]
----

.The source package contents of version 0.9:
----
include::../hello-c-0.9_q/ref/step700.log[]
----

.The binary package contents of version 0.9:
----
include::../hello-c-0.9_q/ref/step701.log[]
----

