Skip to content

Commit

Permalink
build: Fix OSX build when using Homebrew and qt5
Browse files Browse the repository at this point in the history
Qt5 is bottled, so configure won't find it without some help. Use
brew to find out its prefix.

Also, qt5 added the host_bins variable to pkg-config, use it.
  • Loading branch information
theuni committed Oct 1, 2014
1 parent 35eaa6b commit 9fedafb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
7 changes: 7 additions & 0 deletions build-aux/m4/bitcoin_qt.m4
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
fi
CPPFLAGS=$TEMP_CPPFLAGS
])
if test x$use_pkgconfig$qt_bin_path = xyes; then
if test x$bitcoin_qt_got_major_vers = x5; then
qt_bin_path="`$PKG_CONFIG --variable=host_bins Qt5Core 2>/dev/null`"
fi
fi
BITCOIN_QT_PATH_PROGS([MOC], [moc-qt${bitcoin_qt_got_major_vers} moc${bitcoin_qt_got_major_vers} moc], $qt_bin_path)
BITCOIN_QT_PATH_PROGS([UIC], [uic-qt${bitcoin_qt_got_major_vers} uic${bitcoin_qt_got_major_vers} uic], $qt_bin_path)
BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt${bitcoin_qt_got_major_vers} rcc${bitcoin_qt_got_major_vers} rcc], $qt_bin_path)
Expand Down
25 changes: 19 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,25 @@ case $host in

AC_CHECK_PROG([BREW],brew, brew)
if test x$BREW = xbrew; then
dnl add default homebrew paths
openssl_prefix=`$BREW --prefix openssl`
bdb_prefix=`$BREW --prefix berkeley-db4`
export PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include"
LIBS="$LIBS -L$bdb_prefix/lib"
dnl These Homebrew packages may be bottled, meaning that they won't be found
dnl in expected paths because they may conflict with system files. Ask
dnl Homebrew where each one is located, then adjust paths accordingly.
dnl It's safe to add these paths even if the functionality is disabled by
dnl the user (--without-wallet or --without-gui for example).

openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null`
qt5_prefix=`$BREW --prefix qt5 2>/dev/null`
if test x$openssl_prefix != x; then
export PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
fi
if test x$bdb_prefix != x; then
CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include"
LIBS="$LIBS -L$bdb_prefix/lib"
fi
if test x$qt5_prefix != x; then
export PKG_CONFIG_PATH="$qt5_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
fi
fi
else
case $build_os in
Expand Down

3 comments on commit 9fedafb

@DomT4
Copy link
Contributor

@DomT4 DomT4 commented on 9fedafb Oct 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, the language here in regards to Homebrew is wrong I think. Nearly everything modern Homebrew ships is bottled. I think you mean the packages may be keg only, which is our term for not linking them into /usr/local or whatever your preferred Homebrew prefix is.

@theuni
Copy link
Member Author

@theuni theuni commented on 9fedafb Oct 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DomT4 Yes, of course you're correct. Would you like to PR a fix to the wording here? Otherwise I will.

@DomT4
Copy link
Contributor

@DomT4 DomT4 commented on 9fedafb Oct 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theuni Sure, I don't mind creating the PR. Will do that now.

Please sign in to comment.