How to make debian file from scratch

PLEASE LINK METHOD 1 AND 2 WITH SAMBA , AND EXPLAIN WHY WE SHOULD USE METHOD 1 & 2 AND WHICH RELATION HAS WITH SAMBA


Question: How to make  debian file from scratch ?

Answer:

First you need to download  some  dependencies  requered to build  a Debian files :

sudo apt-get install autotools-dev fakeroot dh-make build-essential

 

Methode 1

$ wget http://www.example.com/downloads/example.tar.gz
( Or use any common method you have used for download a file)

Now Extract the tar.gz file (it will automatically create a folder with first part of filename)
(for getting # prompt type sudo su and give your password)

#tar -xzvf example.tar.gz
#cd example
#./configure
#make
#sudo checkinstall

Methode 2

tar-zxvf example.tar.gz
cd example
# dh_make  -e (email) -f ../example.tar.gz

and pick Single for single binary, or whatever is appropriate for your project.

Edit the debian/control file and at least change the Maintainer and Description fields. There are a few other files you will probably want to edit.

Then run the following: (this has to be done as root)
# dpkg-buildpackage -rfakeroot

 

Lets  Show  you  example   of  Samba

1-Download  some  requered build  dependencies for  samba  with

sudo apt-get build-dep samba

2-Make  the debian directory  with :

dh_make  -e webmaster@unixmen.com -f ../samba-3.5.9.tar.gz 

Type of package: single binary, indep binary, multiple binary, library, kernel module, kernel patch?
[s/i/m/l/k/n] s

Maintainer name : Mel Kham
Email-Address    : webmaster@unixmen.com
Date                : Tue, 14 Jun 2011 10:13:08 -0400
Package Name     : samba
Version            : 3.5.9
License            : blank
Type of Package : Single
Hit <enter> to confirm:

3-Now  run  this  command to  start  building

dpkg-buildpackage -rfakeroot
dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2
dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor):
dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2
dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2
dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): -Wl,-Bsymbolic-functions
dpkg-buildpackage: source package samba
dpkg-buildpackage: source version 3.5.9-1
dpkg-buildpackage: source changed by Mel Kham <webmaster@unixmen.com>
dpkg-buildpackage: host architecture i386
dpkg-source --before-build samba-3.5.9

4-After  a  While check if  the  debian files has  been created

 

pirat9@Server-unixmen:~/Downloads/samba-3.5.9$ ls ../
samba-3.5.9                  samba_3.5.9-1.dsc           samba_3.5.9-1_i386.deb   samba-3.5.9.tar.gz
samba_3.5.9-1.debian.tar.gz  samba_3.5.9-1_i386.changes  samba_3.5.9.orig.tar.gz