dlang.sh 988 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. DLANG=$IROOT/dlang
  3. RETCODE=$(fw_exists ${DLANG}.installed)
  4. [ ! "$RETCODE" == 0 ] || { \
  5. source $DLANG.installed
  6. return 0; }
  7. mkdir -p $DLANG
  8. fw_get -O http://downloads.dlang.org/releases/2.x/2.067.1/dmd_2.067.1-0_amd64.deb
  9. dpkg-deb -x dmd_2.067.1-0_amd64.deb $DLANG
  10. # According to this file (dmd.conf) dmd will, upon execution, look for
  11. # a dmd.conf in 1) the current working directory [bad], 2) the directory
  12. # specified by the HOME environment variable [bad], 3) the directory in
  13. # which dmd resides [less bad], and 4) the /etc directory.
  14. # We are trying to maintain as little global presence as possible, so
  15. # we need to change the DFLAGS in the dmd.conf to be correctly sandboxed
  16. # to the $DLANG folder (in IROOT).
  17. cp $DLANG/etc/dmd.conf $DLANG/usr/bin
  18. sed -i "s|-I/usr/|-I${DLANG}/usr/|g" $DLANG/usr/bin/dmd.conf
  19. sed -i "s|-L/usr/|-L${DLANG}/usr/|g" $DLANG/usr/bin/dmd.conf
  20. echo -e "export PATH=${DLANG}/usr/bin:\$PATH" > $DLANG.installed
  21. source $DLANG.installed