Creating deb file in Debian using github source code and debuild tools

I want to compile nginx (with custom libs) using up-to-date source code from GitHub. But if I download the code from GitHub, obviously, there is no "debian" folder and inner files.

So, when I use debuild command: i.e., debuild clean I see the error:

debuild: fatal error at line 629:
cannot find readable debian/changelog anywhere!
Are you in the source code tree?

Is it possible to auto generate all files in debian folder? Or, do I have to do it manually?


One could make a system for autogenerating simple packages, but I have seen none. All of the Debian packages which I know about have hand-built rules files. Aside from that, most of the files in the debian subdirectory look much the same (with scriptable differences) across packages.

For what it's worth, I have built 48 different packages for my own work, and provide the corresponding scripts in the source-tarballs, but in a different subdirectory to avoid conflict with Debian's packagers. Debian does not distribute their build-scripts within the source tarballs, because their policy is to distribute patches against a pristine (unmodified) upstream source. So likely the only sources where you would see the two combined are from developers who build their own packages.

You might be able to adapt the scripts from a given Debian package (though some have odd quirks). To start, you need to find the package scripts. I usually go to the bug-reporting page

https://www.debian.org/Bugs/

and (not all packages are named consistently), search for bugs on that package, e.g., nginxenter link description here. On that page, is a pointer to the package page. Within that, there are links pointing to the package as of different releases, e.g., jessie (stable), and following that link takes you to a page on which there are (on the extreme right) links to

  • [nginx_1.6.2.orig.tar.gz] (pristine source)
  • [nginx_1.6.2-5.debian.tar.xz] (Debian scripts)

Debian's build-system assumes those pieces are available separately; for my own builds I wrote a script which assumes that my scripts are in the different location referred to. For either solution, you may have additional reading to do.