From d8f535e5d380e92ce5ed4f0775c941aa19a6683b Mon Sep 17 00:00:00 2001 From: Jan Grant Date: Wed, 3 Feb 2016 17:26:10 +0000 Subject: Update the CentOS build for sd_notify to support Debian. The packaging is kept separately as a courtesy to non-Debian users. --- .gitignore | 1 + Makefile | 3 +++ README.md | 23 +++++++++++++++++++-- packaging/deb/Makefile | 33 ++++++++++++++++++++++++++++++ packaging/deb/debian/changelog | 5 +++++ packaging/deb/debian/compat | 1 + packaging/deb/debian/control | 16 +++++++++++++++ packaging/deb/debian/erlang-sd-notify.dirs | 2 ++ packaging/deb/debian/rules | 6 ++++++ packaging/deb/debian/source/format | 1 + 10 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 packaging/deb/Makefile create mode 100644 packaging/deb/debian/changelog create mode 100644 packaging/deb/debian/compat create mode 100644 packaging/deb/debian/control create mode 100644 packaging/deb/debian/erlang-sd-notify.dirs create mode 100644 packaging/deb/debian/rules create mode 100644 packaging/deb/debian/source/format diff --git a/.gitignore b/.gitignore index 19f4bd6..ff4c2e1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ *.o *.so .eunit/ +deb-build ebin/ diff --git a/Makefile b/Makefile index dfeaa69..d1dd742 100644 --- a/Makefile +++ b/Makefile @@ -15,3 +15,6 @@ clean: dialyzer: $(REBAR) dialyze $(REBAR_FLAGS) + +deb: + cd packaging/deb && $(MAKE) TOPDIR=$(PWD) deb diff --git a/README.md b/README.md index 4ede017..1ce14d9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -`sd_notify` Erlang interface for Centos 7. +`sd_notify` Erlang interface for Centos 7 and Debian --- -This add the `sd_notify` to the Centos erlang package. +This adds the `sd_notify` to the Centos erlang package. I tested it starting for zero-dependencies RabbitMQ package ([github](https://github.com/rabbitmq/erlang-rpm) - [binany](https://www.rabbitmq.com/releases/erlang/) ) Build from source @@ -38,3 +38,22 @@ RabbitMQ notes: RabbitMQ does not need `sd_notify`,. This add the feature for the users that in general need `sd_notify`. The integration should be considerer as **experimental** + + +Building on Debian +- +Install the pre-requisites to the build: + + sudo apt-get install build-essential devscripts fakeroot \ + debhelper erlang-dev libsystemd-dev erlang-eunit + +Make the package: + + make deb + +Install and test: + + sudo dpkg -i deb-build/erlang-sd-notify_0.9-1_amd64.deb + erl + 1> sd_notify:sd_notify(0,"READY=1"). + ok diff --git a/packaging/deb/Makefile b/packaging/deb/Makefile new file mode 100644 index 0000000..a64ecce --- /dev/null +++ b/packaging/deb/Makefile @@ -0,0 +1,33 @@ +VERSION=0.9 + +# Directory names +DEB_BUILD_DIR=deb-build +PKG_NAME=erlang-sd-notify +DEB_SOURCE_DIR=$(PKG_NAME)-$(VERSION) + +# +PKG_DEST=$(TOPDIR)/$(DEB_BUILD_DIR)/$(DEB_SOURCE_DIR) + +# Where to build the 'pristine' source files +TARBALL_DIR=$(TOPDIR)/$(DEB_BUILD_DIR) +SOURCE_TGZ=$(PKG_NAME)_$(VERSION).orig.tar.gz + +# Place to install the compiled files to +TARGET_DIR=$(TARGET_TOP)/usr/lib/erlang/lib/sd_notify-$(VERSION) + +deb: + mkdir -p $(PKG_DEST) + tar -c -C $(TOPDIR) --exclude-from=$(TOPDIR)/.gitignore --exclude=.git . | tar -x -C $(PKG_DEST) + tar -zcf $(TARBALL_DIR)/$(SOURCE_TGZ) -C $(TARBALL_DIR) $(DEB_SOURCE_DIR) + + tar -c debian | tar -x -C $(PKG_DEST) + cp $(TOPDIR)/LICENSE $(PKG_DEST)/debian/copyright + sed -i 's/%VERSION%/$(VERSION)/g' $(PKG_DEST)/debian/$(PKG_NAME).dirs + + cd $(PKG_DEST) && debuild -us -uc + +deb-install: + pwd + install -o root -g root -t $(TARGET_DIR)/ebin ../../ebin/*.app + install -o root -g root -t $(TARGET_DIR)/ebin ../../ebin/*.beam + install -o root -g root -t $(TARGET_DIR)/priv ../../priv/*.so diff --git a/packaging/deb/debian/changelog b/packaging/deb/debian/changelog new file mode 100644 index 0000000..06a2eb2 --- /dev/null +++ b/packaging/deb/debian/changelog @@ -0,0 +1,5 @@ +erlang-sd-notify (0.9-1) UNRELEASED; urgency=medium + + * Initial release. + + -- Maintainer Name Wed, 03 Feb 2016 14:43:18 +0000 diff --git a/packaging/deb/debian/compat b/packaging/deb/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/packaging/deb/debian/compat @@ -0,0 +1 @@ +9 diff --git a/packaging/deb/debian/control b/packaging/deb/debian/control new file mode 100644 index 0000000..db6448e --- /dev/null +++ b/packaging/deb/debian/control @@ -0,0 +1,16 @@ +Source: erlang-sd-notify +Maintainer: +Section: misc +Priority: optional +Standards-Version: 3.9.2 +Build-Depends: debhelper (>= 9), + erlang-dev (>=17.3-dfsg-4), + libsystemd-dev (>=215), + rebar, + +Package: erlang-sd-notify +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, + erlang-base (>=17.3) | erlang-base-hipe (>=17.3), + libsystemd0 (>=215), +Description: Systemd notification support for Erlang. diff --git a/packaging/deb/debian/erlang-sd-notify.dirs b/packaging/deb/debian/erlang-sd-notify.dirs new file mode 100644 index 0000000..1b9362c --- /dev/null +++ b/packaging/deb/debian/erlang-sd-notify.dirs @@ -0,0 +1,2 @@ +usr/lib/erlang/lib/sd_notify-%VERSION%/ebin +usr/lib/erlang/lib/sd_notify-%VERSION%/priv diff --git a/packaging/deb/debian/rules b/packaging/deb/debian/rules new file mode 100644 index 0000000..bca2f41 --- /dev/null +++ b/packaging/deb/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f +%: + dh $@ + +override_dh_auto_install: + make -C packaging/deb TARGET_TOP=$(PWD)/debian/erlang-sd-notify deb-install diff --git a/packaging/deb/debian/source/format b/packaging/deb/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/packaging/deb/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) -- cgit v1.2.1