0

I am having a program which depends on libcurl.so, libsqlite3.so, libcrypto.so and libpthread.so

Package: myscript
Version: 0.1
Section: utils
Priority: optional
Architecture: all
Essential: no
Depends: curl | libcurl3, sqlite3 | libsqlite3-0, libcrypto++9 | libk5crypto3
Maintainer: Your Name
Description: Sample Program

My queries are, 1. I want to add libpthread dependency in the control file.My machine(linuxmint-17) is having a file named libthread.so.10. But while I am doing dpkg --get-selections , I am not getting any package containing pthread. It is a fresh installation of linuxmint(17) and I haven't manually installed any packages. 2.How will I ensure that this will work, let us say if libcurl4 or libcrypto++99 comes in future.Am I following the correct method or am I missing something.

BusyTraveller
  • 183
  • 3
  • 14

1 Answers1

1

At first, please read Debian documentation about control file.

What you need to specify in debian/control file are the -dev packages in section Source. In the section Package when you describe resulting binary package in most situation line Depends: ${shlibs:Depends}, ${misc:Depends} is sufficient. Make sure dh_shlibdeps is run debian/rules. As far as I know dh_make covers that for you - check the dh_make documentation.

Know the difference between libraries with .so and .so.some.numbers.here extenstions. Nice explanation is provided here.

So, in debian/control you should have one section for source package:

Source: packagename Build-Depends: packages-dev, other-packages-needed-for-build [other fields]

and one or more section for binary package(s) built from this source:

Package: packagename Depends: ${shlibs:Depends}, ${misc:Depends} [other fields]

How to determine what packages to put in Build-Depends? If you need option -lfoo to successfully link your software, that means you need to have a file libfoo.so available. The -pthread option implicitly adds -lpthread option. So, for PCRE you need to have libpcre.so file, for pthreads - libpthread.so. When you established names, run dpkg -S with all those file names as a parameters. You may want to grep the results to get only .so files, not .so.something.

arturcz@szczaw:~$ dpkg -S libpcre.so libpthread.so | grep '\.so$'
libpcre3-dev:amd64: /usr/lib/x86_64-linux-gnu/libpcre.so
libc6-dev:amd64: /usr/lib/x86_64-linux-gnu/libpthread.so

So, the packages name you want to put as a Build-Dependencies are: libc6-dev and libpcre3-dev. However, another rule is use in Debian. Some packages are considered as build essential and you do not need to put them into Build-Dependencies. libc6-dev is one of those packages. If you properly debianized your software, ${shlibs:Depends}, ${misc:Depends} would be replaced by proper content.

How will I ensure that this will work, let us say if libcurl4 or libcrypto++99 comes in future.Am I following the correct method or am I missing something.

You won't. If major number changed in the SONAME of the library, it means, the API or behaviour of both of the library changed. You need to compile your software again with the new library, making necessary changes in the code then test it and fix problems.

Further recommended reading:

ArturFH
  • 1,697
  • 15
  • 28
  • I am a bit confused about Build-Depends. I am making the debian package of a program which has already been successfully build and compiled to a binary file.Then, can you kindly tell me the significance of putting a build dependency in the control file – BusyTraveller Jun 09 '17 at 05:44
  • Are you going to share source form of the package with anybody, to let them compile and build package on their own? If no, you can skip that part. However please keep that in mind, it is not correctly prepared package, according to specification. Build-Depends is for other people to know what they need to install to successfully build your package from sources. And for tools like [pbuilder](https://pbuilder.alioth.debian.org/#aim). – ArturFH Jun 09 '17 at 08:07