tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: default C versions



> My "solution" when I started using pkgsrc on CentOS 6 years ago was to
> use the base compiler only to build a pkgsrc GCC and its dependencies,
> and use the pkgsrc GCC for all other packages.
The problem with this approach is that your ever growing list of GCC's 
dependencies gets built with the base compiler, so you may run into 
problems with other packages using them.
What I do is to build a "bootstrap" GCC unter a different PREFIX, and then 
use that to build the GCC I actually use (you can't use the different-PREFIX 
GCC to build the rest beacuse your binaries would reference a runtime 
library under the different PREFIX).
Of course, that will build GCC twice (the package, which will build the 
compiler three times each), but it seens to work.

In my mk.conf, this looks like this:

# 1: using base compiler and base pkgtools, build pkgtools into compiler boot LOCALBASE
# 2: using base compiler and pkgtools built in 1, build new compiler into compiler boot LOCALBASE
# 3: using new compiler built in 2 and pkgtools built in 1, build same compiler (plus dependencies) and pkgtools into normal LOCALBASE
# 0: using new compiler and pkgtools built in 3, build everything else
PKGSRC_COMPILER_BOOT?=	0
PKGSRC_COMPILER_VERS?=	gcc8
#PKGSRC_COMPILER_VERS?=	base

LOCALBASE.normal=		/usr/pkg
LOCALBASE.compiler_boot=	/usr/pkg.compiler_boot
PKG_DBDIR.normal=		/usr/pkg/pkgdb # must match {,/usr/pkg}/etc/pkg_install.conf
PKG_DBDIR.compiler_boot=	/usr/pkg.compiler_boot/pkgdb
WRKOBJDIR.normal=		/var/work/pkgsrc
WRKOBJDIR.compiler_boot=	/var/work/pkgsrc.compiler_boot
PKGREPOSITORY.normal=		/var/work/pkgsrc/packages/All
PKGREPOSITORY.compiler_boot=	/var/work/pkgsrc.compiler_boot/packages/All

# PKG_TOOLS_BIN
.if ${PKGSRC_COMPILER_BOOT} == 1
PKG_TOOLS_BIN?=		/usr/sbin
.elif ${PKGSRC_COMPILER_BOOT} == 2 || ${PKGSRC_COMPILER_BOOT} == 3
PKG_TOOLS_BIN?=		${LOCALBASE.compiler_boot}/sbin
.elif ${PKGSRC_COMPILER_BOOT} == 0
PKG_TOOLS_BIN?=		${LOCALBASE.normal}/sbin
.else
.error PKGSRC_COMPILER_BOOT
.endif

# LOCALBASE, PKG_DBDIR, WRKOBJDIR, PKGREPOSITORY
.if ${PKGSRC_COMPILER_BOOT} == 1 || ${PKGSRC_COMPILER_BOOT} == 2
LOCALBASE=		${LOCALBASE.compiler_boot}
PKG_DBDIR=		${PKG_DBDIR.compiler_boot}
WRKOBJDIR=		${WRKOBJDIR.compiler_boot}
PKGREPOSITORY=		${PKGREPOSITORY.compiler_boot}
.elif ${PKGSRC_COMPILER_BOOT} == 3 || ${PKGSRC_COMPILER_BOOT} == 0
LOCALBASE=		${LOCALBASE.normal}
PKG_DBDIR=		${PKG_DBDIR.normal}
WRKOBJDIR=		${WRKOBJDIR.normal}
PKGREPOSITORY=		${PKGREPOSITORY.normal}
.else
.error PKGSRC_COMPILER_BOOT
.endif

# PKGSRC_COMPILER etc
.if ${PKGSRC_COMPILER_BOOT} == 1 || ${PKGSRC_COMPILER_BOOT} == 2
PKGSRC_COMPILER=	gcc
USE_NATIVE_GCC=		yes
USE_PKGSRC_GCC=		no
GCCBASE=		/usr/bin
CC=			gcc
CXX=			g++
CPP=			${CC} -E
.elif ${PKGSRC_COMPILER_BOOT} == 3
.if !empty(PKGSRC_COMPILER_VERS:Mgcc*)
PKGSRC_COMPILER=	gcc
USE_NATIVE_GCC=		yes	# Hilfscompiler gilt nicht als pkgsrc
USE_PKGSRC_GCC=		no
USE_PKGSRC_GCC_RUNTIME= no
GCCBASE=		${LOCALBASE.compiler_boot}/${PKGSRC_COMPILER_VERS}
CC=			gcc
CXX=			g++
CPP=			${CC} -E
.elif !empty(PKGSRC_COMPILER_VERS:Mclang*)
PKGSRC_COMPILER=	clang
CC=			clang
CXX=			clang++
CPP=			${CC} -E
CLANGBASE=		${LOCALBASE.compiler_boot}
.else
.error PKGSRC_COMPILER_VERS
.endif
.elif ${PKGSRC_COMPILER_BOOT} == 0
.if !empty(PKGSRC_COMPILER_VERS:Mbase)	# explizit base-Compiler verwenden
PKGSRC_COMPILER=	gcc
USE_NATIVE_GCC=		yes
USE_PKGSRC_GCC=		no
USE_PKGSRC_GCC_RUNTIME= # empty
GCCBASE=		# empty
CC=			gcc
CXX=			g++
CPP=			${CC} -E
.elif !empty(PKGSRC_COMPILER_VERS:Mgcc*)
PKGSRC_COMPILER=	gcc
USE_NATIVE_GCC=		no
USE_PKGSRC_GCC=		yes
USE_PKGSRC_GCC_RUNTIME= yes
GCCBASE=		${LOCALBASE.normal}/${PKGSRC_COMPILER_VERS}
CC=			gcc
CXX=			g++
CPP=			${CC} -E
.elif !empty(PKGSRC_COMPILER_VERS:Mclang*)
PKGSRC_COMPILER=	clang
CC=			clang
CXX=			clang++
CPP=			${CC} -E
CLANGBASE=		${LOCALBASE.normal}
.else
.error PKGSRC_COMPILER_VERS
.endif
.else
.error PKGSRC_COMPILER_BOOT
.endif


Home | Main Index | Thread Index | Old Index