Skip to content
Permalink
Browse files

godot: Fix dependencies in clang variants, make clang9 default on < D…

…arwin14
  • Loading branch information
cjones051073 committed May 16, 2020
1 parent 02581f5 commit bf28c26870a622997dfe3125958175e37732c1d2
Showing with 37 additions and 13 deletions.
  1. +37 −13 games/godot/Portfile
@@ -4,11 +4,16 @@ PortSystem 1.0
PortGroup github 1.0

github.setup godotengine godot 3.2.1 "" -stable
revision 1

categories games graphics multimedia
platforms darwin
license MIT

maintainers @jasonliu-- openmaintainer

homepage https://godotengine.org

description cross-platform 2-D and 3-D game development \
environment
long_description Godot Engine is a cross-platform game engine for \
@@ -40,10 +45,11 @@ compiler.cxx_standard 2014
use_configure no
use_xcode yes

build.cmd scons
build.env BUILD_NAME=macports_build
build.cmd ${prefix}/bin/scons
build.env-append BUILD_NAME=macports_build
build.target platform=osx target=release_debug


destroot {
copy ${worksrcpath}/misc/dist/osx_tools.app \
${destroot}${applications_dir}/Godot.app
@@ -73,6 +79,20 @@ foreach s ${clang_suffixes} {
lappend clang_ports clang${s}
}

# error: invalid value 'gnu++14' in '-std=gnu++14'
if { ${os.major} <= 13 } {
set has_clang_variant no
foreach s ${clang_suffixes} {
if { [variant_isset clang${s}] } {
set has_clang_variant yes
}
}
if { !${has_clang_variant} } {
# Use most recent clang by default
default_variants-append +clang[lindex ${clang_suffixes} end]
}
}

foreach s ${clang_suffixes} {
global use_xcode sconstruct_default_mp_clang
set p clang${s}
@@ -83,17 +103,20 @@ foreach s ${clang_suffixes} {
}
set i [lsearch -exact ${clang_ports} ${p}]
set c [lreplace ${clang_ports} ${i} ${i}]
variant ${p} conflicts {*}${c} \
description "Build using the MacPorts Clang ${v} compiler" \
{
depends_build-append port:clang-${v}
variant ${p} conflicts {*}${c} description "Build using the MacPorts Clang ${v} compiler" {}
if { [variant_isset ${p}] } {

compiler.whitelist macports-clang-${v}
use_xcode no
set selected_clang_v ${v}
set selected_clang_s ${s}
set selected_clang_p ${p}

depends_build-append port:clang-${selected_clang_v}

compiler.whitelist macports-clang-${selected_clang_v}

post-configure {
if {${s} != ${sconstruct_default_mp_clang}} {
reinplace s|${sconstruct_default_mp_clang}\.0|${v}|g \
if {${selected_clang_s} != ${sconstruct_default_mp_clang}} {
reinplace s|${sconstruct_default_mp_clang}\.0|${selected_clang_v}|g \
${worksrcpath}/SConstruct
}

@@ -102,18 +125,19 @@ foreach s ${clang_suffixes} {
# * https://trac.macports.org/ticket/58779#comment:28
ui_warn "
****
**** Installing port ${name} with variant +${p} uses
**** Installing port ${name} with variant +${selected_clang_p} uses
**** MacPorts Clang instead of Xcode Clang. It also
**** circumvents the Xcode toolchain, which means that
**** if you attempt to perform a build using trace mode
**** (port -t install ${name} +${p}), the build will
**** (port -t install ${name} +${selected_clang_p}), the build will
**** fail!
****
**** If you are not using trace mode, you can safely
**** ignore this message.
****
"
}
build.args-append macports_clang=${v}

build.args-append macports_clang=${selected_clang_v}
}
}

2 comments on commit bf28c26

@cjones051073

This comment has been minimized.

Copy link
Contributor Author

@cjones051073 cjones051073 replied May 16, 2020

@jasonliu-- FYI. There was a number of bugs in your submission regarding the clang variants. Due to how tcl caches variables each one was actually setup to depend on the last one defined, clang9. This fixes that, and also makes clang9 default on older systems (where Xcode clang is too old).

@jasonliu--

This comment has been minimized.

Copy link
Contributor

@jasonliu-- jasonliu-- replied May 18, 2020

Looks good to me. Not really sure all those new blank lines near the top are necessary, though, lol.

Please sign in to comment.
You can’t perform that action at this time.