diff --git a/CMakeLists.txt b/CMakeLists.txt index 2843b9f7..8431576d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,17 @@ pkg_check_modules(KMOD REQUIRED libkmod) find_library(PTHREAD pthread) find_library(DL dl) +# Stuff for building the Debian package +set(CPACK_GENERATOR "DEB") +set(CPACK_DEB_COMPONENT_INSTALL ON) +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libnl-3-200, libnl-genl-3-200") +set(CPACK_DEBIAN_PACKAGE_SECTION "net") +set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") +set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "A daemon that handles the userspace side of the LIO TCM-User backstore") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Target Devel ") +set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/open-iscsi/tcmu-runner") +include(CPack) + if (with-tcmalloc) find_library(TCMALLOC_LIB tcmalloc) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free") @@ -214,6 +225,7 @@ endif (with-zbc) if (with-rbd) find_library(LIBRBD rbd) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, librados2, librbd1") # Stuff for building the rbd handler add_library(handler_rbd @@ -244,7 +256,8 @@ if (with-glfs) set(GFAPI_VERSION760 1) endif (GFAPI760_FOUND) - set(GFAPI_VERSION766 0) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, glusterfs-common") + set(GFAPI_VERSION766 0) pkg_check_modules(GFAPI766 glusterfs-api>=7.6.6 QUIET) if (GFAPI766_FOUND) @@ -272,6 +285,7 @@ endif (with-glfs) if (with-qcow) find_package(ZLIB REQUIRED) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, zlib1g") # Stuff for building the qcow handler add_library(handler_qcow diff --git a/extra/install_dep.sh b/extra/install_dep.sh index 84673e9f..b8a4d633 100755 --- a/extra/install_dep.sh +++ b/extra/install_dep.sh @@ -23,8 +23,17 @@ if [ y`uname`y = yLinuxy ]; then yum search librbd-devel | grep -q "N/S matched" && LIBRBD=librbd || LIBRBD=librbd1 $SUDO yum install -y $LIBRBD-devel ;; + ubuntu|debian) + # for generic + $SUDO apt-get install cmake make gcc libnl-3-dev libnl-genl-3-dev libglib2.0-dev zlib1g-dev libkmod-dev + + # for glusterfs + $SUDO apt-get install glusterfs-common + # for ceph + $SUDO apt-get install librados2 librados-dev + $SUDO apt-get install librbd1 librbd-dev *) - echo "TODO: only fedora/rhel/centos are supported for now!" + echo "TODO: only fedora/rhel/centos/ubuntu/debian are supported for now!" ;; esac else diff --git a/extra/make_runnerdeb.sh b/extra/make_runnerdeb.sh new file mode 100755 index 00000000..77f30815 --- /dev/null +++ b/extra/make_runnerdeb.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +if [ "$1" == "--help" -o "$1" == "help" ]; then + echo "" + echo " USAGE:" + echo "" + echo " # cd tcmu-runner/extra/" + echo " # ./make_runnerdeb.sh [-Dwith-=false]" + echo "" + echo " Will build the Debian package in top dir by using the HEAD commit ID as default." + echo "" + exit +fi + +TOPDIR=`pwd`/../ + +VERSION=`git describe --tags --match "v[0-9]*"` +VERSION=`echo $VERSION | sed "s/-/./g"` +VERSION=`echo $VERSION | sed "s/v//"` + +cmake $TOPDIR -DSUPPORT_SYSTEMD=ON -DCMAKE_INSTALL_PREFIX=/usr -DCPACK_DEBIAN_PACKAGE_VERSION=$VERSION "$@" +(cd $TOPDIR ; make package)