Browse Source

Fixed DLANG to be properly sandboxed to IROOT

We needed to update and specify the correct DFLAGS in
the dmd.conf file. Additionally, we had to copy this
file to the appropriate directory to be automatically
loaded by dmd.
msmith-techempower 10 years ago
parent
commit
aa68f9bb46
2 changed files with 16 additions and 1 deletions
  1. 4 0
      frameworks/D/vibed/setup.sh
  2. 12 1
      toolset/setup/linux/languages/dlang.sh

+ 4 - 0
frameworks/D/vibed/setup.sh

@@ -4,6 +4,10 @@ fw_depends dlang dub
 
 
 sed -i 's|127.0.0.1|'"${DBHOST}"'|g' source/app.d
 sed -i 's|127.0.0.1|'"${DBHOST}"'|g' source/app.d
 
 
+# Clean any files from last run
+rm -f fwb
+rm -rf .dub
+
 dub build --force
 dub build --force
 
 
 ./fwb &
 ./fwb &

+ 12 - 1
toolset/setup/linux/languages/dlang.sh

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