User build ports
How to build ports as a user on FreeBSD.
For example you can build ports from a committer account on "freefall" and related machines by setting a couple of lines in your ".profile".
- Only your user home directory needs to be writeable.
- You can build most ports and their dependencies.
- The home can be shared between different archs.
- Successful build packages are cached.
- dependency to the installed "pkg" is lifted.
The PREFIX path I suggest is "/home/<user>/local-<arch>"
.profile
1 # .profile
2
3 # PREFIX will be /home/<user>/local-<arch>
4 export UNAMEM=`uname -m`
5 export LOCALBASE=${HOME}/local-${UNAMEM}
6 export X11BASE=${HOME}/local-${UNAMEM}
7 export PKG_DBDIR=${HOME}/local-${UNAMEM}/var.db.pk
8 export PACKAGES=${HOME}/local-${UNAMEM}/packages
9 export __MAKE_CONF=${HOME}/local-${UNAMEM}/etc/make.conf
10 export PORT_DBDIR=${HOME}/local-${UNAMEM}/options
11
12 # Extend path so we can run dependent programs
13 export PATH=${HOME}/bin:${HOME}/local-${UNAMEM}/bin:${HOME}/local-${UNAMEM}/sbin:${PATH}
14 export LD_LIBRARY_PATH=${HOME}/local-${UNAMEM}/lib
15 export LD_RUN_PATH=${HOME}/local-${UNAMEM}/lib
16
17 # Tell Makefile who owns it all
18 export INSTALL_AS_USER=yes
19 export WHOAMI=`whoami`
20 export BINOWN=${WHOAMI}
21 export BINGRP=${WHOAMI}
22 export MANOWN=${WHOAMI}
23 export MANGRP=${WHOAMI}
24
25 # ranlib on readonly libs don't work
26 export SHAREMODE=644
27
28 # ldconfig must write, so we change the options
29 export LDCONFIG="/sbin/ldconfig -i -f ${HOME}/local-${UNAMEM}/etc/ldconfig.hints"
30
31 # The place for cached distfiles shared, with all archs
32 export DISTDIR=${HOME}/distfiles
33
34 # Decide where temp build stuff
35 export WRKDIRPREFIX=${HOME}/work
36
37 # Finally we may use our own ports tree
38 export PORTSDIR=${HOME}/ports
39
40 # We like to cache and save the packages
41 export USE_PACKAGE_DEPENDS="yes"
42 export DEPENDS_SHOW_FLAVOR="yes"
43 export DEPENDS_TARGET="package install"
44
45 # We use the installed pkg, but do not depend on it
46 export PKG_DEPENDS=
47 export PKG_PREFIX=/usr/local
48 export PKG_BIN=/usr/local/sbin/pkg-static