Skip to content

Commit ab15c45

Browse files
committed
Significantly speed up collect-dlls.sh
Don't re-run objdump repeatedly. Cache the results instead and only run it once per executable file.
1 parent 7e67c84 commit ab15c45

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

win32/collect-dlls.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,30 @@ EXE=$2
1111
mkdir -p $OUTPUT
1212
rm -rf $OUTPUT/*
1313

14-
cp -a $EXE $OUTPUT
14+
add_binary()
15+
{
16+
destfile="$OUTPUT/`basename $1`"
17+
if [ ! -f $destfile ] ; then
18+
cp -anv $1 $destfile
19+
objdump -x $1 | grep "DLL Name" | cut -d: -f2 >${destfile}.objdeps
20+
fi
21+
}
22+
1523
last_file_count=0
24+
add_binary $EXE
1625

1726
while true ; do
18-
file_count=`ls -1 $OUTPUT/* | wc -l`
27+
file_count=`ls -1 $OUTPUT/*.objdeps | wc -l`
1928
echo "count=$file_count"
2029
if [ $file_count -eq $last_file_count ] ; then break ; fi
2130
last_file_count=$file_count
2231

23-
objdump -x $OUTPUT/* | grep "DLL Name" | cut -d: -f2 | sort | uniq | while read i ; do
32+
cat $OUTPUT/*.objdeps | sort | uniq | while read i ; do
2433
dll=`echo $i` # fixup weird line endings
2534
if [[ -f /mingw32/bin/$dll ]] ; then
26-
cp -anv /mingw32/bin/$dll $OUTPUT
35+
add_binary /mingw32/bin/$dll
2736
fi
2837
done
2938
done
39+
40+
rm -rf $OUTPUT/*.objdeps

0 commit comments

Comments
 (0)