From 93533c200289a09d12d4a981718002442a033d40 Mon Sep 17 00:00:00 2001 From: Hailiang Wang Date: Tue, 22 Aug 2017 00:37:37 +0800 Subject: [PATCH] script: add pkgdep.sh to install dependencies automatically. Change-Id: I7447a28fa8ecd8395a85b66952d19aa25683876c Signed-off-by: Hailiang Wang Reviewed-on: https://review.gerrithub.io/374946 Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris Tested-by: SPDK Automated Test System --- Makefile | 2 ++ README.md | 46 ++++++++-------------------------------- scripts/pkgdep.sh | 34 +++++++++++++++++++++++++++++ scripts/vagrant/build.sh | 9 +------- 4 files changed, 46 insertions(+), 45 deletions(-) create mode 100755 scripts/pkgdep.sh mode change 100644 => 100755 scripts/vagrant/build.sh diff --git a/Makefile b/Makefile index 8ab3ac7bc..3ba1b0db1 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,8 @@ lib: $(DPDKBUILD) app: lib test: lib examples: lib +pkgdep: + sh ./scripts/pkgdep.sh $(DIRS-y): mk/cc.mk config.h diff --git a/README.md b/README.md index 2984a4985..b611e7e5b 100644 --- a/README.md +++ b/README.md @@ -36,43 +36,6 @@ The development kit currently includes: well as a [Porting Guide](http://www.spdk.io/doc/porting.html) for porting SPDK to different frameworks and operating systems. - -## Prerequisites - -Note: The requirements for building the docs can take a while to -install so you may want to skip them unless you need them. - -Fedora/CentOS: - -~~~{.sh} -sudo dnf install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \ - git astyle-devel python-pep8 lcov python clang-analyzer -# Additional dependencies for RDMA (NVMe over Fabrics) -sudo dnf install -y libibverbs-devel librdmacm-devel -# Additional dependencies for building docs -sudo dnf install -y doxygen mscgen -~~~ - -Ubuntu/Debian: - -~~~{.sh} -sudo apt-get install -y gcc g++ make libcunit1-dev libaio-dev libssl-dev \ - git astyle pep8 lcov clang -# Additional dependencies for RDMA (NVMe over Fabrics) -sudo apt-get install -y libibverbs-dev librdmacm-dev -# Additional dependencies for building docs -sudo apt-get install -y doxygen mscgen -~~~ - -FreeBSD: - -~~~{.sh} -sudo pkg install gmake cunit openssl git devel/astyle bash devel/pep8 \ - python -# Additional dependencies for building docs -sudo pkg install doxygen mscgen -~~~ - ## Source Code @@ -82,6 +45,15 @@ cd spdk git submodule update --init ~~~ + +## Prerequisites + +The dependencies can be installed automatically by `scripts/pkgdep.sh`. + +~~~{.sh} +./scripts/pkgdep.sh +~~~ + ## Build diff --git a/scripts/pkgdep.sh b/scripts/pkgdep.sh new file mode 100755 index 000000000..ab02564d3 --- /dev/null +++ b/scripts/pkgdep.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Please run this script as root. + +SYSTEM=`uname -s` + +if [ -s /etc/redhat-release ]; then + # Includes Fedora, CentOS + if [ -f /etc/centos-release ]; then + # Add EPEL repository for CUnit-devel + yum --enablerepo=extras install -y epel-release + fi + yum install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \ + git astyle-devel python-pep8 lcov python clang-analyzer + # Additional dependencies for NVMe over Fabrics + yum install -y libibverbs-devel librdmacm-devel + # Additional dependencies for building docs + yum install -y doxygen mscgen +elif [ -f /etc/debian_version ]; then + # Includes Ubuntu, Debian + apt-get install -y gcc g++ make libcunit1-dev libaio-dev libssl-dev \ + git astyle pep8 lcov clang + # Additional dependencies for NVMe over Fabrics + apt-get install -y libibverbs-dev librdmacm-dev + # Additional dependencies for building docs + apt-get install -y doxygen mscgen +elif [ $SYSTEM = "FreeBSD" ] ; then + pkg install gmake cunit openssl git devel/astyle bash devel/pep8 \ + python + # Additional dependencies for building docs + pkg install doxygen mscgen +else + echo "pkgdep: unknown system type." + exit 1 +fi diff --git a/scripts/vagrant/build.sh b/scripts/vagrant/build.sh old mode 100644 new mode 100755 index e2281abc5..7ac0162c4 --- a/scripts/vagrant/build.sh +++ b/scripts/vagrant/build.sh @@ -32,15 +32,8 @@ echo DISTRIB_RELEASE: $DISTRIB_RELEASE echo DISTRIB_CODENAME: $DISTRIB_CODENAME echo DISTRIB_DESCRIPTION: $DISTRIB_DESCRIPTION -if [ -f /etc/lsb-release ]; then - apt-get install -y gcc g++ make libcunit1-dev libaio-dev libssl-dev -elif [ -f /etc/redhat-release ]; then - # Add EPEL repository for CUnit-devel - yum --enablerepo=extras install -y epel-release - yum install -y gcc gcc-c++ CUnit-devel libaio-devel openssl-devel -fi - cd $SPDK_DIR +$SUDOCMD ./scripts/pkgdep.sh $SUDOCMD ./configure --enable-debug $SUDOCMD make clean $SUDOCMD make -j2