MacPorts wrapper script question

Ryan Schmidt ryandesign at macports.org
Mon Feb 2 14:29:37 PST 2009


On Feb 2, 2009, at 16:08, Jeremy Lavergne wrote:

> I'm going through my pspp portfile again and trying to implement  
> the wrapper the way you had suggested in wine.
>
> Should I continue writing my wrapper script in the portfile, rather  
> than including it in pspp/files?
>
> I've got rename setup correctly, but I'm unsure of how to use  
> xinstall to set the permissions for the way I have the wrappers  
> generated from the portfile.  If you have the time can you review  
> the following part that I'm constructing (notice I'm also adding  
> the conditional for the gui variant).  Thanks!
>
> if {[variant_isset gui]} {
> 	ln -s ${prefix}/lib/pspp/libpsppire.dylib \
> 	${destroot}${prefix}/lib/pspp/libpsppire.so
> 	ln -s ${prefix}/lib/pspp/libpsppwidgets.dylib \
> 	${destroot}${prefix}/lib/pspp/libpsppwidgets.so
> 	
> 	file rename ${destroot}${prefix}/bin/psppire ${destroot}${prefix}/ 
> libexec/${name}/psppire
> 	
> 	set script [open ${destroot}${prefix}/bin/psppire w+]
> 	puts $script "#!/bin/bash"
> 	puts $script "export OLDPWD=`pwd`"
> 	puts $script "cd /tmp"
> 	puts $script "LD_LIBRARY_PATH=${prefix}/lib/pspp ${prefix}/libexec/ 
> ${name}/psppire"
> 	puts $script "cd \$OLDPWD"
> 	close $script
> 	
> 	xinstall -m 755 ${destroot}${prefix}/bin/psppire
> 	#system "chmod 755 ${destroot}${prefix}/bin/psppire"
> }

I recommend you do it the way wine does, putting the wrapper script  
into the files directory. It's easier to read the script that way,  
and easier to edit.

The script would then be "psppire.in" and would look like this:


#!/bin/bash

export OLDPWD=`pwd`
cd /tmp
LD_LIBRARY_PATH=@PREFIX@/lib/pspp ${prefix}/libexec/pspp/psppire
cd $OLDPWD


In the post-destroot you would use xinstall -m 755 to put it into $ 
{destroot}${prefix}/bin/psppire with the right permissions and then  
use reinplace to change @PREFIX@ to the real install prefix.


Do you ever need to pass command line arguments to the psppire  
program? If so, see how the wine port handles that.




More information about the macports-dev mailing list