[99744] trunk/dports/graphics/libQGLViewer

Ryan Schmidt ryandesign at macports.org
Thu Nov 15 13:43:30 PST 2012


On Nov 15, 2012, at 14:05, vince at macports.org wrote:

> Revision: 99744
>          https://trac.macports.org/changeset/99744
> Author:   vince at macports.org
> Date:     2012-11-15 12:05:07 -0800 (Thu, 15 Nov 2012)
> Log Message:
> -----------
> Patch for universal build (add universal flags to all .pro files)
> 
> Modified Paths:
> --------------
>    trunk/dports/graphics/libQGLViewer/Portfile
> 
> Added Paths:
> -----------
>    trunk/dports/graphics/libQGLViewer/files/universal.sh
> 
> Modified: trunk/dports/graphics/libQGLViewer/Portfile
> ===================================================================
> --- trunk/dports/graphics/libQGLViewer/Portfile	2012-11-15 20:01:38 UTC (rev 99743)
> +++ trunk/dports/graphics/libQGLViewer/Portfile	2012-11-15 20:05:07 UTC (rev 99744)
> @@ -37,6 +37,8 @@
>     patchfiles-append           patch-contribs.pro.diff
> }
> 
> +variant universal {}
> +
> variant x11 {}
> 
> if {![variant_isset x11]} {
> @@ -50,6 +52,13 @@
> 
> post-patch {
>     reinplace "s|@@QT_PLUGINS_DIR@@|${qt_plugins_dir}|g" ${worksrcpath}/designerPlugin/designerPlugin.pro
> +
> +	if {[variant_isset universal]} {
> +		file copy ${filespath}/universal.sh ${worksrcpath}
> +		reinplace "s|@@@WRKSRCPATH@@@|${worksrcpath}|" ${worksrcpath}/universal.sh
> +		reinplace "s|@@@ARCHS@@@|${configure.universal_cxxflags}|" ${worksrcpath}/universal.sh
> +		system 'chmod +x ${worksrcpath}/universal.sh && ${worksrcpath}/universal.sh'
> +	}
> }
> 
> configure.pre_args              PREFIX=${prefix} \
> 
> Added: trunk/dports/graphics/libQGLViewer/files/universal.sh
> ===================================================================
> --- trunk/dports/graphics/libQGLViewer/files/universal.sh	                        (rev 0)
> +++ trunk/dports/graphics/libQGLViewer/files/universal.sh	2012-11-15 20:05:07 UTC (rev 99744)
> @@ -0,0 +1,10 @@
> +#!/bin/sh
> +for file in `find @@@WRKSRCPATH@@@ -name '*.pro'`; do
> +	cat << EOT > ${file}.tmp
> +QMAKE_CFLAGS_RELEASE += @@@ARCHS@@@
> +QMAKE_CXXFLAGS_RELEASE += @@@ARCHS@@@
> +QMAKE_LFLAGS_RELEASE += @@@ARCHS@@@
> +EOT
> +	cat ${file} >> ${file}.tmp
> +	mv ${file}.tmp ${file}
> +done

This looks like it fixes the universal variant, but don't you need the same for the non-universal variant when building for a non-default build_arch? Using [get_canonical_archflags cxx] instead of ${configure.universal_cxxflags} would let you handle both at once.

It would be better to handle this in Tcl code in the Portfile instead of a shell script. The fs-traverse procedure is probably what you want to use.



More information about the macports-dev mailing list