66c68a
#!/bin/sh -
66c68a
0c1e1f
# mingw-scripts
66c68a
# Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones.
b8c580
# Copyright (C) 2008 Levente Farkas
66c68a
#
66c68a
# This program is free software; you can redistribute it and/or modify
66c68a
# it under the terms of the GNU General Public License as published by
0c1e1f
# the Free Software Foundation; either version 2, or (at your option)
0c1e1f
# any later version.
66c68a
#
66c68a
# This program is distributed in the hope that it will be useful,
66c68a
# but WITHOUT ANY WARRANTY; without even the implied warranty of
66c68a
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
66c68a
# GNU General Public License for more details.
66c68a
#
66c68a
# You should have received a copy of the GNU General Public License
66c68a
# along with this program; if not, write to the Free Software
0c1e1f
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
0c1e1f
# 02111-1307, USA.
66c68a
b8c580
# This is a useful command-line script through which one can use the
0c1e1f
# macros from /etc/rpm/macros.cross, macros.mingw32 and macros.mingw64
66c68a
0c1e1f
if [ "`basename $0`" = "i686-w64-mingw32-pkg-config" ] ; then
0c1e1f
    NAME="mingw32_pkg_config"
0c1e1f
elif [ "`basename $0`" = "x86_64-w64-mingw32-pkg-config" ] ; then
0c1e1f
    NAME="mingw64_pkg_config"
0c1e1f
else
0c1e1f
    NAME="`basename $0|tr -- - _`"
0c1e1f
fi
505179
7daa01
# When using the CMake wrappers, prevent CFLAGS and CXXFLAGS from being set
7daa01
# unless they're already set in the current environment (RHBZ #1136069)
7daa01
if [[ $NAME == *cmake* ]] ; then
7daa01
    MINGW32_CFLAGS=${MINGW32_CFLAGS:-""}
7daa01
    MINGW32_CXXFLAGS=${MINGW32_CXXFLAGS:-""}
7daa01
    MINGW64_CFLAGS=${MINGW64_CFLAGS:-""}
7daa01
    MINGW64_CXXFLAGS=${MINGW64_CXXFLAGS:-""}
7daa01
fi
7daa01
505179
# NOTE: The use of 'eval' in combination with '$@' is a potential security risk
505179
#       We should find a more safe replacement for this command
505179
#       Suggestions are welcome at the Fedora MinGW mailing list
f185f5
eval "MINGW_CMAKE_NO_VERBOSE=1 `rpm --eval "%{$NAME}"`" '"$@"'