dlang.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. RETCODE=$(fw_exists ${IROOT}/dlang.installed)
  3. [ ! "$RETCODE" == 0 ] || { \
  4. source $IROOT/dlang.installed
  5. return 0; }
  6. DLANG=$IROOT/dlang
  7. DMDVER="2.071.1"
  8. LDCVER="1.0.0"
  9. mkdir -p $DLANG
  10. fw_get -O http://downloads.dlang.org/releases/2.x/$DMDVER/dmd_$DMDVER-0_amd64.deb
  11. dpkg-deb -x dmd_$DMDVER-0_amd64.deb $DLANG
  12. cd $DLANG
  13. fw_get -O https://github.com/ldc-developers/ldc/releases/download/v$LDCVER/ldc2-$LDCVER-linux-x86_64.tar.xz
  14. fw_untar ldc2-$LDCVER-linux-x86_64.tar.xz
  15. ln -s $DLANG/ldc2-$LDCVER-linux-x86_64/bin/ldc2 $DLANG/usr/bin/ldc2
  16. # According to this file (dmd.conf) dmd will, upon execution, look for
  17. # a dmd.conf in 1) the current working directory [bad], 2) the directory
  18. # specified by the HOME environment variable [bad], 3) the directory in
  19. # which dmd resides [less bad], and 4) the /etc directory.
  20. # We are trying to maintain as little global presence as possible, so
  21. # we need to change the DFLAGS in the dmd.conf to be correctly sandboxed
  22. # to the $DLANG folder (in IROOT).
  23. cp $DLANG/etc/dmd.conf $DLANG/usr/bin
  24. sed -i "s|-I/usr/|-I${DLANG}/usr/|g" $DLANG/usr/bin/dmd.conf
  25. sed -i "s|-L/usr/|-L${DLANG}/usr/|g" $DLANG/usr/bin/dmd.conf
  26. echo -e "export PATH=${DLANG}/usr/bin:\$PATH" > $IROOT/dlang.installed
  27. source $IROOT/dlang.installed