diff --git a/README.md b/README.md index 1d30da9..7630cdb 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This action sets up watcom for use in actions by: - downloading a watcom release. -- eventually setting the PATH and WATCOM environment variables. +- set default Open Watcom environment variables (WATCOM + INCLUDE + PATH). - failing if the specific version of Open Watcom is not available for download. # Usage @@ -21,7 +21,7 @@ steps: with: version: "2.0" - run: | - wcl386 -zq -d+ ${{ env.WATCOM }}/h -w3 -bt=dos -d2 -fomain.c.obj -c -cc main.c + wcl386 -zq -d+ -i"${{ env.WATCOM }}/h" -w3 -bt=dos -d2 -fomain.c.obj -c -cc main.c wlink option quiet name hello.exe opt map system dos4g debug all file main.c.obj - run: | cmake -S . -B build -G "Watcom WMake" -D CMAKE_SYSTEM_NAME=DOS diff --git a/action.yml b/action.yml index a7ebc0b..ff6d517 100644 --- a/action.yml +++ b/action.yml @@ -13,11 +13,11 @@ inputs: required: false default: '' location: - description: 'Location where Open Watcom should be extracted to (default=/opt/watcom or C:\\watcom)' + description: 'Location where Open Watcom should be extracted to (default=/opt/watcom or C:\\WATCOM)' required: false default: '' environment: - description: 'Set environment variables (WATCOM + PATH)' + description: 'Set default Open Watcom environment variables (WATCOM + INCLUDE + PATH)' required: false default: true runs: diff --git a/src/interface.ts b/src/interface.ts index 9f724fa..9f8ba35 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -22,15 +22,21 @@ export interface ISetupWatcomSettings { location: string; /** - * Set WATCOM environment variable + add to PATH + * Set Open Watcom default environment variable (WATCOM + INCLUDE) and add + * native binaries subdir to PATH */ environment: boolean; /** - * Watcom subdir containing the native binaries + * Watcom subdir containing the native binaries (for host OS) */ path_subdir: string; + /** + * List of Watcom subdirs containing the default header files (for host OS) + */ + inc_subdirs: string[]; + /** * Need mode bits fix-up */ diff --git a/src/main.ts b/src/main.ts index 754d0da..fa7774a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,13 +52,15 @@ function getInputs(): ISetupWatcomSettings { let default_location: string; let p_path_subdir: string; + let p_inc_subdirs: string[]; if (process.platform === "win32") { - default_location = "C:\\watcom"; + default_location = "C:\\WATCOM"; if (p_version == "2.0-64") { - p_path_subdir = "binnt64"; + p_path_subdir = "BINNT64"; } else { - p_path_subdir = "binnt"; + p_path_subdir = "BINNT"; } + p_inc_subdirs = ["H", "H\\NT", "H\\NT\\DIRECTX", "H\\NT\\DDK"]; } else if (process.platform === "darwin") { throw new Error("Unsupported platform"); } else { @@ -68,6 +70,7 @@ function getInputs(): ISetupWatcomSettings { } else { p_path_subdir = "binl"; } + p_inc_subdirs = ["lh"]; } let p_location = core.getInput("location"); @@ -84,6 +87,7 @@ function getInputs(): ISetupWatcomSettings { location: p_location, environment: p_environment, path_subdir: p_path_subdir, + inc_subdirs: p_inc_subdirs, needs_chmod: p_needs_chmod, }; } @@ -98,6 +102,7 @@ async function run(): Promise { core.info(`location: ${settings.location}`); core.info(`environment: ${settings.environment}`); core.info(`path_subdir: ${settings.path_subdir}`); + core.info(`inc_subdirs: ${settings.inc_subdirs}`); core.endGroup(); if (settings.archive_type == "tar" && process.platform == "win32") { core.startGroup("Install GNU tar (MSYS)."); @@ -168,6 +173,17 @@ async function run(): Promise { const bin_path = path.join(watcom_path, settings.path_subdir); core.addPath(bin_path); core.info(`PATH appended with ${bin_path}.`); + const originalInclude = process.env["INCLUDE"]; + const sep = (process.platform == "win32") ? ";" : ":"; + let inc_path = ""; + for (var x of settings.inc_subdirs) { + inc_path = inc_path + path.join(watcom_path, x) + sep; + } + if (originalInclude) { + inc_path = inc_path + originalInclude; + } + core.exportVariable("INCLUDE", inc_path); + core.info(`Setted INCLUDE=${inc_path}`); core.endGroup(); } } catch (error) {