mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
bin/package: fix 64-bit detection on systems without 'cc'
If the compiler is called gcc but not cc, the 64-bit detection didn't work and $HOSTTYPE (and the arch/ subdirectory) did not get the -64 suffix. bin/package, src/cmd/INIT/package.sh: - Run checkcc() before attempting to compile the program. This will set $cc to the path to gcc if there is no 'cc' command. - trap: use 'rm -rf' to also delete .dSYM directories (macOS). - checkcc(): Since we're here, find clang as well.
This commit is contained in:
parent
24fc1bbca9
commit
0ead68b704
2 changed files with 16 additions and 10 deletions
13
bin/package
13
bin/package
|
@ -1724,12 +1724,12 @@ int b() { return 0; }
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*) case $bits in
|
*) case $bits in
|
||||||
'') bits=$( cd "$TMPDIR"
|
'') bits=$( set -e
|
||||||
LC_ALL=C
|
cd "$TMPDIR"
|
||||||
export LC_ALL
|
|
||||||
tmp=hi$$
|
tmp=hi$$
|
||||||
trap 'rm -f $tmp.*' 0 1 2
|
trap 'rm -rf "$tmp".*' 0 1 2
|
||||||
echo 'int main() { return 0; }' > $tmp.a.c
|
echo 'int main() { return 0; }' > $tmp.a.c
|
||||||
|
checkcc
|
||||||
$cc $CCFLAGS -o $tmp.a.exe $tmp.a.c </dev/null >/dev/null 2>&1
|
$cc $CCFLAGS -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" )
|
file $tmp.a.exe 2>/dev/null | sed "s/$tmp\.a\.exe//g" )
|
||||||
case $bits in
|
case $bits in
|
||||||
|
@ -1805,7 +1805,10 @@ checkcc()
|
||||||
if onpath $CC
|
if onpath $CC
|
||||||
then cc=$_onpath_
|
then cc=$_onpath_
|
||||||
else case $CC in
|
else case $CC in
|
||||||
cc) if onpath gcc
|
cc) if onpath clang
|
||||||
|
then CC=clang
|
||||||
|
cc=$_onpath_
|
||||||
|
elif onpath gcc
|
||||||
then CC=gcc
|
then CC=gcc
|
||||||
cc=$_onpath_
|
cc=$_onpath_
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1724,12 +1724,12 @@ int b() { return 0; }
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*) case $bits in
|
*) case $bits in
|
||||||
'') bits=$( cd "$TMPDIR"
|
'') bits=$( set -e
|
||||||
LC_ALL=C
|
cd "$TMPDIR"
|
||||||
export LC_ALL
|
|
||||||
tmp=hi$$
|
tmp=hi$$
|
||||||
trap 'rm -f $tmp.*' 0 1 2
|
trap 'rm -rf "$tmp".*' 0 1 2
|
||||||
echo 'int main() { return 0; }' > $tmp.a.c
|
echo 'int main() { return 0; }' > $tmp.a.c
|
||||||
|
checkcc
|
||||||
$cc $CCFLAGS -o $tmp.a.exe $tmp.a.c </dev/null >/dev/null 2>&1
|
$cc $CCFLAGS -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" )
|
file $tmp.a.exe 2>/dev/null | sed "s/$tmp\.a\.exe//g" )
|
||||||
case $bits in
|
case $bits in
|
||||||
|
@ -1805,7 +1805,10 @@ checkcc()
|
||||||
if onpath $CC
|
if onpath $CC
|
||||||
then cc=$_onpath_
|
then cc=$_onpath_
|
||||||
else case $CC in
|
else case $CC in
|
||||||
cc) if onpath gcc
|
cc) if onpath clang
|
||||||
|
then CC=clang
|
||||||
|
cc=$_onpath_
|
||||||
|
elif onpath gcc
|
||||||
then CC=gcc
|
then CC=gcc
|
||||||
cc=$_onpath_
|
cc=$_onpath_
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue