This avoids having to manually add -lpsapi when linking in libc++.a. This requires using a new script to merge libraries using ar -M with a small MRI script. The script merge_archives.py in libcxx does the merge by manually extracting all object files and creating a new archive out of them. The import libraries created by LLVM have more than one object file with the same file name (just like MSVC tools do), so extracting them doesn't work as intended - but merging using a MRI script works.
30 lines
388 B
Bash
Executable File
30 lines
388 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
if [ $# -lt 2 ]; then
|
|
echo $0 lib add1 [add2...]
|
|
exit 1
|
|
fi
|
|
|
|
: ${AR:=llvm-ar}
|
|
: ${RANLIB:=llvm-ranlib}
|
|
|
|
SCRIPT=merge.mri
|
|
OUT=tmp.a
|
|
TARGET=$1
|
|
|
|
rm -f $SCRIPT
|
|
|
|
echo "CREATE $OUT" >> $SCRIPT
|
|
while [ $# -gt 0 ]; do
|
|
echo "ADDLIB $1" >> $SCRIPT
|
|
shift
|
|
done
|
|
echo "SAVE" >> $SCRIPT
|
|
echo "END" >> $SCRIPT
|
|
$AR -M < $SCRIPT
|
|
rm -f $SCRIPT
|
|
$RANLIB $OUT
|
|
mv $OUT $TARGET
|