mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
build: More robust temp file handling
This commit is contained in:
parent
8a6b38a9b5
commit
b4ad7359d6
@ -1,13 +1,18 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
# This is used for renaming symbols for the fat runtime, don't call directly
|
# This is used for renaming symbols for the fat runtime, don't call directly
|
||||||
# TODO: make this a lot less fragile!
|
# TODO: make this a lot less fragile!
|
||||||
|
cleanup () {
|
||||||
|
rm -f ${SYMSFILE} ${KEEPSYMS}
|
||||||
|
}
|
||||||
|
|
||||||
PREFIX=$1
|
PREFIX=$1
|
||||||
KEEPSYMS_IN=$2
|
KEEPSYMS_IN=$2
|
||||||
shift 2
|
shift 2
|
||||||
BUILD=$@
|
BUILD=$@
|
||||||
OUT=$(echo $BUILD | sed 's/.* -o \(.*\.o\).*/\1/')
|
OUT=$(echo $BUILD | sed 's/.* -o \(.*\.o\).*/\1/')
|
||||||
SYMSFILE=/tmp/${PREFIX}_rename.syms.$$
|
trap cleanup INT QUIT EXIT
|
||||||
KEEPSYMS=/tmp/keep.syms.$$
|
SYMSFILE=$(mktemp --tmpdir ${PREFIX}_rename.syms.XXXXX)
|
||||||
|
KEEPSYMS=$(mktemp --tmpdir keep.syms.XXXXX)
|
||||||
# grab the command without the target obj or src file flags
|
# grab the command without the target obj or src file flags
|
||||||
# we don't just call gcc directly as there may be flags modifying the arch
|
# we don't just call gcc directly as there may be flags modifying the arch
|
||||||
CC_CMD=$(echo $BUILD | sed 's/ -o .*\.o//;s/ -c //;s/ .[^ ]*\.c//;')
|
CC_CMD=$(echo $BUILD | sed 's/ -o .*\.o//;s/ -c //;s/ .[^ ]*\.c//;')
|
||||||
@ -24,4 +29,3 @@ if test -s ${SYMSFILE}
|
|||||||
then
|
then
|
||||||
objcopy --redefine-syms=${SYMSFILE} ${OUT}
|
objcopy --redefine-syms=${SYMSFILE} ${OUT}
|
||||||
fi
|
fi
|
||||||
rm -f ${SYMSFILE} ${KEEPSYMS}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user