Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Ubuntu and Debian Package creation with Cmake #590

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/open-iscsi/tcmu-runner")
include(CPack)

Copy link
Collaborator

@mikechristie mikechristie Sep 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to rebase and repush by doing a forced push, so we do not end up seeing this in the final pull and commit.

If everyone adds junk like this then it gets messy in the main git tree.

[edit]

That comment was for the commit:

Merge branch 'master' into master
@DifanZhang
DifanZhang committed 19 hours ago

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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -244,6 +256,7 @@ if (with-glfs)
set(GFAPI_VERSION760 1)
endif (GFAPI760_FOUND)

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)
Expand Down Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion extra/install_dep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions extra/make_runnerdeb.sh
Original file line number Diff line number Diff line change
@@ -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-<rbd|glfs|qcow|zbc|fbo>=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)