Changes between Version 18 and Version 19 of PortfileRecipes


Ignore:
Timestamp:
Apr 18, 2010, 7:11:06 AM (14 years ago)
Author:
ryandesign (Ryan Carsten Schmidt)
Comment:

add archflags section

Legend:

Unmodified
Added
Removed
Modified
  • PortfileRecipes

    v18 v19  
    187187Note: 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.
    188188
     189== Removing -arch flags from *-config scripts and *.pc files == #archflags
     190
     191MacPorts 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.
     192
     193Consider: [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.
     194
     195Port maintainers should therefore ensure that any `-arch` flags are removed from such scripts and files prior to installation, e.g. like this:
     196
     197{{{
     198post-configure {
     199    reinplace -E {s|-arch [a-z0-9_]+||g} \
     200        ${worksrcpath}/redland-src-config \
     201        ${worksrcpath}/redland.pc
     202}
     203}}}
     204
     205This example is taken from [browser:trunk/dports/www/redland/Portfile redland].
     206
     207If 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:
     208
     209{{{
     210post-configure {
     211    if {[variant_isset universal]} {
     212        set dirs {}
     213        foreach arch ${universal_archs_to_use} {
     214            lappend dirs ${worksrcpath}-${arch}
     215        }
     216    } else {
     217        set dirs ${worksrcpath}
     218    }
     219    foreach dir ${dirs} {
     220        reinplace -E {s|-arch [a-z0-9_]+||g} \
     221            ${dir}/curl-config \
     222            ${dir}/libcurl.pc
     223    }
     224}
     225}}}
     226
     227This example is taken from [browser:trunk/dports/www/curl/Portfile curl].
     228
     229If 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).
     230
    189231== Providing compiler variants == #gcc
    190232