[MacPorts] PortfileRecipes modified

MacPorts noreply at macports.org
Sun Apr 18 00:11:06 PDT 2010


Changed page "PortfileRecipes" by ryandesign at macports.org from 70.253.76.241*
Page URL: <http://trac.macports.org/wiki/PortfileRecipes>
Diff URL: <http://trac.macports.org/wiki/PortfileRecipes?action=diff&version=19>
Revision 19
Comment: add archflags section

-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: PortfileRecipes
=========================================================================
--- PortfileRecipes (version: 18)
+++ PortfileRecipes (version: 19)
@@ -186,6 +186,48 @@
 
 Note: Ensure you use the correct capitalization for each filename. For example, many projects typically use all-caps for most of the documentation files, except for ChangeLog, which is often written in camel-case. If you fail to use the correct capitalization, the port may still install on your system, but will fail for users with case-sensitive filesystems.
 
+== Removing -arch flags from *-config scripts and *.pc files == #archflags
+
+MacPorts provides `-arch` flags to ports' configure scripts in CFLAGS, LDFLAGS and similar variables, which tell the port what architecture(s) to build for, but these `-arch` flags should not appear in *-config scripts or pkg-config *.pc files because they will influence the build of dependent ports.
+
+Consider: [browser:trunk/dports/mail/libetpan/Portfile libetpan] @0.58_0+universal is installed. Its [changeset:66602 libetpan-config script contains -arch flags]. I now want to build etpan which depends on libetpan. [changeset:65910 etpan cannot be built universal] so I do not request the +universal variant when building etpan. Yet it still tries to build universal because it got the universal `-arch` flags from libetpan's config script, so the build fails.
+
+Port maintainers should therefore ensure that any `-arch` flags are removed from such scripts and files prior to installation, e.g. like this:
+
+{{{
+post-configure {
+    reinplace -E {s|-arch [a-z0-9_]+||g} \
+        ${worksrcpath}/redland-src-config \
+        ${worksrcpath}/redland.pc
+}
+}}}
+
+This example is taken from [browser:trunk/dports/www/redland/Portfile redland].
+
+If you're using the muniversal portgroup, it's a bit more complicated because you have to reinplace in each architecture's source directory, and you have to still accommodate non-universal builds:
+
+{{{
+post-configure {
+    if {[variant_isset universal]} {
+        set dirs {}
+        foreach arch ${universal_archs_to_use} {
+            lappend dirs ${worksrcpath}-${arch}
+        }
+    } else {
+        set dirs ${worksrcpath}
+    }
+    foreach dir ${dirs} {
+        reinplace -E {s|-arch [a-z0-9_]+||g} \
+            ${dir}/curl-config \
+            ${dir}/libcurl.pc
+    }
+}
+}}}
+
+This example is taken from [browser:trunk/dports/www/curl/Portfile curl].
+
+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).
+
 == 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