Newer
Older
dub_jkp / build.sh
  1. #!/usr/bin/env bash
  2. set -e
  3.  
  4. if [ "$DMD" = "" ]; then
  5. if [ ! "$DC" = "" ]; then # backwards compatibility with DC
  6. DMD=$DC
  7. else
  8. command -v gdmd >/dev/null 2>&1 && DMD=gdmd || true
  9. command -v ldmd2 >/dev/null 2>&1 && DMD=ldmd2 || true
  10. command -v dmd >/dev/null 2>&1 && DMD=dmd || true
  11. fi
  12. fi
  13.  
  14. if [ "$DMD" = "" ]; then
  15. echo >&2 "Failed to detect D compiler. Use DMD=... to set a dmd compatible binary manually."
  16. exit 1
  17. fi
  18.  
  19. if [ "$GITVER" = "" ]; then
  20. GITVER=$(git describe) || echo "Could not determine a version with git."
  21. fi
  22. if [ "$GITVER" != "" ]; then
  23. echo Generating version file...
  24. echo "module dub.version_;" > source/dub/version_.d
  25. echo "enum dubVersion = \"$GITVER\";" >> source/dub/version_.d
  26. else
  27. echo Using existing version file.
  28. fi
  29.  
  30. # For OSX compatibility >= 10.8
  31. MACOSX_DEPLOYMENT_TARGET=10.8
  32.  
  33. echo Running $DMD...
  34. DFLAGS="${DFLAGS:--g -O -w}"
  35. $DMD -ofbin/dub $DFLAGS -version=DubUseCurl -version=DubApplication -Isource $* @build-files.txt
  36. bin/dub --version
  37. echo DUB has been built as bin/dub.
  38. echo
  39. echo You may want to run
  40. echo sudo ln -s $(pwd)/bin/dub /usr/local/bin
  41. echo now.