fix bootstrap on osx
authorr8k <rajivk085@gmail.com>
Mon, 28 Nov 2016 19:26:46 +0000 (11:26 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Mon, 28 Nov 2016 19:38:29 +0000 (11:38 -0800)
Summary:
* include all dependencies
 * update `autoconf` & `configure` with correct params
 * include `make` & `make install` in the bootstrap for a better user experience
 * fixes #332
Closes https://github.com/facebook/folly/pull/513

Reviewed By: yfeldblum

Differential Revision: D4177362

Pulled By: Orvid

fbshipit-source-id: c62d6633c382fca57bb06db08724a7355b71bdb3

README.md
folly/build/bootstrap-osx-homebrew.sh

index 9b5f4ac..bc6c474 100644 (file)
--- a/README.md
+++ b/README.md
@@ -147,8 +147,6 @@ You may also use `folly/build/bootstrap-osx-homebrew.sh` to build against `maste
 ```
   cd folly
   ./build/bootstrap-osx-homebrew.sh
 ```
   cd folly
   ./build/bootstrap-osx-homebrew.sh
-  make
-  make check
 ```
 
 #### OS X (MacPorts)
 ```
 
 #### OS X (MacPorts)
index c7c350c..af8c201 100755 (executable)
@@ -8,22 +8,53 @@ set -e
 BASE_DIR="$(cd "$(dirname -- "$0")"/.. ; pwd)"  # folly/folly
 cd "$BASE_DIR"
 
 BASE_DIR="$(cd "$(dirname -- "$0")"/.. ; pwd)"  # folly/folly
 cd "$BASE_DIR"
 
-brewget() {
+# brew install alias
+brew_install() {
     brew install $@ || brew upgrade $@
 }
 
     brew install $@ || brew upgrade $@
 }
 
-# tool dependencies: autotools and scons (for double-conversion)
-brewget autoconf automake libtool
+# install deps
+install_deps() {
+       # folly deps
+       dependencies=(autoconf automake libtool pkg-config double-conversion glog gflags boost libevent xz snappy lz4 jemalloc openssl)
 
 
-# dependencies
-brewget glog gflags boost libevent double-conversion
+       # fetch deps
+       for dependency in ${dependencies[@]}; do
+               brew_install ${dependency}
+       done
+}
 
 
-autoreconf -i
-./configure
+# set env flags
+export_flags() {
+       # fetch opt dirs
+       OPT_GFLAGS=$(brew --prefix gflags)
+       OPT_OPENSSL=$(brew --prefix openssl)
 
 
-pushd test
-test -e gtest-1.7.0.zip || {
-    curl -O https://googletest.googlecode.com/files/gtest-1.7.0.zip
-    unzip gtest-1.7.0.zip
+       # export LDFLAGS
+       export LDFLAGS=-L${OPT_OPENSSL}/lib
+       export CPPFLAGS=-I${OPT_OPENSSL}/include
+       export GFLAGS_LIBS=-L${OPT_GFLAGS}/lib
+       export GFLAGS_CFLAGS=-I${OPT_GFLAGS}/include
 }
 }
+
+# now the fun part
+install_deps
+export_flags
+autoreconf -ivf
+./configure --disable-silent-rules --disable-dependency-tracking
+
+# fetch googletest, if doesn't exist
+pushd test
+GTEST_VER=1.7.0
+GTEST_DIR=gtest-${GTEST_VER}
+if [ ! -d ${GTEST_DIR} ]; then
+       mkdir ${GTEST_DIR}
+    curl -SL \
+       https://github.com/google/googletest/archive/release-${GTEST_VER}.tar.gz | \
+       tar -xvzf - --strip-components=1 -C ${GTEST_DIR}
+fi
 popd
 popd
+
+# make, test, install
+make
+make install