From a8a774e71b0420a08459e38ef25b834b817e8da8 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sun, 28 Aug 2016 15:44:28 +0100 Subject: [PATCH 1/2] Problem: cannot build deb with drafts on OBS Solution: parse the OBS prjconf and the user env variable DEB_BUILD_OPTIONS. If either of those define "drafts" then build with draft APIs enabled. --- packaging/debian/rules | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packaging/debian/rules b/packaging/debian/rules index 5549b7c9..2ed87470 100755 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -10,6 +10,27 @@ ifeq ($(DEB_BUILD_ARCH_OS), kfreebsd) DO_TEST = no endif +DRAFTS=no + +# OBS build: add +# Macros: +# %_with_drafts 1 +# at the BOTTOM of the OBS prjconf +OBS_BUILD_CFG=/.build/build.dist +ifeq ("$(wildcard $(OBS_BUILD_CFG))","") +BUILDCONFIG=$(shell ls -1 /usr/src/packages/SOURCES/_buildconfig* | head -n 1) +endif +ifneq ("$(wildcard $(OBS_BUILD_CFG))","") +ifneq ("$(shell grep drafts $(OBS_BUILD_CFG))","") +DRAFTS=yes +endif +endif + +# User build: DEB_BUILD_OPTIONS=drafts dpkg-buildpackage +ifneq (,$(findstring drafts,$(DEB_BUILD_OPTIONS))) +DRAFTS=yes +endif + override_dh_clean: dh_clean find $(CURDIR) -type s -exec rm {} \; @@ -17,7 +38,7 @@ override_dh_clean: rm -f config.log override_dh_auto_configure: - dh_auto_configure -- --with-pgm --with-libsodium + dh_auto_configure -- --with-pgm --with-libsodium --enable-drafts=$(DRAFTS) override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) From abd37423d3b07f51932673f238a4322e81da2e3f Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sun, 28 Aug 2016 15:44:13 +0100 Subject: [PATCH 2/2] Problem: cannot build rpm with drafts on OBS Solution: if rpmbuild is called with --with drafts, which can be triggered on OBS by adding: Macros: %_with_drafts 1 to the bottom of the prjconf, then enable draft APIs. --- packaging/redhat/zeromq.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packaging/redhat/zeromq.spec b/packaging/redhat/zeromq.spec index e7123b72..7bdba9d2 100644 --- a/packaging/redhat/zeromq.spec +++ b/packaging/redhat/zeromq.spec @@ -1,3 +1,13 @@ +# To build with draft APIs, use "--with drafts" in rpmbuild for local builds or add +# Macros: +# %_with_drafts 1 +# at the BOTTOM of the OBS prjconf +%bcond_with drafts +%if %{with drafts} +%define DRAFTS yes +%else +%define DRAFTS no +%endif %define lib_name libzmq5 Name: zeromq Version: 4.2.0 @@ -103,7 +113,7 @@ sed -i "s/openpgm-[0-9].[0-9]/%{openpgm_pc}/g" \ %build autoreconf -fi -%configure \ +%configure --enable-drafts=%{DRAFTS} \ %{?_with_libsodium} \ %{?_without_libsodium} \ %{?_with_pgm} \