Skip to content

Commit

Permalink
Merge pull request #88 from jmalak/add-ow-target
Browse files Browse the repository at this point in the history
add target OS which define INCLUDE variable setup
  • Loading branch information
jmalak authored Sep 20, 2024
2 parents ea5b721 + f45265d commit ac87ac3
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ inputs:
description: 'Set default Open Watcom environment variables (WATCOM + INCLUDE + PATH)'
required: false
default: true
target:
description: 'Set target OS specific Open Watcom header search path (INCLUDE)'
required: false
default: ''
runs:
using: 'node20'
main: 'index.js'
57 changes: 54 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import * as exec from "@actions/exec";
function getInputs(): ISetupWatcomSettings {
const p_version = core.getInput("version");
const version_allowed = ["1.8", "1.9", "2.0", "2.0-64"];
const p_target = core.getInput("target");
const target_allowed = ["", "dos", "win", "nt", "os2", "os2-16", "linux"];

if (!version_allowed.includes(p_version.toLowerCase())) {
throw new Error(
Expand All @@ -18,6 +20,14 @@ function getInputs(): ISetupWatcomSettings {
);
}

if (!target_allowed.includes(p_target.toLowerCase())) {
throw new Error(
`"target" needs to be one of ${target_allowed.join(
", ",
)}, got ${p_target}`,
);
}

let p_url: string;
let p_needs_chmod = false;
let p_archive_type: ArchiveType;
Expand Down Expand Up @@ -58,7 +68,6 @@ function getInputs(): ISetupWatcomSettings {
} else {
p_path_subdir = "BINNT";
}
p_inc_subdirs = ["H", "H\\NT", "H\\NT\\DIRECTX", "H\\NT\\DDK"];
} else if (process.platform === "darwin") {
if (p_version !== "2.0-64") {
throw new Error("Unsupported platform");
Expand All @@ -70,15 +79,57 @@ function getInputs(): ISetupWatcomSettings {
} else {
throw new Error("Unsupported platform");
}
p_inc_subdirs = ["lh"];
} else {
if (p_version == "2.0-64") {
p_path_subdir = "binl64";
} else {
p_path_subdir = "binl";
}
p_inc_subdirs = ["lh"];
}
if (process.platform === "win32") {
switch (p_target) {
case "dos":
p_inc_subdirs = ["H"];
break;
case "win":
p_inc_subdirs = ["H", "H\\WIN"];
break;
case "os2":
p_inc_subdirs = ["H", "H\\OS2"];
break;
case "os2-16":
p_inc_subdirs = ["H", "H\\OS21X"];
break;
case "linux":
p_inc_subdirs = ["LH"];
break;
case "nt":
default:
p_inc_subdirs = ["H", "H\\NT", "H\\NT\\DIRECTX", "H\\NT\\DDK"];
}
} else {
switch (p_target) {
case "dos":
p_inc_subdirs = ["h"];
break;
case "win":
p_inc_subdirs = ["h", "h/win"];
break;
case "nt":
p_inc_subdirs = ["h", "h/nt", "h/nt/directx", "h/nt/ddk"];
break;
case "os2":
p_inc_subdirs = ["h", "h/os2"];
break;
case "os2-16":
p_inc_subdirs = ["h", "h/os21x"];
break;
case "linux":
default:
p_inc_subdirs = ["lh"];
}
}

let p_location = core.getInput("location");
if (!p_location) {
if (process.platform === "win32") {
Expand Down

0 comments on commit ac87ac3

Please sign in to comment.