Requirements

Softwares

Packages

I recommand to use softpartitions for both /usr/pkg and /usr/pkgsrc

Get pkgsrc

Via CVS

# export CVSROOT=anoncvs@anoncvs.NetBSD.org:/cvsroot
# export CVS_RSH=ssh
# cd /usr
# cvs checkout -P pkgsrc 

Installation

Bootstraping

GCC

# export PATH=$PATH:/usr/sfw/bin:/usr/ccs/bin
# echo CC=gcc > /etc/mk.conf
# cd /usr/pkgsrc/bootstrap
# ./bootstrap

Sun Studio

# export PATH=/opt/SUNWspro/bin:$PATH
# echo CC=cc > /etc/mk.conf
# echo PKGSRC_COMPILER=sunpro >> /etc/mk.conf
# export CC=cc
# cd /usr/pkgsrc/bootstrap
# ./bootstrap

Usage

Settings

# export PATH=$PATH:/usr/pkg/bin:/usr/pkg/sbin

Sample

# cd /usr/pkgsrc/pkgtools/pkgfind
# bmake install

Targets

Target Description
show-depends-dir Show dependencies
show-options Show available options for the current port

mk.conf

UID/GID

APACHE_USER=webservd
APACHE_GROUP=webservd
SQUID_USER=webservd
SQUID_GROUP=webservd
MAILMAN_MAILGROUP=nobody

Specify an option for a specific package

PKG_OPTIONS.squid=ssl opt2
PKG_OPTIONS.postfix=pcre sasl tls bdb

Apache stuff

PKG_APACHE=apache2
PKG_PHP=php4

Notes

Troubleshootings

Python

If you have the following error :

Objects/complexobject.c: In function `complex_pow':
Objects/complexobject.c:469: error: invalid operands to binary ==
Objects/complexobject.c:469: error: wrong type argument to unary minus
Objects/complexobject.c:469: error: invalid operands to binary ==
Objects/complexobject.c:469: error: wrong type argument to unary minus

edit the file ./work/Python-2.3.5/Include/pyport.h, search for

#define Py_HUGE_VAL HUGE_VAL

set it to

#ifndef Py_HUGE_VAL 
#define Py_HUGE_VAL HUGE 
#endif 

The following Makefile patch is also available, but didn't work here :

 +.if ${OPSYS} == "SunOS" && ${CC} == "gcc" 
 +#workaround for bug with Solaris/gcc : __builtin_huge_val is a func. in that 
 case, but  not declare as in Solaris header.
 +CONFIGURE_ARGS+=       OPT="${CFLAGS} -D\"Py_HUGE_VAL=__builtin_huge_val()\""
 +.else
  CONFIGURE_ARGS+=       OPT="${CFLAGS}"
 +.endif

netpbm

Makefile.patch

28a29,30
> 
> 
55a58,61
> 
> .if ${OPSYS} == "SunOS" && ${OS_VERSION} == "5.10"
> CFLAGS+=      -ansi -D__EXTENSIONS__
> .endif
# cd /usr/pkgsrc/graphics/netpbm
# patch Makefile < Makefile.patch

libtool

If you have strange segfault with libtool, try to change the shebang (the first line) of /usr/pkg/bin/libtool from

#! /bin/ksh

to

#! /usr/bin/bash

libstdc++.la

Use the following to replace libstcd++.la file :

/usr/sfw/lib/libstdc++.la

# libstdc++.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.4a-GCC3.0 (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libstdc++.so.6'

# Names of this library.
library_names='libstdc++.so.6.0.3 libstdc++.so.6 libstdc++.so'

# The name of the static archive.
old_library='libstdc++.a'

# Libraries that this one depends upon.
dependency_libs='-lc -lm -L/usr/sfw/lib -lgcc_s'

# Version information for libstdc++.
current=6
age=0
revision=3

# Is this an already installed library?
installed=yes

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/sfw/lib'

/usr/sfw/lib/64/libstdc++.la

# libstdc++.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.4a-GCC3.0 (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libstdc++.so.6'

# Names of this library.
library_names='libstdc++.so.6.0.3 libstdc++.so.6 libstdc++.so'

# The name of the static archive.
old_library='libstdc++.a'

# Libraries that this one depends upon.
dependency_libs='-L/lib/64 -lc -lm -L/usr/sfw/lib/64 -lgcc_s'

# Version information for libstdc++.
current=6
age=0
revision=3

# Is this an already installed library?
installed=yes

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/sfw/lib/64'

XML::Parser

This perl module require libexpat, which comes with both Solaris itself and pkgsrc. I don't why, but if you build the module with the pkgsrc's libexpat, an error occured while loading libexpat. So, you need to build XML::Parser with the Solaris's libexpat.

[..]
.include "../../mk/bsd.pkg.mk"

.if ${OPSYS} == "SunOS" && ${OS_VERSION} == "5.10"
MAKE_PARAMS+=           EXPATLIBPATH=/usr/sfw/lib
MAKE_PARAMS+=           EXPATINCPATH=/usr/sfw/include
.else
MAKE_PARAMS+=          EXPATLIBPATH=${BUILDLINK_PREFIX.expat}/lib
MAKE_PARAMS+=          EXPATINCPATH=${BUILDLINK_PREFIX.expat}/include
.endif