Newer
Older
dub_jkp / build.sh
@Sönke Ludwig Sönke Ludwig on 10 Jul 2013 1 KB Remove -property flag from build scripts.
  1. #!/bin/sh
  2. set -e
  3.  
  4. if [ "$DC" = "" ]; then
  5. command -v gdmd >/dev/null 2>&1 && DC=gdmd || true
  6. command -v ldmd2 >/dev/null 2>&1 && DC=ldmd2 || true
  7. command -v dmd >/dev/null 2>&1 && DC=dmd || true
  8. fi
  9.  
  10. if [ "$DC" = "" ]; then
  11. echo >&2 "Failed to detect D compiler. Use DC=... to set a dmd compatible binary manually."
  12. exit 1
  13. fi
  14.  
  15. # link against libcurl
  16. LIBS=`pkg-config --libs libcurl 2>/dev/null || echo "-lcurl"`
  17.  
  18. # fix for modern GCC versions with --as-needed by default
  19. if [ "$DC" = "dmd" ]; then
  20. LIBS="-lphobos2 $LIBS"
  21. elif [ "$DC" = "ldmd2" ]; then
  22. LIBS="-lphobos-ldc $LIBS"
  23. fi
  24.  
  25. # adjust linker flags for dmd command line
  26. LIBS=`echo "$LIBS" | sed 's/^-L/-L-L/; s/ -L/ -L-L/g; s/^-l/-L-l/; s/ -l/ -L-l/g'`
  27.  
  28. echo Generating version file...
  29. GITVER=$(git describe) || GITVER=unknown
  30. echo "module dub.version_; enum dubVersion = \"$GITVER\";" > source/dub/version_.d
  31.  
  32.  
  33. echo Running $DC...
  34. $DC -ofbin/dub -g -debug -w -Isource $* $LIBS @build-files.txt
  35. echo DUB has been built as bin/dub.
  36. echo
  37. echo You may want to run
  38. echo sudo ln -s $(pwd)/bin/dub /usr/local/bin
  39. echo now.