[MacPorts] PortfileRecipes modified

MacPorts noreply at macports.org
Fri Sep 30 15:44:16 PDT 2011


Changed page "PortfileRecipes" by ryandesign at macports.org from 75.55.116.24*
Page URL: <https://trac.macports.org/wiki/PortfileRecipes>
Diff URL: <https://trac.macports.org/wiki/PortfileRecipes?action=diff&version=30>
Revision 30
Comment: add compiler-based-on-Xcode section

-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: PortfileRecipes
=========================================================================
--- PortfileRecipes (version: 29)
+++ PortfileRecipes (version: 30)
@@ -255,6 +255,41 @@
 
 If you modify a port to remove `-arch` flags from its *-config scripts and/or *.pc files, don't forget to also increase the port's revision (unless you're already increasing its version).
 
+== Specifying which compiler to use based on the version of Xcode == #compiler
+
+As of MacPorts 2, the default value of configure.compiler is chosen based on Xcode version instead of OS X version. If a certain compiler won't build your port, test whether that compiler has been chosen, and then set a different compiler that does work. When choosing an alternate compiler, keep in mind that as of Xcode 4, we would prefer ports build with clang. If that's not possible, use llvm-gcc-4.2. If neither work, use gcc-4.2, but provide a fallback to apple-gcc-4.2.
+
+If your port works with clang but not llvm-gcc-4.2, do this:
+
+{{{
+if {${configure.compiler} == "llvm-gcc-4.2"} {
+    configure.compiler clang
+}
+}}}
+
+If your port works with llvm-gcc-4.2 but not clang, do this:
+
+{{{
+if {${configure.compiler} == "clang"} {
+    configure.compiler llvm-gcc-4.2
+}
+}}}
+
+If your port works with neither clang nor llvm-gcc-4.2, use gcc-4.2 and add a fallback to apple-gcc-4.2. This should be considered a temporary stopgap measure. Please file a bug report with the upstream developers of the software so they can fix it to work with clang and llvm-gcc-4.2. Put a reference to the upstream bug report in the Portfile.
+
+{{{
+if {${configure.compiler} == "clang" ||
+    ${configure.compiler} == "llvm-gcc-4.2"} {
+    configure.compiler gcc-4.2
+    if {![file executable ${configure.cc}]} {
+        depends_build-append port:apple-gcc42
+        configure.compiler apple-gcc-4.2
+    }
+}
+}}}
+
+These snippets are taken from [http://lists.macosforge.org/pipermail/macports-dev/2011-July/015263.html this message on macports-dev].
+
 == Providing compiler variants == #gcc
 
 By default, a port will compile using Apple's gcc compiler.

-------8<------8<------8<------8<------8<------8<------8<------8<--------

* The IP shown here might not mean anything if the user or the server is
behind a proxy.

--
MacPorts <http://www.macports.org/>
Ports system for Mac OS

This is an automated message. Someone at http://www.macports.org/ added your email
address to be notified of changes on PortfileRecipes. If it was not you, please
report to .


More information about the macports-changes mailing list