build-protoc.sh 745 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. cd $(dirname "$0")
  3. WORKING_DIR=$(pwd)
  4. # Override the default value set in configure.ac that has '-g' which produces
  5. # huge binary.
  6. export CXXFLAGS="-DNDEBUG"
  7. # Statically link libgcc and libstdc++.
  8. # -s to produce stripped binary
  9. export LDFLAGS="-static-libgcc -static-libstdc++ -s"
  10. # Under Cygwin we use MinGW GCC because the executable produced by Cygwin GCC
  11. # depends on Cygwin DLL.
  12. if [[ "$(uname)" == CYGWIN* ]]; then
  13. export CC=i686-pc-mingw32-gcc
  14. export CXX=i686-pc-mingw32-c++
  15. export CXXCPP=i686-pc-mingw32-cpp
  16. fi
  17. cd "$WORKING_DIR"/.. && ./configure --disable-shared && make clean && make &&
  18. cd "$WORKING_DIR" && mkdir -p target &&
  19. (cp ../src/protoc target/protoc.exe || cp ../src/protoc.exe target/protoc.exe)