Apps has the same behavior when started from a terminal window. It doesn't download.
I don't know of a good way to tell the required dependencies from the optional ones automagically. PHP is full of optional ones but they're conveniently in an extensions directory. Basically I'm looping through all the files in a directory tree, running ldd, then looping through its output recursively looking for the referenced libraries. If it has /local/ in the path of the library it's referencing (which I assume it gets from the ld.so.cache thanks to ldconfig) then I search through the /tmp/tcloop tree to see which extension it is actually in (this requires that copy2fs not be used). If ldd returns not found, then I use the app browser to figure out what extension has the missing file. Here's my script. I'm not convinced that I'm breaking out of the circular reference trap right, and it throws off the library counts, but it does seem to work OK in most cases:
#!/bin/sh
list_libs(){
local t
t=$(($1 + 1))
ldd "$2" | grep '=>' | while read SLIB SEP DLIB ADDR; do
if [ "$DLIB $ADDR" = "not found" ] ; then
echo -e "\\n***ERROR*** $SLIB not found ***\\n"
else
x=$DLIB
eval "x$t=$x"
c=0
for z in $(seq $t); do
eval "y=\$x$z"
if [ $z -lt $t -a "$x" = "$y" ] ; then
c=$(($t - $z))
fi
echo -e -n \\t
done
echo -n "$t ==>> $x"
echo $x | grep -q /local/ && echo -n " extension: $(find /tmp/tcloop -name $(basename "$x") | cut -d/ -f4).tcz"
echo
if [ $c -gt 0 ] ; then
echo -e "\\n***ERROR*** CIRCULAR REFERENCES FOUND *** BACKING UP $c LEVELS *** $y\\n"
return $c
else
list_libs $t "$x"
c=$?
if [ $c -gt 0 ] ; then
c=$(($c - 1))
return $c
fi
fi
fi
done
}
for a in $@; do
echo $a
list_libs 0 "$a"
echo -e \\n
done
Then I do some gleaning of the output like this:
grep extension saved-lib-tree.out | cut -d\ -f6 | sort | uniq -c | sort -n
to see what I really need. I'm also assuming that anything that shows up more than once is referenced by a dependency so I don't need to add those to the deps file.