xinstall glob question

Ryan Schmidt ryandesign at macports.org
Thu Apr 30 16:42:32 PDT 2009


On Apr 30, 2009, at 18:35, Darren Weber wrote:

> It seems that I should be able to replace most of the system calls  
> as follows (orig system call is commented here, with tcl  
> replacements below):
>
> #system "
> #    cd ${build.dir};
> #    find ${destroot}/${vtkExamplePath}/bin | grep -e '\[^(bin)\]\ 
> $' > find.txt;
> #    for f in `cat find.txt`; do
> #        if \[ -f \${f} \] && \[ -x \${f} \]; then
> #            echo install_name_tool changing link libs for \${f};
> #            otool -L \${f} | grep 'libvtk' > otool_libs.txt;
> #            for lib in `cat otool_libs.txt`; do
> #                newlib=`echo \${lib} | sed s#${build.dir}/bin#$ 
> {prefix}/lib/${distname}#`;
> #                install_name_tool -change \${lib} \${newlib} \${f};
> #            done;
> #            rm otool_libs.txt;
> #        fi;
> #    done;
> #    rm find.txt;
> #    "
>
>
> foreach f [glob ${destroot}/${vtkExamplePath}/bin/*] {
>     if { string equal [file extension ${f}] ".app" } {
>         set exeName [file rootname [lindex [file split $f] end]]
>         set f [format "%s/Contents/MacOS/%s" ${f} ${exeName}]
>     }
>     if { expr [file isfile ${f}] && [file executable ${f}] } {
>         system "
>             cd ${build.dir};
>             otool -L \${f} | grep 'libvtk' > otool_libs.txt;
>             for lib in `cat otool_libs.txt`; do
>                 newlib=`echo \${lib} | sed s#${build.dir}/bin#$ 
> {prefix}/lib/${distname}#`;
>                 install_name_tool -change \${lib} \${newlib} \${f};
>             done;
>             rm otool_libs.txt;
>             "
>     }
> }
>
>
> There is some problem with the tcl equivalent.  While it appears to  
> work in tclsh, it doesn't work in the Portfile.  Any ideas?



You may also want to look at the build phase of the oracle- 
instantclient port where I also do some install_name_tool / otool  
manipulations. I only use system to run install_name_tool, and I get  
the output of otool using exec.




More information about the macports-dev mailing list