xinstall glob question

Darren Weber dweber at macports.org
Thu Apr 30 16:43:00 PDT 2009


I get an error, ie:

Error: Target org.macports.destroot returned: syntax error in expression "
string equal [file extension ${f}] ".app" ": variable references require
preceding $




On Thu, Apr 30, 2009 at 4:35 PM, Darren Weber <dweber at macports.org> 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?
>
> Thanks in advance,
> Darren
>
>
>
>
>
>
> On Thu, Apr 30, 2009 at 3:24 PM, Ryan Schmidt <ryandesign at macports.org>wrote:
>
>> On Apr 30, 2009, at 17:18, Darren Weber wrote:
>>
>>  Please take a look at this mess to reset RPATH for all libs in a set of
>>> binaries:
>>>
>>> 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;
>>>    "
>>>
>>> It works, but can it be done more efficiently?
>>>
>>> Can you do file tests in tcl, like the bash tests [ -f $f ] && [ -x $f ]
>>> ?
>>>
>>
>> Sure, those are respectively "file isfile" and "file executable". Take a
>> look at the manual for the file command:
>>
>> http://wiki.tcl.tk/1041
>>
>>
>>  PS, Don't ask me why it's required ;-)
>>>
>>
>> I'm scared to...
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20090430/6fc20ee2/attachment.html>


More information about the macports-dev mailing list