Commit 6536cf29 authored by Jacob Bower's avatar Jacob Bower Committed by Facebook Github Bot

Make folly pkg-config more usable on OS X

Summary:
As part of open-sourcing the Watchman C++ client I'm adding an (optional) dependency in Watchman to Folly. When I tried to build this client with Folly on OS X I ran into some problems using the libfolly pkg-config file. This diff addresses these issues:

1. When using `build/bootstrap-osx-homebrew.sh`, the compile config for gflags and OpenSSL are overriden. If present, these custom flags will now be propagated to `libfolly.pc`.
2. I changed the the package requirements in `libfolly.pc` from `Requires.private` to just `Requires`.

Both of these changes are needed as much of Folly's implementation is in header files. As such, consumers of libfolly need to use the same library/include paths when building.

Reviewed By: yfeldblum

Differential Revision: D4332720

fbshipit-source-id: 6a051ae318ac10bdeb4dc383a16de81f1c0327bb
parent ed6a4850
......@@ -30,9 +30,9 @@ export_flags() {
OPT_GFLAGS=$(brew --prefix gflags)
OPT_OPENSSL=$(brew --prefix openssl)
# export LDFLAGS
# export flags
export LDFLAGS=-L${OPT_OPENSSL}/lib
export CPPFLAGS=-I${OPT_OPENSSL}/include
export OPENSSL_INCLUDES=-I${OPT_OPENSSL}/include
export GFLAGS_LIBS=-L${OPT_GFLAGS}/lib
export GFLAGS_CFLAGS=-I${OPT_GFLAGS}/include
}
......
......@@ -130,8 +130,18 @@ if test "$folly_cv_prog_cc_glog" != "yes"; then
fi
FB_CHECK_PKG_CONFIG([GLOG], [libglog])
AX_CHECK_OPENSSL([],
[AC_MSG_ERROR(["Error: libssl required"])])
AS_IF(
[test "x$OPENSSL_INCLUDES" = "x"],
[
AX_CHECK_OPENSSL([], [AC_MSG_ERROR(["Error: libssl required"])])
],
[
# AX_CHECK_OPENSSL doesn't seem to play nice with builds started
# via build/bootstrap-osx-homebrew.sh
AC_MSG_WARN(["Using existing OpenSSL flags from environment."])
PKG_CXXFLAGS="$PKG_CXXFLAGS $OPENSSL_INCLUDES"
]
)
FB_CHECK_PKG_CONFIG([OPENSSL], [openssl])
# check for boost libs
......@@ -602,7 +612,7 @@ AS_IF([test "x${mobile}" = "xyes"], [
# Include directory that contains "folly" so #include <folly/Foo.h> works
AM_CPPFLAGS='-I$(top_srcdir)/..'
AM_CPPFLAGS="$AM_CPPFLAGS $BOOST_CPPFLAGS"
AM_CPPFLAGS="$AM_CPPFLAGS $BOOST_CPPFLAGS $OPENSSL_INCLUDES"
AM_LDFLAGS="$AM_LDFLAGS $BOOST_CONTEXT_LIB $BOOST_PROGRAM_OPTIONS_LIB"
AM_LDFLAGS="$AM_LDFLAGS $BOOST_THREAD_LIB $BOOST_FILESYSTEM_LIB"
AM_LDFLAGS="$AM_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_REGEX_LIB -lpthread"
......
......@@ -6,7 +6,7 @@ includedir=@includedir@
Name: libfolly
Description: Facebook (Folly) C++ library
Version: @PKG_VERSION@
Requires.private: @PKG_DEPS@
Requires: @PKG_DEPS@
Libs.private: @PKG_LIBS@
Libs: -L${libdir} -lfolly
Cflags: -I${includedir} @PKG_CXXFLAGS@
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment