1

On my linux (Ubuntu 11.04) development machine. I often need to install libraries from source. This always causes problems for me because the package manager doesn't consider packages installed from source when it checks dependencies. This makes the package manager worthless to me since once I install one set of libs from source (especially if they are vital to the gnome environment i.e. gstreamer), I can never use it again without screwing up my entire distro with mixed dependencies. It seems to me that it would be relatively simple to check the dependencies with pkg-config without having to worry with the deb database. I don't mind writing a little code here. Does anyone have any ideas?

tripleee
  • 175,061
  • 34
  • 275
  • 318
Jonathan Henson
  • 8,076
  • 3
  • 28
  • 52
  • I guess it would be better to build a .deb of the packages you want to install. I don't know exactly how that works, but should not be too hard for a programmer to do. A .rpm, at least, is built quite easy... – glglgl Aug 09 '11 at 19:15
  • 2
    When I had that problem regularly, I usually made a self build debian package and so the package manager had all needed information. – AProgrammer Aug 09 '11 at 19:17
  • @glglgl so after I compile with configuration I want, I can just dump the binaries into a .deb? I would like to know how to do this. Also, I would still like aptitude to get smarter--which I don't mind helping them with as I know Open Source developers are busy--because it is just plain silly that they don't call pkg-config to check for installed dependencies. – Jonathan Henson Aug 09 '11 at 19:18
  • @AProgrammer #glglgl could you guys provide me with a link on how to do what you are recommending? It's a cheap point for both of you. To everyone else, I still would like to fix this to where I don't have to do this every-time. – Jonathan Henson Aug 09 '11 at 19:22
  • As said, I don't know exactly. But I am sure that Debian provides an appropriate program to do so. With RPM you write a .spec file, put it and the sources to the right place, run `rpmbuild` and you have a source package and a binary package. Neat thing... – glglgl Aug 09 '11 at 19:23
  • @glglgl, will the rpm package be recognized in apt as already installed? – Jonathan Henson Aug 09 '11 at 19:24
  • That's covered (with other things, I never build a fully conformant one) there: http://www.debian.org/doc/manuals/maint-guide/. – AProgrammer Aug 09 '11 at 19:24
  • 4
    The `equivs` package was designed specifically for this purpose. It allows you to create an empty dummy package with the desired name. Install that instead, and the package manager will be happy. (It's not worthless, it is doing its job, and saving people's bottoms every day. The `--force-depends` flag allows you to override dependency constraints for individual invocations.) – tripleee Aug 09 '11 at 19:26
  • rpm and Debian don't mix very well, but a .rpm integrates into the packet manager as a normal packet as if it had been provided by the distributor. But I think that is as well the case with .deb on Debian. Normally, these scripts include as well symbols about what the packages provide and require in order to get the dependencies right. – glglgl Aug 09 '11 at 19:27
  • @tripleee, I do love the usefulness of apt, otherwise I wouldn't be asking the question. I just don't understand why they couldn't also run pkg-config if the .deb package isn't found. I think this would be a useful feature, and I don't mind writing it. Thanks for the equivs suggestion, I'll look into it and vote you up if it checks out. – Jonathan Henson Aug 09 '11 at 19:30
  • @tripleee Well, never mind that was #Henning that suggested that. If you want a vote, put that into an answer. – Jonathan Henson Aug 09 '11 at 19:31

3 Answers3

7

Alternatively, you should look into the equivs package, which is made exactly for the purpose of creating empty .debs that will make apt/dpkg think a certain package is installed when it isn't.

hmakholm left over Monica
  • 23,074
  • 3
  • 51
  • 73
3

Grab the source package from Debian unstable and build a .deb from that using the developer tools. If you need an even newer upstream version, you can apply the .diff.gz part of the Debian source to an upstream tarball and get a build infrastructure that has good chances of working. If if doesn't, I'm sure the package maintainer would appreciate patches to make it work with the new upstream version.

hmakholm left over Monica
  • 23,074
  • 3
  • 51
  • 73
  • by developer tools I assume you mean gcc, make, and the like? How do I build the .deb once I have compiled the source? Also, can I use the source from the actual project location. I.e. git, svn, hg? – Jonathan Henson Aug 09 '11 at 19:27
  • I mean the various scripts Debian developers use to automate package building. Most are in the `dpkg-dev` package, if I remember correctly; the one you'll need here is `dpkg-buildpackage`. Truth to be told, I don't recall exactly how I learned to use them. The information is in the various Debian [developer manuals](http://www.debian.org/doc/devel-manuals), intermixed with project administrativa that won't interest you. Try skimming through the `packaging-tutorial`, through. – hmakholm left over Monica Aug 09 '11 at 19:43
  • 1
    Thanks for your help here I will learn to do this. In the mean time, I just got equivs to work and that will serve my purposes. – Jonathan Henson Aug 09 '11 at 19:45
  • (And yes, you can use the upstream source. In fact the package-specific Debian build architecture is always distributed as a patch relative to the upstream source, so you have a chance to cull source changes out of the patch if you don't want them). – hmakholm left over Monica Aug 09 '11 at 19:46
  • Old-style Debian packages were based on the existence of a pristine upstram tarball. There are weird packages which had to work around this assumption for various reasons, but usually, you could basically just extract a newer tarball on top of an extracted .deb source and run `debuild`. – tripleee Aug 09 '11 at 20:03
  • Take care to give your own packages sane version numbers, and maybe pin them in your apt config. Take a look at how backports and Ubuntu packages are numbered. – tripleee Aug 09 '11 at 20:06
2

Another option would be checkinstall. It creates a .deb package containing dependency information, but also you will be able to uninstall it via package management.

Dario Seidl
  • 4,140
  • 1
  • 39
  • 55