Tweaking a Portfile

Ryan Schmidt ryandesign at
Sat Apr 18 00:58:08 PDT 2009

On Apr 17, 2009, at 15:52, vincent habchi wrote:

> Specifically, I'm trying to improve the science/qucs port by  
> enabling a universal build.
> Qucs is built in two parts: a front end that cannot be universal  
> because it links against Qt3, itself dependant on Carbon ; a back  
> end composed of a mathematical core that can and should be compiled  
> in 64-bit mode in order to improve performance.
> So I have to configure one subdirectory with "standard" flags, even  
> if the universal variant is set, and I have to revert to normal  
> universal configuration in the second subdirectory. Is there an  
> easy way to do this?
> I tried this piece of code:
> pre-configure {
> 	# We must configure QUCS in 32-bit mode because of QT3 dependency
> 	# then we go back to qucs-core that we configure universal
> 	if {[variant_isset universal]} then {
> 		set cua		${configure.universal_args}
> 		set cuc 	${configure.universal_cflags}
> 		set cucpp	${configure.universal_cppflags}
> 		set cucxx	${configure.universal_cxxflags}
> 		set culd	${configure.universal_ldflags}
> 		unset		{configure.universal_args}
> 		unset		{configure.universal_cflags}
> 		unset		{configure.universal_cppflags}
> 		unset		{configure.universal_cxxflags}
> 		unset		{configure.universal_ldflags}
> 	}
> }
> But it does not seem to work, since the environnement variables  
> seem to be computed before the pre-conf phase (and configure runs  
> with the universal flags). If I substitute pre-configure by  
> configure, of course nothing happens anymore.
> Any easy way to get out of this maze?

You may want to consider splitting the port into two ports, one for  
the backend and one for the frontend, so that you can handle their  
universality separately.

To give an example, I used to have a +gui variant in the graphviz  
port to also install a pre-compiled PowerPC GUI application which  
uses the command-line graphviz tools. Besides being a wrong use of  
variants generally, since it made it inconvenient to install the GUI  
if you had not initially done so, it had this problem where the core  
graphviz utilities could possibly be built universal but the pre- 
compiled PowerPC GUI would never be. By splitting this into separate  
ports graphviz and graphviz-oldgui I fixed both problems.

More information about the macports-users mailing list