Skip to content

Instantly share code, notes, and snippets.

@LunaTheFoxgirl
Created July 12, 2025 15:31
Show Gist options
  • Select an option

  • Save LunaTheFoxgirl/3e14a3aa977c14398c902023e567268a to your computer and use it in GitHub Desktop.

Select an option

Save LunaTheFoxgirl/3e14a3aa977c14398c902023e567268a to your computer and use it in GitHub Desktop.
# Setup SDK Root
if [[ ! -d /opt/SDKs ]]; then
sudo mkdir -p /opt/SDKs/
sudo chmod -R 777 /opt/SDKs
curl -o /opt/SDKs/init.sh https://gist.githubusercontent.com/LunaTheFoxgirl/60cda49e9fd9b95c837f2d4c09706523/raw/7e9fee07357459dcc55df8de5ae4f40a6d5a34a4/init.sh
chmod +x /opt/SDKs/init.sh
echo "source /opt/SDKs/init.sh" | sudo tee -a /etc/profile
fi
echo "Setting up .buildtmp..."
mkdir .buildtmp;
cd .buildtmp
# 1. Install LDC into our new SDK Root
if [[ ! -d /opt/SDKs/ldc2 ]]; then
echo "Downloading LDC2..."
mkdir -p /opt/SDKs/ldc2
curl -L https://github.com/ldc-developers/ldc/releases/download/v1.41.0/ldc2-1.41.0-osx-universal.tar.xz -o ldc2.tar.xz
echo "Extracting LDC2..."
tar xf ldc2.tar.xz
echo "Installing LDC2...."
mv ldc2-1.41.0-osx-universal/* /opt/SDKs/ldc2
export PATH=/opt/SDKs/ldc2/bin:$PATH
rm -r ldc2*
# 2. Install new DUB
echo "Building latest dub from source..."
git clone https://github.com/dlang/dub
dub build --root=dub/ --build=release
echo "Staging dub into /opt/SDKs/ldc2/bin..."
cp dub/bin/dub /opt/SDKs/ldc2/bin/
fi
# 3. Build serve-d and DCD from latest source.
echo "Rebuilding serve-d and dcd..."
if [[ ! -d "/opt/SDKs/serve-d" ]]; then
echo "Install directory not found, creating..."
mkdir -p /opt/SDKs/serve-d/bin
mkdir -p /opt/SDKs/dcd/bin
fi
git clone https://github.com/Pure-D/serve-d
git clone https://github.com/dlang-community/DCD
dub build --root=dcd --dest=/opt/SDKs/ --build=release --config=client
dub build --root=dcd --dest=/opt/SDKs/ --build=release --config=server
dub build --root=serve-d --build=release
cp serve-d/serve-d /opt/SDKs/serve-d/bin/
echo "Cleaning up..."
cd ..
rm -rf .buildtmp
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment