Skip to content

Commit 441f63d

Browse files
LINUX: Fix build with libtorrent 1.0.x. Closes qbittorrent#1878.
1 parent d6f309b commit 441f63d

3 files changed

Lines changed: 67 additions & 3 deletions

File tree

conf.pri.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ BINDIR = @EXPAND_BINDIR@
55
DATADIR = @EXPAND_DATADIR@
66
MANPREFIX = @EXPAND_MANDIR@
77

8-
QMAKE_CXXFLAGS += @CPPFLAGS@
8+
QMAKE_CXXFLAGS += @QBT_CONF_EXTRA_CFLAGS@
9+
INCLUDEPATH += @QBT_CONF_INCLUDES@
910
LIBS += @LDFLAGS@ @LIBS@
1011

1112
CONFIG += @QBT_ADD_CONFIG@

configure

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ QBT_REMOVE_DEFINES
592592
QBT_ADD_DEFINES
593593
QBT_REMOVE_CONFIG
594594
QBT_ADD_CONFIG
595+
QBT_CONF_EXTRA_CFLAGS
596+
QBT_CONF_INCLUDES
595597
EXPAND_MANDIR
596598
EXPAND_DATADIR
597599
EXPAND_BINDIR
@@ -2787,8 +2789,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
27872789
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
27882790
ac_compiler_gnu=$ac_cv_c_compiler_gnu
27892791

2790-
# expand $ac_aux_dir to an absolute path
2791-
am_aux_dir=`cd $ac_aux_dir && pwd`
2792+
# Expand $ac_aux_dir to an absolute path.
2793+
am_aux_dir=`cd "$ac_aux_dir" && pwd`
27922794

27932795
ac_ext=c
27942796
ac_cpp='$CPP $CPPFLAGS'
@@ -4080,6 +4082,7 @@ fi
40804082

40814083

40824084

4085+
40834086
# Define --wth-* and --enable-* arguments
40844087

40854088

@@ -5375,12 +5378,42 @@ _ACEOF
53755378
test "$exec_prefix_NONE" && exec_prefix=NONE
53765379

53775380

5381+
# Original extract() function contributed by pmzqla
5382+
# $*: Strings to parse
5383+
# Set $DEFINES, $INCLUDES, $OTHER
5384+
extract() {
5385+
if [ -z "$*" ]; then
5386+
echo "Input string required"
5387+
return 1
5388+
fi
5389+
5390+
# Convert " -" to "\n" if not between quotes
5391+
string=$(echo " $*" | sed -e 's: -:\n:g' -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g")
5392+
SAVEIFS=$IFS
5393+
IFS=$(printf "\n\b")
5394+
for i in $string; do
5395+
case "$(echo "$i" | cut -c1)" in
5396+
'') ;;
5397+
D) QBT_CONF_DEFINES="$(echo $i | cut -c2-) $QBT_CONF_DEFINES";;
5398+
I) QBT_CONF_INCLUDES="$(echo $i | cut -c2-) $QBT_CONF_INCLUDES";;
5399+
*) QBT_CONF_EXTRA_CFLAGS="-$i $QBT_CONF_EXTRA_CFLAGS";;
5400+
esac
5401+
done
5402+
IFS=$SAVEIFS
5403+
}
5404+
5405+
extract $CPPFLAGS
5406+
QBT_ADD_DEFINES="$QBT_ADD_DEFINES $QBT_CONF_DEFINES"
5407+
QBT_CONF_EXTRA_CFLAGS="$QBT_CONF_EXTRA_CFLAGS $CXXFLAGS"
5408+
53785409
# Substitute the values of these vars in conf.pri.in
53795410

53805411

53815412

53825413

53835414

5415+
5416+
53845417
ac_config_files="$ac_config_files conf.pri"
53855418

53865419
cat >confcache <<\_ACEOF

configure.ac

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,37 @@ AX_DEFINE_DIR([EXPAND_BINDIR], [bindir])
172172
AX_DEFINE_DIR([EXPAND_DATADIR], [datadir])
173173
AX_DEFINE_DIR([EXPAND_MANDIR], [mandir])
174174

175+
# Original extract() function contributed by pmzqla
176+
# $*: Strings to parse
177+
# Set $DEFINES, $INCLUDES, $OTHER
178+
extract() {
179+
if [[ -z "$*" ]]; then
180+
echo "Input string required"
181+
return 1
182+
fi
183+
184+
# Convert " -" to "\n" if not between quotes
185+
string=$(echo " $*" | sed -e 's: -:\n:g' -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g")
186+
SAVEIFS=$IFS
187+
IFS=$(printf "\n\b")
188+
for i in $string; do
189+
case "$(echo "$i" | cut -c1)" in
190+
'') ;;
191+
D) QBT_CONF_DEFINES="$(echo $i | cut -c2-) $QBT_CONF_DEFINES";;
192+
I) QBT_CONF_INCLUDES="$(echo $i | cut -c2-) $QBT_CONF_INCLUDES";;
193+
*) QBT_CONF_EXTRA_CFLAGS="-$i $QBT_CONF_EXTRA_CFLAGS";;
194+
esac
195+
done
196+
IFS=$SAVEIFS
197+
}
198+
199+
extract $CPPFLAGS
200+
QBT_ADD_DEFINES="$QBT_ADD_DEFINES $QBT_CONF_DEFINES"
201+
QBT_CONF_EXTRA_CFLAGS="$QBT_CONF_EXTRA_CFLAGS $CXXFLAGS"
202+
175203
# Substitute the values of these vars in conf.pri.in
204+
AC_SUBST(QBT_CONF_INCLUDES)
205+
AC_SUBST(QBT_CONF_EXTRA_CFLAGS)
176206
AC_SUBST(QBT_ADD_CONFIG)
177207
AC_SUBST(QBT_REMOVE_CONFIG)
178208
AC_SUBST(QBT_ADD_DEFINES)

0 commit comments

Comments
 (0)