Repository: nifi-minifi-cpp Updated Branches: refs/heads/master c719b40a7 -> 342cee09a
MINIFICPP-339: Add bootstrap script MINIFICPP-339: Update readme and options MINIFICPP-339: Add rhel6 controls MINIFICPP-339: Run bash beautify This closes #218. Signed-off-by: Marc Parisi <phroc...@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/342cee09 Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/342cee09 Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/342cee09 Branch: refs/heads/master Commit: 342cee09a41a9641ad59ddd7c91333c73166a1e9 Parents: c719b40 Author: Marc Parisi <phroc...@apache.org> Authored: Fri Dec 8 13:16:13 2017 -0500 Committer: Marc Parisi <phroc...@apache.org> Committed: Wed Dec 13 14:23:05 2017 -0500 ---------------------------------------------------------------------- .travis.yml | 2 +- README.md | 39 +++ bootstrap.sh | 471 ++++++++++++++++++++++++++++++ centos.sh | 144 +++++++++ darwin.sh | 71 +++++ extensions/librdkafka/CMakeLists.txt | 4 - extensions/usb-camera/CMakeLists.txt | 4 - fedora.sh | 69 +++++ rheldistro.sh | 113 +++++++ ubuntu.sh | 69 +++++ 10 files changed, 977 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/342cee09/.travis.yml ---------------------------------------------------------------------- diff --git a/.travis.yml b/.travis.yml index c732db9..219d973 100644 --- a/.travis.yml +++ b/.travis.yml @@ -120,4 +120,4 @@ matrix: - package='xz'; [[ $(brew ls --versions ${package}) ]] && { brew outdated ${package} || brew upgrade ${package}; } || brew install ${package} script: - - mkdir ./build && cd ./build && cmake .. ${CMAKE_BUILD_OPTIONS} && make -j2 VERBOSE=1 && sudo make test ARGS="-j2 --output-on-failure" && make linter && make apache-rat && make docs + - ./bootstrap.sh -e -t && cd build && make -j2 VERBOSE=1 && sudo make test ARGS="-j2 --output-on-failure" && make linter && make apache-rat && make docs http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/342cee09/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 9993832..4872dd3 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ MiNiFi is a child project effort of Apache NiFi. This repository is for a nativ - [Caveats](#caveats) - [Getting Started](#getting-started) - [System Requirements](#system-requirements) + - [Bootstrapping](#bootstrapping) - [Building](#building) - [Cleaning](#cleaning) - [Configuring](#configuring) @@ -215,6 +216,44 @@ $ sudo brew install libpcap ## Getting Started +### Bootstrapping + +- MiNiFi C++ offers a bootstrap script in the root of our github repo that will boot strap the cmake and build process for you without the need to install dependencies yourself. To use this process, please run the command boostrap.sh from the root of the MiNiFi C++ source tree. + + +- Per the table, below, you will be presented with a menu guided bootstrap process. You may enable and disable extensions ( further defined below ). Once you are finished selecting the features you wish to build, enter N to continue with the process. CMAKE dependencies will be resolved for your distro. You may enter command line options -n to force yes to all prompts ( including the package installation prompts ) and -b to automatically run make once the cmake process is complete. Alternatively, you may include the package argument to boostrap, -p, which will run make package. + +- If you provide -b or -p to bootstrap.sh, you do not need to follow the Building section, below. If you do not provide these arguments you may skip the cmake .. section from Building. + + ``` + # ~/Development/code/apache/nifi-minifi-cpp on git:master + $ ./bootstrap.sh + # CMAKE Build dir exists, should we overwrite your build directory before we begin? + If you have already bootstrapped, bootstrapping again isn't necessary to run make [ Y/N ] Y + $ **************************************** + Select MiNiFi C++ Features to toggle. + **************************************** + A. Persistent Repositories .....Enabled + B. Lib Curl Features ...........Enabled + C. Lib Archive Features ........Enabled + D. Execute Script support ......Enabled + E. Expression Langauge support .Enabled + F. Kafka support ...............Disabled + G. PCAP support ................Disabled + H. USB Camera support ..........Disabled + I. GPS support .................Disabled + J. TensorFlow Support ..........Disabled + K. Enable all extensions + L. Portable Build ..............Enabled + M. Build with Debug symbols ....Disabled + N. Continue with these options + Q. Exit + * Extension cannot be installed due to + version of cmake or other software + + Enter choice [ A - N ] + ``` + ### Building - From your source checkout, create a directory to perform the build (e.g. build) and cd into that directory. http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/342cee09/bootstrap.sh ---------------------------------------------------------------------- diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..bcce694 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,471 @@ +#!/bin/bash + + +#RED='\033[0;41;30m' +RED='\033[0;101m' +NO_COLOR='\033[0;0;39m' +CORES=1 +BUILD="false" +PACKAGE="false" + +TRUE="Enabled" +FALSE="Disabled" +FEATURES_SELECTED="false" +AUTO_REMOVE_EXTENSIONS="true" +export NO_PROMPT="false" + +OPTIONS=() +CMAKE_OPTIONS_ENABLED=() +CMAKE_OPTIONS_DISABLED=() +CMAKE_MIN_VERSION=() + +DEPENDENCIES=() + +add_option(){ + eval "$1=$2" + OPTIONS+=("$1") + CMAKE_OPTIONS_ENABLED+=("$1:$3") + CMAKE_OPTIONS_DISABLED+=("$1:$4") +} + +add_enabled_option(){ + eval "$1=$2" + OPTIONS+=("$1") + CMAKE_OPTIONS_DISABLED+=("$1:$3") +} +add_cmake_option(){ + eval "$1=$2" +} + +add_disabled_option(){ + eval "$1=$2" + OPTIONS+=("$1") + CMAKE_OPTIONS_ENABLED+=("$1:$3") + if [ ! -z "$4" ]; then + CMAKE_MIN_VERSION+=("$1:$4") + fi +} + +add_dependency(){ + DEPENDENCIES+=("$1:$2") +} + +### parse the command line arguments + +while :; do + case $1 in + -n|--noprompt) + NO_PROMPT="true" + ;; + -p|--package) + CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) + BUILD="true" + PACKAGE="true" + ;; + -b|--build) + CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu) + BUILD="true" + ;; + *) break + esac + shift +done + +if [ "$NO_PROMPT" = "true" ]; then + agree="N" + echo "****************************************" + echo "Welcome, this boostrap script will update your system to install MiNIFi C++" + echo "You have opted to skip prompts. Do you agree to this script installing" + echo "System packages without prompting you?" + read -p "Enter Y to continue, N to exit [ Y/N ] " agree + if [ "$agree" = "Y" ] || [ "$agree" = "y" ]; then + echo "Continuing..." + else + exit + fi +fi + + + +if [ -f /etc/os-release ]; then + . /etc/os-release + OS=$NAME + VER=$VERSION_ID +elif type lsb_release >/dev/null 2>&1; then + OS=$(lsb_release -si) + VER=$(lsb_release -sr) +elif [ -f /etc/lsb-release ]; then + . /etc/lsb-release + OS=$DISTRIB_ID + VER=$DISTRIB_RELEASE +elif [ -f /etc/debian_version ]; then + OS=Debian + VER=$(cat /etc/debian_version) +elif [ -f /etc/redhat-release ]; then + # Older Red Hat, CentOS, etc. + ... +else + OS=$(uname -s) + VER=$(uname -r) +fi + +OS_MAJOR=`echo $VER | cut -d. -f1` +OS_MINOR=`echo $VER | cut -d. -f2` +OS_REVISION=`echo $EVR | cut -d. -f3` + +if [[ "$OS" = "Darwin" ]]; then + source darwin.sh +elif [[ "$OS" = Ubuntu* ]]; then + source ubuntu.sh +elif [[ "$OS" = Red* ]]; then + source rheldistro.sh +elif [[ "$OS" = CentOS* ]]; then + source centos.sh +elif [[ "$OS" = Fedora* ]]; then + source fedora.sh +fi + + +### verify the cmake version + +CMAKE_COMMAND="" + +if [ -x "$(command -v cmake)" ]; then + CMAKE_COMMAND="cmake" +elif [ -x "$(command -v cmake3)" ]; then + CMAKE_COMMAND="cmake3" +fi + +if [ -z "${CMAKE_COMMAND}" ]; then + echo "CMAKE is not installed, attempting to install it..." + bootstrap_cmake + if [ -x "$(command -v cmake)" ]; then + CMAKE_COMMAND="cmake" + elif [ -x "$(command -v cmake3)" ]; then + CMAKE_COMMAND="cmake3" + fi +fi + + +## before we begin, let's ensure that cmake exists + +CMAKE_VERSION=`${CMAKE_COMMAND} --version | head -n 1 | awk '{print $3}'` + +CMAKE_MAJOR=`echo $CMAKE_VERSION | cut -d. -f1` +CMAKE_MINOR=`echo $CMAKE_VERSION | cut -d. -f2` +CMAKE_REVISION=`echo $CMAKE_VERSION | cut -d. -f3` + +add_cmake_option PORTABLE_BUILD ${TRUE} +add_cmake_option DEBUG_SYMBOLS ${FALSE} +## uses the source from the third party directory +add_enabled_option ROCKSDB_ENABLED ${TRUE} "DISABLE_ROCKSDB" +## need libcurl installed +add_enabled_option HTTP_CURL_ENABLED ${TRUE} "DISABLE_CURL" +add_dependency HTTP_CURL_ENABLED "libcurl" +add_dependency HTTP_CURL_ENABLED "openssl" + +# third party directory +add_enabled_option LIBARCHIVE_ENABLED ${TRUE} "DISABLE_LIBARCHIVE" +add_dependency LIBARCHIVE_ENABLED "libarchive" + +add_enabled_option EXECUTE_SCRIPT_ENABLED ${TRUE} "DISABLE_SCRIPTING" +add_dependency EXECUTE_SCRIPT_ENABLED "python" +add_dependency EXECUTE_SCRIPT_ENABLED "lua" + +add_enabled_option EXPRESSION_LANGAUGE_ENABLED ${TRUE} "DISABLE_EXPRESSION_LANGUAGE" +add_dependency EXPRESSION_LANGAUGE_ENABLED "bison" +add_dependency EXPRESSION_LANGAUGE_ENABLED "flex" + +add_disabled_option PCAP_ENABLED ${FALSE} "ENABLE_PCAP" +add_dependency PCAP_ENABLED "libpcap" + +add_disabled_option USB_ENABLED ${FALSE} "ENABLE_USB_CAMERA" + +add_dependency USB_ENABLED "libusb" +add_dependency USB_ENABLED "libpng" + +add_disabled_option GPS_ENABLED ${FALSE} "ENABLE_GPS" +add_dependency GPS_ENABLED "gpsd" + +add_disabled_option KAFKA_ENABLED ${FALSE} "ENABLE_LIBRDKAFKA" "3.4.0" + +## currently need to limit on certain platforms +#add_disabled_option TENSORFLOW_ENABLED ${FALSE} "ENABLE_TENSORFLOW" + + +pause(){ + read -p "Press [Enter] key to continue..." fackEnterKey +} + + + +ToggleFeature(){ + VARIABLE_VALUE=${!1} + if [ $VARIABLE_VALUE = "Enabled" ]; then + eval "$1=${FALSE}" + else + for option in "${CMAKE_MIN_VERSION[@]}" ; do + OPT=${option%%:*} + if [ "$OPT" = "$1" ]; then + NEEDED_VER=${option#*:} + NEEDED_MAJOR=`echo $NEEDED_VER | cut -d. -f1` + NEEDED_MINOR=`echo $NEEDED_VER | cut -d. -f2` + NEEDED_REVISION=`echo $NEEDED_VERSION | cut -d. -f3` + if (( NEEDED_MAJOR > CMAKE_MAJOR )); then + return 1 + fi + + if (( NEEDED_MINOR > CMAKE_MINOR )); then + return 1 + fi + + if (( NEEDED_REVISION > CMAKE_REVISION )); then + return 1 + fi + fi + done + CAN_ENABLE=$(verify_enable $1) + if [ "$CAN_ENABLE" = "true" ]; then + eval "$1=${TRUE}" + fi + fi +} + +EnableAllFeatures(){ + for option in "${OPTIONS[@]}" ; do + feature_status=${!option} + if [ "$feature_status" = "${FALSE}" ]; then + ToggleFeature $option + fi + # eval "$option=${TRUE}" + done +} + +print_feature_status(){ + feature="$1" + feature_status=${!1} + if [ "$feature_status" = "Enabled" ]; then + echo "Enabled" + else + for option in "${CMAKE_MIN_VERSION[@]}" ; do + OPT=${option%%:*} + if [ "${OPT}" = "$1" ]; then + NEEDED_VER=${option#*:} + NEEDED_MAJOR=`echo $NEEDED_VER | cut -d. -f1` + NEEDED_MINOR=`echo $NEEDED_VER | cut -d. -f2` + NEEDED_REVISION=`echo $NEEDED_VERSION | cut -d. -f3` + if (( NEEDED_MAJOR > CMAKE_MAJOR )); then + echo -e "${RED}Disabled*${NO_COLOR}" + return 1 + fi + + if (( NEEDED_MINOR > CMAKE_MINOR )); then + echo -e "${RED}Disabled*${NO_COLOR}" + return 1 + fi + + if (( NEEDED_REVISION > CMAKE_REVISION )); then + echo -e "${RED}Disabled*${NO_COLOR}" + return 1 + fi + fi + done + CAN_ENABLE=$(verify_enable $1) + if [ "$CAN_ENABLE" = "true" ]; then + echo -e "${RED}Disabled${NO_COLOR}" + else + echo -e "${RED}Disabled*${NO_COLOR}" + fi + + fi +} + + +### parse the command line arguments + +while :; do + case $1 in + -e|--enableall) + NO_PROMPT="true" + FEATURES_SELECTED="true" + EnableAllFeatures + ;; + -t|--travis) + NO_PROMPT="true" + FEATURES_SELECTED="true" + ;; + *) break + esac + shift +done + +if [ ! -d "build" ]; then + mkdir build/ +else + + overwrite="Y" + if [ "$NO_PROMPT" = "false" ] && [ "$FEATURES_SELECTED" = "false" ]; then + echo "CMAKE Build dir exists, should we overwrite your build directory before we begin?" + read -p "If you have already bootstrapped, bootstrapping again isn't necessary to run make [ Y/N ] " overwrite + fi + if [ "$overwrite" = "N" ] || [ "$overwrite" = "n" ]; then + echo "Exiting ...." + exit + else + rm build/CMakeCache.txt > /dev/null 2>&1 + fi +fi + +## change to the directory + +cd build + + +show_supported_features() { + clear + echo "****************************************" + echo " Select MiNiFi C++ Features to toggle." + echo "****************************************" + echo "A. Persistent Repositories .....$(print_feature_status ROCKSDB_ENABLED)" + echo "B. Lib Curl Features ...........$(print_feature_status HTTP_CURL_ENABLED)" + echo "C. Lib Archive Features ........$(print_feature_status LIBARCHIVE_ENABLED)" + echo "D. Execute Script support ......$(print_feature_status EXECUTE_SCRIPT_ENABLED)" + echo "E. Expression Langauge support .$(print_feature_status EXPRESSION_LANGAUGE_ENABLED)" + echo "F. Kafka support ...............$(print_feature_status KAFKA_ENABLED)" + echo "G. PCAP support ................$(print_feature_status PCAP_ENABLED)" + echo "H. USB Camera support ..........$(print_feature_status USB_ENABLED)" + echo "I. GPS support .................$(print_feature_status GPS_ENABLED)" + echo "J. TensorFlow Support ..........$(print_feature_status TENSORFLOW_ENABLED)" + echo "K. Enable all extensions" + echo "L. Portable Build ..............$(print_feature_status PORTABLE_BUILD)" + echo "M. Build with Debug symbols ....$(print_feature_status DEBUG_SYMBOLS)" + echo "N. Continue with these options" + echo "Q. Exit" + echo "* Extension cannot be installed due to" + echo -e " version of cmake or other software\r\n" +} +read_options(){ + local choice + read -p "Enter choice [ A - N ] " choice + choice=$(echo ${choice} | tr '[:upper:]' '[:lower:]') + case $choice in + a) ToggleFeature ROCKSDB_ENABLED ;; + b) ToggleFeature HTTP_CURL_ENABLED ;; + c) ToggleFeature LIBARCHIVE_ENABLED ;; + d) ToggleFeature EXECUTE_SCRIPT_ENABLED ;; + e) ToggleFeature EXPRESSION_LANGAUGE_ENABLED ;; + f) ToggleFeature KAFKA_ENABLED ;; + g) ToggleFeature PCAP_ENABLED ;; + h) ToggleFeature USB_ENABLED ;; + i) ToggleFeature GPS_ENABLED ;; + j) ToggleFeature TENSORFLOW_ENABLED ;; + k) EnableAllFeatures ;; + l) ToggleFeature PORTABLE_BUILD ;; + m) ToggleFeature DEBUG_SYMBOLS ;; + n) FEATURES_SELECTED="true" ;; + q) exit 0;; + *) echo -e "${RED}Please enter an option A-L...${NO_COLOR}" && sleep 2 + esac +} + +while [ ! "$FEATURES_SELECTED" == "true" ] +do + show_supported_features + read_options +done + +### ensure we have all dependencies + + +build_deps + + +## just in case + +CMAKE_VERSION=`${CMAKE_COMMAND} --version | head -n 1 | awk '{print $3}'` + +CMAKE_MAJOR=`echo $CMAKE_VERSION | cut -d. -f1` +CMAKE_MINOR=`echo $CMAKE_VERSION | cut -d. -f2` +CMAKE_REVISION=`echo $CMAKE_VERSION | cut -d. -f3` + + +CMAKE_BUILD_COMMAND="${CMAKE_COMMAND} " + + +build_cmake_command(){ + + for option in "${OPTIONS[@]}" ; do + option_value="${!option}" + if [ "$option_value" = "${TRUE}" ]; then + # option is enabled + FOUND="" + FOUND_VALUE="" + for cmake_opt in "${CMAKE_OPTIONS_ENABLED[@]}" ; do + KEY=${cmake_opt%%:*} + VALUE=${cmake_opt#*:} + if [ "$KEY" = "$option" ]; then + FOUND="1" + FOUND_VALUE="$VALUE" + fi + done + if [ "$FOUND" = "1" ]; then + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -D${FOUND_VALUE}=TRUE" + fi + else + FOUND="" + FOUND_VALUE="" + if [ -z "$FOUND" ]; then + for cmake_opt in "${CMAKE_OPTIONS_DISABLED[@]}" ; do + KEY=${cmake_opt%%:*} + VALUE=${cmake_opt#*:} + if [ "$KEY" = "$option" ]; then + FOUND="1" + FOUND_VALUE="$VALUE" + fi + done + fi + if [ "$FOUND" = "1" ]; then + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -D${FOUND_VALUE}=TRUE" + fi + fi + done + if [ "${DEBUG_SYMBOLS}" = "${TRUE}" ]; then + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DCMAKE_BUILD_TYPE=RelWithDebInfo" + fi + + if [ "${PORTABLE_BUILD}" = "${TRUE}" ]; then + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DPORTABLE=ON " + else + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DPORTABLE=OFF " + fi + + add_os_flags + + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} .." + continue_with_plan="Y" + if [ ! "$NO_PROMPT" = "true" ]; then + read -p "Command will be '${CMAKE_BUILD_COMMAND}', run this? [ Y/N ] " continue_with_plan + fi + if [ "$overwrite" = "N" ] || [ "$overwrite" = "n" ]; then + echo "Exiting ...." + exit + fi +} + + +build_cmake_command + + + +### run the cmake command +${CMAKE_BUILD_COMMAND} + +if [ "$BUILD" = "true" ]; then + make -j${CORES} +fi + +if [ "$PACKAGE" = "true" ]; then + make package +fi + + http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/342cee09/centos.sh ---------------------------------------------------------------------- diff --git a/centos.sh b/centos.sh new file mode 100644 index 0000000..8f6bf0a --- /dev/null +++ b/centos.sh @@ -0,0 +1,144 @@ +#!/bin/bash + +verify_enable() { + feature="$1" + feature_status=${!1} + if [ "$OS_MAJOR" = "6" ]; then + if [ "$feature" = "GPS_ENABLED" ]; then + echo "false" + elif [ "$feature" = "USB_ENABLED" ]; then + echo "false" + else + echo "true" + fi + else + if [ "$feature" = "USB_ENABLED" ]; then + echo "false" + else + echo "true" + fi + fi +} + +add_os_flags() { + if [ "$OS_MAJOR" = "6" ]; then + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DCMAKE_CXX_FLAGS=-lrt " + fi +} +install_bison() { + if [ "$OS_MAJOR" = "6" ]; then + BISON_INSTALLED="false" + if [ -x "$(command -v bison)" ]; then + BISON_VERSION=`bison --version | head -n 1 | awk '{print $4}'` + BISON_MAJOR=`echo $BISON_VERSION | cut -d. -f1` + if (( BISON_MAJOR >= 3 )); then + BISON_INSTALLED="true" + fi + fi + if [ "$BISON_INSTALLED" = "false" ]; then + wget https://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.xz + tar xvf bison-3.0.4.tar.xz + pushd bison-3.0.4 + ./configure + make + make install + popd + fi + + else + INSTALLED+=("bison") + fi +} + +install_libusb() { + if [ "$OS_MAJOR" = "6" ]; then + sudo yum -y install libtool libudev-devel + # git clone --branch v1.0.18 https://github.com/libusb/libusb.git + git clone https://github.com/libusb/libusb.git + pushd libusb + git checkout v1.0.18 + ./bootstrap.sh + ./configure + make + sudo make install + popd + rm -rf libusb + else + INSTALLED+=("libusb-devel") + fi + +} + + + +bootstrap_cmake(){ + sudo yum -y install wget + if [ "$OS_MAJOR" = "6" ]; then + sudo yum -y install centos-release-scl + sudo yum -y install devtoolset-6 + sudo yum -y install epel-release + sudo yum -y install cmake3 + if [ "$NO_PROMPT" = "true" ]; then + scl enable devtoolset-6 bash ./bootstrap.sh -n + else + scl enable devtoolset-6 bash ./bootstrap.sh + fi + else + wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + sudo yum -y install epel-release-latest-7.noarch.rpm + sudo yum -y install cmake3 + fi +} +build_deps(){ +# Install epel-release so that cmake3 will be available for installation + + COMMAND="sudo yum -y install gcc gcc-c++ libuuid libuuid-devel" + INSTALLED=() + for option in "${OPTIONS[@]}" ; do + option_value="${!option}" + if [ "$option_value" = "${TRUE}" ]; then + # option is enabled + FOUND_VALUE="" + for cmake_opt in "${DEPENDENCIES[@]}" ; do + KEY=${cmake_opt%%:*} + VALUE=${cmake_opt#*:} + if [ "$KEY" = "$option" ]; then + FOUND_VALUE="$VALUE" + if [ "$FOUND_VALUE" = "libcurl" ]; then + INSTALLED+=("libcurl-devel") + elif [ "$FOUND_VALUE" = "libpcap" ]; then + INSTALLED+=("libpcap-devel") + elif [ "$FOUND_VALUE" = "openssl" ]; then + INSTALLED+=("openssl") + INSTALLED+=("openssl-devel") + elif [ "$FOUND_VALUE" = "libusb" ]; then + install_libusb + elif [ "$FOUND_VALUE" = "libpng" ]; then + INSTALLED+=("libpng-devel") + elif [ "$FOUND_VALUE" = "bison" ]; then + install_bison + elif [ "$FOUND_VALUE" = "flex" ]; then + INSTALLED+=("flex") + elif [ "$FOUND_VALUE" = "python" ]; then + INSTALLED+=("python34-devel") + elif [ "$FOUND_VALUE" = "lua" ]; then + INSTALLED+=("lua-devel") + elif [ "$FOUND_VALUE" = "gpsd" ]; then + INSTALLED+=("gpsd-devel") + elif [ "$FOUND_VALUE" = "libarchive" ]; then + INSTALLED+=("xz-devel") + INSTALLED+=("bzip2-devel") + fi + fi + done + + fi + done + + for option in "${INSTALLED[@]}" ; do + COMMAND="${COMMAND} $option" + done + + ${COMMAND} + +} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/342cee09/darwin.sh ---------------------------------------------------------------------- diff --git a/darwin.sh b/darwin.sh new file mode 100644 index 0000000..90f748b --- /dev/null +++ b/darwin.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +verify_enable() { + echo "true" +} + +add_os_flags(){ + : +} + +bootstrap_cmake(){ + brew install cmake +} +build_deps(){ + + COMMAND="brew install cmake" + INSTALLED=() + for option in "${OPTIONS[@]}" ; do + option_value="${!option}" + if [ "$option_value" = "${TRUE}" ]; then + # option is enabled + FOUND_VALUE="" + for cmake_opt in "${DEPENDENCIES[@]}" ; do + KEY=${cmake_opt%%:*} + VALUE=${cmake_opt#*:} + if [ "$KEY" = "$option" ]; then + FOUND_VALUE="$VALUE" + if [ "$FOUND_VALUE" = "libcurl" ]; then + INSTALLED+=("curl") + elif [ "$FOUND_VALUE" = "libpcap" ]; then + INSTALLED+=("libpcap") + elif [ "$FOUND_VALUE" = "openssl" ]; then + INSTALLED+=("openssl") + elif [ "$FOUND_VALUE" = "libusb" ]; then + INSTALLED+=("libusb") + elif [ "$FOUND_VALUE" = "libpng" ]; then + INSTALLED+=("libpng") + elif [ "$FOUND_VALUE" = "bison" ]; then + INSTALLED+=("bison") + elif [ "$FOUND_VALUE" = "flex" ]; then + INSTALLED+=("flex") + elif [ "$FOUND_VALUE" = "python" ]; then + INSTALLED+=("python") + elif [ "$FOUND_VALUE" = "lua" ]; then + INSTALLED+=("lua") + elif [ "$FOUND_VALUE" = "gpsd" ]; then + INSTALLED+=("gpsd") + elif [ "$FOUND_VALUE" = "libarchive" ]; then + INSTALLED+=("xz") + INSTALLED+=("bzip2") + fi + fi + done + + fi + done + + for option in "${INSTALLED[@]}" ; do + COMMAND="${COMMAND} $option" + done + + echo "Ensuring you have all dependencies installed..." + ${COMMAND} > /dev/null 2>&1 + + for option in "${INSTALLED[@]}" ; do + if [ "$option" = "curl" ]; then + brew link curl --force > /dev/null 2>&1 + fi + done + +} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/342cee09/extensions/librdkafka/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/extensions/librdkafka/CMakeLists.txt b/extensions/librdkafka/CMakeLists.txt index 3cc6a19..2f876c1 100644 --- a/extensions/librdkafka/CMakeLists.txt +++ b/extensions/librdkafka/CMakeLists.txt @@ -51,10 +51,6 @@ endif() find_package(ZLIB REQUIRED) include_directories(${ZLIB_INCLUDE_DIRS}) target_link_libraries (minifi-rdkafka-extensions ${ZLIB_LIBRARIES}) -find_package(Boost COMPONENTS system filesystem REQUIRED) -include_directories(${Boost_INCLUDE_DIRS}) -target_link_libraries(minifi-rdkafka-extensions ${Boost_SYSTEM_LIBRARY}) -target_link_libraries(minifi-rdkafka-extensions ${Boost_FILESYSTEM_LIBRARY}) if (WIN32) set_target_properties(minifi-rdkafka-extensions PROPERTIES LINK_FLAGS "/WHOLERDKAFKA" http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/342cee09/extensions/usb-camera/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/extensions/usb-camera/CMakeLists.txt b/extensions/usb-camera/CMakeLists.txt index e24de93..24a6246 100644 --- a/extensions/usb-camera/CMakeLists.txt +++ b/extensions/usb-camera/CMakeLists.txt @@ -71,10 +71,6 @@ target_link_libraries(minifi-usb-camera-extensions ${LIBUSB_LIBRARIES}) find_package(ZLIB REQUIRED) include_directories(${ZLIB_INCLUDE_DIRS}) target_link_libraries (minifi-usb-camera-extensions ${ZLIB_LIBRARIES}) -find_package(Boost COMPONENTS system filesystem REQUIRED) -include_directories(${Boost_INCLUDE_DIRS}) -target_link_libraries(minifi-usb-camera-extensions ${Boost_SYSTEM_LIBRARY}) -target_link_libraries(minifi-usb-camera-extensions ${Boost_FILESYSTEM_LIBRARY}) if (WIN32) set_target_properties(minifi-usb-camera-extensions PROPERTIES LINK_FLAGS "/WHOLEARCHIVE" http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/342cee09/fedora.sh ---------------------------------------------------------------------- diff --git a/fedora.sh b/fedora.sh new file mode 100644 index 0000000..d0026e0 --- /dev/null +++ b/fedora.sh @@ -0,0 +1,69 @@ +#!/bin/bash +verify_enable(){ + echo "true" +} +add_os_flags() { + : +} +bootstrap_cmake(){ + sudo yum -y install wget + wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + sudo yum -y install epel-release-latest-7.noarch.rpm + sudo yum -y install cmake3 +} +build_deps(){ +# Install epel-release so that cmake3 will be available for installation + sudo yum -y install wget + wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + sudo yum -y install epel-release-latest-7.noarch.rpm + + COMMAND="sudo yum -y install gcc gcc-c++ libuuid libuuid-devel" + INSTALLED=() + for option in "${OPTIONS[@]}" ; do + option_value="${!option}" + if [ "$option_value" = "${TRUE}" ]; then + # option is enabled + FOUND_VALUE="" + for cmake_opt in "${DEPENDENCIES[@]}" ; do + KEY=${cmake_opt%%:*} + VALUE=${cmake_opt#*:} + if [ "$KEY" = "$option" ]; then + FOUND_VALUE="$VALUE" + if [ "$FOUND_VALUE" = "libcurl" ]; then + INSTALLED+=("libcurl-devel") + elif [ "$FOUND_VALUE" = "libpcap" ]; then + INSTALLED+=("libpcap-devel") + elif [ "$FOUND_VALUE" = "openssl" ]; then + INSTALLED+=("openssl") + INSTALLED+=("openssl-devel") + elif [ "$FOUND_VALUE" = "libusb" ]; then + INSTALLED+=("libusb-devel") + elif [ "$FOUND_VALUE" = "libpng" ]; then + INSTALLED+=("libpng-devel") + elif [ "$FOUND_VALUE" = "bison" ]; then + INSTALLED+=("bison") + elif [ "$FOUND_VALUE" = "flex" ]; then + INSTALLED+=("flex") + elif [ "$FOUND_VALUE" = "python" ]; then + INSTALLED+=("python3-devel") + elif [ "$FOUND_VALUE" = "lua" ]; then + INSTALLED+=("lua-devel") + elif [ "$FOUND_VALUE" = "gpsd" ]; then + INSTALLED+=("gpsd-devel") + elif [ "$FOUND_VALUE" = "libarchive" ]; then + INSTALLED+=("xz-devel") + INSTALLED+=("bzip2-devel") + fi + fi + done + + fi + done + + for option in "${INSTALLED[@]}" ; do + COMMAND="${COMMAND} $option" + done + + ${COMMAND} + +} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/342cee09/rheldistro.sh ---------------------------------------------------------------------- diff --git a/rheldistro.sh b/rheldistro.sh new file mode 100644 index 0000000..537f6d3 --- /dev/null +++ b/rheldistro.sh @@ -0,0 +1,113 @@ +#!/bin/bash +verify_enable() { + feature="$1" + feature_status=${!1} + if [ "$OS_MAJOR" = "6" ]; then + if [ "$feature" = "GPS_ENABLED" ]; then + echo "false" + elif [ "$feature" = "USB_ENABLED" ]; then + echo "false" + else + echo "true" + fi + else + if [ "$feature" = "USB_ENABLED" ]; then + echo "false" + else + echo "true" + fi + fi +} + +add_os_flags() { + if [ "$OS_MAJOR" = "6" ]; then + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DCMAKE_CXX_FLAGS=-lrt " + fi +} +install_bison() { + if [ "$OS_MAJOR" = "6" ]; then + BISON_INSTALLED="false" + if [ -x "$(command -v bison)" ]; then + BISON_VERSION=`bison --version | head -n 1 | awk '{print $4}'` + BISON_MAJOR=`echo $BISON_VERSION | cut -d. -f1` + if (( BISON_MAJOR >= 3 )); then + BISON_INSTALLED="true" + fi + fi + if [ "$BISON_INSTALLED" = "false" ]; then + wget https://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.xz + tar xvf bison-3.0.4.tar.xz + pushd bison-3.0.4 + ./configure + make + make install + popd + fi + + else + INSTALLED+=("bison") + fi +} + +bootstrap_cmake(){ + sudo yum -y install wget + wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + sudo yum -y install epel-release-latest-7.noarch.rpm + sudo yum -y install cmake3 +} +build_deps(){ +# Install epel-release so that cmake3 will be available for installation + sudo yum -y install wget + wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + sudo yum -y install epel-release-latest-7.noarch.rpm + + COMMAND="sudo yum install cmake3 gcc gcc-c++ libuuid libuuid-devel" + INSTALLED=() + for option in "${OPTIONS[@]}" ; do + option_value="${!option}" + if [ "$option_value" = "${TRUE}" ]; then + # option is enabled + FOUND_VALUE="" + for cmake_opt in "${DEPENDENCIES[@]}" ; do + KEY=${cmake_opt%%:*} + VALUE=${cmake_opt#*:} + if [ "$KEY" = "$option" ]; then + FOUND_VALUE="$VALUE" + if [ "$FOUND_VALUE" = "libcurl" ]; then + INSTALLED+=("libcurl-devel") + elif [ "$FOUND_VALUE" = "libpcap" ]; then + INSTALLED+=("libpcap-devel") + elif [ "$FOUND_VALUE" = "openssl" ]; then + INSTALLED+=("openssl") + INSTALLED+=("openssl-devel") + elif [ "$FOUND_VALUE" = "libusb" ]; then + INSTALLED+=("libusb-devel") + elif [ "$FOUND_VALUE" = "libpng" ]; then + INSTALLED+=("libpng-devel") + elif [ "$FOUND_VALUE" = "bison" ]; then + install_bison + elif [ "$FOUND_VALUE" = "flex" ]; then + INSTALLED+=("flex") + elif [ "$FOUND_VALUE" = "python" ]; then + INSTALLED+=("python34-devel") + elif [ "$FOUND_VALUE" = "lua" ]; then + INSTALLED+=("lua-devel") + elif [ "$FOUND_VALUE" = "gpsd" ]; then + INSTALLED+=("gpsd-devel") + elif [ "$FOUND_VALUE" = "libarchive" ]; then + INSTALLED+=("xz-devel") + INSTALLED+=("bzip2-devel") + fi + fi + done + + fi + done + + for option in "${INSTALLED[@]}" ; do + COMMAND="${COMMAND} $option" + done + + ${COMMAND} + +} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/342cee09/ubuntu.sh ---------------------------------------------------------------------- diff --git a/ubuntu.sh b/ubuntu.sh new file mode 100644 index 0000000..95b8e25 --- /dev/null +++ b/ubuntu.sh @@ -0,0 +1,69 @@ +#!/bin/bash +verify_enable(){ + feature="$1" + feature_status=${!1} + if [ "$feature" = "USB_ENABLED" ]; then + echo "false" + else + echo "true" + fi +} +add_os_flags() { + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DFAIL_ON_WARNINGS= " +} +bootstrap_cmake(){ + sudo apt-get -y install cmake +} +build_deps(){ + + COMMAND="sudo apt-get -y install cmake gcc g++ libssl-dev uuid uuid-dev" + export DEBIAN_FRONTEND=noninteractive + INSTALLED=() + sudo apt-get -y update + for option in "${OPTIONS[@]}" ; do + option_value="${!option}" + if [ "$option_value" = "${TRUE}" ]; then + # option is enabled + FOUND_VALUE="" + for cmake_opt in "${DEPENDENCIES[@]}" ; do + KEY=${cmake_opt%%:*} + VALUE=${cmake_opt#*:} + if [ "$KEY" = "$option" ]; then + FOUND_VALUE="$VALUE" + if [ "$FOUND_VALUE" = "libcurl" ]; then + INSTALLED+=("libcurl4-openssl-dev") + elif [ "$FOUND_VALUE" = "libpcap" ]; then + INSTALLED+=("libpcap-dev") + elif [ "$FOUND_VALUE" = "openssl" ]; then + INSTALLED+=("openssl") + elif [ "$FOUND_VALUE" = "libusb" ]; then + INSTALLED+=("libusb-dev") + elif [ "$FOUND_VALUE" = "libpng" ]; then + INSTALLED+=("libpng-dev") + elif [ "$FOUND_VALUE" = "bison" ]; then + INSTALLED+=("bison") + elif [ "$FOUND_VALUE" = "flex" ]; then + INSTALLED+=("flex") + elif [ "$FOUND_VALUE" = "python" ]; then + INSTALLED+=("libpython3-dev") + elif [ "$FOUND_VALUE" = "lua" ]; then + INSTALLED+=("liblua5.1-0-dev") + elif [ "$FOUND_VALUE" = "gpsd" ]; then + INSTALLED+=("libgps-dev") + elif [ "$FOUND_VALUE" = "libarchive" ]; then + INSTALLED+=("liblzma-dev") + fi + fi + done + + fi + done + + for option in "${INSTALLED[@]}" ; do + COMMAND="${COMMAND} $option" + done + + echo "Ensuring you have all dependencies installed..." + ${COMMAND} + +}