GNU Emacs flavours in FreeBSD

r460621 added flavours to editors/emacs. If you previously used editors/emacs-nox11 to get a flavour suitable for most server systems, you’re in for a couple of surprises.

  1. Remove EMACS_PORT_NAME=emacs-nox11 from /etc/make.conf.
  2. Remove WITHOUT_X11=yes from /etc/make.conf.
  3. Add OPTIONS_UNSET+=X11 to /etc/make.conf simply as a precaution.
  4. Add DEFAULT_VERSIONS+=emacs=nox to /etc/make.conf.

The full range of valid values, as of r460621, are full, canna, nox, devel_full, and devel_nox.

Be sure to repeat the above steps for /usr/local/etc/synth/LiveSystem-make.conf, or similar files, if you are using ports-mgmt/synth.

I was under the impression that I have now told the ports collection that I want the nox flavour of editors/emacs.

root@enterprise:/usr/ports/editors/emacs # make -V DEFAULT_VERSIONS | gsed 's/ /\n/g'
apache=2.4
bdb=6
emacs=nox
firebird=2.5
fpc=3.0.2
gcc=6
ghostscript=9
linux=c6_64
lua=5.2
mysql=5.7
perl5=5.26
php=7.1
pgsql=9.6
python=2.7
python2=2.7
python3=3.6
ruby=2.3
samba=4.6
ssl=openssl
tcltk=8.6
varnish=4

To quote the relevant parts of the 20180201 entry of ports/head/UPDATING:

  An alternative to the default flavor, full, can be set in make.conf.  For
  example, to set the nox flavor as the default, use

     DEFAULT_VERSIONS+=emacs=nox

This is clearly not the case, just run make -C /usr/ports/editors/emacs config to prove my point. dialog4ports still shows the full (hah!) plethora of options. Instead, run these commands:

setenv FLAVOR nox
make -C /usr/ports/editors/emacs config
unsetenv FLAVOR

I ended up selecting ACL, LLDB, MODULES, SOURCES, XML, and KQUEUE.

If you, like me, are still using the severly outdated ports-mgmt/portupgrade, try this:

setenv FLAVOR nox
portupgrade -fpvo editors/emacs editors/emacs-nox11
unsetenv FLAVOR

After about 3 minutes, depending on your processing speed, a new and shiny GNU Emacs has replaced the previously installed GNU Emacs.

--->  ** Upgrade tasks 1: 1 done, 0 ignored, 0 skipped and 0 failed
--->  Listing the results (+:done / -:ignored / *:skipped / !:failed)
        + editors/emacs (emacs-25.3_2,3 -> emacs-nox-25.3_2,3)
--->  Packages processed: 1 done, 0 ignored, 0 skipped and 0 failed
--->  Session ended at: Fri, 02 Feb 2018 10:12:14 +0100 (consumed 00:02:43)

If you have print/auctex and/or devel/distel installed, you need to update their package names:

portupgrade -fpv print/auctex devel/distel

The results are in:

--->  ** Upgrade tasks 2: 2 done, 0 ignored, 0 skipped and 0 failed
--->  Listing the results (+:done / -:ignored / *:skipped / !:failed)
        + devel/distel (distel-4.1.1_1 -> distel-emacs25_nox-4.1.1_2)
        + print/auctex (auctex-emacs-nox11-11.90_2 -> auctex-emacs25_nox-11.90_3)
--->  Packages processed: 2 done, 0 ignored, 0 skipped and 0 failed
--->  Session ended at: Fri, 02 Feb 2018 10:15:16 +0100 (consumed 00:00:40)

At least print/auctex and devel/distel have the decency to honour my request for the nox flavour of editors/emacs.

Edit and upgrade any local metaports to reflect the new port origins and package names. If you are using ports-mgmt/portmaster or ports-mgmt/synth, this should do:

RUN_DEPENDS+=emacs-nox>0:${PORTSDIR}/editors/emacs@nox
RUN_DEPENDS+=auctex-emacs25_nox>0:${PORTSDIR}/print/auctex@nox
RUN_DEPENDS+=distel-emacs25_nox>0:${PORTSDIR}/devel/distel@nox

Update 2018-02-05

I revisited ports-mgmt/portmaster this weekend and created this little shell script:

#!/bin/sh

if [ "$#" = 0 ]; then
  extra=-a
fi

portmaster --no-confirm --no-term-title --no-index-fetch --index-first -g -w -D -v $extra $@

That first attempt resulted in a shell script generating a series of -r arguments for portmaster, excluding my local metaport.

#!/bin/sh
# $BSDnet: config/freebsd/enterprise/root/bin/run-pm-for-enterprise-base.sh,v 1.1 2018-02-20 12:08:53 trond Exp $

temporary_commandfile="/tmp/run-pm-for-enterprise-base-resume.sh"

for nv in `pkg version -vIL= | awk '{print $1}'`; do
  r_list="${r_list} -r ${nv}"
done
unset nv

if [ -z "${r_list}" ]; then
  echo "$0: empty list of outdated packages" >/dev/stderr
  echo "$0: maybe you should run svn up /usr/ports" >/dev/stderr
  exit 69
fi

commandline="portmaster --no-confirm --no-term-title --no-index-fetch --index-first -g -w -D -v -x enterprise-base ${r_list}"

echo "#!/bin/sh"                                        >  ${temporary_commandfile}
echo "export BATCH=yes"                                 >> ${temporary_commandfile}
echo "export DISABLE_VULNERABILITIES=yes"               >> ${temporary_commandfile}
echo "export PAGER=:"                                   >> ${temporary_commandfile}
echo "${commandline} -R && rm ${temporary_commandfile}" >> ${temporary_commandfile}
chmod u+x,o-rwx ${temporary_commandfile}

export BATCH=yes
export DISABLE_VULNERABILITIES=yes
export PAGER=:

${commandline} && rm ${temporary_commandfile}

I have since embraced ports-mgmt/synth, but that one is not entirely without flaws.

Leave a Reply

Your email address will not be published. Required fields are marked *