Update 2014-08-07: r363978, dated Mon Aug 4 09:11:25 2014 UTC, solves the parallel build bug once and for all, and there’s no need for the Makefile.local as shown below.


I’ve been scratching my head over why mail/thunderbird doesn’t build in parallel when www/firefox does.

Research reveals MAKE_JOBS_SAFE was removed last August, in r324744. I can’t find a specific reason other than guessing parallel build was considered broken in FreeBSD.

So far, I’ve added a Makefile.local file in the /usr/ports/mail/thunderbird directory. The time spent compiling mail/thunderbird went from roughly 2.5 hours to merely 38 minutes on a 4 core Intel Core i7-960 running at 3.2 GHz. YMMV.

The contents of the Makefile.local file is:

# Enable parallel build.
MAKE_JOBS_SAFE=	yes

# MAKE_JOBS_NUMBER isn't defined at this stage, so we gather the number of CPU cores ourself.
_LOCAL_MAKE_JOBS_NUMBER!=	${SYSCTL} -n kern.smp.cpus

# Do we set MOZ_MAKE_FLAGS elsewhere in the regular Makefile, or in the central .mk files?
# I hope this construct properly propagates any previous assignments to MOZ_MAKE_FLAGS.
MOZ_MAKE_FLAGS+=	-j ${_LOCAL_MAKE_JOBS_NUMBER}

# Finally tell gmake what we expect from it.
MOZ_EXPORT+=	MOZ_MAKE_FLAGS="${MOZ_MAKE_FLAGS}"
MOZ_MK_OPTIONS+=	MOZ_MAKE_FLAGS="${MOZ_MAKE_FLAGS}"

# EOF

Mind you, I have only tested this change with the following options set:

  • ENIGMAIL
  • GIO
  • LIGHTNING
  • LOGGING
  • OPTIMIZED_CFLAGS
  • ALSA

and with the following options unset:

  • DBUS
  • DEBUG
  • GCONF
  • GNOMEUI
  • GNOMEVFS2
  • GSTREAMER
  • LIBPROXY
  • PGO
  • PROFILE
  • TEST
  • PULSEAUDIO