On my FreeBSD/i386 stable/10 and head VMs I have set up clang as the system compiler.

CC=clang
CXX=clang++
CPP=clang-cpp

KERNCONF=VBOX

I have also set CPUTYPE to corei7 as this is accepted by clang and pretty much describes the capabilities of the host system.

CPUTYPE?=corei7

I’m not afraid of building and installing some extra pieces:

WITH_CLANG_EXTRAS=yes
WITH_CTF=yes
WITH_GNUCXX=yes
WITH_LIBCPLUSPLUS=yes
WITH_LLDB=yes
WITH_NAND=yes
WITH_PKGTOOLS=yes

editors/emacs/Makefile, r359256, requires the use of gcc as the compiler on the i386 platform, but the gcc native to stable/10 and head fails to recognize corei7.

Thus, I must tell gcc to optimize for core2.

.if ${.CURDIR} == /usr/ports/editors/emacs
CPUTYPE?=core2
.else
CPUTYPE?=corei7
.endif

Sadly, PORTSDIR isn’t defined when /etc/make.conf is read, so I can’t use this more flexible approach:

.if ${.CURDIR} == ${PORTSDIR}/editors/emacs
CPUTYPE?=core2
.else
CPUTYPE?=corei7
.endif