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
# .profile # PREFIX will be /home/<user>/local-<arch> export UNAMEM=`uname -m` export LOCALBASE=${HOME}/local-${UNAMEM} export X11BASE=${HOME}/local-${UNAMEM} export PKG_DBDIR=${HOME}/local-${UNAMEM}/var.db.pk export PACKAGES=${HOME}/local-${UNAMEM}/packages export __MAKE_CONF=${HOME}/local-${UNAMEM}/etc/make.conf export PORT_DBDIR=${HOME}/local-${UNAMEM}/options # Extend path so we can run dependent programs export PATH=${HOME}/bin:${HOME}/local-${UNAMEM}/bin:${HOME}/local-${UNAMEM}/sbin:${PATH} export LD_LIBRARY_PATH=${HOME}/local-${UNAMEM}/lib export LD_RUN_PATH=${HOME}/local-${UNAMEM}/lib # Tell Makefile who owns it all export INSTALL_AS_USER=yes export WHOAMI=`whoami` export BINOWN=${WHOAMI} export BINGRP=${WHOAMI} export MANOWN=${WHOAMI} export MANGRP=${WHOAMI} # ranlib on readonly libs don't work export SHAREMODE=644 # ldconfig must write, so we change the options export LDCONFIG="/sbin/ldconfig -i -f ${HOME}/local-${UNAMEM}/etc/ldconfig.hints" # The place for cached distfiles shared, with all archs export DISTDIR=${HOME}/distfiles # Decide where temp build stuff export WRKDIRPREFIX=${HOME}/work # Finally we may use our own ports tree export PORTSDIR=${HOME}/ports # We like to cache and save the packages export USE_PACKAGE_DEPENDS="yes" export DEPENDS_SHOW_FLAVOR="yes" export DEPENDS_TARGET="package install" # We use the installed pkg, but do not depend on it export PKG_DEPENDS= export PKG_PREFIX=/usr/local export PKG_BIN=/usr/local/sbin/pkg-static