pkgsrc tips (Was Re: Proper choice of package management strategy)

Amadeus amadeus.stevenson at
Sat Jan 20 09:35:43 PST 2007

Hi list,

Seeing as I haven't tried pkgsrc on Linux before I decided to try it out 
on my host system, Fedora Core 6, to see if anything needed tweaking (I 
use pkgsrc on netbsd so am fairly familiar with it), especially as I 
have justly "blindly recommended" it :)

Hopefully this will be helpful to anyone else trying (perhaps the 
makings of a hint if someone with LFS went through similar examples?).

I started from scratch to compile "tuxracer" (what else? :)

Following the on-line documentation I extracted pkgsrc.tar.gz (from to /usr, and ran /usr/pkgsrc/bootstrap/bootstrap.

To compile and install into /usr/pkg/{bin,lib,etc} (including dependencies):

cd /usr/pkgsrc/games/tuxracer && make && make install

Things I tweaked in my /usr/pkgsrc/etc/mk.conf:

X11BASE = /usr #pkgsrc looks for include/X11/X.h on the host system, 
which, for me, was in /usr

I had to use /usr/pkgsrc/bin/bmake instead of "make" to make install 
I had to make sure /usr/pkg/bin/pkg-config was used not my host's copy 
in /usr/bin (ie. set PATH)
I had to install /usr/pkgsrc/devel/imake for some X11 dependencies. This 
involved fixing the xorg-cf-files Makefile. This also involved 
installing x11/xproto manually (ie. the dependency wasn't handled). I 
also had to bash it into working by faking pkg-config output.
For the SDL dependency -> nas dependency I had to bodge 
work/.tools/bin/imake as well as pkg-config :( I removed nas support in 
SDL as a quick fix after this failed.

I also specified CFLAGS += in the mk.conf for optimizations (note the += 
not and =, as some packages require special CFLAGS...)

Sources are stored in /usr/pkgsrc/distfiles (in case you need to 
manually download any).

Make sure your PATH and MANPATH point to /usr/pkg (or whatever you chose 
for the pkgsrc base.)

There is a nice "bmake show-options" functionality which lets you 
configure the packages so as not to compile unwanted supports for kde 
etc. You can globally set options in mk.conf (ala portage). I couldn't 
figure out how to show-options for dependencies automatically tho. 
"bmake clean CLEANDEPENDS=YES" is useful.


pkgsrc checks its own pkg db for dependency checking (by default in 
/var/db). For a fresh pkgsrc install this was empty so all the 
dependencies were compiled (even though most of them already existed on 
the host system, just not in /var/db). You could add fake entries into 
/var/db but that's an ugly fudge.

After compiling and installing tuxracer (which works) I checked what 
pkgsrc had compiled and installed for this using the "pkg_info" tool in 

[amadeus at poff SDL]$ /usr/pkg/sbin/pkg_info
imake-1.0.2         Imake and other utilities from modular
renderproto-0.9.2   Render extension headers from modular
perl-5.8.8nb3       Practical Extraction and Report Language
expat-2.0.0nb1      XML parser library written in C
Xft2-2.1.7nb2       Library for configuring and customizing font access
freetype2-2.2.1nb2  Font rendering engine and library API
jpeg-6bnb3          IJG's jpeg compression utilities
arts-1.5.5          Analog Real-Time Synthesizer
Xfixes-2.0.1nb4     X Fixes extension of X RandR
Xrender-0.9.0nb1    Client library for the X Rendering Extension protocol
aalib-    ASCII Art library
autoconf-2.61       Generates automatic source code configuration scripts
xproto-7.0.9nb3     X protocol and ancillary headers from Xorg X11
png-1.2.14nb1       Library for manipulating PNG images
automake-1.10       GNU Standards-compliant Makefile generator
randrproto-1.1.2    Randr extension headers from modular
qt3-libs-3.3.7      C++ X GUI toolkit
pkg_install-20061103 Package management and administration tools for pkgsrc
xcursor-1.1.2nb2    Client-side cursor loading library for X
pax-20060202        POSIX standard archiver with many extensions
xpkgwedge-1.16      Allows X11 pkgs to be built and used outside of 
p5-perl-headers-2.6.18-1.2869.fc6nb3 Perl header files
glib2-2.12.4nb1     Some useful routines for C programming (glib2)
tcl-8.4.14          Ousterhout's Tool Command Language, a scripting language
unzip-5.52nb3       List, test and extract compressed files in a ZIP archive
libmad-0.15.1bnb1   High-quality MPEG audio decoder
bootstrap-mk-files-20061111 *.mk files for the bootstrap bmake utility
nasm-0.98.39nb2     General-purpose x86 assembler
smpeg-0.4.4nb13     SDL MPEG Player Library
Xrandr-1.0.2nb3     X RandR extension (Library)
libaudiofile-0.2.6nb1 Sound library for SGI audio file
digest-20060826     Message digest wrapper utility
libogg-1.1.3        Ogg project codecs library
mng-1.0.9nb1        Multiple-image Network Graphics (MNG) reference library
libtool-base-1.5.22nb4 Generic shared library support script (the script 
MesaLib-6.4.2nb2    Graphics library similar to SGI's OpenGL
mtree-20040722      Utility for mapping and checking directory hierarchies
libvorbis-1.1.2     Library for the Ogg Vorbis audio encoding format
x11-links-0.30      Shadow tree of links to native X11 headers and libraries
tiff-3.8.2nb3       Library and tools for reading and writing TIFF data 
lcms-1.15nb2        Light Color Management System -- a color management 
SDL-1.2.11nb1       Simple DirectMedia Layer, a cross-platform 
multimedia library
tnftp-20050625      The enhanced FTP client in NetBSD
pkgmanpages-20050911 Manual page(s) for the packages collection
SDL_mixer-1.2.7nb1  Multi-channel audio mixer library
tuxracer-0.61nb12   3D penguin racing game using OpenGL
xorg-cf-files-1.0.2 Xorg imake rules
esound-0.2.36nb1    The Enlightened sound daemon
glu-6.4.2           GLU polygon tessellation facility for Mesa
fontconfig-2.4.2    Library for configuring and customizing font access
pkg-config-0.21     System for managing library compile/link flags
qt3-tools-3.3.7     QT GUI (WYSIWYG) builder and other tools

I should note I only specified not to include nas support in my mk.conf, 
and had I specified other supports to be removed less of the above stuff 
would have been compiled.

I also checked against which libraries tuxracer was compiled...

[amadeus at poff SDL]$ ldd `which tuxracer` =>  (0x00d68000) => /usr/lib/ (0x00c93000) => /usr/lib/ (0x00c77000) => /usr/lib/ (0x00aa1000) => /usr/lib/ (0x006de000) => /usr/lib/ (0x00ba5000) => /usr/lib/ (0x007d0000) => /usr/lib/ (0x00761000) => /lib/ (0x00a75000) => /usr/pkg/lib/ (0x00110000) => /usr/pkg/lib/ (0x001f2000) => /lib/ (0x00a7b000) => /usr/pkg/lib/ 
(0x002ae000) => /usr/pkg/lib/ (0x0032f000) => /usr/pkg/lib/ (0x007e7000) => /usr/lib/ (0x0090b000) => /lib/ (0x00a4c000) => /lib/ (0x006bc000) => /lib/ (0x00d69000) => /usr/lib/ (0x00a9c000) => /usr/lib/ (0x00a94000)
        /lib/ (0x008f0000) => /usr/pkg/lib/ (0x006e6000) => /usr/pkg/lib/ (0x00bb5000) => /usr/lib/ (0x008bc000)

pkgsrc include paths included /usr/lib so a lot of the libraries are not 
the ones compiled by pkgsrc...

I manually updated /usr/pkg/lib/ to my system's 
/usr/lib/ to get hardware accelerated tuxracer.

It seems to me to be an "all or nothing" affair. Either use it from the 
beginning of your LFS installation to compile everything (and thus 
against the "spirit" of LFS as discussed in the original thread 
vis-a-vis portage etc) or don't use it, unless you want wasted 
space/time although arguably the ease of "make install" might save you 
lots (of time)...

It always comes down to personal preference...

Great, I can get back to some work now :)



ps. If there's a package you can't find in pkgsrc try pkgsrc-wip (work 
in progress)

Zeb Packard wrote:
> The one thing I would really like though, is some sort of general
> "here's how to handle dependancies in PM"

More information about the lfs-support mailing list