From 4087133a5eb0cab813425dafdfbd59b9116390a2 Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Wed, 23 Sep 2015 21:51:16 -0400 Subject: [PATCH] change handling of embedded version information rather than modifying push.cpp as part of the built process, this passes in a version string on the command. This is a little cleaner (it does not lead to false changes in push.cpp) and makes it easier for a packager to provide explicit version information, e.g., by passing in version information to make: make version=`lars-test' --- Makefile | 9 +++++---- push.cpp | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 588d11c..7976025 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -version := $(shell git describe --dirty) +version = $(shell git describe --dirty || echo dev) curl=no ifneq ($(curl),no) @@ -7,10 +7,11 @@ else flags= endif +all: push.so + push.so: push.cpp - sed -i "" -e "s|PUSHVERSION \".*\"|PUSHVERSION \"$(version)\"|" push.cpp - CXXFLAGS="$(CXXFLAGS) $(flags)" LIBS="$(LIBS) $(flags)" znc-buildmod push.cpp - sed -i "" -e "s|PUSHVERSION \".*\"|PUSHVERSION \"dev\"|" push.cpp + CXXFLAGS="$(CXXFLAGS) -DPUSHVERSION=\"$(version)\" $(flags)" LIBS="$(LIBS) $(flags)" \ + znc-buildmod push.cpp install: push.so mkdir -p $(HOME)/.znc/modules/ diff --git a/push.cpp b/push.cpp index 5a563b3..242bf6d 100755 --- a/push.cpp +++ b/push.cpp @@ -9,7 +9,9 @@ */ #define REQUIRESSL +#ifndef PUSHVERSION #define PUSHVERSION "dev" +#endif #include #include