Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a package of Apache and its dependencies:

sudo make package-recursive \
__MAKE_CONF=~/make.apache22.conf \

Everything works fine; Apache and its dependencies compile and install and apache22.tbz is in gvkv. The problem is that the dependency packages are built in their respective ports/<package> directories! There are about fifteen of them and while it's easy enough to retrieve them with find and a perl one-liner, surely there must be a way to tell make to run in an environment such that the dependency packages end up in gvkv.

share|improve this question

Part of the fun of using FreeBSD is dealing with the ports subsystem. It's good in many ways--easy installation and upgrading within the FreeBSD ecosystem but poor in others--setting variables via make configuration files or environment don't work as expected or even as advertised.

Nevertheless, SirDice has come to the rescue with a neat little trick:

mount -t nullfs /directory/for/pkgs /usr/ports/packages

which is really cool because it bypasses the use of environment variables and you can set the destination directory for wherever you want. Very helpful if you're (like me) using a 'build-jail' to make packages that are installed on different systems or other jails.

The /usr/ports/packages directory is where PACKAGES points to (if it exists) which is supposedly able to point somewhere else but didn't work for me. The man page stipulates setting PKGREPOSITORY which only works if you are building a single package.

share|improve this answer

I've read that that PKGREPOSITORY is dependent on PACKAGES.

You can set PACKAGES in /etc/make.conf. For example:

DISTDIR= /opt/portbuild/distfiles
share|improve this answer
That's true--it works as long as there is only one package to build; otherwise, if you are also building the dependencies, they are written to their respective ports directories. – gvkv Aug 21 '10 at 1:15
For us, the package and the dependencies are all written to /opt/portbuild/packages – Stefan Lasiewski Aug 21 '10 at 17:25
Make sure the PACKAGES directory exists before running the make. – Craig Aug 24 '10 at 19:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.