From 9c60caec3bb99282affdebab2dfc0b4a89ea049f Mon Sep 17 00:00:00 2001 From: Mingtao Yang Date: Wed, 4 Sep 2024 10:12:04 -0700 Subject: [PATCH] remove mac-build.sh Summary: This script was not maintained. Use `python3 build/fbcode_builder/getdeps.py` instead. Reviewed By: NickR23 Differential Revision: D62156342 fbshipit-source-id: 70196889c59488125360aacc8f2616be11d45af5 --- README.md | 88 +++++++++--------------------------------- fizz/mac-build.sh | 98 ----------------------------------------------- 2 files changed, 18 insertions(+), 168 deletions(-) delete mode 100644 fizz/mac-build.sh diff --git a/README.md b/README.md index d885045370f..ccb65490ce5 100644 --- a/README.md +++ b/README.md @@ -101,86 +101,34 @@ The source code for this program can be found under `fizz/tool`. ## Building -### Ubuntu 16.04 LTS +### getdeps.py -To begin, you should install the dependencies we need for build. This largely -consists of [folly](https://github.com/facebook/folly)'s dependencies, as well as -[libsodium](https://github.com/jedisct1/libsodium). +getdeps.py is a script that many fbcode OSS projects use which will +automatically download dependencies for a project and build the project. This is +what CI uses as its main entry point. -```sh -sudo apt-get install \ - g++ \ - cmake \ - libboost-all-dev \ - libevent-dev \ - libdouble-conversion-dev \ - libgoogle-glog-dev \ - libgflags-dev \ - libiberty-dev \ - liblz4-dev \ - liblzma-dev \ - libsnappy-dev \ - make \ - zlib1g-dev \ - binutils-dev \ - libjemalloc-dev \ - libssl-dev \ - pkg-config \ - libsodium-dev -``` - -Then, build and install folly: - -```sh -git clone https://github.com/facebook/folly -mkdir folly/build_ && cd folly/build_ -cmake .. -make -j $(nproc) -sudo make install ``` - -And lastly, build and install fizz. - -```sh -cd ../.. -git clone https://github.com/facebookincubator/fizz -mkdir fizz/build_ && cd fizz/build_ -cmake ../fizz -make -j $(nproc) -sudo make install +python3 build/fbcode_builder/getdeps.py --allow-system-packages build ``` -### Building on Mac +### Manually +Fizz is a typical CMake project. In order to build Fizz, you must configure +CMake such that Fizz's dependencies can be found (e.g. using the [`CMAKE_PREFIX_PATH`](https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html) variable) -The following instructions were tested on MacOS High Sierra -with Xcode 9.4.1. They should work with later Xcode versions as well. +For example: -Run the helper script from within the `fizz` subdirectory. The helper -script assumes that you have homebrew installed and are using homebrew -as your package manager. To install homebrew use the instructions on -the homebrew [website](https://brew.sh/). - -It will install and link the required dependencies and also build folly. -This may take several minutes the first time. - -```sh -cd fizz -./mac-build.sh ``` - -After building, the directory `out/` will contain the libraries as well as -`out/bin` will contain the `ClientSocket` and `ServerSocket` binaries. -Running it again will be faster and only rebuild `fizz`. - -You can also install both `fizz` as well as `folly` to a custom directory -using the build script, by supplying an `INSTALL_PREFIX` env var. - -```sh -INSTALL_PREFIX=/usr/local ./mac-build.sh +cmake \ + -GNinja + -DCMAKE_PREFIX_PATH=/path/to/prefix \ + -DCMAKE_INSTALL_PREFIX=/path/to/prefix \ + -B/build/fizz \ + /path/to/checkout/fizz + +cmake --build /path/to/checkout/fizz +cmake --install /atph/to/checkout/fizz ``` -You might need to run the script as root to install to certain directories. - ## Contributing We'd love to have your help in making Fizz better. If you're interested, please diff --git a/fizz/mac-build.sh b/fizz/mac-build.sh deleted file mode 100644 index e86c1b2504f..00000000000 --- a/fizz/mac-build.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2018-present, Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. - -# setup the build dir -TOP_DIR=$(pwd) - -# setup the out dir -BUILD_DIR=out -mkdir -p $BUILD_DIR -cd $BUILD_DIR || exit -BWD=$(pwd) - -DEPS_DIR=$BWD/deps - -FOLLY_DIR=$DEPS_DIR/folly -FOLLY_BUILD_DIR=$DEPS_DIR/folly/build/ -FIZZ_BUILD_DIR=$BWD/build - -NCPU=$(sysctl -n hw.ncpu || printf 1) - -mkdir -p "$FIZZ_BUILD_DIR" - -# OpenSSL dirs. If you have OpenSSL installed somewhere -# else, change these dirs -OPENSSL_ROOT_DIR=/usr/local/opt/openssl -OPENSSL_LIB_DIR=/usr/local/opt/openssl/lib/ - - -if [ -z "$INSTALL_PREFIX" ]; then - FOLLY_INSTALL_DIR=$DEPS_DIR - FIZZ_INSTALL_DIR=$BWD -else - FOLLY_INSTALL_DIR=$INSTALL_PREFIX - FIZZ_INSTALL_DIR=$INSTALL_PREFIX -fi - -if [ ! -d "$FOLLY_DIR" ] ; then - # install the default dependencies from homebrew - brew install \ - cmake \ - boost \ - double-conversion \ - fmt \ - gflags \ - glog \ - libevent \ - lz4 \ - snappy \ - xz \ - openssl \ - libsodium - - brew link \ - boost \ - double-conversion \ - gflags \ - fmt \ - glog \ - libevent \ - lz4 \ - snappy \ - xz \ - libsodium - - # build folly - git clone https://github.com/facebook/folly.git "$FOLLY_DIR" - echo "Building Folly ($NCPU cores)" - mkdir -p "$FOLLY_BUILD_DIR" - cd "$FOLLY_BUILD_DIR" || exit - cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_INSTALL_PREFIX="$FOLLY_INSTALL_DIR" \ - -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" \ - -DOPENSSL_LIBRARIES="$OPENSSL_LIB_DIR" .. - make -j"${NCPU}" install - cd "$BWD" || exit -fi - -# build fizz -cd "$FIZZ_BUILD_DIR" || exit -cmake \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_INSTALL_PREFIX="$FIZZ_INSTALL_DIR" \ - -DCMAKE_PREFIX_PATH="$FOLLY_INSTALL_DIR" \ - -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" \ - -DOPENSSL_LIBRARIES="$OPENSSL_LIB_DIR" ../.. - -echo "Building Fizz ($NCPU cores)" -make -j"${NCPU}" install - -rm -rf "${BWD:?}"/bin -cp -R "$FIZZ_BUILD_DIR"/bin/ "$BWD"/bin/ - -cd "$TOP_DIR" || exit