mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
package: fix code for detecting 64-bit compiler
bin/package, src/cmd/INIT/package.sh: - The code for detecting a 64-bit object file was seriously broken: the temporary file name could contain '64' because it included $$, the current PID, and 64-bit was detected if the output of 'file' (which includes the complete file name) contained '64'. Fix by removing the file name from 'file' output before testing. - Also refactor that code a bit and remove the nonsensical test if /bin/sh is a 64-bit binary, which is neither here nor there. It's what the compiler produces that we need to care about.
This commit is contained in:
parent
6025c8125e
commit
9a48ba1557
2 changed files with 14 additions and 32 deletions
23
bin/package
23
bin/package
|
@ -2491,24 +2491,15 @@ int b() { return 0; }
|
|||
esac
|
||||
;;
|
||||
*) case $bits in
|
||||
'') case `file /bin/sh 2>/dev/null` in
|
||||
*universal*64* | *64-bit* | *x86[_-]64*)
|
||||
pwd=`pwd`
|
||||
cd "$TMPDIR"
|
||||
'') bits=` cd "$TMPDIR"
|
||||
tmp=hi$$
|
||||
trap 'rm -f $tmp.*' 0 1 2
|
||||
cat > $tmp.a.c <<!
|
||||
int main() { return 0; }
|
||||
!
|
||||
if $cc -o $tmp.a.exe $tmp.a.c
|
||||
then case `file $tmp.a.exe` in
|
||||
*64*) bits=64 ;;
|
||||
esac
|
||||
fi </dev/null >/dev/null 2>&1
|
||||
rm -f $tmp.*
|
||||
trap - 0 1 2
|
||||
cd $pwd
|
||||
;;
|
||||
echo 'int main() { return 0; }' > $tmp.a.c
|
||||
$cc -o $tmp.a.exe $tmp.a.c </dev/null >/dev/null 2>&1
|
||||
file $tmp.a.exe 2>/dev/null | sed "s/$tmp\.a\.exe//g" `
|
||||
case $bits in
|
||||
*64*) bits=64 ;;
|
||||
*) bits= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -2490,24 +2490,15 @@ int b() { return 0; }
|
|||
esac
|
||||
;;
|
||||
*) case $bits in
|
||||
'') case `file /bin/sh 2>/dev/null` in
|
||||
*universal*64* | *64-bit* | *x86[_-]64*)
|
||||
pwd=`pwd`
|
||||
cd "$TMPDIR"
|
||||
'') bits=` cd "$TMPDIR"
|
||||
tmp=hi$$
|
||||
trap 'rm -f $tmp.*' 0 1 2
|
||||
cat > $tmp.a.c <<!
|
||||
int main() { return 0; }
|
||||
!
|
||||
if $cc -o $tmp.a.exe $tmp.a.c
|
||||
then case `file $tmp.a.exe` in
|
||||
*64*) bits=64 ;;
|
||||
esac
|
||||
fi </dev/null >/dev/null 2>&1
|
||||
rm -f $tmp.*
|
||||
trap - 0 1 2
|
||||
cd $pwd
|
||||
;;
|
||||
echo 'int main() { return 0; }' > $tmp.a.c
|
||||
$cc -o $tmp.a.exe $tmp.a.c </dev/null >/dev/null 2>&1
|
||||
file $tmp.a.exe 2>/dev/null | sed "s/$tmp\.a\.exe//g" `
|
||||
case $bits in
|
||||
*64*) bits=64 ;;
|
||||
*) bits= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue