version.sh 721 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. #
  3. # This script extracts the 0MQ version from zmq.hpp, which is the master
  4. # location for this information.
  5. #
  6. if [ ! -f zmq.hpp ]; then
  7. echo "version.sh: error: zmq.hpp does not exist" 1>&2
  8. exit 1
  9. fi
  10. MAJOR=$(grep '^#define CPPZMQ_VERSION_MAJOR \+[0-9]\+' zmq.hpp)
  11. MINOR=$(grep '^#define CPPZMQ_VERSION_MINOR \+[0-9]\+' zmq.hpp)
  12. PATCH=$(grep '^#define CPPZMQ_VERSION_PATCH \+[0-9]\+' zmq.hpp)
  13. if [ -z "$MAJOR" -o -z "$MINOR" -o -z "$PATCH" ]; then
  14. echo "version.sh: error: could not extract version from zmq.hpp" 1>&2
  15. exit 1
  16. fi
  17. MAJOR=$(echo $MAJOR | awk '{ print $3 }')
  18. MINOR=$(echo $MINOR | awk '{ print $3 }')
  19. PATCH=$(echo $PATCH | awk '{ print $3 }')
  20. echo $MAJOR.$MINOR.$PATCH | tr -d '\n\r'