Skip to content

Commit

Permalink
Fix #47: make libpath an array update fixed version DMD (#48)
Browse files Browse the repository at this point in the history
* Make libpath an array and add more win32 paths

Based on the bug report, on Windows more libpaths need to be added to
make libcurl.dll findable. This commit attempts to do so by turning
libpath field into an array and adding some more windows paths.

Enhances test program to use std.net.curl to test this.

* Extra CI check for -m64 dmd

* Update fixed dmd version to check
  • Loading branch information
mihails-strasuns authored Jul 15, 2021
1 parent c910ec8 commit 763d869
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 20 deletions.
6 changes: 4 additions & 2 deletions .github/hello.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
+/

void main() {
import std.stdio;
import std.stdio, std.net.curl;
writeln("Hello, World!");
}
writeln("Latest dmd version: ",
get("http://downloads.dlang.org/releases/LATEST"));
}
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
ldc-latest,
ldc-beta,
ldc-master,
dmd-2.089.0,
dmd-2.097.0,
dmd-latest,
dmd-beta,
dmd-master,
Expand All @@ -41,6 +41,11 @@ jobs:
shell: bash
run: $DC .github/hello.d && ./hello

- name: Verify D compiler wtih explicit bitness ($DC)
if: ${{ env['DC'] == 'dmd' }}
shell: bash
run: $DC -m64 .github/hello.d && ./hello

- name: Verify D compiler ($DC, shared)
shell: bash
run: $DC -shared .github/hello.d && ./hello
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface CompilerDescription {
version: string;
url: string;
binpath: string;
libpath : string;
libpath : string[];
sig?: string;
download_dub?: boolean;
}
Expand Down Expand Up @@ -89,7 +89,7 @@ async function dmd(version: string): Promise<CompilerDescription> {
: minor !== undefined && minor < 69 ? `${base_url}.windows.zip`
: `${base_url}.windows.7z`,
binpath: "\\dmd2\\windows\\bin",
libpath: "\\dmd2\\windows\\lib64",
libpath: [ "\\dmd2\\windows\\bin64" ],
download_dub: download_dub,
// Signatures for nightly releases are not available (yet?)
sig: nightly ? undefined : `${base_url}.windows.7z.sig`
Expand All @@ -101,7 +101,7 @@ async function dmd(version: string): Promise<CompilerDescription> {
: minor !== undefined && minor < 69 ? `${base_url}.linux.zip`
: `${base_url}.linux.tar.xz`,
binpath: "/dmd2/linux/bin64",
libpath: "/dmd2/linux/lib64",
libpath: [ "/dmd2/linux/lib64" ],
download_dub: download_dub,
sig: nightly ? undefined : `${base_url}.linux.tar.xz.sig`
};
Expand All @@ -112,7 +112,7 @@ async function dmd(version: string): Promise<CompilerDescription> {
: minor !== undefined && minor < 69 ? `${base_url}.osx.zip`
: `${base_url}.osx.tar.xz`,
binpath: "/dmd2/osx/bin",
libpath: "/dmd2/linux/lib64",
libpath: [ "/dmd2/linux/lib64" ],
download_dub: download_dub,
sig: nightly ? undefined : `${base_url}.osx.tar.xz.sig`
};
Expand Down Expand Up @@ -177,7 +177,7 @@ async function ldc_resolve_master(gh_token: string): Promise<CompilerDescription
version: latest.version,
url: "https://github.com/ldc-developers/ldc/releases/download/CI/" + latest.name,
binpath: `${base_path}bin`,
libpath: `${base_path}lib64`
libpath: [ `${base_path}lib64` ]
};
}

Expand All @@ -204,21 +204,21 @@ async function ldc(version: string, gh_token: string): Promise<CompilerDescripti
version: version,
url: `${base_url}-windows-multilib.7z`,
binpath: `\\ldc2-${version}-windows-multilib\\bin`,
libpath: `\\ldc2-${version}-windows-multilib\\lib64`
libpath: [ `\\ldc2-${version}-windows-multilib\\lib64` ]
};
case "linux": return {
name: "ldc2",
version: version,
url: `${base_url}-linux-x86_64.tar.xz`,
binpath: `/ldc2-${version}-linux-x86_64/bin`,
libpath: `/ldc2-${version}-linux-x86_64/lib64`
libpath: [ `/ldc2-${version}-linux-x86_64/lib64` ]
};
case "darwin": return {
name: "ldc2",
version: version,
url: `${base_url}-osx-x86_64.tar.xz`,
binpath: `/ldc2-${version}-osx-x86_64/bin`,
libpath: `/ldc2-${version}-osx-x86_64/lib64`
libpath: [ `/ldc2-${version}-osx-x86_64/lib64` ]
};
default:
throw new Error("unsupported platform: " + process.platform);
Expand Down
18 changes: 10 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@ async function run() {
core.addPath(binpath);
core.exportVariable("DC", descr.name);

const libpath = cached + descr.libpath;
console.log("Adding '" + libpath + "' to library path");
if (process.platform == "win32") {
core.addPath(cached + descr.libpath);
}
else {
core.exportVariable("LD_LIBRARY_PATH", libpath);
}
descr.libpath.forEach(function(libpath) {
const path = cached + libpath;
console.log("Adding '" + path + "' to library path");
if (process.platform == "win32") {
core.addPath(path);
}
else {
core.exportVariable("LD_LIBRARY_PATH", path);
}
});
console.log("Done");
} catch (error) {
console.log(error);
Expand Down

0 comments on commit 763d869

Please sign in to comment.