Skip to content

Instantly share code, notes, and snippets.

@larryv
Created January 30, 2013 05:42
Show Gist options
  • Save larryv/4670959 to your computer and use it in GitHub Desktop.
Save larryv/4670959 to your computer and use it in GitHub Desktop.
Index: src/port1.0/portconfigure.tcl
===================================================================
--- src/port1.0/portconfigure.tcl (revision 102270)
+++ src/port1.0/portconfigure.tcl (working copy)
@@ -170,11 +170,44 @@
default configure.universal_cxxflags {[portconfigure::configure_get_universal_cflags]}
default configure.universal_ldflags {[portconfigure::configure_get_universal_ldflags]}
+# Internal function to set port dependencies for configure.compiler.
+# Defined up here so that it is available when setting the default value.
+proc portconfigure::get_compiler_dependencies {option action args} {
+ global configure.compiler portconfigure::last_compiler
+ if {![info exists portconfigure::last_compiler]} {
+ set portconfigure::last_compiler {}
+ }
+
+ # Evaluate value lazily by processing on read, not write.
+ if {![string equal ${action} "read"]} {
+ return
+ }
+
+ if {[string equal ${portconfigure::last_compiler} ${configure.compiler}] ||
+ ![portconfigure::compiler_is_port ${configure.compiler}]} {
+ return
+ }
+
+ set compiler_port $portconfigure::compiler_name_map(${configure.compiler})
+ if {[string match macports-gcc* ${configure.compiler}]} {
+ depends_lib-append port:${compiler_port}
+ } else {
+ depends_build-append port:${compiler_port}
+ }
+ if {[arch_flag_supported ${configure.compiler}]} {
+ depends_skip_archcheck-append ${compiler_port}
+ }
+
+ set portconfigure::last_compiler ${configure.compiler}
+}
+
# Select a distinct compiler (C, C preprocessor, C++)
options configure.ccache configure.distcc configure.pipe configure.cc \
configure.cxx configure.cpp configure.objc configure.f77 \
configure.f90 configure.fc configure.javac configure.compiler \
compiler.blacklist compiler.whitelist compiler.fallback
+option_proc configure.compiler portconfigure::get_compiler_dependencies
+
default configure.ccache {${configureccache}}
default configure.distcc {${configuredistcc}}
default configure.pipe {${configurepipe}}
@@ -388,14 +421,7 @@
# check if a compiler comes from a port
proc portconfigure::compiler_is_port {compiler} {
- switch $compiler {
- clang -
- llvm-gcc-4.2 -
- gcc-4.2 -
- gcc-4.0 -
- gcc-3.3 {return no}
- default {return yes}
- }
+ return [info exists portconfigure::compiler_name_map(${compiler})]
}
# maps compiler names to the port that provides them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment