cmake: build DOS utilities in maintainer mode

This commit is contained in:
OpenAI
2026-05-31 07:47:50 +00:00
committed by Mario Fetka
parent d570dd59ec
commit 38083458a4
2 changed files with 10 additions and 9 deletions

View File

@@ -4,11 +4,12 @@
# - legacy command names are installed from netold.exe
# - new command names that netold.exe does not contain are installed from net.exe
#
# Maintainer mode can rebuild the new net.exe with Open Watcom. The freshly
# Maintainer mode rebuilds the new net.exe with Open Watcom. The freshly
# built binary is only installed when MARS_NWE_INSTALL_NEW_DOSUTILS is ON, or
# for the new-only command names in the default split install.
option(MAINTAINER_BUILD "Enable maintainer-only DOS tool helpers and diagnostics" OFF)
set(MARS_DOSUTILS_BUILD_FROM_SOURCE ${MAINTAINER_BUILD})
set(MARS_DOSUTILS_LEGACY_NET_EXE
"${CMAKE_CURRENT_SOURCE_DIR}/netold.exe"
@@ -52,7 +53,7 @@ set(MARS_DOSUTILS_NEW_ONLY_TOOLS
ncopy
)
if(MARS_NWE_BUILD_DOSUTILS)
if(MARS_DOSUTILS_BUILD_FROM_SOURCE)
find_package(OpenWatcom REQUIRED)
set(DOSUTILS_C_SOURCES
@@ -197,7 +198,7 @@ else()
set(MARS_DOSUTILS_BUILT_NET_EXE "")
endif()
if(MARS_NWE_BUILD_DOSUTILS)
if(MARS_DOSUTILS_BUILD_FROM_SOURCE)
set(MARS_DOSUTILS_SELECTED_NEW_EXE "${MARS_DOSUTILS_BUILT_NET_EXE}")
else()
set(MARS_DOSUTILS_SELECTED_NEW_EXE "${MARS_DOSUTILS_NEW_NET_EXE}")
@@ -211,7 +212,7 @@ endif()
set(MARS_DOSUTILS_SELECTED_LEGACY_IS_BUILT FALSE)
set(MARS_DOSUTILS_SELECTED_NEW_IS_BUILT FALSE)
if(MARS_NWE_BUILD_DOSUTILS)
if(MARS_DOSUTILS_BUILD_FROM_SOURCE)
if(MARS_DOSUTILS_SELECTED_LEGACY_EXE STREQUAL MARS_DOSUTILS_BUILT_NET_EXE)
set(MARS_DOSUTILS_SELECTED_LEGACY_IS_BUILT TRUE)
endif()
@@ -225,14 +226,14 @@ if(MARS_NWE_INSTALL_DOSUTILS)
message(FATAL_ERROR
"Selected legacy/default DOS utility missing: ${MARS_DOSUTILS_SELECTED_LEGACY_EXE}. "
"Commit dosutils/netold.exe, enable MARS_NWE_INSTALL_NEW_DOSUTILS, "
"or enable MARS_NWE_BUILD_DOSUTILS."
"or enable MAINTAINER_BUILD."
)
endif()
if(NOT MARS_DOSUTILS_SELECTED_NEW_IS_BUILT AND NOT EXISTS "${MARS_DOSUTILS_SELECTED_NEW_EXE}")
message(FATAL_ERROR
"Selected new DOS utility missing: ${MARS_DOSUTILS_SELECTED_NEW_EXE}. "
"Commit dosutils/net.exe or enable MARS_NWE_BUILD_DOSUTILS."
"Commit dosutils/net.exe or enable MAINTAINER_BUILD."
)
endif()
@@ -269,7 +270,7 @@ if(MARS_NWE_INSTALL_DOSUTILS)
DESTINATION "${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS/login"
RENAME slist.exe)
if(MAINTAINER_BUILD AND MARS_NWE_BUILD_DOSUTILS)
if(MAINTAINER_BUILD AND MARS_DOSUTILS_BUILD_FROM_SOURCE)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/dlystrt.exe"
DESTINATION "${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS/public"
RENAME dlystrt.exe)

View File

@@ -624,7 +624,7 @@ The modern CMake build can rebuild `net.exe` with Open Watcom v2 on Linux.
Configure with:
```bash
cmake -S . -B build -DMARS_NWE_BUILD_DOSUTILS=ON
cmake -S . -B build -DMAINTAINER_BUILD=ON
cmake --build build
```
@@ -644,7 +644,7 @@ rm -f *.o *.obj
### Default install behavior
When `MARS_NWE_BUILD_DOSUTILS` is disabled, CMake installs a prebuilt `net.exe` from the source tree.
When `MAINTAINER_BUILD` is disabled, CMake installs a prebuilt `net.exe` from the source tree. Maintainer builds rebuild the DOS utilities with Open Watcom automatically.
That keeps the normal mars_nwe build independent from Open Watcom. Maintainers can enable the Open Watcom build only when they want to regenerate the DOS binary.