mystic/cryptlib/patches/gccversion-345.patch
2024-04-20 11:07:14 +02:00

48 lines
1.4 KiB
Diff

--- cryptlib-3.4.5/tools/ccopts.sh.orig 2023-01-15 12:18:32.449673775 +0100
+++ cryptlib-3.4.5/tools/ccopts.sh 2023-01-15 12:20:07.109441725 +0100
@@ -508,10 +508,17 @@
# apparent version less than 10 we add a trailing zero to the string to make
# the checks that follow work.
-GCC_VER="$($CC -dumpversion | tr -d '.' | cut -c 1-2)"
-if [ "$GCC_VER" -lt 10 ] ; then
- GCC_VER="${GCC_VER}0" ;
-fi
+GCC_VER="$($CC -dumpversion)"
+case $GCC_VER in
+ [0-9])
+ GCC_VER="${GCC_VER}0" ;;
+
+ [0-9][0-9]*)
+ GCC_VER="$(echo $GCC_VER | tr -d '.' | cut -c 1-3)" ;;
+
+ *)
+ GCC_VER="$(echo $GCC_VER | tr -d '.' | cut -c 1-2)" ;;
+esac
# Try and determine the CPU type. This is made more complex by a pile of
# *BSE's which, along with antideluvian tools like an as that doesn't
@@ -589,12 +596,7 @@
# ASLR where it's supported.
if [ "$ARCH" = "i586" ] || [ "$ARCH" = "i686" ] || [ "$ARCH" = "x86_64" ] ; then
- if [ "$GCC_VER" -ge 45 ] ; then
- CCARGS="$CCARGS -march=native -mtune=generic" ;
- if [ "$ARCH" = "x86_64" ] ; then
- CCARGS="$CCARGS -fPIC" ;
- fi ;
- elif [ "$GCC_VER" -ge 30 ] ; then
+ if [ "$GCC_VER" -ge 30 ] ; then
case $ARCH in
'x86_64')
CCARGS="$CCARGS -march=opteron -fPIC" ;;
@@ -606,7 +608,7 @@
CCARGS="$CCARGS -march=pentium" ;;
esac ;
else
- CCARGS="$CCARGS -mcpu=pentium" ;
+ CCARGS="$CCARGS -march=native" ;
fi ;
fi