Subject: Some work on pkgsrc on Darwin
To: None <tech-pkg@netbsd.org>
From: Eric Gillespie <epg@pretzelnet.org>
List: tech-pkg
Date: 02/11/2002 21:09:55
A few weeks ago i got my shiny new iBook and set out to get all the
programs i normally use working on OS X via pkgsrc. I am now done,
and what an adventure it has been. You can get the resulting binary
packages at <http://pretzelnet.org/pkg/darwin/>.
At <http://pretzelnet.org/~epg/pkgsrc-on-darwin/> i have put up all my
diffs and a new package, dlcompat. I found dlcompat from the Fink
project (http://fink.sourceforge.net/), but apparently it originally
comes from Apple. It's a dlopen wrapper so dynamically loading
modules works on Darwin.
I have also patched bsd.pkg.mk to buildlink to dlcompat automatically;
i'm not sure if i got this exactly right, but i think changing all the
packages which need dlopen to do this special thing on Darwin is
probably a mistake. Similarly, adding -no-cpp-precomp to a bunch of
separate package Makefiles (which i did) is probably not the best
solution. Putting it in mk.conf didn't seem to help. (Apple's gcc
pre-compiles headers by default, which doesn't work for some packages,
hence the -no-cpp-precomp option).
The single biggest problem on Darwin is dynamic libraries. There is a
version of libtool floating around out there (from the Fink people, i
believe; that's where i got it anyway) that produces shared libraries
on Darwin. I am not a libtool expert, and all my efforts at getting
pkgsrc's libtool to build shared libs on Darwin were met with failure.
Supposedly libtool HEAD contains the patches; i have not verified
this. pkgsrc's libtool does seem to contain at least some of the
necessary support. I had to edit Darwin.defs.mk to get pkgsrc to
recognize that Darwin can do shared libraries (this is in my diffs),
but that leads to a bigger problem.
The PLIST files refer to ELF so files. Mach-O dylib files have
drastically different naming conventions. At first i thought i could
use awk in bsd.pkg.mk to translate (as a matter of fact there was some
primitive support for this already) from ELF so to Mach-O dylib and
did so (this is in the diffs i put up). This worked on the package i
tested it with, but with no other packages. Here's why:
0 ~% uname -a
NetBSD trantor.pretzelnet.org 1.5.2 NetBSD 1.5.2 ($Id: TRANTOR,v 1.7 2001/11/24 20:48:33 epg Exp $) #3: Sat Nov 24 15:58:07 EST 2001 epg@trantor.pretzelnet.org:/u/src/sys/arch/i386/compile/TRANTOR i386
0 ~% ls /usr/pkg/lib/librep.*
/usr/pkg/lib/librep.a /usr/pkg/lib/librep.so /usr/pkg/lib/librep.so.11.1
/usr/pkg/lib/librep.la /usr/pkg/lib/librep.so.11
0 ~% rep --version
rep version 0.15.1
0 ~% uname -a
Darwin argo.pretzelnet.org 1.4 Darwin Kernel Version 1.4: Sun Sep 9 15:39:59 PDT 2001; root:xnu/xnu-201.obj~1/RELEASE_PPC Power Macintosh powerpc
0 ~% ls /usr/pkg/lib/librep.*
/usr/pkg/lib/librep.9.2.1.dylib /usr/pkg/lib/librep.dylib
/usr/pkg/lib/librep.9.dylib /usr/pkg/lib/librep.la
/usr/pkg/lib/librep.a
0 ~% rep --version
rep version 0.15.1
Same version of rep, both built from pkgsrc, yet completely different
shared library file names. I have no idea how to go about fixing
this. Just so i could get my software, i hacked each PLIST
individually. I didn't clutter the diffs on my web site with all that
nonsense.
Things have been rather hellish at work lately with no sign of getting
better, so i haven't looked at this stuff in about a week; it's
possible i've forgotten some of the things i did or learned. And i
wasn't able to solve a lot of the problems. But hopefully what i've
done and learned will be useful enough so that someone else can pick
up and make pkgsrc kick ass on pkgsrc.
If i remember anything else i'll be sure to post it here. Have fun.
--
Eric Gillespie, Jr. <*> epg@pretzelnet.org
"When everyone has to reinvent the wheel, many people invent
square wheels."