makelibzmq 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #! /bin/sh
  2. # Build libzmq.a static library and libzmq.so dynamic library
  3. #
  4. # Usage: makelibzmq
  5. # BUILD_DLL=false makelibzmq # Skip building DLL
  6. #
  7. # NOTE: We do a single compile run for both static and dynamic libraries
  8. # which results in the static library having -Wc,exportall compiled objects;
  9. # in practice this doesn't seem to cause a problem beyond using some extra
  10. # space (around 10%).
  11. #
  12. # Written by Ewen McNeill <ewen@imatix.com>, 2014-07-21
  13. # Updated by Ewen McNeill <ewen@imatix.com>, 2014-07-22
  14. #---------------------------------------------------------------------------
  15. set -e # Stop on errors
  16. BUILD_DLL="${BUILD_DLL:-true}" # Build DLL by default
  17. # Figure out where we are
  18. BIN_DIR=$(dirname $0)
  19. if [ -z "${BIN_DIR}" ]; then BIN_DIR="."; fi
  20. case "${BIN_DIR}" in
  21. .) BIN_DIR="$(pwd)"; ;;
  22. /*) ;;
  23. *) BIN_DIR="$(pwd)/${BIN_DIR}"; ;;
  24. esac
  25. ZCXX="${BIN_DIR}/zc++"
  26. # Locate top of source tree, assuming we're in builds/zos
  27. TOP="${BIN_DIR}/../.."
  28. SRC="${TOP}/src"
  29. # Install pre-generated platform.hpp
  30. cp -p "${BIN_DIR}/platform.hpp" "${SRC}/platform.hpp"
  31. # Compile all the source (optionally ready for a DLL)
  32. if [ "${BUILD_DLL}" = "true" ]; then
  33. ZCXXFLAGS="${ZCXXFLAGS} -Wc,exportall"
  34. export ZCXXFLAGS
  35. #echo "Building DLL with ${ZCXXFLAGS}"
  36. fi
  37. cd "${SRC}"
  38. "${BIN_DIR}/cxxall"
  39. # Make static library
  40. ar r libzmq.a *.o
  41. # Optionally Make dynamic library
  42. if [ "${BUILD_DLL}" = "true" ]; then
  43. #echo "Building libzmq.so DLL"
  44. "${ZCXX}" -Wl,DLL -o libzmq.so *.o
  45. fi