2006-09-30 20:02:39 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2007-08-29 14:20:39 +04:00
|
|
|
# Generated by qconf 1.4 ( http://delta.affinix.com/qconf/ )
|
2006-09-30 20:02:39 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
show_usage() {
|
|
|
|
cat <<EOT
|
|
|
|
Usage: $0 [OPTION]...
|
|
|
|
|
|
|
|
This script creates necessary configuration files to build/install.
|
|
|
|
|
|
|
|
Main options:
|
2007-07-25 11:00:14 +04:00
|
|
|
--prefix=[path] Base path for build/install. Default: /usr/local
|
|
|
|
--bindir=[path] Directory for binaries. Default: PREFIX/bin
|
|
|
|
--datadir=[path] Directory for data. Default: PREFIX/share
|
|
|
|
--qtdir=[path] Directory where Qt is installed.
|
|
|
|
--verbose Show extra configure output.
|
|
|
|
--help This help text.
|
2006-09-30 20:02:39 +04:00
|
|
|
|
2007-03-12 15:21:02 +03:00
|
|
|
Dependency options:
|
2008-07-02 19:06:22 +04:00
|
|
|
--with-libtorrent-inc=[path] Path to libtorrent-rasterbar include
|
|
|
|
files
|
|
|
|
--with-libtorrent-lib=[path] Path to libtorrent-rasterbar library
|
|
|
|
files
|
|
|
|
--with-libtorrent-static-lib=[path] Path to libtorrent-rasterbar .a file
|
2007-06-15 15:29:00 +04:00
|
|
|
--with-libboost-inc=[path] Path to libboost include files
|
2007-11-24 01:57:49 +03:00
|
|
|
--with-libcurl-inc=[path] Path to libcurl include files
|
|
|
|
--with-libcurl-lib=[path] Path to libcurl library files
|
2007-08-29 13:22:21 +04:00
|
|
|
--disable-libmagick Disable use of libmagick
|
|
|
|
--with-libmagick-inc=[path] Path to libmagick++ include files
|
|
|
|
--with-libmagick-lib=[path] Path to libmagick++ library files
|
2007-09-04 02:05:40 +04:00
|
|
|
--disable-libzzip Disable use of libzzip
|
|
|
|
--with-libzzip-inc=[path] Path to libzzip++ include files
|
|
|
|
--with-libzzip-lib=[path] Path to libzzip++ library files
|
2007-03-12 15:21:02 +03:00
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
EOT
|
|
|
|
}
|
|
|
|
|
|
|
|
# which/make detection adapted from Qt
|
|
|
|
which_command() {
|
|
|
|
OLD_HOME=$HOME
|
|
|
|
HOME=/dev/null
|
|
|
|
export HOME
|
|
|
|
|
|
|
|
WHICH=`which which 2>/dev/null`
|
|
|
|
if echo $WHICH | grep 'shell built-in command' >/dev/null 2>&1; then
|
|
|
|
WHICH=which
|
|
|
|
elif [ -z "$WHICH" ]; then
|
|
|
|
if which which >/dev/null 2>&1; then
|
|
|
|
WHICH=which
|
|
|
|
else
|
|
|
|
for a in /usr/ucb /usr/bin /bin /usr/local/bin; do
|
|
|
|
if [ -x $a/which ]; then
|
|
|
|
WHICH=$a/which
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$WHICH" ]; then
|
|
|
|
OLD_IFS=$IFS
|
|
|
|
IFS=:
|
|
|
|
for a in $PATH; do
|
|
|
|
if [ -x $a/$1 ]; then
|
|
|
|
echo "$a/$1"
|
|
|
|
IFS=$OLD_IFS
|
|
|
|
export IFS
|
|
|
|
HOME=$OLD_HOME
|
|
|
|
export HOME
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
IFS=$OLD_IFS
|
|
|
|
export IFS
|
|
|
|
else
|
|
|
|
a=`"$WHICH" "$1" 2>/dev/null`
|
|
|
|
if [ ! -z "$a" -a -x "$a" ]; then
|
|
|
|
echo "$a"
|
|
|
|
HOME=$OLD_HOME
|
|
|
|
export HOME
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
HOME=$OLD_HOME
|
|
|
|
export HOME
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
WHICH=which_command
|
|
|
|
|
|
|
|
# find a make command
|
|
|
|
if [ -z "$MAKE" ]; then
|
|
|
|
MAKE=
|
|
|
|
for mk in gmake make; do
|
|
|
|
if $WHICH $mk >/dev/null 2>&1; then
|
|
|
|
MAKE=`$WHICH $mk`
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -z "$MAKE" ]; then
|
|
|
|
echo "You don't seem to have 'make' or 'gmake' in your PATH."
|
|
|
|
echo "Cannot proceed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
show_qt_info() {
|
|
|
|
printf "Be sure you have a proper Qt 4.0 build environment set up. This means not\n"
|
|
|
|
printf "just Qt, but also a C++ compiler, a make tool, and any other packages\n"
|
|
|
|
printf "necessary for compiling C++ programs.\n"
|
|
|
|
printf "\n"
|
|
|
|
printf "If you are certain everything is installed, then it could be that Qt 4 is not\n"
|
|
|
|
printf "being recognized or that a different version of Qt is being detected by\n"
|
|
|
|
printf "mistake (for example, this could happen if \$QTDIR is pointing to a Qt 3\n"
|
|
|
|
printf "installation). At least one of the following conditions must be satisfied:\n"
|
|
|
|
printf "\n"
|
|
|
|
printf " 1) --qtdir is set to the location of Qt\n"
|
|
|
|
printf " 2) \$QTDIR is set to the location of Qt\n"
|
|
|
|
printf " 3) QtCore is in the pkg-config database\n"
|
|
|
|
printf " 4) qmake is in the \$PATH\n"
|
|
|
|
printf "\n"
|
|
|
|
printf "This script will use the first one it finds to be true, checked in the above\n"
|
|
|
|
printf "order. #3 and #4 are the recommended options. #1 and #2 are mainly for\n"
|
|
|
|
printf "overriding the system configuration.\n"
|
|
|
|
printf "\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
|
|
|
|
case "$1" in
|
|
|
|
--prefix=*)
|
|
|
|
PREFIX=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
--bindir=*)
|
|
|
|
BINDIR=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2007-07-25 11:00:14 +04:00
|
|
|
--datadir=*)
|
|
|
|
DATADIR=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
--qtdir=*)
|
|
|
|
EX_QTDIR=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2007-03-12 15:21:02 +03:00
|
|
|
--with-libtorrent-inc=*)
|
|
|
|
QC_WITH_LIBTORRENT_INC=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2007-03-12 15:34:57 +03:00
|
|
|
--with-libtorrent-lib=*)
|
|
|
|
QC_WITH_LIBTORRENT_LIB=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2007-06-15 15:29:00 +04:00
|
|
|
--with-libtorrent-static-lib=*)
|
|
|
|
QC_WITH_LIBTORRENT_STATIC_LIB=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2007-04-04 01:51:26 +04:00
|
|
|
--with-libboost-inc=*)
|
|
|
|
QC_WITH_LIBBOOST_INC=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2007-11-24 01:57:49 +03:00
|
|
|
--with-libcurl-inc=*)
|
|
|
|
QC_WITH_LIBCURL_INC=$optarg
|
2007-03-12 15:25:58 +03:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2007-11-24 01:57:49 +03:00
|
|
|
--with-libcurl-lib=*)
|
|
|
|
QC_WITH_LIBCURL_LIB=$optarg
|
2007-03-12 15:43:35 +03:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2007-08-29 13:22:21 +04:00
|
|
|
--disable-libmagick)
|
|
|
|
QC_DISABLE_libmagick="Y"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
--with-libmagick-inc=*)
|
|
|
|
QC_WITH_LIBMAGICK_INC=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
--with-libmagick-lib=*)
|
|
|
|
QC_WITH_LIBMAGICK_LIB=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2007-09-04 02:05:40 +04:00
|
|
|
--disable-libzzip)
|
|
|
|
QC_DISABLE_libzzip="Y"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
--with-libzzip-inc=*)
|
|
|
|
QC_WITH_LIBZZIP_INC=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
--with-libzzip-lib=*)
|
|
|
|
QC_WITH_LIBZZIP_LIB=$optarg
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
--verbose)
|
2007-08-29 14:20:39 +04:00
|
|
|
QC_VERBOSE="Y"
|
2006-09-30 20:02:39 +04:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--help) show_usage; exit ;;
|
|
|
|
*) show_usage; exit ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
PREFIX=${PREFIX:-/usr/local}
|
|
|
|
BINDIR=${BINDIR:-$PREFIX/bin}
|
2007-07-25 11:00:14 +04:00
|
|
|
DATADIR=${DATADIR:-$PREFIX/share}
|
2006-09-30 20:02:39 +04:00
|
|
|
|
|
|
|
echo "Configuring qbittorrent ..."
|
|
|
|
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ "$QC_VERBOSE" = "Y" ]; then
|
2006-09-30 20:02:39 +04:00
|
|
|
echo
|
|
|
|
echo PREFIX=$PREFIX
|
|
|
|
echo BINDIR=$BINDIR
|
2007-07-25 11:00:14 +04:00
|
|
|
echo DATADIR=$DATADIR
|
2006-09-30 20:02:39 +04:00
|
|
|
echo EX_QTDIR=$EX_QTDIR
|
2007-03-12 15:21:02 +03:00
|
|
|
echo QC_WITH_LIBTORRENT_INC=$QC_WITH_LIBTORRENT_INC
|
2007-03-12 15:34:57 +03:00
|
|
|
echo QC_WITH_LIBTORRENT_LIB=$QC_WITH_LIBTORRENT_LIB
|
2007-06-15 15:29:00 +04:00
|
|
|
echo QC_WITH_LIBTORRENT_STATIC_LIB=$QC_WITH_LIBTORRENT_STATIC_LIB
|
2007-04-04 01:51:26 +04:00
|
|
|
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
|
2007-11-24 01:57:49 +03:00
|
|
|
echo QC_WITH_LIBCURL_INC=$QC_WITH_LIBCURL_INC
|
|
|
|
echo QC_WITH_LIBCURL_LIB=$QC_WITH_LIBCURL_LIB
|
2007-08-29 13:22:21 +04:00
|
|
|
echo QC_DISABLE_libmagick=$QC_DISABLE_libmagick
|
|
|
|
echo QC_WITH_LIBMAGICK_INC=$QC_WITH_LIBMAGICK_INC
|
|
|
|
echo QC_WITH_LIBMAGICK_LIB=$QC_WITH_LIBMAGICK_LIB
|
2007-09-04 02:05:40 +04:00
|
|
|
echo QC_DISABLE_libzzip=$QC_DISABLE_libzzip
|
|
|
|
echo QC_WITH_LIBZZIP_INC=$QC_WITH_LIBZZIP_INC
|
|
|
|
echo QC_WITH_LIBZZIP_LIB=$QC_WITH_LIBZZIP_LIB
|
2006-09-30 20:02:39 +04:00
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf "Verifying Qt 4 build environment ... "
|
|
|
|
|
2007-08-29 14:20:39 +04:00
|
|
|
# run qmake -v and check version
|
|
|
|
qmake_check_v4() {
|
|
|
|
if [ -x "$1" ]; then
|
|
|
|
if echo `$1 -v 2>&1` | grep "Qt version 4\." >/dev/null 2>&1; then
|
|
|
|
return 0
|
|
|
|
elif [ "$QC_VERBOSE" = "Y" ]; then
|
|
|
|
echo "Warning: $1 not for Qt 4"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$QC_VERBOSE" = "Y" ]; then
|
2006-09-30 20:02:39 +04:00
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
|
|
|
qm=""
|
2007-08-29 14:20:39 +04:00
|
|
|
names="qmake-qt4 qmake4 qmake"
|
2006-09-30 20:02:39 +04:00
|
|
|
|
|
|
|
# qt4 check: --qtdir
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ -z "$qm" ] && [ ! -z "$EX_QTDIR" ]; then
|
|
|
|
for n in $names; do
|
|
|
|
qstr=$EX_QTDIR/bin/$n
|
|
|
|
if qmake_check_v4 "$qstr"; then
|
|
|
|
qm=$qstr
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
2006-09-30 20:02:39 +04:00
|
|
|
fi
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ -z "$qm" ] && [ "$QC_VERBOSE" = "Y" ]; then
|
2006-09-30 20:02:39 +04:00
|
|
|
echo "Warning: qmake not found via --qtdir"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# qt4 check: QTDIR
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ -z "$qm" ] && [ ! -z "$QTDIR" ]; then
|
|
|
|
for n in $names; do
|
|
|
|
qstr=$QTDIR/bin/$n
|
|
|
|
if qmake_check_v4 "$qstr"; then
|
|
|
|
qm=$qstr
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
2006-09-30 20:02:39 +04:00
|
|
|
fi
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ -z "$qm" ] && [ "$QC_VERBOSE" = "Y" ]; then
|
2006-09-30 20:02:39 +04:00
|
|
|
echo "Warning: qmake not found via \$QTDIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# qt4 check: pkg-config
|
|
|
|
if [ -z "$qm" ]; then
|
|
|
|
str=`pkg-config QtCore --variable=exec_prefix 2>/dev/null`
|
|
|
|
if [ ! -z "$str" ]; then
|
2007-08-29 14:20:39 +04:00
|
|
|
for n in $names; do
|
|
|
|
qstr=$str/bin/$n
|
|
|
|
if qmake_check_v4 "$qstr"; then
|
|
|
|
qm=$qstr
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
2006-09-30 20:02:39 +04:00
|
|
|
fi
|
|
|
|
fi
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ -z "$qm" ] && [ "$QC_VERBOSE" = "Y" ]; then
|
2006-09-30 20:02:39 +04:00
|
|
|
echo "Warning: qmake not found via pkg-config"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# qt4 check: PATH
|
|
|
|
if [ -z "$qm" ]; then
|
2007-08-29 14:20:39 +04:00
|
|
|
for n in $names; do
|
|
|
|
qstr=`$WHICH $n 2>/dev/null`
|
|
|
|
if qmake_check_v4 "$qstr"; then
|
|
|
|
qm=$qstr
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
2006-09-30 20:02:39 +04:00
|
|
|
fi
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ -z "$qm" ] && [ "$QC_VERBOSE" = "Y" ]; then
|
2006-09-30 20:02:39 +04:00
|
|
|
echo "Warning: qmake not found via \$PATH"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$qm" ]; then
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ "$QC_VERBOSE" = "Y" ]; then
|
2006-09-30 20:02:39 +04:00
|
|
|
echo " -> fail"
|
|
|
|
else
|
|
|
|
echo "fail"
|
|
|
|
fi
|
|
|
|
printf "\n"
|
2007-08-29 14:20:39 +04:00
|
|
|
printf "Reason: Unable to find the 'qmake' tool for Qt 4.\n"
|
2006-09-30 20:02:39 +04:00
|
|
|
printf "\n"
|
|
|
|
show_qt_info
|
|
|
|
exit 1;
|
|
|
|
fi
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ "$QC_VERBOSE" = "Y" ]; then
|
2006-09-30 20:02:39 +04:00
|
|
|
echo qmake found in $qm
|
|
|
|
fi
|
|
|
|
|
|
|
|
gen_files() {
|
|
|
|
cat >$1/modules.cpp <<EOT
|
2007-09-04 02:59:46 +04:00
|
|
|
#line 1 "qt4.qcm"
|
2006-09-30 20:02:39 +04:00
|
|
|
/*
|
|
|
|
-----BEGIN QCMOD-----
|
2007-09-04 02:59:46 +04:00
|
|
|
name: Qt >= 4.3
|
2006-09-30 20:02:39 +04:00
|
|
|
-----END QCMOD-----
|
|
|
|
*/
|
2007-09-04 02:59:46 +04:00
|
|
|
class qc_qt4 : public ConfObj
|
2006-09-30 20:02:39 +04:00
|
|
|
{
|
|
|
|
public:
|
2007-09-04 02:59:46 +04:00
|
|
|
qc_qt4(Conf *c) : ConfObj(c) {}
|
|
|
|
QString name() const { return "Qt >= 4.3"; }
|
|
|
|
QString shortname() const { return "Qt 4.3"; }
|
2006-09-30 20:02:39 +04:00
|
|
|
bool exec()
|
|
|
|
{
|
2008-07-06 22:39:07 +04:00
|
|
|
if(QT_VERSION >= 0x040400) {
|
|
|
|
conf->addDefine("QT_4_4");
|
|
|
|
}
|
2007-09-04 02:59:46 +04:00
|
|
|
return(QT_VERSION >= 0x040300);
|
2008-07-06 22:39:07 +04:00
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
}
|
|
|
|
};
|
2008-07-02 19:06:22 +04:00
|
|
|
#line 1 "libtorrent-rasterbar.qcm"
|
2006-09-30 20:02:39 +04:00
|
|
|
/*
|
|
|
|
-----BEGIN QCMOD-----
|
2008-07-02 19:06:22 +04:00
|
|
|
name: libtorrent-rasterbar
|
|
|
|
arg: with-libtorrent-inc=[path], Path to libtorrent-rasterbar include files
|
|
|
|
arg: with-libtorrent-lib=[path], Path to libtorrent-rasterbar library files
|
|
|
|
arg: with-libtorrent-static-lib=[path], Path to libtorrent-rasterbar .a file
|
2006-09-30 20:02:39 +04:00
|
|
|
-----END QCMOD-----
|
|
|
|
*/
|
2008-07-02 19:06:22 +04:00
|
|
|
class qc_libtorrent_rasterbar : public ConfObj
|
2006-09-30 20:02:39 +04:00
|
|
|
{
|
|
|
|
public:
|
2008-07-02 19:06:22 +04:00
|
|
|
qc_libtorrent_rasterbar(Conf *c) : ConfObj(c) {}
|
|
|
|
QString name() const { return "libtorrent-rasterbar >= 0.13"; }
|
|
|
|
QString shortname() const { return "libtorrent-rasterbar"; }
|
2006-09-30 20:02:39 +04:00
|
|
|
bool exec(){
|
2007-04-04 01:51:26 +04:00
|
|
|
QString s;
|
|
|
|
s = conf->getenv("QC_WITH_LIBTORRENT_INC");
|
|
|
|
if(!s.isEmpty()) {
|
2007-04-12 21:17:04 +04:00
|
|
|
if(!conf->checkHeader(s, "libtorrent/lsd.hpp")) {
|
2007-04-04 01:51:26 +04:00
|
|
|
return false;
|
2007-03-12 15:21:02 +03:00
|
|
|
}
|
2007-04-04 01:51:26 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/include";
|
|
|
|
sl << "/usr/local/include";
|
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
2007-04-12 21:17:04 +04:00
|
|
|
if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
|
2007-04-04 01:51:26 +04:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
conf->addIncludePath(s);
|
|
|
|
conf->addIncludePath(s+QDir::separator()+"libtorrent");
|
2007-03-12 15:34:57 +03:00
|
|
|
|
2007-06-15 15:29:00 +04:00
|
|
|
s = conf->getenv("QC_WITH_LIBTORRENT_STATIC_LIB");
|
|
|
|
if(!s.isEmpty() && QFile::exists(s) && s.endsWith(".a")){
|
|
|
|
conf->addLib(s);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-04-04 01:51:26 +04:00
|
|
|
s = conf->getenv("QC_WITH_LIBTORRENT_LIB");
|
|
|
|
if(!s.isEmpty()) {
|
2008-07-02 19:06:22 +04:00
|
|
|
if(!conf->checkLibrary(s, "torrent-rasterbar")) {
|
2007-03-12 15:34:57 +03:00
|
|
|
return false;
|
2007-04-04 01:51:26 +04:00
|
|
|
}
|
2007-03-12 15:34:57 +03:00
|
|
|
conf->addLib(QString("-L") + s);
|
2007-04-04 01:51:26 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/lib64/";
|
2007-04-04 01:51:26 +04:00
|
|
|
sl << "/usr/local/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/local/lib64/";
|
2007-04-04 01:51:26 +04:00
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
2008-07-02 19:06:22 +04:00
|
|
|
if(conf->checkLibrary(s, "torrent-rasterbar")){
|
2007-04-04 01:51:26 +04:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found) return false;
|
|
|
|
conf->addLib(QString("-L") + s);
|
|
|
|
}
|
|
|
|
return true;
|
2006-09-30 20:02:39 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
#line 1 "libboost.qcm"
|
|
|
|
/*
|
|
|
|
-----BEGIN QCMOD-----
|
|
|
|
name: libboost
|
2007-04-04 01:51:26 +04:00
|
|
|
arg: with-libboost-inc=[path], Path to libboost include files
|
2006-09-30 20:02:39 +04:00
|
|
|
-----END QCMOD-----
|
|
|
|
*/
|
|
|
|
class qc_libboost : public ConfObj
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
qc_libboost(Conf *c) : ConfObj(c) {}
|
|
|
|
QString name() const { return "libboost"; }
|
|
|
|
QString shortname() const { return "libboost"; }
|
|
|
|
bool exec(){
|
2007-04-04 01:51:26 +04:00
|
|
|
QString s;
|
|
|
|
s = conf->getenv("QC_WITH_LIBBOOST_INC");
|
|
|
|
if(!s.isEmpty()) {
|
|
|
|
if(!conf->checkHeader(s, "boost/format.hpp")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(!conf->checkHeader(s, "boost/date_time/posix_time/posix_time.hpp")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(!conf->checkHeader(s, "boost/filesystem/path.hpp")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(!conf->checkHeader(s, "boost/thread.hpp")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/include";
|
|
|
|
sl << "/usr/local/include";
|
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
|
|
|
if(conf->checkHeader(s, "boost/format.hpp")){
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(!conf->checkHeader(s, "boost/date_time/posix_time/posix_time.hpp")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(!conf->checkHeader(s, "boost/filesystem/path.hpp")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(!conf->checkHeader(s, "boost/thread.hpp")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
conf->addIncludePath(s);
|
|
|
|
return true;
|
2006-09-30 20:02:39 +04:00
|
|
|
}
|
|
|
|
};
|
2007-11-24 01:57:49 +03:00
|
|
|
#line 1 "libcurl.qcm"
|
2006-09-30 20:02:39 +04:00
|
|
|
/*
|
|
|
|
-----BEGIN QCMOD-----
|
2007-07-20 21:11:02 +04:00
|
|
|
name: libcommoncpp2
|
2007-11-24 01:57:49 +03:00
|
|
|
arg: with-libcurl-inc=[path], Path to libcurl include files
|
|
|
|
arg: with-libcurl-lib=[path], Path to libcurl library files
|
2006-09-30 20:02:39 +04:00
|
|
|
-----END QCMOD-----
|
|
|
|
*/
|
2007-11-24 01:57:49 +03:00
|
|
|
class qc_libcurl : public ConfObj
|
2006-09-30 20:02:39 +04:00
|
|
|
{
|
|
|
|
public:
|
2007-11-24 01:57:49 +03:00
|
|
|
qc_libcurl(Conf *c) : ConfObj(c) {}
|
|
|
|
QString name() const { return "libcurl"; }
|
|
|
|
QString shortname() const { return "libcurl"; }
|
2006-09-30 20:02:39 +04:00
|
|
|
bool exec(){
|
2007-07-20 21:11:02 +04:00
|
|
|
QString s;
|
2007-11-24 01:57:49 +03:00
|
|
|
s = conf->getenv("QC_WITH_LIBCURL_INC");
|
2007-04-04 01:51:26 +04:00
|
|
|
if(!s.isEmpty()) {
|
2007-11-24 01:57:49 +03:00
|
|
|
if(!conf->checkHeader(s, "curl/curl.h")) {
|
2007-04-04 01:51:26 +04:00
|
|
|
return false;
|
2007-07-20 21:11:02 +04:00
|
|
|
}
|
2007-04-04 01:51:26 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/include";
|
|
|
|
sl << "/usr/local/include";
|
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
2007-11-24 01:57:49 +03:00
|
|
|
if(conf->checkHeader(s, "curl/curl.h")){
|
2007-04-04 01:51:26 +04:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found) {
|
|
|
|
return false;
|
2007-07-20 21:11:02 +04:00
|
|
|
}
|
2007-04-04 01:51:26 +04:00
|
|
|
}
|
|
|
|
conf->addIncludePath(s);
|
2007-03-12 15:43:35 +03:00
|
|
|
|
2007-11-24 01:57:49 +03:00
|
|
|
s = conf->getenv("QC_WITH_LIBCURL_LIB");
|
2007-04-04 01:51:26 +04:00
|
|
|
if(!s.isEmpty()) {
|
2007-11-24 01:57:49 +03:00
|
|
|
if(!QFile::exists(s+QString("/libcurl.so")))
|
|
|
|
return false;
|
2007-07-20 21:11:02 +04:00
|
|
|
conf->addLib(QString("-L") + s);
|
2007-04-04 01:51:26 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/lib64/";
|
2007-04-04 01:51:26 +04:00
|
|
|
sl << "/usr/local/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/local/lib64/";
|
2007-04-04 01:51:26 +04:00
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
2007-11-24 01:57:49 +03:00
|
|
|
if(QFile::exists(s+QString("libcurl.so"))){
|
|
|
|
found = true;
|
|
|
|
break;
|
2007-04-04 01:51:26 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found) return false;
|
|
|
|
conf->addLib(QString("-L") + s);
|
|
|
|
}
|
|
|
|
return true;
|
2006-09-30 20:02:39 +04:00
|
|
|
}
|
|
|
|
};
|
2007-08-29 13:22:21 +04:00
|
|
|
#line 1 "libmagick.qcm"
|
|
|
|
/*
|
|
|
|
-----BEGIN QCMOD-----
|
|
|
|
name: libmagick
|
|
|
|
arg: with-libmagick-inc=[path], Path to libmagick++ include files
|
|
|
|
arg: with-libmagick-lib=[path], Path to libmagick++ library files
|
|
|
|
-----END QCMOD-----
|
|
|
|
*/
|
2007-08-29 18:04:45 +04:00
|
|
|
#include <QProcess>
|
2007-08-29 13:22:21 +04:00
|
|
|
class qc_libmagick : public ConfObj
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
qc_libmagick(Conf *c) : ConfObj(c) {}
|
|
|
|
QString name() const { return "ImageMagick library (libmagick++)"; }
|
|
|
|
QString shortname() const { return "libmagick++"; }
|
2007-08-29 14:20:39 +04:00
|
|
|
QString checkString() const {
|
|
|
|
if(!conf->getenv("QC_DISABLE_libmagick").isEmpty())
|
|
|
|
return "";
|
|
|
|
return ConfObj::checkString();
|
|
|
|
}
|
2007-08-29 13:22:21 +04:00
|
|
|
bool exec(){
|
2007-08-29 14:20:39 +04:00
|
|
|
if(!conf->getenv("QC_DISABLE_libmagick").isEmpty())
|
|
|
|
return false;
|
|
|
|
QString s;
|
2007-08-29 13:22:21 +04:00
|
|
|
s = conf->getenv("QC_WITH_LIBMAGICK_INC");
|
|
|
|
if(!s.isEmpty()) {
|
|
|
|
if(!conf->checkHeader(s, "Magick++.h")) {
|
|
|
|
return false;
|
2007-08-29 14:20:39 +04:00
|
|
|
}
|
2007-08-29 13:22:21 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/include";
|
|
|
|
sl << "/usr/local/include";
|
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
|
|
|
if(conf->checkHeader(s, "Magick++.h")){
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-08-29 14:20:39 +04:00
|
|
|
if(!found)
|
2007-08-29 13:22:21 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
conf->addIncludePath(s);
|
|
|
|
|
|
|
|
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
|
|
|
|
if(!s.isEmpty()) {
|
2008-04-11 20:47:55 +04:00
|
|
|
if(!conf->checkLibrary(s, "Magick++")) {
|
|
|
|
return false;
|
|
|
|
}
|
2007-08-29 13:22:21 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/lib64/";
|
2007-08-29 13:22:21 +04:00
|
|
|
sl << "/usr/local/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/local/lib64/";
|
2007-08-29 13:22:21 +04:00
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
2008-04-11 20:47:55 +04:00
|
|
|
if(conf->checkLibrary(s, "Magick++")) {
|
2007-08-29 13:22:21 +04:00
|
|
|
found = true;
|
2008-04-11 20:47:55 +04:00
|
|
|
break;
|
2007-08-29 13:22:21 +04:00
|
|
|
}
|
|
|
|
}
|
2007-08-29 14:20:39 +04:00
|
|
|
if(!found)
|
|
|
|
return false;
|
2007-08-29 13:22:21 +04:00
|
|
|
}
|
2007-08-29 18:04:45 +04:00
|
|
|
conf->addLib(QString("-L") + s);
|
|
|
|
QProcess magickConfig;
|
|
|
|
QStringList params;
|
|
|
|
params << "--libs";
|
|
|
|
magickConfig.start("Magick++-config", params, QIODevice::ReadOnly);
|
|
|
|
magickConfig.waitForStarted();
|
|
|
|
magickConfig.waitForFinished();
|
|
|
|
QByteArray result = magickConfig.readAll();
|
2007-09-04 02:05:40 +04:00
|
|
|
result = result.replace("\n", "");
|
2007-08-29 18:04:45 +04:00
|
|
|
conf->addLib(result.data());
|
2007-08-29 14:20:39 +04:00
|
|
|
conf->addDefine("HAVE_MAGICK");
|
2007-08-29 13:22:21 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
2007-09-04 02:05:40 +04:00
|
|
|
#line 1 "libzzip.qcm"
|
|
|
|
/*
|
|
|
|
-----BEGIN QCMOD-----
|
|
|
|
name: libzzip
|
|
|
|
arg: with-libzzip-inc=[path], Path to libzzip++ include files
|
|
|
|
arg: with-libzzip-lib=[path], Path to libzzip++ library files
|
|
|
|
-----END QCMOD-----
|
|
|
|
*/
|
|
|
|
#include <QProcess>
|
|
|
|
class qc_libzzip : public ConfObj
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
qc_libzzip(Conf *c) : ConfObj(c) {}
|
|
|
|
QString name() const { return "Zzip library (libzzip)"; }
|
|
|
|
QString shortname() const { return "libzzip"; }
|
|
|
|
QString checkString() const {
|
|
|
|
if(!conf->getenv("QC_DISABLE_LIBZZIP").isEmpty())
|
|
|
|
return "";
|
|
|
|
return ConfObj::checkString();
|
|
|
|
}
|
|
|
|
bool exec(){
|
|
|
|
if(!conf->getenv("QC_DISABLE_LIBZZIP").isEmpty())
|
|
|
|
return false;
|
|
|
|
QString s;
|
|
|
|
s = conf->getenv("QC_WITH_LIBZZIP_INC");
|
|
|
|
if(!s.isEmpty()) {
|
|
|
|
if(!conf->checkHeader(s, "zzip/zzip.h")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/include";
|
|
|
|
sl << "/usr/local/include";
|
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
|
|
|
if(conf->checkHeader(s, "zzip/zzip.h")){
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
conf->addIncludePath(s);
|
|
|
|
|
|
|
|
s = conf->getenv("QC_WITH_LIBZZIP_LIB");
|
|
|
|
if(!s.isEmpty()) {
|
2007-10-14 13:15:02 +04:00
|
|
|
if(!QFile::exists(s+QString("/libzzip.so"))){
|
2007-09-04 02:05:40 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/lib64/";
|
2007-09-04 02:05:40 +04:00
|
|
|
sl << "/usr/local/lib/";
|
2007-10-14 13:09:19 +04:00
|
|
|
sl << "/usr/local/lib64/";
|
2007-09-04 02:05:40 +04:00
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
|
|
|
if(QFile::exists(s+QString("libzzip.so"))){
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
conf->addLib(QString("-L") + s);
|
|
|
|
conf->addLib("-lzzip");
|
|
|
|
conf->addDefine("HAVE_ZZIP");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
2006-09-30 20:02:39 +04:00
|
|
|
|
|
|
|
EOT
|
|
|
|
cat >$1/modules_new.cpp <<EOT
|
2007-09-04 02:59:46 +04:00
|
|
|
o = new qc_qt4(conf);
|
2006-09-30 20:02:39 +04:00
|
|
|
o->required = true;
|
|
|
|
o->disabled = false;
|
2008-07-02 19:06:22 +04:00
|
|
|
o = new qc_libtorrent_rasterbar(conf);
|
2006-09-30 20:02:39 +04:00
|
|
|
o->required = true;
|
|
|
|
o->disabled = false;
|
|
|
|
o = new qc_libboost(conf);
|
|
|
|
o->required = true;
|
|
|
|
o->disabled = false;
|
2007-11-24 01:57:49 +03:00
|
|
|
o = new qc_libcurl(conf);
|
2006-09-30 20:02:39 +04:00
|
|
|
o->required = true;
|
|
|
|
o->disabled = false;
|
2007-08-29 13:22:21 +04:00
|
|
|
o = new qc_libmagick(conf);
|
|
|
|
o->required = false;
|
|
|
|
o->disabled = false;
|
2007-09-04 02:05:40 +04:00
|
|
|
o = new qc_libzzip(conf);
|
|
|
|
o->required = false;
|
|
|
|
o->disabled = false;
|
2006-09-30 20:02:39 +04:00
|
|
|
|
|
|
|
EOT
|
|
|
|
cat >$1/conf4.h <<EOT
|
2007-08-29 14:20:39 +04:00
|
|
|
// For license information, see the COPYING file in the qconf base directory.
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
#ifndef QC_CONF4_H
|
|
|
|
#define QC_CONF4_H
|
|
|
|
|
|
|
|
#include <QtCore>
|
|
|
|
|
|
|
|
class Conf;
|
|
|
|
|
|
|
|
enum VersionMode { VersionMin, VersionExact, VersionMax, VersionAny };
|
|
|
|
|
|
|
|
// ConfObj
|
|
|
|
//
|
|
|
|
// Subclass ConfObj to create a new configuration module.
|
|
|
|
class ConfObj
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Conf *conf;
|
|
|
|
bool required;
|
|
|
|
bool disabled;
|
|
|
|
bool success;
|
|
|
|
|
|
|
|
ConfObj(Conf *c);
|
|
|
|
virtual ~ConfObj();
|
|
|
|
|
|
|
|
// long or descriptive name of what is being checked/performed
|
|
|
|
// example: "KDE >= 3.3"
|
|
|
|
virtual QString name() const = 0;
|
|
|
|
|
|
|
|
// short name
|
|
|
|
// example: "kde"
|
|
|
|
virtual QString shortname() const = 0;
|
|
|
|
|
|
|
|
// string to display during check
|
|
|
|
// default: "Checking for [name] ..."
|
|
|
|
virtual QString checkString() const;
|
|
|
|
|
|
|
|
// string to display after check
|
|
|
|
// default: "yes" or "no", based on result of exec()
|
|
|
|
virtual QString resultString() const;
|
|
|
|
|
|
|
|
// this is where the checking code goes
|
|
|
|
virtual bool exec() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Conf
|
|
|
|
//
|
|
|
|
// Interact with this class from your ConfObj to perform detection
|
|
|
|
// operations and to output configuration parameters.
|
|
|
|
class Conf
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool debug_enabled;
|
|
|
|
QString qmake_path;
|
|
|
|
QString maketool;
|
|
|
|
|
|
|
|
QString DEFINES;
|
|
|
|
QString INCLUDEPATH;
|
|
|
|
QString LIBS;
|
|
|
|
QString extra;
|
|
|
|
|
|
|
|
QList<ConfObj*> list;
|
|
|
|
QMap<QString,QString> vars;
|
|
|
|
|
|
|
|
Conf();
|
|
|
|
~Conf();
|
|
|
|
|
|
|
|
QString getenv(const QString &var);
|
|
|
|
QString qvar(const QString &s);
|
|
|
|
|
|
|
|
bool exec();
|
|
|
|
|
|
|
|
void debug(const QString &s);
|
|
|
|
|
|
|
|
QString expandIncludes(const QString &inc);
|
|
|
|
QString expandLibs(const QString &lib);
|
|
|
|
|
|
|
|
int doCommand(const QString &s, QByteArray *out = 0);
|
|
|
|
int doCommand(const QString &prog, const QStringList &args, QByteArray *out = 0);
|
|
|
|
|
|
|
|
bool doCompileAndLink(const QString &filedata, const QStringList &incs, const QString &libs, const QString &proextra, int *retcode = 0);
|
|
|
|
bool checkHeader(const QString &path, const QString &h);
|
|
|
|
bool findHeader(const QString &h, const QStringList &ext, QString *inc);
|
|
|
|
bool checkLibrary(const QString &path, const QString &name);
|
|
|
|
bool findLibrary(const QString &name, QString *lib);
|
|
|
|
QString findProgram(const QString &prog);
|
|
|
|
bool findSimpleLibrary(const QString &incvar, const QString &libvar, const QString &incname, const QString &libname, QString *incpath, QString *libs);
|
|
|
|
bool findFooConfig(const QString &path, QString *version, QStringList *incs, QString *libs, QString *otherflags);
|
|
|
|
bool findPkgConfig(const QString &name, VersionMode mode, const QString &req_version, QString *version, QStringList *incs, QString *libs, QString *otherflags);
|
|
|
|
|
|
|
|
void addDefine(const QString &str);
|
|
|
|
void addLib(const QString &str);
|
|
|
|
void addIncludePath(const QString &str);
|
|
|
|
void addExtra(const QString &str);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool first_debug;
|
|
|
|
|
|
|
|
friend class ConfObj;
|
|
|
|
void added(ConfObj *o);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
EOT
|
|
|
|
cat >$1/conf4.cpp <<EOT
|
2007-08-29 14:20:39 +04:00
|
|
|
// For license information, see the COPYING file in the qconf base directory.
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
#include "conf4.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
class MocTestObject : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
MocTestObject() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
QString qc_getenv(const QString &var)
|
|
|
|
{
|
|
|
|
char *p = ::getenv(var.toLatin1().data());
|
|
|
|
if(!p)
|
|
|
|
return QString();
|
|
|
|
return QString(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList qc_pathlist()
|
|
|
|
{
|
|
|
|
QStringList list;
|
|
|
|
QString path = qc_getenv("PATH");
|
|
|
|
if(!path.isEmpty())
|
|
|
|
list = path.split(':', QString::SkipEmptyParts);
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString qc_findprogram(const QString &prog)
|
|
|
|
{
|
|
|
|
QString out;
|
|
|
|
QStringList list = qc_pathlist();
|
|
|
|
for(int n = 0; n < list.count(); ++n)
|
|
|
|
{
|
|
|
|
QFileInfo fi(list[n] + '/' + prog);
|
|
|
|
if(fi.exists() && fi.isExecutable())
|
|
|
|
{
|
|
|
|
out = fi.filePath();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString qc_findself(const QString &argv0)
|
|
|
|
{
|
|
|
|
if(argv0.contains('/'))
|
|
|
|
return argv0;
|
|
|
|
else
|
|
|
|
return qc_findprogram(argv0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int qc_runcommand(const QString &command, QByteArray *out, bool showOutput)
|
|
|
|
{
|
|
|
|
QString fullcmd = command;
|
|
|
|
if(!showOutput)
|
|
|
|
fullcmd += " 2>/dev/null";
|
|
|
|
FILE *f = popen(fullcmd.toLatin1().data(), "r");
|
|
|
|
if(!f)
|
|
|
|
return -1;
|
|
|
|
if(out)
|
|
|
|
out->clear();
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
char c = (char)fgetc(f);
|
|
|
|
if(feof(f))
|
|
|
|
break;
|
|
|
|
if(out)
|
|
|
|
out->append(c);
|
|
|
|
if(showOutput)
|
|
|
|
fputc(c, stdout);
|
|
|
|
}
|
|
|
|
int ret = pclose(f);
|
|
|
|
if(ret == -1)
|
|
|
|
return -1;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
int qc_runprogram(const QString &prog, const QStringList &args, QByteArray *out, bool showOutput)
|
|
|
|
{
|
|
|
|
QString fullcmd = prog;
|
|
|
|
QString argstr = args.join(" ");
|
|
|
|
if(!argstr.isEmpty())
|
|
|
|
fullcmd += QString(" ") + argstr;
|
|
|
|
return qc_runcommand(fullcmd, out, showOutput);
|
|
|
|
|
|
|
|
// TODO: use QProcess once it is fixed
|
|
|
|
/*
|
|
|
|
QProcess process;
|
|
|
|
if(showOutput)
|
|
|
|
process.setReadChannelMode(ForwardedChannels);
|
|
|
|
process.start(prog, args);
|
|
|
|
process.waitForFinished(-1);
|
|
|
|
return process.exitCode();
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2007-03-11 21:32:36 +03:00
|
|
|
bool qc_removedir(const QString &dirPath)
|
|
|
|
{
|
|
|
|
QDir dir(dirPath);
|
|
|
|
if(!dir.exists())
|
|
|
|
return false;
|
|
|
|
QStringList list = dir.entryList();
|
|
|
|
foreach(QString s, list)
|
|
|
|
{
|
|
|
|
if(s == "." || s == "..")
|
|
|
|
continue;
|
|
|
|
QFileInfo fi(dir.filePath(s));
|
|
|
|
if(fi.isDir())
|
|
|
|
{
|
|
|
|
if(!qc_removedir(fi.filePath()))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(!dir.remove(s))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
QString dirName = dir.dirName();
|
|
|
|
if(!dir.cdUp())
|
|
|
|
return false;
|
|
|
|
if(!dir.rmdir(dirName))
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
void qc_splitcflags(const QString &cflags, QStringList *incs, QStringList *otherflags)
|
|
|
|
{
|
|
|
|
incs->clear();
|
|
|
|
otherflags->clear();
|
|
|
|
|
|
|
|
QStringList cflagsList = cflags.split(" ");
|
|
|
|
for(int n = 0; n < cflagsList.count(); ++n)
|
|
|
|
{
|
|
|
|
QString str = cflagsList[n];
|
|
|
|
if(str.startsWith("-I"))
|
|
|
|
{
|
|
|
|
// we want everything except the leading "-I"
|
|
|
|
incs->append(str.remove(0, 2));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// we want whatever is left
|
|
|
|
otherflags->append(str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-29 14:20:39 +04:00
|
|
|
QString qc_escapeArg(const QString &str)
|
|
|
|
{
|
|
|
|
QString out;
|
|
|
|
for(int n = 0; n < (int)str.length(); ++n) {
|
|
|
|
if(str[n] == '-')
|
|
|
|
out += '_';
|
|
|
|
else
|
|
|
|
out += str[n];
|
|
|
|
}
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2006-09-30 20:02:39 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// ConfObj
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
ConfObj::ConfObj(Conf *c)
|
|
|
|
{
|
|
|
|
conf = c;
|
|
|
|
conf->added(this);
|
|
|
|
required = false;
|
|
|
|
disabled = false;
|
|
|
|
success = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ConfObj::~ConfObj()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ConfObj::checkString() const
|
|
|
|
{
|
|
|
|
return QString("Checking for %1 ...").arg(name());
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ConfObj::resultString() const
|
|
|
|
{
|
|
|
|
if(success)
|
|
|
|
return "yes";
|
|
|
|
else
|
|
|
|
return "no";
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// qc_internal_pkgconfig
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
class qc_internal_pkgconfig : public ConfObj
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QString pkgname, desc;
|
|
|
|
VersionMode mode;
|
|
|
|
QString req_ver;
|
|
|
|
|
|
|
|
qc_internal_pkgconfig(Conf *c, const QString &_name, const QString &_desc, VersionMode _mode, const QString &_req_ver) : ConfObj(c)
|
|
|
|
{
|
|
|
|
pkgname = _name;
|
|
|
|
desc = _desc;
|
|
|
|
mode = _mode;
|
|
|
|
req_ver = _req_ver;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString name() const { return desc; }
|
|
|
|
QString shortname() const { return pkgname; }
|
|
|
|
|
|
|
|
bool exec()
|
|
|
|
{
|
|
|
|
QStringList incs;
|
|
|
|
QString version, libs, other;
|
|
|
|
if(!conf->findPkgConfig(pkgname, mode, req_ver, &version, &incs, &libs, &other))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
for(int n = 0; n < incs.count(); ++n)
|
|
|
|
conf->addIncludePath(incs[n]);
|
|
|
|
if(!libs.isEmpty())
|
|
|
|
conf->addLib(libs);
|
|
|
|
//if(!other.isEmpty())
|
|
|
|
// conf->addExtra(QString("QMAKE_CFLAGS += %1\n").arg(other));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// Conf
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
Conf::Conf()
|
|
|
|
{
|
|
|
|
// TODO: no more vars?
|
|
|
|
//vars.insert("QMAKE_INCDIR_X11", new QString(X11_INC));
|
|
|
|
//vars.insert("QMAKE_LIBDIR_X11", new QString(X11_LIBDIR));
|
|
|
|
//vars.insert("QMAKE_LIBS_X11", new QString(X11_LIB));
|
|
|
|
//vars.insert("QMAKE_CC", CC);
|
|
|
|
|
|
|
|
debug_enabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Conf::~Conf()
|
|
|
|
{
|
|
|
|
qDeleteAll(list);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Conf::added(ConfObj *o)
|
|
|
|
{
|
|
|
|
list.append(o);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Conf::getenv(const QString &var)
|
|
|
|
{
|
|
|
|
return qc_getenv(var);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Conf::debug(const QString &s)
|
|
|
|
{
|
|
|
|
if(debug_enabled)
|
|
|
|
{
|
|
|
|
if(first_debug)
|
|
|
|
printf("\n");
|
|
|
|
first_debug = false;
|
|
|
|
printf(" * %s\n", qPrintable(s));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Conf::exec()
|
|
|
|
{
|
|
|
|
for(int n = 0; n < list.count(); ++n)
|
|
|
|
{
|
|
|
|
ConfObj *o = list[n];
|
|
|
|
|
|
|
|
// if this was a disabled-by-default option, check if it was enabled
|
|
|
|
if(o->disabled)
|
|
|
|
{
|
2007-08-29 14:20:39 +04:00
|
|
|
QString v = QString("QC_ENABLE_") + qc_escapeArg(o->shortname());
|
2006-09-30 20:02:39 +04:00
|
|
|
if(getenv(v) != "Y")
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// and the opposite?
|
|
|
|
else
|
|
|
|
{
|
2007-08-29 14:20:39 +04:00
|
|
|
QString v = QString("QC_DISABLE_") + qc_escapeArg(o->shortname());
|
2006-09-30 20:02:39 +04:00
|
|
|
if(getenv(v) == "Y")
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool output = true;
|
|
|
|
QString check = o->checkString();
|
|
|
|
if(check.isEmpty())
|
|
|
|
output = false;
|
|
|
|
|
|
|
|
if(output)
|
|
|
|
{
|
|
|
|
printf("%s", check.toLatin1().data());
|
|
|
|
fflush(stdout);
|
|
|
|
}
|
|
|
|
|
|
|
|
first_debug = true;
|
|
|
|
bool ok = o->exec();
|
|
|
|
o->success = ok;
|
|
|
|
|
|
|
|
if(output)
|
|
|
|
{
|
|
|
|
QString result = o->resultString();
|
|
|
|
if(!first_debug)
|
|
|
|
printf(" -> %s\n", result.toLatin1().data());
|
|
|
|
else
|
|
|
|
printf(" %s\n", result.toLatin1().data());
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!ok && o->required)
|
|
|
|
{
|
|
|
|
printf("\nError: need %s!\n", o->name().toLatin1().data());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Conf::qvar(const QString &s)
|
|
|
|
{
|
|
|
|
return vars.value(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Conf::expandIncludes(const QString &inc)
|
|
|
|
{
|
|
|
|
return QString("-I") + inc;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Conf::expandLibs(const QString &lib)
|
|
|
|
{
|
|
|
|
return QString("-L") + lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Conf::doCommand(const QString &s, QByteArray *out)
|
|
|
|
{
|
|
|
|
debug(QString("[%1]").arg(s));
|
|
|
|
int r = qc_runcommand(s, out, debug_enabled);
|
|
|
|
debug(QString("returned: %1").arg(r));
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Conf::doCommand(const QString &prog, const QStringList &args, QByteArray *out)
|
|
|
|
{
|
|
|
|
QString fullcmd = prog;
|
|
|
|
QString argstr = args.join(" ");
|
|
|
|
if(!argstr.isEmpty())
|
|
|
|
fullcmd += QString(" ") + argstr;
|
|
|
|
debug(QString("[%1]").arg(fullcmd));
|
|
|
|
int r = qc_runprogram(prog, args, out, debug_enabled);
|
|
|
|
debug(QString("returned: %1").arg(r));
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Conf::doCompileAndLink(const QString &filedata, const QStringList &incs, const QString &libs, const QString &proextra, int *retcode)
|
|
|
|
{
|
|
|
|
QDir tmp(".qconftemp");
|
|
|
|
if(!tmp.mkdir("atest"))
|
|
|
|
{
|
|
|
|
debug("unable to create atest dir");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
QDir dir(tmp.filePath("atest"));
|
|
|
|
if(!dir.exists())
|
|
|
|
{
|
|
|
|
debug("atest dir does not exist");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString fname = dir.filePath("atest.cpp");
|
|
|
|
QString out = "atest";
|
|
|
|
QFile f(fname);
|
|
|
|
if(!f.open(QFile::WriteOnly | QFile::Truncate))
|
|
|
|
{
|
|
|
|
debug("unable to open atest.cpp for writing");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(f.write(filedata.toLatin1()) == -1)
|
|
|
|
{
|
|
|
|
debug("error writing to atest.cpp");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
f.close();
|
|
|
|
|
|
|
|
debug(QString("Wrote atest.cpp:\n%1").arg(filedata));
|
|
|
|
|
|
|
|
QString pro = QString(
|
|
|
|
"CONFIG += console\n"
|
|
|
|
"CONFIG -= qt app_bundle\n"
|
|
|
|
"SOURCES += atest.cpp\n");
|
|
|
|
QString inc = incs.join(" ");
|
|
|
|
if(!inc.isEmpty())
|
|
|
|
pro += "INCLUDEPATH += " + inc + '\n';
|
|
|
|
if(!libs.isEmpty())
|
|
|
|
pro += "LIBS += " + libs + '\n';
|
|
|
|
pro += proextra;
|
|
|
|
|
|
|
|
fname = dir.filePath("atest.pro");
|
|
|
|
f.setFileName(fname);
|
|
|
|
if(!f.open(QFile::WriteOnly | QFile::Truncate))
|
|
|
|
{
|
|
|
|
debug("unable to open atest.pro for writing");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(f.write(pro.toLatin1()) == -1)
|
|
|
|
{
|
|
|
|
debug("error writing to atest.pro");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
f.close();
|
|
|
|
|
|
|
|
debug(QString("Wrote atest.pro:\n%1").arg(pro));
|
|
|
|
|
|
|
|
QString oldpath = QDir::currentPath();
|
|
|
|
QDir::setCurrent(dir.path());
|
|
|
|
|
|
|
|
bool ok = false;
|
|
|
|
int r = doCommand(qmake_path, QStringList() << "atest.pro");
|
|
|
|
if(r == 0)
|
|
|
|
{
|
|
|
|
r = doCommand(maketool, QStringList());
|
|
|
|
if(r == 0)
|
|
|
|
{
|
|
|
|
ok = true;
|
|
|
|
if(retcode)
|
|
|
|
*retcode = doCommand(QString("./") + out, QStringList());
|
|
|
|
}
|
|
|
|
r = doCommand(maketool, QStringList() << "distclean");
|
|
|
|
if(r != 0)
|
|
|
|
debug("error during atest distclean");
|
|
|
|
}
|
|
|
|
|
|
|
|
QDir::setCurrent(oldpath);
|
|
|
|
|
|
|
|
// cleanup
|
2007-03-11 21:32:36 +03:00
|
|
|
//dir.remove("atest.pro");
|
|
|
|
//dir.remove("atest.cpp");
|
|
|
|
//tmp.rmdir("atest");
|
|
|
|
|
|
|
|
// remove whole dir since distclean doesn't always work
|
|
|
|
qc_removedir(tmp.filePath("atest"));
|
2006-09-30 20:02:39 +04:00
|
|
|
|
|
|
|
if(!ok)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Conf::checkHeader(const QString &path, const QString &h)
|
|
|
|
{
|
|
|
|
QFileInfo fi(path + '/' + h);
|
|
|
|
if(fi.exists())
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Conf::findHeader(const QString &h, const QStringList &ext, QString *inc)
|
|
|
|
{
|
|
|
|
if(checkHeader("/usr/include", h))
|
|
|
|
{
|
|
|
|
*inc = "";
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
QStringList dirs;
|
|
|
|
dirs += "/usr/local/include";
|
|
|
|
dirs += ext;
|
|
|
|
for(QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it)
|
|
|
|
{
|
|
|
|
if(checkHeader(*it, h))
|
|
|
|
{
|
|
|
|
*inc = *it;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Conf::checkLibrary(const QString &path, const QString &name)
|
|
|
|
{
|
|
|
|
QString str =
|
|
|
|
//"#include <stdio.h>\n"
|
|
|
|
"int main()\n"
|
|
|
|
"{\n"
|
|
|
|
//" printf(\"library checker running\\\\n\");\n"
|
|
|
|
" return 0;\n"
|
|
|
|
"}\n";
|
|
|
|
|
|
|
|
QString libs;
|
|
|
|
if(!path.isEmpty())
|
|
|
|
libs += QString("-L") + path + ' ';
|
|
|
|
libs += QString("-l") + name;
|
|
|
|
if(!doCompileAndLink(str, QStringList(), libs, QString()))
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Conf::findLibrary(const QString &name, QString *lib)
|
|
|
|
{
|
|
|
|
if(checkLibrary("", name))
|
|
|
|
{
|
|
|
|
*lib = "";
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if(checkLibrary("/usr/local/lib", name))
|
|
|
|
{
|
|
|
|
*lib = "/usr/local/lib";
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Conf::findProgram(const QString &prog)
|
|
|
|
{
|
|
|
|
return qc_findprogram(prog);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Conf::findSimpleLibrary(const QString &incvar, const QString &libvar, const QString &incname, const QString &libname, QString *incpath, QString *libs)
|
|
|
|
{
|
|
|
|
QString inc, lib;
|
|
|
|
QString s;
|
|
|
|
|
|
|
|
s = getenv(incvar);
|
|
|
|
if(!s.isEmpty()) {
|
|
|
|
if(!checkHeader(s, incname))
|
|
|
|
return false;
|
|
|
|
inc = s;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(!findHeader(incname, QStringList(), &s))
|
|
|
|
return false;
|
|
|
|
inc = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
s = getenv(libvar);
|
|
|
|
if(!s.isEmpty()) {
|
|
|
|
if(!checkLibrary(s, libname))
|
|
|
|
return false;
|
|
|
|
lib = s;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(!findLibrary(libname, &s))
|
|
|
|
return false;
|
|
|
|
lib = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString lib_out;
|
|
|
|
if(!lib.isEmpty())
|
|
|
|
lib_out += QString("-L") + s;
|
|
|
|
lib_out += QString("-l") + libname;
|
|
|
|
|
|
|
|
*incpath = inc;
|
|
|
|
*libs = lib_out;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Conf::findFooConfig(const QString &path, QString *version, QStringList *incs, QString *libs, QString *otherflags)
|
|
|
|
{
|
|
|
|
QStringList args;
|
|
|
|
QByteArray out;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
args += "--version";
|
|
|
|
ret = doCommand(path, args, &out);
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
QString version_out = QString::fromLatin1(out).trimmed();
|
|
|
|
|
|
|
|
args.clear();
|
|
|
|
args += "--libs";
|
|
|
|
ret = doCommand(path, args, &out);
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
QString libs_out = QString::fromLatin1(out).trimmed();
|
|
|
|
|
|
|
|
args.clear();
|
|
|
|
args += "--cflags";
|
|
|
|
ret = doCommand(path, args, &out);
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
QString cflags = QString::fromLatin1(out).trimmed();
|
|
|
|
|
|
|
|
QStringList incs_out, otherflags_out;
|
|
|
|
qc_splitcflags(cflags, &incs_out, &otherflags_out);
|
|
|
|
|
|
|
|
*version = version_out;
|
|
|
|
*incs = incs_out;
|
|
|
|
*libs = libs_out;
|
|
|
|
*otherflags = otherflags_out.join(" ");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Conf::findPkgConfig(const QString &name, VersionMode mode, const QString &req_version, QString *version, QStringList *incs, QString *libs, QString *otherflags)
|
|
|
|
{
|
|
|
|
QStringList args;
|
|
|
|
QByteArray out;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
args += name;
|
|
|
|
args += "--exists";
|
|
|
|
ret = doCommand("pkg-config", args, &out);
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if(mode != VersionAny)
|
|
|
|
{
|
|
|
|
args.clear();
|
|
|
|
args += name;
|
|
|
|
if(mode == VersionMin)
|
|
|
|
args += QString("--atleast-version=%1").arg(req_version);
|
|
|
|
else if(mode == VersionMax)
|
|
|
|
args += QString("--max-version=%1").arg(req_version);
|
|
|
|
else
|
|
|
|
args += QString("--exact-version=%1").arg(req_version);
|
|
|
|
ret = doCommand("pkg-config", args, &out);
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
args.clear();
|
|
|
|
args += name;
|
|
|
|
args += "--modversion";
|
|
|
|
ret = doCommand("pkg-config", args, &out);
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
QString version_out = QString::fromLatin1(out).trimmed();
|
|
|
|
|
|
|
|
args.clear();
|
|
|
|
args += name;
|
|
|
|
args += "--libs";
|
|
|
|
ret = doCommand("pkg-config", args, &out);
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
QString libs_out = QString::fromLatin1(out).trimmed();
|
|
|
|
|
|
|
|
args.clear();
|
|
|
|
args += name;
|
|
|
|
args += "--cflags";
|
|
|
|
ret = doCommand("pkg-config", args, &out);
|
|
|
|
if(ret != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
QString cflags = QString::fromLatin1(out).trimmed();
|
|
|
|
|
|
|
|
QStringList incs_out, otherflags_out;
|
|
|
|
qc_splitcflags(cflags, &incs_out, &otherflags_out);
|
|
|
|
|
|
|
|
*version = version_out;
|
|
|
|
*incs = incs_out;
|
|
|
|
*libs = libs_out;
|
|
|
|
*otherflags = otherflags_out.join(" ");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Conf::addDefine(const QString &str)
|
|
|
|
{
|
|
|
|
if(DEFINES.isEmpty())
|
|
|
|
DEFINES = str;
|
|
|
|
else
|
|
|
|
DEFINES += QString(" ") + str;
|
|
|
|
debug(QString("DEFINES += %1").arg(str));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Conf::addLib(const QString &str)
|
|
|
|
{
|
|
|
|
if(LIBS.isEmpty())
|
|
|
|
LIBS = str;
|
|
|
|
else
|
|
|
|
LIBS += QString(" ") + str;
|
|
|
|
debug(QString("LIBS += %1").arg(str));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Conf::addIncludePath(const QString &str)
|
|
|
|
{
|
|
|
|
if(INCLUDEPATH.isEmpty())
|
|
|
|
INCLUDEPATH = str;
|
|
|
|
else
|
|
|
|
INCLUDEPATH += QString(" ") + str;
|
|
|
|
debug(QString("INCLUDEPATH += %1").arg(str));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Conf::addExtra(const QString &str)
|
|
|
|
{
|
|
|
|
extra += str + '\n';
|
|
|
|
debug(QString("extra += %1").arg(str));
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
// main
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
#include "conf4.moc"
|
|
|
|
|
|
|
|
#ifdef HAVE_MODULES
|
|
|
|
# include"modules.cpp"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
Conf *conf = new Conf;
|
|
|
|
ConfObj *o;
|
|
|
|
o = 0;
|
|
|
|
#ifdef HAVE_MODULES
|
|
|
|
# include"modules_new.cpp"
|
|
|
|
#endif
|
|
|
|
|
2007-08-29 14:20:39 +04:00
|
|
|
conf->debug_enabled = (qc_getenv("QC_VERBOSE") == "Y") ? true: false;
|
2006-09-30 20:02:39 +04:00
|
|
|
if(conf->debug_enabled)
|
|
|
|
printf(" -> ok\n");
|
|
|
|
else
|
|
|
|
printf("ok\n");
|
|
|
|
|
|
|
|
QString confCommand = qc_getenv("QC_COMMAND");
|
|
|
|
QString proName = qc_getenv("QC_PROFILE");
|
|
|
|
conf->qmake_path = qc_getenv("QC_QMAKE");
|
|
|
|
conf->maketool = qc_getenv("QC_MAKETOOL");
|
|
|
|
|
|
|
|
if(conf->debug_enabled)
|
|
|
|
printf("conf command: [%s]\n", qPrintable(confCommand));
|
|
|
|
|
|
|
|
QString confPath = qc_findself(confCommand);
|
|
|
|
if(confPath.isEmpty())
|
|
|
|
{
|
|
|
|
printf("Error: cannot find myself; rerun with an absolute path\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString srcdir = QFileInfo(confPath).absolutePath();
|
|
|
|
QString builddir = QDir::current().absolutePath();
|
|
|
|
QString proPath = QDir(srcdir).filePath(proName);
|
|
|
|
|
|
|
|
if(conf->debug_enabled)
|
|
|
|
{
|
|
|
|
printf("conf path: [%s]\n", qPrintable(confPath));
|
|
|
|
printf("srcdir: [%s]\n", qPrintable(srcdir));
|
|
|
|
printf("builddir: [%s]\n", qPrintable(builddir));
|
|
|
|
printf("profile: [%s]\n", qPrintable(proPath));
|
|
|
|
printf("qmake path: [%s]\n", qPrintable(conf->qmake_path));
|
|
|
|
printf("make tool: [%s]\n", qPrintable(conf->maketool));
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool success = false;
|
|
|
|
if(conf->exec())
|
|
|
|
{
|
|
|
|
QFile f("conf.pri");
|
|
|
|
if(!f.open(QFile::WriteOnly | QFile::Truncate))
|
|
|
|
{
|
|
|
|
printf("Error writing %s\n", qPrintable(f.fileName()));
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString str;
|
|
|
|
str += "# qconf\n\n";
|
|
|
|
|
|
|
|
QString var;
|
|
|
|
var = qc_getenv("PREFIX");
|
|
|
|
if(!var.isEmpty())
|
|
|
|
str += QString("PREFIX = %1\n").arg(var);
|
|
|
|
var = qc_getenv("BINDIR");
|
|
|
|
if(!var.isEmpty())
|
|
|
|
str += QString("BINDIR = %1\n").arg(var);
|
2007-08-29 14:20:39 +04:00
|
|
|
var = qc_getenv("INCDIR");
|
|
|
|
if(!var.isEmpty())
|
|
|
|
str += QString("INCDIR = %1\n").arg(var);
|
2006-09-30 20:02:39 +04:00
|
|
|
var = qc_getenv("LIBDIR");
|
|
|
|
if(!var.isEmpty())
|
|
|
|
str += QString("LIBDIR = %1\n").arg(var);
|
|
|
|
var = qc_getenv("DATADIR");
|
|
|
|
if(!var.isEmpty())
|
|
|
|
str += QString("DATADIR = %1\n").arg(var);
|
|
|
|
str += '\n';
|
|
|
|
|
|
|
|
if(qc_getenv("QC_STATIC") == "Y")
|
|
|
|
str += "CONFIG += staticlib\n";
|
|
|
|
|
|
|
|
// TODO: don't need this?
|
|
|
|
//str += "QT_PATH_PLUGINS = " + QString(qInstallPathPlugins()) + '\n';
|
|
|
|
|
|
|
|
if(!conf->DEFINES.isEmpty())
|
|
|
|
str += "DEFINES += " + conf->DEFINES + '\n';
|
|
|
|
if(!conf->INCLUDEPATH.isEmpty())
|
|
|
|
str += "INCLUDEPATH += " + conf->INCLUDEPATH + '\n';
|
|
|
|
if(!conf->LIBS.isEmpty())
|
|
|
|
str += "LIBS += " + conf->LIBS + '\n';
|
|
|
|
if(!conf->extra.isEmpty())
|
|
|
|
str += conf->extra;
|
|
|
|
str += '\n';
|
|
|
|
|
|
|
|
QByteArray cs = str.toLatin1();
|
|
|
|
f.write(cs);
|
|
|
|
f.close();
|
|
|
|
success = true;
|
|
|
|
}
|
|
|
|
QString qmake_path = conf->qmake_path;
|
|
|
|
delete conf;
|
|
|
|
|
|
|
|
if(!success)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
// run qmake on the project file
|
|
|
|
int ret = qc_runprogram(qmake_path, QStringList() << proPath, 0, true);
|
|
|
|
if(ret != 0)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOT
|
|
|
|
cat >$1/conf4.pro <<EOT
|
|
|
|
CONFIG += console
|
|
|
|
CONFIG -= app_bundle
|
|
|
|
QT -= gui
|
|
|
|
TARGET = conf
|
|
|
|
|
|
|
|
HEADERS += conf4.h
|
|
|
|
SOURCES += conf4.cpp
|
|
|
|
|
|
|
|
|
|
|
|
DEFINES += HAVE_MODULES
|
|
|
|
|
|
|
|
EOT
|
|
|
|
}
|
|
|
|
|
|
|
|
export PREFIX
|
|
|
|
export BINDIR
|
2007-07-25 11:00:14 +04:00
|
|
|
export DATADIR
|
2006-09-30 20:02:39 +04:00
|
|
|
export EX_QTDIR
|
2007-03-12 15:21:02 +03:00
|
|
|
export QC_WITH_LIBTORRENT_INC
|
2007-03-12 15:34:57 +03:00
|
|
|
export QC_WITH_LIBTORRENT_LIB
|
2007-06-15 15:29:00 +04:00
|
|
|
export QC_WITH_LIBTORRENT_STATIC_LIB
|
2007-04-04 01:51:26 +04:00
|
|
|
export QC_WITH_LIBBOOST_INC
|
2007-11-24 01:57:49 +03:00
|
|
|
export QC_WITH_LIBCURL_INC
|
|
|
|
export QC_WITH_LIBCURL_LIB
|
2007-08-29 13:22:21 +04:00
|
|
|
export QC_DISABLE_libmagick
|
|
|
|
export QC_WITH_LIBMAGICK_INC
|
|
|
|
export QC_WITH_LIBMAGICK_LIB
|
2007-09-04 02:05:40 +04:00
|
|
|
export QC_DISABLE_libzzip
|
|
|
|
export QC_WITH_LIBZZIP_INC
|
|
|
|
export QC_WITH_LIBZZIP_LIB
|
2007-08-29 14:20:39 +04:00
|
|
|
export QC_VERBOSE
|
2006-09-30 20:02:39 +04:00
|
|
|
rm -rf .qconftemp
|
|
|
|
(
|
|
|
|
mkdir .qconftemp
|
|
|
|
gen_files .qconftemp
|
|
|
|
cd .qconftemp
|
|
|
|
$qm conf4.pro >/dev/null
|
|
|
|
$MAKE clean >/dev/null 2>&1
|
|
|
|
$MAKE >../conf.log 2>&1
|
|
|
|
)
|
|
|
|
|
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
rm -rf .qconftemp
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ "$QC_VERBOSE" = "Y" ]; then
|
2006-09-30 20:02:39 +04:00
|
|
|
echo " -> fail"
|
|
|
|
else
|
|
|
|
echo "fail"
|
|
|
|
fi
|
|
|
|
printf "\n"
|
|
|
|
printf "Reason: There was an error compiling 'conf'. See conf.log for details.\n"
|
|
|
|
printf "\n"
|
|
|
|
show_qt_info
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ "$QC_VERBOSE" = "Y" ]; then
|
2006-09-30 20:02:39 +04:00
|
|
|
echo "conf.log:"
|
|
|
|
cat conf.log
|
|
|
|
fi
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
QC_COMMAND=$0
|
|
|
|
export QC_COMMAND
|
|
|
|
QC_PROFILE=qbittorrent.pro
|
|
|
|
export QC_PROFILE
|
|
|
|
QC_QMAKE=$qm
|
|
|
|
export QC_QMAKE
|
|
|
|
QC_MAKETOOL=$MAKE
|
|
|
|
export QC_MAKETOOL
|
|
|
|
.qconftemp/conf
|
|
|
|
ret="$?"
|
|
|
|
if [ "$ret" = "1" ]; then
|
|
|
|
rm -rf .qconftemp
|
|
|
|
echo
|
|
|
|
exit 1;
|
|
|
|
else
|
|
|
|
if [ "$ret" != "0" ]; then
|
|
|
|
rm -rf .qconftemp
|
2007-08-29 14:20:39 +04:00
|
|
|
if [ "$QC_VERBOSE" = "Y" ]; then
|
2006-09-30 20:02:39 +04:00
|
|
|
echo " -> fail"
|
|
|
|
else
|
|
|
|
echo "fail"
|
|
|
|
fi
|
|
|
|
echo
|
|
|
|
echo "Reason: Unexpected error launching 'conf'"
|
|
|
|
echo
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
rm -rf .qconftemp
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Good, your configure finished. Now run $MAKE."
|
|
|
|
echo
|