Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] create .deb from upstream source

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
Chrisdb
Posts: 279
Joined: 2018-04-10 07:16

[SOLVED] create .deb from upstream source

#1 Post by Chrisdb »

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/debm ... 04.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
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: create .deb from upstream source

#2 Post by Head_on_a_Stick »

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.
deadbang

Chrisdb
Posts: 279
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

#3 Post by Chrisdb »

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
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: create .deb from upstream source

#4 Post by Head_on_a_Stick »

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.
deadbang

shep
Posts: 423
Joined: 2011-03-15 15:22

Re: create .deb from upstream source

#5 Post by shep »

Sometimes upstream will give *.deb specific instructions.

https://github.com/johanmalm/jgmenu/blo ... an-package

User avatar
Soul Singin'
Posts: 1605
Joined: 2008-12-21 07:02

Re: create .deb from upstream source

#6 Post by Soul Singin' »

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.

Chrisdb
Posts: 279
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

#7 Post by Chrisdb »

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
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 72 times

Re: create .deb from upstream source

#8 Post by stevepusser »

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.
MX Linux packager and developer

Chrisdb
Posts: 279
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

#9 Post by Chrisdb »

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/debm ... maintainer

Happy newyear everybody btw :D

User avatar
Soul Singin'
Posts: 1605
Joined: 2008-12-21 07:02

Re: create .deb from upstream source

#10 Post by Soul Singin' »

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!

Chrisdb
Posts: 279
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

#11 Post by Chrisdb »

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
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: create .deb from upstream source

#12 Post by Head_on_a_Stick »

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.
deadbang

Chrisdb
Posts: 279
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

#13 Post by Chrisdb »

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
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: create .deb from upstream source

#14 Post by Head_on_a_Stick »

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.
deadbang

Chrisdb
Posts: 279
Joined: 2018-04-10 07:16

Re: create .deb from upstream source

#15 Post by Chrisdb »

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

Post Reply