[MacPorts] PortfileRecipes modified

MacPorts noreply at macports.org
Sun Aug 25 10:06:40 PDT 2013


Page "PortfileRecipes" was changed by jeremyhu at macports.org
Diff URL: <https://trac.macports.org/wiki/PortfileRecipes?action=diff&version=69>
Revision 69
Changes:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: PortfileRecipes
=========================================================================
--- PortfileRecipes (version: 68)
+++ PortfileRecipes (version: 69)
@@ -400,6 +400,10 @@
 
 == Providing compiler variants == #gcc
 
+'''This recipe is not recommended.  Please do not use it in new ports'''
+
+Use of the C++ and ObjC compilers provided by macports-gcc-X.Y compiler options (and by extension, dragonegg compiler options) is strongly discouraged because it will lead to different C++ and ObjC runtimes being used by different ports (which can make such ports incompatible with each other)'''.  The general rule of thumb is that if the C++ or ObjC usage is wholly contained within the port, it is safe to use the gcc compilers.  If the port uses C++ or ObjC APIs provided by the host or other ports, then you must use an Apple provided compiler or one of the macports-clang compilers.  Similarly, if the port is providing ObjC or C++ APIs to other ports, then it must use an Apple provided compiler or one of the macports-clang ports.  See the next section below for instructions on how to choose just the fortran compiler based on gcc variants.
+
 By default, a port will compile using Apple's Clang or GCC compiler. For
 most ports this is fine, but some require a recent version of GCC, or
 are for some reason incompatible with Apple's version. In these cases
@@ -468,6 +472,72 @@
 }
 }}}
 
+== Selecting a Fortran Compiler == #fortran
+
+The default Apple-provided compilers (and the clang compilers from MacPorts) do not support as many languages as the gcc ports.  The Portfile recipe below will allow you to compile fortran code while still using the default compiler for C, ObjC, C++, and ObjC++ code.  If your port uses gcj, the same process can be used to select a gcj compiler.
+
+{{{
+set gcc_versions {4.3 4.4 4.5 4.6 4.7 4.8 4.9}
+set default_fortran_variant +gcc48
+
+foreach ver ${gcc_versions} {
+    set ver_no_dot [join [split ${ver} "."] ""]
+
+    variant gcc${ver_no_dot} description {build with gfortran from gcc${ver_no_dot}} {}
+
+    variant gcc${ver_no_dot} conflicts g95 {}
+    variant g95 conflicts gcc${ver_no_dot} {}
+
+    foreach over ${gcc_versions} {
+        if {${ver} == ${over}} {
+            continue
+        }
+
+        set over_no_dot [join [split ${over} "."] ""]
+        variant gcc${ver_no_dot} conflicts gcc${over_no_dot} {}
+    }
+
+    if {[variant_isset gcc${ver_no_dot}]} {
+        if {${default_fortran_variant} != "+gcc${ver_no_dot}"} {
+            set default_fortran_variant ""
+        }
+    }
+}
+
+variant g95 description {build with g95} {}
+
+if {[variant_isset g95]} {
+    if {${default_fortran_variant} != "+g95"} {
+        set default_fortran_variant ""
+    }
+}
+
+if {${default_fortran_variant} != ""} {
+    default_variants "${default_fortran_variant}"
+}
+
+foreach ver ${gcc_versions} {
+    set ver_no_dot [join [split ${ver} "."] ""]
+
+    if {[variant_isset gcc${ver_no_dot}]} {
+        depends_lib-append port:libgcc
+        depends_build-append port:gcc${ver_no_dot}
+
+        configure.fc  ${prefix}/bin/gfortran-mp-${ver}
+        configure.f77 ${prefix}/bin/gfortran-mp-${ver}
+        configure.f90 ${prefix}/bin/gfortran-mp-${ver}
+    }
+}
+
+if {[variant_isset g95]} {
+    depends_lib-append port:libgcc
+    depends_build-append port:g95
+
+    configure.fc ${prefix}/bin/g95
+    configure.f77 ${prefix}/bin/g95
+    configure.f90 ${prefix}/bin/g95
+}
+}}}
 
 == Replacing and renaming ports == #replaced-by
 
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/PortfileRecipes>
MacPorts <http://www.macports.org/>
Ports system for OS X

This is an automated message. Someone added your email address to be
notified of changes on 'PortfileRecipes' page.
If it was not you, please report to .


More information about the macports-changes mailing list