tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Bootstrapping on OS X with clang



Edgar,


> Is there a way to bootstrap pkgsrc on Mac OS X using the native clang that 
> comes with Xode?

Sure. :)

Use, for example:

cd /Volumes/Data/dist/pkgsrc/bootstrap
sudo env MANZ=yes MAKE_JOBS=8 STRIPFLAG=-s CC=/Developer/usr/bin/clang 
CFLAGS="-O2 -pipe -march=core2 -fomit-frame-pointer -fno-stack-protector" 
./bootstrap --prefix /usr/pkg --pkgdbdir /usr/pkg/db --ignore-case-check --abi 
64 --compiler clang

If you didn't select "UNIX Development" during Xcode installation, use, for 
example:

cd /Volumes/Data/dist/pkgsrc/bootstrap
sudo env MANZ=yes MAKE_JOBS=8 STRIPFLAG=-s CC=/Developer/usr/bin/clang 
CFLAGS="-O2 -pipe -march=core2 -fomit-frame-pointer -fno-stack-protector 
-isysroot /Developer/SDKs/MacOSX10.6.sdk" 
LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk" ./bootstrap --prefix 
/usr/pkg --pkgdbdir /usr/pkg/db --ignore-case-check --abi 64 --compiler clang


Before doing so, you may want to apply the following patch (before I commit 
it), otherwise GCC will be called anyway:

--- bootstrap.orig      2010-12-08 19:03:30.000000000 +0100
+++ bootstrap   2010-12-08 19:03:36.000000000 +0100
@@ -480,7 +480,6 @@
        set_opsys=no
        [ -z "$fetch_cmd" ] && fetch_cmd="/usr/bin/ftp"
        machine_arch=`uname -p`
-       CC="gcc -isystem /usr/include"; export CC
        osrev=`uname -r`
        macosx_version=`echo $osrev | awk -F . '{ print "10."$1-4; }'`
        case "$macosx_version" in

After successful bootstrap, add PKGSRC_COMPILER=clang to your mk.conf.
Some packages can't be compiled with clang, either because they have errors -- 
like p7zip (Clang is more strict that GCC), or use GCC-specific extensions or 
assembler statements, which Clang does not support -- like gimp.

If you get stuck, let me know. :)

Cheers,
Adam


Home | Main Index | Thread Index | Old Index