summaryrefslogtreecommitdiff
path: root/net-libs/czmq/files/version.sh
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-libs/czmq/files/version.sh
reinit the tree, so we can have metadata
Diffstat (limited to 'net-libs/czmq/files/version.sh')
-rw-r--r--net-libs/czmq/files/version.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/net-libs/czmq/files/version.sh b/net-libs/czmq/files/version.sh
new file mode 100644
index 000000000000..527ba285ebbb
--- /dev/null
+++ b/net-libs/czmq/files/version.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# This script extracts the version from the project header file
+#
+project=$1
+if [ ! -f include/$project.h ]; then
+ echo "version.sh: error: include/$project.h does not exist" 1>&2
+ exit 1
+fi
+MAJOR=`egrep '^#define .*_VERSION_MAJOR +[0-9]+$' include/$project.h`
+MINOR=`egrep '^#define .*_VERSION_MINOR +[0-9]+$' include/$project.h`
+PATCH=`egrep '^#define .*_VERSION_PATCH +[0-9]+$' include/$project.h`
+if [ -z "$MAJOR" -o -z "$MINOR" -o -z "$PATCH" ]; then
+ echo "version.sh: error: could not extract version from include/$project.h" 1>&2
+ exit 1
+fi
+MAJOR=`echo $MAJOR | awk '{ print $3 }'`
+MINOR=`echo $MINOR | awk '{ print $3 }'`
+PATCH=`echo $PATCH | awk '{ print $3 }'`
+echo $MAJOR.$MINOR.$PATCH | tr -d '\n'
+