Author Topic: How to create a -devel package?  (Read 297 times)

Offline sling-shot

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1730
  • Satyameva Jayate | Truth Alone Triumphs.
How to create a -devel package?
« on: January 30, 2013, 03:37:07 AM »
I am looking for guidelines to creating a -devel package. I have gone through some of the .spec files that create both a library and a devel package.

I am particularly interested to know :
1. How to determine if a particular package can have a -devel version?
2. How to know what %files to be included in the devel section?

I am looking to package a library that is currently not in our repository so I do not have a referene .spec file to go with.
Packaging well will cure headaches of many :) But learning to package will cause headaches in many :(

AMD AthlonX2 3600+/ASUS M2NPV-VM/ATi HD4670/Onboard sound/3.5GB DDR2-533 RAM/SEAGATE 160+320GB HDD/DELL S2240L FullHD/Creative SBS370 2.1/PCLinuxOS2013/KDE4
Samsung NP305U1-A06IN | Nokia E6

Offline TerryN

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 725
Re: How to create a -devel package?
« Reply #1 on: January 30, 2013, 04:05:16 AM »
I am particularly interested to know :
1. How to determine if a particular package can have a -devel version?
2. How to know what %files to be included in the devel section?

A package will have a -devel if it provides a library that other packages will want to use in their builds.  It's just like when you build normal packages you use BuildRequires to locate the -devel packages required by the build.
For example: libpng3 provides a library which takes care of handling png images.  Any developer who wants to handle png images can use code provided in libpng rather than writing their own routines.  To do so the developer will install libpng-devel which will install the necessary development files to enable the code to call libpng3 to be included in the build.

The files to include in the devel package are the files needed for other applications to include the library code in their build.  These include (but are not limited to):

header (.h) files (usually found in %{_includedir})
linker libraries (.so) files (usually found in %{_libdir} or a subdirectory of)
pkgconfig (.pc) files (usually found in %{_libdir}/pkgconfig)
any documentation specifically aimed at developers

You need to be very careful which files you put in the runtime package and which you put in the -devel package.  Getting it wrong can result in lots of -devel packages being pulled in as dependencies when users install your package.  See http://www.pclinuxos.com/forum/index.php/topic,101266.msg905539.html#msg905539  section on devel dependencies.
Also you should avoid packaging any .la files if they are produced during the build otherwise it can lead to problems like this.  

Terry.

« Last Edit: January 31, 2013, 05:04:52 AM by TerryN »
Dell E521 - AMD 64 X2 5000+, 4GB RAM, ATI X1300 graphics
PCLinuxOS 2013 (KDE)
|Twitter|

Offline sling-shot

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1730
  • Satyameva Jayate | Truth Alone Triumphs.
Re: How to create a -devel package?
« Reply #2 on: January 31, 2013, 09:16:29 AM »
TerryN, I am not sure I understand where to put rm -rf as outlined by Texstar in that link above.
I suppose it should be placed somewhere in the .spec file may be after %make install?

Does this mean that effective from now on, *.la files are banned unless specifically indicated?
Packaging well will cure headaches of many :) But learning to package will cause headaches in many :(

AMD AthlonX2 3600+/ASUS M2NPV-VM/ATi HD4670/Onboard sound/3.5GB DDR2-533 RAM/SEAGATE 160+320GB HDD/DELL S2240L FullHD/Creative SBS370 2.1/PCLinuxOS2013/KDE4
Samsung NP305U1-A06IN | Nokia E6

Offline TerryN

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 725
Re: How to create a -devel package?
« Reply #3 on: January 31, 2013, 09:46:45 AM »
TerryN, I am not sure I understand where to put rm -rf as outlined by Texstar in that link above.
I suppose it should be placed somewhere in the .spec file may be after %make install?

Does this mean that effective from now on, *.la files are banned unless specifically indicated?

The .la files should not be packaged but unfortunately some -devel packages do have them and so they get installed at build time.  This can lead to errors during the build like the example here.  If you see this sort of error you run the rm -rf to get rid of any *.la files that were installed and then run the build again.

To avoid packaging *.la files the SPEC should have something like:

Code: [Select]
find %{buildroot} -name '*.la' -delete
in the %install section after the %make install or

Code: [Select]
%exclude %{_libdir}/*.la
in the %files section.

Terry.
Dell E521 - AMD 64 X2 5000+, 4GB RAM, ATI X1300 graphics
PCLinuxOS 2013 (KDE)
|Twitter|

Offline sling-shot

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1730
  • Satyameva Jayate | Truth Alone Triumphs.
Re: How to create a -devel package?
« Reply #4 on: January 31, 2013, 09:49:37 AM »
Thank you :)
Packaging well will cure headaches of many :) But learning to package will cause headaches in many :(

AMD AthlonX2 3600+/ASUS M2NPV-VM/ATi HD4670/Onboard sound/3.5GB DDR2-533 RAM/SEAGATE 160+320GB HDD/DELL S2240L FullHD/Creative SBS370 2.1/PCLinuxOS2013/KDE4
Samsung NP305U1-A06IN | Nokia E6

Offline ghostbunny

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1168
Re: How to create a -devel package?
« Reply #5 on: January 31, 2013, 03:08:28 PM »
I have a further question.

What about *.a files? they are also devel libraries but shall we delete them too?
The full life is a big mess

PS:
I'm German. Sorry because of possible mistakes in my written messages xD


Offline TerryN

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 725
Re: How to create a -devel package?
« Reply #6 on: January 31, 2013, 03:28:06 PM »
What about *.a files? they are also devel libraries but shall we delete them too?

Like .la files they are intended for static linking which is undesirable but they don't cause build problems like .la files.  Either remove them or put them in a separate -static-devel subpackage.

Terry.
« Last Edit: January 31, 2013, 03:35:35 PM by TerryN »
Dell E521 - AMD 64 X2 5000+, 4GB RAM, ATI X1300 graphics
PCLinuxOS 2013 (KDE)
|Twitter|

Offline ghostbunny

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1168
Re: How to create a -devel package?
« Reply #7 on: January 31, 2013, 03:50:29 PM »
Thanks Terry,

i update currently libupnp there are .la and .a files included in the devel package i delete this files now.

regards
ghostbunny
The full life is a big mess

PS:
I'm German. Sorry because of possible mistakes in my written messages xD