Repository: nifi-minifi-cpp Updated Branches: refs/heads/master 9dbad3bde -> 8c94b3421
MINIFICPP-524: Make building rocksdb default MINIFICPP-526: Update script to support changing rocksdb options This closes #352. Signed-off-by: Aldrin Piri <ald...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/commit/8c94b342 Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/8c94b342 Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/8c94b342 Branch: refs/heads/master Commit: 8c94b3421e0156a25a84b8cfe71b6d6a5399678e Parents: 9dbad3b Author: Marc Parisi <phroc...@apache.org> Authored: Tue Jun 5 10:51:04 2018 -0400 Committer: Aldrin Piri <ald...@apache.org> Committed: Thu Jun 7 11:49:45 2018 -0400 ---------------------------------------------------------------------- CMakeLists.txt | 1 + bootstrap.sh | 107 +++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 98 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/8c94b342/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e44507..4a4e2e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ option(USE_SYSTEM_OPENSSL "Instructs the build system to search for and use an S option(USE_SYSTEM_UUID "Instructs the build system to search for and use an UUID library available in the host system" ON) option(USE_SYSTEM_CURL "Instructs the build system to search for and use a cURL library available in the host system" ON) option(USE_SYSTEM_ZLIB "Instructs the build system to search for and use a zlib library available in the host system" ON) +option(BUILD_ROCKSDB "Instructs the build system to use RocksDB from the third party directory" ON) include(FeatureSummary) include(ExternalProject) http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/8c94b342/bootstrap.sh ---------------------------------------------------------------------- diff --git a/bootstrap.sh b/bootstrap.sh index d5fb8ec..b0fecdb 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -30,6 +30,7 @@ FALSE="Disabled" FEATURES_SELECTED="false" AUTO_REMOVE_EXTENSIONS="true" export NO_PROMPT="false" +ALL_FEATURES_ENABLED=${FALSE} DEPLOY="false" OPTIONS=() @@ -87,7 +88,8 @@ EnableAllFeatures(){ # eval "$option=${TRUE}" done } - +MENU="features" +GUIDED_INSTALL=${FALSE} while :; do case $1 in -n|--noprompt) @@ -113,6 +115,12 @@ while :; do BUILD="true" PACKAGE="true" ;; + -i|--install) + GUIDED_INSTALL="Enabled" + EnableAllFeatures + MENU="main" + ALL_FEATURES_ENABLED=${TRUE} + ;; -b|--build) CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) BUILD="true" @@ -238,6 +246,7 @@ CMAKE_REVISION=`echo $CMAKE_VERSION | cut -d. -f3` add_cmake_option PORTABLE_BUILD ${TRUE} add_cmake_option DEBUG_SYMBOLS ${FALSE} +add_cmake_option BUILD_ROCKSDB ${TRUE} ## uses the source from the third party directory add_enabled_option ROCKSDB_ENABLED ${TRUE} "DISABLE_ROCKSDB" ## need libcurl installed @@ -297,6 +306,7 @@ can_deploy(){ ToggleFeature(){ VARIABLE_VALUE=${!1} + ALL_FEATURES_ENABLED="Disabled" if [ $VARIABLE_VALUE = "Enabled" ]; then eval "$1=${FALSE}" else @@ -390,8 +400,68 @@ fi ## change to the directory + + pushd build +if [ "$GUIDED_INSTALL" == "${TRUE}" ]; then + EnableAllFeatures + ALL_FEATURES_ENABLED=${TRUE} +fi + + +show_main_menu() { + clear + echo "****************************************" + echo " MiNiFi C++ Main Menu." + echo "****************************************" + echo "A. Select MiNIFi C++ Features " + if [ "$ALL_FEATURES_ENABLED" = "${TRUE}" ]; then + echo " All features enabled ........$(print_feature_status ALL_FEATURES_ENABLED)" + fi + echo "B. Select Advanced Features " + echo "C. Continue with selected options " + echo -e "Q. Exit\r\n" +} + +read_main_menu_options(){ + local choice + read -p "Enter choice [ A-C ] " choice + choice=$(echo ${choice} | tr '[:upper:]' '[:lower:]') + case $choice in + a) MENU="features" ;; + b) MENU="advanced" ;; + c) FEATURES_SELECTED="true" ;; + q) exit 0;; + *) echo -e "${RED}Please enter a valid option...${NO_COLOR}" && sleep 1 + esac +} + +show_advanced_features_menu() { + clear + echo "****************************************" + echo " MiNiFi C++ Advanced Features." + echo "****************************************" + echo "A. Portable Build ..............$(print_feature_status PORTABLE_BUILD)" + echo "B. Build with Debug symbols ....$(print_feature_status DEBUG_SYMBOLS)" + echo "C. Build RocksDB from source ...$(print_feature_status BUILD_ROCKSDB)" + echo -e "R. Return to Main Menu\r\n" +} + +read_advanced_menu_options(){ + local choice + read -p "Enter choice [ A-C ] " choice + choice=$(echo ${choice} | tr '[:upper:]' '[:lower:]') + case $choice in + a) ToggleFeature PORTABLE_BUILD ;; + b) ToggleFeature DEBUG_SYMBOLS ;; + c) ToggleFeature BUILD_ROCKSDB ;; + r) MENU="main" ;; + *) echo -e "${RED}Please enter a valid option...${NO_COLOR}" && sleep 1 + esac +} + + show_supported_features() { clear @@ -411,14 +481,16 @@ show_supported_features() { echo "K. Bustache Support ............$(print_feature_status BUSTACHE_ENABLED)" echo "L. MQTT Support ................$(print_feature_status MQTT_ENABLED)" echo "M. Enable all extensions" - echo "N. Portable Build ..............$(print_feature_status PORTABLE_BUILD)" - echo "O. Build with Debug symbols ....$(print_feature_status DEBUG_SYMBOLS)" echo "P. Continue with these options" - echo "Q. Exit" + if [ "$GUIDED_INSTALL" = "${TRUE}" ]; then + echo "R. Return to Main Menu" + fi + echo "Q. Quit" echo "* Extension cannot be installed due to" echo -e " version of cmake or other software\r\n" } -read_options(){ + +read_feature_options(){ local choice read -p "Enter choice [ A - N ] " choice choice=$(echo ${choice} | tr '[:upper:]' '[:lower:]') @@ -436,9 +508,11 @@ read_options(){ k) ToggleFeature BUSTACHE_ENABLED ;; l) ToggleFeature MQTT_ENABLED ;; m) EnableAllFeatures ;; - n) ToggleFeature PORTABLE_BUILD ;; - o) ToggleFeature DEBUG_SYMBOLS ;; p) FEATURES_SELECTED="true" ;; + r) if [ "$GUIDED_INSTALL" = "${TRUE}" ]; then + MENU="main" + fi + ;; q) exit 0;; *) echo -e "${RED}Please enter an option A-L...${NO_COLOR}" && sleep 2 esac @@ -446,10 +520,17 @@ read_options(){ while [ ! "$FEATURES_SELECTED" == "true" ] do - show_supported_features - read_options + if [ "$MENU" == "main" ]; then + show_main_menu + read_main_menu_options + elif [ "$MENU" == "advanced" ]; then + show_advanced_features_menu + read_advanced_menu_options + else + show_supported_features + read_feature_options + fi done - ### ensure we have all dependencies @@ -514,6 +595,12 @@ build_cmake_command(){ CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DPORTABLE=OFF " fi + if [ "${BUILD_ROCKSDB}" = "${TRUE}" ]; then + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DBUILD_ROCKSDB=ON " + else + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DBUILD_ROCKSDB= " + fi + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DBUILD_IDENTIFIER=${BUILD_IDENTIFIER}" add_os_flags