Skip to content

Instantly share code, notes, and snippets.

@UplinkCoder
Last active August 29, 2015 14:08
Show Gist options
  • Save UplinkCoder/7481cd40aae352e2cb0d to your computer and use it in GitHub Desktop.
Save UplinkCoder/7481cd40aae352e2cb0d to your computer and use it in GitHub Desktop.
import std.stdio;
import std.string;
void main() {
getLibString().writeLibs();
}
string getLibString(string p_llvmConfig="llvm-config") {
import std.process;
string llvmConfig = escapeShellFileName(p_llvmConfig);
return std.process.executeShell(llvmConfig ~ " --libs")[1];
}
void writeLibs(string libString, File outs=stdout) {
outs.write(`"libs" : `);
foreach (libs;libString.split("-l").split(" ")) {
outs.write ("[");
foreach(lib;libs) {
if (lib.chop != "") outs.write('"',lib.chop,'"',',');
}
outs.write(`"z","pthread","ncurses","stdc++","dl"`);
outs.writeln("],");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment