rework COMPILER yet again. new version should be easier to grasp

This commit is contained in:
espie 2017-08-22 10:27:33 +00:00
parent 4e7478d103
commit 7737872aef
7 changed files with 63 additions and 49 deletions

View File

@ -1,6 +1,6 @@
#-*- mode: Makefile; tab-width: 4; -*-
# ex:ts=4 sw=4 filetype=make:
# $OpenBSD: bsd.port.mk,v 1.1364 2017/08/21 09:10:52 espie Exp $
# $OpenBSD: bsd.port.mk,v 1.1365 2017/08/22 10:27:33 espie Exp $
#
# bsd.port.mk - 940820 Jordan K. Hubbard.
# This file is in the public domain.
@ -302,7 +302,19 @@ _MODULES_DONE =
. include "${PORTSDIR}/infrastructure/mk/modules.port.mk"
.endif
# this only happens if we exit modules without having ever gone
# thru compiler.port.mk
COMPILER ?= base-clang base-gcc gcc3
COMPILER_LANGS ?= c c++
.if ${PROPERTIES:Mclang}
CHOSEN_COMPILER ?= base-clang
.elif ${PROPERTIES:Mgcc4}
CHOSEN_COMPILER ?= base-gcc
.else
CHOSEN_COMPILER ?= gcc3
.endif
COMPILER_LIBCXX ?= ${LIBCXX}
###
### Variable setup that can happen after modules
###

View File

@ -1,4 +1,4 @@
# $OpenBSD: compiler.port.mk,v 1.3 2017/07/13 11:43:55 espie Exp $
# $OpenBSD: compiler.port.mk,v 1.4 2017/08/22 10:27:33 espie Exp $
#
# Copyright (c) 2017 Marc Espie
#
@ -24,53 +24,62 @@
# SUCH DAMAGE.
#
COMPILER:= ${COMPILER:S/^gcc$/base-clang ports-gcc/}
COMPILER:= ${COMPILER:S/^clang$/base-clang ports-clang/}
.for c in ${COMPILER:L}
. if "$c" == "base"
. elif "$c" == "gcc" || "$c" == "gcc4" || "$c" == "gcc-only"
. if !defined(CHOSEN_COMPILER)
MODGCC4_ARCHS ?= *
. if "$c" == "base-gcc"
_COMPILER_ARCHS += ${GCC4_ARCHS}
. if ${PROPERTIES:Mgcc4}
CHOSEN_COMPILER ?= base-gcc
. endif
. elif "$c" == "gcc3"
_COMPILER_ARCHS += ${GCC3_ARCHS}
. if ${PROPERTIES:Mgcc3}
CHOSEN_COMPILER ?= gcc3
. endif
. elif "$c" == "base-clang"
_COMPILER_ARCHS += ${CLANG_ARCHS}
. if ${PROPERTIES:Mclang}
CHOSEN_COMPILER ?= base-clang
. endif
. elif "$c" == "ports-gcc"
MODGCC4_ARCHS ?= ${GCC49_ARCHS}
_MODGCC4_ARCH_USES = No
. if ${MODGCC4_ARCHS} != ""
. for _i in ${MODGCC4_ARCHS}
. if !empty(MACHINE_ARCH:M${_i})
_COMPILER_ARCHS += ${MODGCC4_ARCHS}
. for _i in ${MODGCC4_ARCHS}
. if !empty(MACHINE_ARCH:M${_i})
_MODGCC4_ARCH_USES = Yes
. endif
. endfor
. endif
. if ${_MODGCC4_ARCH_USES:L} == "yes"
. endfor
. if ${_MODGCC4_ARCH_USES:L} == "yes" && !defined(CHOSEN_COMPILER)
MODULES += gcc4
MODGCC4_LANGS += ${COMPILER_LANGS}
CHOSEN_COMPILER = gcc
. endif
CHOSEN_COMPILER = ports-gcc
. endif
. elif "$c" == "clang"
. if !defined(CHOSEN_COMPILER)
MODCLANG_ARCHS ?= *
. elif "$c" == "ports-clang"
MODCLANG_ARCHS ?= ${LLVM_ARCHS}
_MODCLANG_ARCH_USES = No
. if ${MODCLANG_ARCHS} != ""
. for _i in ${MODCLANG_ARCHS}
. if !empty(MACHINE_ARCH:M${_i})
_COMPILER_ARCHS += ${MODCLANG_ARCHS}
. for _i in ${MODCLANG_ARCHS}
. if !empty(MACHINE_ARCH:M${_i})
_MODCLANG_ARCH_USES = Yes
. endif
. endfor
. endif
. if ${_MODCLANG_ARCH_USES:L} == "yes"
. endfor
. if ${_MODCLANG_ARCH_USES:L} == "yes" && !defined(CHOSEN_COMPILER)
MODULES += lang/clang
MODCLANG_LANGS += ${COMPILER_LANGS}
CHOSEN_COMPILER = clang
. endif
CHOSEN_COMPILER = ports-clang
. endif
. else
ERRORS += "Fatal: unknown keyword $c in COMPILER"
CHOSEN_COMPILER = error
. endif
.endfor
# okay we went through, we didn't find anything
CHOSEN_COMPILER ?= old
.if $(CHOSEN_COMPILER) == "clang" || $(CHOSEN_COMPILER) == "gcc"
. if ${COMPILER_LANGS:Mc++}
CHOSEN_COMPILER ?= none found
ONLY_FOR_ARCHS ?= ${_COMPILER_ARCHS}
.if ${CHOSEN_COMPILER:Mports-*} && ${COMPILER_LANGS:Mc++}
COMPILER_LIBCXX = ${LIBECXX}
. endif
.endif

View File

@ -1,4 +1,4 @@
# $OpenBSD: modules.port.mk,v 1.13 2017/06/03 15:02:26 espie Exp $
# $OpenBSD: modules.port.mk,v 1.14 2017/08/22 10:27:33 espie Exp $
#
# Copyright (c) 2001 Marc Espie
#
@ -34,13 +34,7 @@ _COMPILER=
ERRORS += "Fatal: COMPILER coming from a file included *after* the gcc module"
. endif
COMPILER_LANGS ?= c c++
ONLY_FOR_ARCHS ?= ${CXX11_ARCHS}
. if ${PROPERTIES:Mclang} && !${COMPILER:Mgcc-only}
# XXX just ignore clang in base then, compiler will grab gcc4
CHOSEN_COMPILER = base
. else
_COMPILER=compiler
. endif
.endif
.for _m in ${_COMPILER} ${MODULES:L}

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.18 2017/07/26 21:28:51 espie Exp $
# $OpenBSD: Makefile,v 1.19 2017/08/22 10:27:33 espie Exp $
ONLY_FOR_ARCHS= amd64 i386
@ -19,7 +19,7 @@ WANTLIB= c m
MASTER_SITES= ${MASTER_SITE_GNU:=gprolog/}
COMPILER = gcc-only
COMPILER = base-gcc ports-gcc
COMPILER_LANGS = c
AUTOCONF_VERSION= 2.68
CONFIGURE_STYLE= autoconf dest no-autoheader

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.17 2017/08/06 20:10:25 sthen Exp $
# $OpenBSD: Makefile,v 1.18 2017/08/22 10:27:33 espie Exp $
COMMENT= G.729a voice codec for Asterisk
DISTNAME= asterisk-g72x-1.4.1
@ -18,7 +18,7 @@ WANTLIB += bcg729
NO_TEST= Yes
COMPILER= gcc-only
COMPILER= base-gcc ports-gcc
AUTOCONF_VERSION= 2.69
AUTOMAKE_VERSION= 1.15

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.259 2017/08/05 12:29:21 sthen Exp $
# $OpenBSD: Makefile,v 1.260 2017/08/22 10:27:33 espie Exp $
BROKEN-aarch64= linker problems with BlocksRuntime that only show up at runtime
@ -43,7 +43,7 @@ WANTLIB-main += xml2 xslt z
# Runtime fails on ld.lld arches: dlopen()ing the .so modules results in
# undefined symbols from the BlocksRuntime lib.
#
COMPILER = gcc-only
COMPILER = base-gcc ports-gcc
SHARED_LIBS+= asteriskssl 0.0 # 1
SHARED_LIBS+= asteriskpj 0.0 # 2

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.213 2017/07/26 22:45:34 sthen Exp $
# $OpenBSD: Makefile,v 1.214 2017/08/22 10:27:33 espie Exp $
COMMENT-main= VideoLAN client; multimedia player
COMMENT-jack= JACK audio output module for VLC
@ -51,8 +51,7 @@ AUTOMAKE_VERSION= 1.15
MODULES= devel/gettext \
x11/qt4
COMPILER = clang
MODCLANG_ARCHS= amd64 i386
COMPILER = base-clang base-gcc
WANTLIB-main += ${COMPILER_LIBCXX}
@ -205,6 +204,6 @@ post-install:
@find ${PREFIX}/lib/vlc -name '*.la' -print | xargs rm
.include <bsd.port.mk>
.if defined(CHOSEN_COMPILER) && ${CHOSEN_COMPILER} == "base"
.if ${CHOSEN_COMPILER} == "base-clang"
CXXFLAGS += -std=c++11 -DXXX_CLANG_WORKAROUND=1
.endif