Attempt to replace the Ubuntu fix by a more generic fix that does not depend on a distribution name. See also #71.
1 parent ec513fb commit f5c2cbc3a3187c2d1f5f125a97444b5802433192
@Sönke Ludwig Sönke Ludwig authored on 7 May 2013
Showing 1 changed file
View
14
build.sh
echo >&2 "Failed to detect D compiler. Use DC=... to set a dmd compatible binary manually."
exit 1
fi
 
# link against libcurl
LIBS=`pkg-config --libs libcurl 2>/dev/null || echo "-lcurl"`
 
# fix for modern GCC versions with --as-needed by default
if [ "$DC" = "dmd" ]; then
LIBS="-lphobos2 $LIBS"
fi
 
# adjust linker flags for dmd command line
LIBS=`echo "$LIBS" | sed 's/^-L/-L-L/; s/ -L/ -L-L/g; s/^-l/-L-l/; s/ -l/ -L-l/g'`
 
# HACK to work around (r)dmd placing -lcurl before the object files - which is wrong if --as-needed is used
# On newer Ubuntu versions this is the default, though
if [ -f /etc/lsb-release ]; then
lsb_release -i | grep -q "Ubuntu" 2> /dev/null && LIBS="-L--no-as-needed $LIBS"
fi
 
echo Running $DC...
$DC -ofbin/dub -g -debug -w -property -Isource $* $LIBS @build-files.txt
echo DUB has been built as bin/dub.