summaryrefslogtreecommitdiff
path: root/support-files/mysql.spec.sh
diff options
context:
space:
mode:
authorJoerg Bruehe <joerg@mysql.com>2008-11-06 17:09:14 +0100
committerJoerg Bruehe <joerg@mysql.com>2008-11-06 17:09:14 +0100
commit3080e061e8c96d8d26f766763ad456babd2987ee (patch)
tree12a4c1e599f7891b3ba6896fca9295928254d963 /support-files/mysql.spec.sh
parent0c20c0f12ff15601e23bd45bcda70317a59d9380 (diff)
parent723b92054c20d4bc5b37650b99c74d2136b7aa60 (diff)
downloadmariadb-git-3080e061e8c96d8d26f766763ad456babd2987ee.tar.gz
Bug #40546 Debug server in RPM is built with compiler optimization
Prevent this by modifying CFLAGS and CXXFLAGS. Upmerge from 5.0, modified according to the different spec file structure. support-files/mysql.spec.sh: Bug #40546 Debug server in RPM is built with compiler optimization Modify CFLAGS and CXXFLAGS for the duration of the debug server build (implemented by doing it in a subshell) so that they do not contain any optimization flag. Play it safe and prepare for both gcc and icc.
Diffstat (limited to 'support-files/mysql.spec.sh')
-rw-r--r--support-files/mysql.spec.sh28
1 files changed, 20 insertions, 8 deletions
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 31e1c205d66..e7c090484b7 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -306,8 +306,6 @@ mkdir -p $RBR%{_libdir}/mysql
PATH=${MYSQL_BUILD_PATH:-/bin:/usr/bin}
export PATH
-# Build the Debug binary.
-
# Use gcc for C and C++ code (to avoid a dependency on libstdc++ and
# including exceptions into the code
if [ -z "$CXX" -a -z "$CC" ]
@@ -316,16 +314,25 @@ then
export CXX="gcc"
fi
+# Prepare compiler flags
+CFLAGS=${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS}
+CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti }
+
##############################################################################
#
# Build the debug version
#
##############################################################################
-# Strip -Oxxx, add -g and --with-debug.
-(cd mysql-debug-%{mysql_version} &&
-CFLAGS=`echo "${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS} -g" | sed -e 's/-O[0-9]*//g'` \
-CXXFLAGS=`echo "${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti} -g" | sed -e 's/-O[0-9]*//g'` \
+(
+# We are in a subshell, so we can modify variables just for one run.
+CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //' -e 's/$/ -g/'`
+CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //' -e 's/$/ -g/'`
+
+# Add -g and --with-debug.
+cd mysql-debug-%{mysql_version} &&
+CFLAGS=\"$CFLAGS\" \
+CXXFLAGS=\"$CXXFLAGS\" \
BuildMySQL "--enable-shared \
--with-debug \
--with-innodb \
@@ -357,8 +364,8 @@ fi
##############################################################################
(cd mysql-release-%{mysql_version} &&
-CFLAGS="${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS} -g" \
-CXXFLAGS="${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti} -g" \
+CFLAGS=\"$CFLAGS\" \
+CXXFLAGS=\"$CXXFLAGS\" \
BuildMySQL "--enable-shared \
--with-innodb \
%if %{CLUSTER_BUILD}
@@ -833,6 +840,11 @@ fi
# itself - note that they must be ordered by date (important when
# merging BK trees)
%changelog
+* Thu Nov 06 2008 Joerg Bruehe <joerg@mysql.com>
+
+- Modify CFLAGS and CXXFLAGS such that a debug build is not optimized.
+ This should cover both gcc and icc flags. Fixes bug#40546.
+
* Fri Aug 29 2008 Kent Boortz <kent@mysql.com>
- Removed the "Federated" storage engine option, and enabled in all