[SOLVED] create .deb from upstream source

If none of the more specific forums is the right place to ask

[SOLVED] create .deb from upstream source

Postby Chrisdb » 2019-12-31 10:22

I've been looking for some decent and up-to-date documentation about creating deb files from upstream sources. During my search, I found the following:
https://www.debian.org/doc/manuals/debmake-doc/ch04.en.html

Can anyone tell me if this is the preferred way, or are there other tutorials/tools out there...

thx
Last edited by Chrisdb on 2020-01-02 16:34, edited 1 time in total.
User avatar
Chrisdb
 
Posts: 156
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

Postby Head_on_a_Stick » 2019-12-31 10:40

Chrisdb wrote:if this is the preferred way

Yes, debmake is the most convenient option, it fills in most of the debian folder contents for you.
User avatar
Head_on_a_Stick
 
Posts: 11021
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: create .deb from upstream source

Postby Chrisdb » 2019-12-31 11:14

One thing I don't understand is this:
Code: Select all
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.


Does this mean that an installed deb would reside next to stable software packages?
I would think that upstream produced binaries would some day collide with the stable packages, or am I missing something?
User avatar
Chrisdb
 
Posts: 156
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

Postby Head_on_a_Stick » 2019-12-31 11:17

Most programs should install to DESTDIR, which dpkg will automatically convert to /usr/bin (not /usr/local/bin), so that's not something you usually have to worry about.
User avatar
Head_on_a_Stick
 
Posts: 11021
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: create .deb from upstream source

Postby shep » 2019-12-31 13:36

Sometimes upstream will give *.deb specific instructions.

https://github.com/johanmalm/jgmenu/blob/master/INSTALL.md#build-a-debian-package
shep
 
Posts: 353
Joined: 2011-03-15 15:22

Re: create .deb from upstream source

Postby Soul Singin' » 2019-12-31 14:23

Chrisdb wrote:I've been looking for some decent and up-to-date documentation about creating deb files from upstream sources.

HowTo Build a Package from Source the Smart Way. It's a little out-of-date (10 years old), but still a good starting point.

Chrisdb wrote:One thing I don't understand is this:
Code: Select all
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.


Does this mean that an installed deb would reside next to stable software packages?
I would think that upstream produced binaries would some day collide with the stable packages, or am I missing something?

I think you're both missing something and understanding correctly at the same time.

The page begins by explaining how source is traditionally compiled using the "make install" process. The sentence that you quoted is from that section. It means that Debian packaging requires changing that process.

What you understand correctly is that installation of the DEB package (that you build) would place the files in /usr/bin/ alongside your other software packages. You also understand correctly that the package you build will "some day collide" with a Debian version of that package.

What you're missing is the version number. If the package that you build has a higher version number than the package available from Debian, then APT will not touch your package. APT assumes that you prefer the package with the higher version number (unless you specify a different preference with pinning).

Of course, one day in the future, Debian may offer a version that is newer than the one you built. If so, APT will upgrade to that newer version. That's what most people prefer, so in most cases there's no issue.

But if your compiled package supports a particular feature and if that feature differs from what Debian's package supports, you might prefer your own package. If so, you can use pinning to prevent the upgrade. Or your can build yourself yet another package that suits your tastes and preferences.
User avatar
Soul Singin'
 
Posts: 1607
Joined: 2008-12-21 07:02

Re: create .deb from upstream source

Postby Chrisdb » 2019-12-31 22:02

Soul Singin' wrote:HowTo Build a Package from Source the Smart Way. It's a little out-of-date (10 years old), but still a good starting point.


Thx for the link. Like you said it is a good starting point. What do you think about debmake and debuild in contrast to running dh-make and dpkg-buildpackage?

Another question, in the rules file I see the following:
Code: Select all
override_dh_auto_install: dh_auto_install -- prefix=/usr


Shouldn't the prefix be used with 'override_dh_auto_configure'?
User avatar
Chrisdb
 
Posts: 156
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

Postby stevepusser » 2019-12-31 22:13

Chrisdb wrote:
Soul Singin' wrote:HowTo Build a Package from Source the Smart Way. It's a little out-of-date (10 years old), but still a good starting point.


Thx for the link. Like you said it is a good starting point. What do you think about debmake and debuild in contrast to running dh-make and dpkg-buildpackage?

Another question, in the rules file I see the following:
Code: Select all
override_dh_auto_install: dh_auto_install -- prefix=/usr


Shouldn't the prefix be used with 'override_dh_auto_configure'?


What particular rules file are you referring to? Anyway, what you have to use depends on how the upstream Makefile or whatever is configured and installing the files. If you're lucky, you don't have to do any overrides, but sometimes the install prefix is set in either the configuration or the install step--sources vary wildly.

Are you trying to package any project in particular? Maybe someone has already done the packaging work for you, and you can copy it.
The MX Linux repositories: Backports galore! If we don't have something, just ask and we'll try--we like challenges. New packages: Kodi 18.5, Featherpad 0.12.0, PulseEffects 4.7.0, KeepassXC 2.5.2, SuperTuxKart 1.1, Waterfox 2019.12
User avatar
stevepusser
 
Posts: 11397
Joined: 2009-10-06 05:53

Re: create .deb from upstream source

Postby Chrisdb » 2019-12-31 22:35

I was thinking of the most recent php version 7.4 and it has several configure options. I know there is a SURY PHP Repository, but I would like to create a Deb file myself :D

stevepusser wrote:What particular rules file are you referring to?

Are you trying to package any project in particular? Maybe someone has already done the packaging work for you, and you can copy it.

I was referring to:
https://www.debian.org/doc/manuals/debmake-doc/ch04.en.html#step-maintainer

Happy newyear everybody btw :D
User avatar
Chrisdb
 
Posts: 156
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

Postby Soul Singin' » 2019-12-31 23:20

Chrisdb wrote:I was thinking of the most recent php version 7.4 and it has several configure options. I know there is a SURY PHP Repository, but I would like to create a Deb file myself :D

In that case, take a look at Ondrej Sury's work. Study his Debian-ization of the upstream source and then build your own DEB packages.

Chrisdb wrote:Happy newyear everybody btw :D

Happy New Year to you too!

And happy DEB building! Have fun!
User avatar
Soul Singin'
 
Posts: 1607
Joined: 2008-12-21 07:02

Re: create .deb from upstream source

Postby Chrisdb » 2020-01-01 08:30

Soul Singin' wrote:In that case, take a look at Ondrej Sury's work. Study his Debian-ization of the upstream source and then build your own DEB packages.


Thx for the info :D

Maybe this is also an opportunity for you to update your wiki :wink:
User avatar
Chrisdb
 
Posts: 156
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

Postby Head_on_a_Stick » 2020-01-01 10:46

Chrisdb wrote:I was thinking of the most recent php version 7.4 and it has several configure options.

That version is in experimental: https://packages.debian.org/experimental/php7.4

Just add a deb-src line for experimental then update the package database and grab the source:
Code: Select all
apt source php7.4

^ That should download the package source from Debian, which will include the debian/ folder with all the patches and compilation options so you can build a custom version.
User avatar
Head_on_a_Stick
 
Posts: 11021
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: create .deb from upstream source

Postby Chrisdb » 2020-01-01 12:48

Head_on_a_Stick wrote:
Chrisdb wrote:I was thinking of the most recent php version 7.4 and it has several configure options.

That version is in experimental: https://packages.debian.org/experimental/php7.4

Just add a deb-src line for experimental then update the package database and grab the source:
Code: Select all
apt source php7.4

^ That should download the package source from Debian, which will include the debian/ folder with all the patches and compilation options so you can build a custom version.


Just to be sure, if I use source from unstable/experimental and I compile it on my stable system, I will not create a frankendebian right?
User avatar
Chrisdb
 
Posts: 156
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

Postby Head_on_a_Stick » 2020-01-01 12:53

Chrisdb wrote:if I use source from unstable/experimental and I compile it on my stable system, I will not create a frankendebian right?

That's right. FrankenDebians are Debian stable machines that have been polluted with packages from testing/unstable (or Ubuntu PPAs) but rebuilding the package in your stable environment will produce a "safe" backport.
User avatar
Head_on_a_Stick
 
Posts: 11021
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: create .deb from upstream source

Postby Chrisdb » 2020-01-02 16:33

Head_on_a_Stick wrote:
Chrisdb wrote:if I use source from unstable/experimental and I compile it on my stable system, I will not create a frankendebian right?

That's right. FrankenDebians are Debian stable machines that have been polluted with packages from testing/unstable (or Ubuntu PPAs) but rebuilding the package in your stable environment will produce a "safe" backport.


Thx. I will have a try with some packages
User avatar
Chrisdb
 
Posts: 156
Joined: 2018-04-10 07:16


Return to General Questions

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable