Rewrite spec file, make corect CFLAGS, CPPFLAGS and LDFLAGS

This commit is contained in:
Jan F. Chadima 2010-03-10 06:37:35 +00:00
parent 410f2cd182
commit c4c518457a

View File

@ -9,7 +9,7 @@
Summary: The Cyrus SASL library
Name: cyrus-sasl
Version: 2.1.23
Release: 9%{?dist}
Release: 10%{?dist}
License: BSD
Group: System Environment/Libraries
# Source0 originally comes from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/;
@ -190,41 +190,42 @@ krb5_prefix=`krb5-config --prefix`
if test x$krb5_prefix = x%{_prefix} ; then
krb5_prefix=
else
CPPFLAGS="-I${krb5_prefix}/include"; export CPPFLAGS
CFLAGS="-I${krb5_prefix}/include $CFLAGS"
LDFLAGS="-L${krb5_prefix}/%{_lib}"; export LDFLAGS
CPPFLAGS="-I${krb5_prefix}/include $CPPFLAGS"; export CPPFLAGS
LDFLAGS="-L${krb5_prefix}/%{_lib} $LDFLAGS"; export LDFLAGS
fi
# Find OpenSSL.
LIBS="-lcrypt"; export LIBS
if pkg-config openssl ; then
CPPFLAGS="`pkg-config --cflags-only-I openssl` $CPPFLAGS"; export CPPFLAGS
CFLAGS="`pkg-config --cflags openssl` $CFLAGS"; export CFLAGS
LDFLAGS="`pkg-config --libs-only-L openssl` $LDFLAGS"; export LDFLAGS
fi
# Find the SQL libraries used needed by the SQL auxprop plugin.
mysql_config=mysql_config
pg_config=pg_config
SQL_CFLAGS=`${mysql_config} --cflags`" -I"`${pg_config} --includedir`
SQL_LIBS=`${mysql_config} --libs`" -L"`${pg_config} --libdir`" -lpq"
SQL_CFLAGS=`eval echo "$SQL_CFLAGS" | sed -e 's,-I%{_includedir}[^/],,g' -e 's,-I%{_includedir}$,,g' -e 's,[[:blank:]]+, ,g'`
SQL_LIBS=`eval echo "$SQL_LIBS" | sed -e 's,-L%{_libdir}[^/],,g' -e 's,-L%{_libdir}$,,g' -e 's,[[:blank:]]+, ,g'`
SQL_LDFLAGS=`eval echo "$SQL_LIBS" | sed -e 's,-[^L][^ ]*,,g'`
echo $SQL_LDFLAGS
SQL_LIBS=`eval echo "$SQL_LIBS" | sed -e 's,-[^l][^ ]*,,g'`
echo $SQL_LIBS
# Find the MySQL libraries used needed by the SQL auxprop plugin.
INC_DIR="`mysql_config --include`"
if test x"$INC_DIR" != "x-I%{_includedir}"; then
CPPFLAGS="$INC_DIR $CPPFLAGS"; export CPPFLAGS
fi
LIB_DIR="`mysql_config --libs | sed -e 's,-[^L][^ ]*,,g' -e 's,^ *,,' -e 's, *$,,' -e 's, *, ,g'`"
if test x"$LIB_DIR" != "x-L%{_libdir}"; then
LDFLAGS="$LIB_DIR $LDFLAGS"; export LDFLAGS
fi
cleanup_flags() {
sed -r -e 's,-D_GNU_SOURCE(=[^[:blank:]]+)?,,g' \
-e 's,-D_FILE_OFFSET_BITS=[[:digit:]]+,,g' \
-e 's,-D_LARGEFILE_SOURCE(=[^[:blank:]]+)?,,g' \
-e 's,[[:blank:]]+, ,g'
}
CFLAGS=`echo $CFLAGS $SQL_CFLAGS | cleanup_flags`; export CFLAGS
CPPFLAGS=`echo $CPPFLAGS $SQL_CFLAGS | cleanup_flags`; export CPPFLAGS
LDFLAGS=`echo $LDFLAGS $SQL_LDFLAGS | cleanup_flags`; export LDFLAGS
# Find the PostgreSQL libraries used needed by the SQL auxprop plugin.
INC_DIR="-I`pg_config --includedir`"
if test x"$INC_DIR" != "x-I%{_includedir}"; then
CPPFLAGS="$INC_DIR $CPPFLAGS"; export CPPFLAGS
fi
LIB_DIR="-L`pg_config --libdir`"
if test x"$LIB_DIR" != "x-L%{_libdir}"; then
LDFLAGS="$LIB_DIR $LDFLAGS"; export LDFLAGS
fi
CFLAGS="$CFLAGS $CPPFLAGS"; export CFLAGS
echo "$CFLAGS"
echo "$CPPFLAGS"
echo "$LDFLAGS"
%configure \
--enable-shared --disable-static \
@ -395,6 +396,9 @@ fi
%{_sbindir}/sasl2-shared-mechlist
%changelog
* Wed Mar 10 2010 Jan F. Chadima <jchadima@redhat.com> - 2.1.23-10
- Rewrite spec file, make corect CFLAGS, CPPFLAGS and LDFLAGS
* Mon Feb 22 2010 Jan F. Chadima <jchadima@redhat.com> - 2.1.23-9
- solve race condition (#566875)