mirror of
https://github.com/D-Modem/gui.git
synced 2026-11-28 14:19:58 -08:00
Build the Windows app with clang-retro
Replace Open Watcom (windows/build-watcom.sh) and MSVC in CI with clang-retro: cmake/clang-retro.cmake, a CMake toolchain file that takes the clang-dos toolchain package (CLANG_DOS) and a --config target (CLANG_RETRO_CONFIG). - Windows 95 and later: win32-picolibc (static C library, no msvcrt.dll), no SSH. CI checks its imports for 9x and NT 4.0. - Windows 7 and later: win7, with libssh and mbedTLS built for it. - CI runs the tests of both builds in Wine. - picolibc names for _snprintf, _stricmp and _strnicmp; a main for picolibc's start-up code; DMODEM_GUI_SSH to turn the SSH build off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRRhKGCaYUyYtH7Boap
This commit is contained in:
14 files changed
+191
-91
No files matched your search
+44
-13
@@ -57,36 +57,67 @@ jobs:
|
||||
DMODEM_SSH_TEST_PPK="$RUNNER_TEMP/key.ppk" DMODEM_SSH_TEST_AGENT="$RUNNER_TEMP/agent.sock" \
|
||||
build/ssh/dmodemssh_test
|
||||
|
||||
# Both Windows builds use clang-retro (https://clang-retro.github.io/),
|
||||
# its toolchain package from its setup-toolchain action, on Linux
|
||||
windows-9x:
|
||||
name: Windows 95 and later (Open Watcom)
|
||||
name: Windows 95 and later (clang-retro, win32-picolibc)
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: open-watcom/setup-watcom@v0
|
||||
with:
|
||||
version: "2.0"
|
||||
- uses: clang-retro/dos-sdk/.github/actions/setup-toolchain@main
|
||||
id: clang-dos
|
||||
- name: Packages
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends ninja-build wine wine32:i386
|
||||
- name: Build
|
||||
run: sh windows/build-watcom.sh build/watcom
|
||||
run: |
|
||||
cmake -S . -B build/win9x -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE=cmake/clang-retro.cmake -DCLANG_RETRO_CONFIG=win32-picolibc \
|
||||
-DCMAKE_CROSSCOMPILING_EMULATOR=wine
|
||||
cmake --build build/win9x
|
||||
- name: Test (Wine)
|
||||
run: |
|
||||
export WINEDEBUG=-all WINEPREFIX="$RUNNER_TEMP/wine"
|
||||
wineboot -i >/dev/null 2>&1 || true
|
||||
ctest --test-dir build/win9x --output-on-failure
|
||||
- name: Imports (Windows 95, 98 and ME, and NT 4.0)
|
||||
run: |
|
||||
python3 "$CLANG_DOS/share/clang-dos/check-imports.py" build/win9x/windows/dmodem.exe
|
||||
python3 "$CLANG_DOS/share/clang-dos/check-imports.py" --nt 4.0 build/win9x/windows/dmodem.exe
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dmodem-windows-9x
|
||||
path: build/watcom/dmodem.exe
|
||||
path: build/win9x/windows/dmodem.exe
|
||||
|
||||
windows:
|
||||
name: Windows (MSVC)
|
||||
runs-on: windows-latest
|
||||
name: Windows 7 and later (clang-retro, with SSH)
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: clang-retro/dos-sdk/.github/actions/setup-toolchain@main
|
||||
id: clang-dos
|
||||
- name: Packages
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends ninja-build wine wine32:i386
|
||||
- name: Build
|
||||
run: |
|
||||
cmake -S . -B build -A Win32
|
||||
cmake --build build --config Release
|
||||
- name: Test
|
||||
run: ctest --test-dir build -C Release --output-on-failure
|
||||
cmake -S . -B build/win7 -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE=cmake/clang-retro.cmake -DCLANG_RETRO_CONFIG=win7 \
|
||||
-DDMODEM_GUI_SSH=ON -DCMAKE_CROSSCOMPILING_EMULATOR=wine
|
||||
cmake --build build/win7
|
||||
- name: Test (Wine)
|
||||
run: |
|
||||
export WINEDEBUG=-all WINEPREFIX="$RUNNER_TEMP/wine"
|
||||
wineboot -i >/dev/null 2>&1 || true
|
||||
ctest --test-dir build/win7 --output-on-failure
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dmodem-windows
|
||||
path: build/windows/Release/dmodem.exe
|
||||
path: build/win7/windows/dmodem.exe
|
||||
|
||||
macos:
|
||||
name: macOS (SwiftUI)
|
||||
|
||||
+13
-4
@@ -1,8 +1,7 @@
|
||||
# D-Modem's desktop apps: the shared C core (libdmodemctl), and the
|
||||
# Linux app (GTK 4 and libadwaita) when its libraries are there, or the
|
||||
# Windows app with MinGW or MSVC. The Windows 95 build of the Windows
|
||||
# app (windows/build-watcom.sh) and the macOS app (macos/) build with
|
||||
# their own tools and take the core from here.
|
||||
# Windows app with clang-retro (cmake/clang-retro.cmake), MinGW or MSVC.
|
||||
# The macOS app (macos/) builds with Xcode and takes the core from here.
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(dmodem-gui VERSION 1.0.0 LANGUAGES C)
|
||||
|
||||
@@ -10,11 +9,21 @@ set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
option(DMODEM_GUI_LINUX "Build the GTK 4 app (linux/)" ON)
|
||||
# (clang-retro, cmake/clang-retro.cmake: the Windows 95 build, which has
|
||||
# no libssh, as mbedTLS and libssh need Windows Vista)
|
||||
if(CLANG_DOS)
|
||||
set(_ssh_default OFF)
|
||||
else()
|
||||
set(_ssh_default ON)
|
||||
endif()
|
||||
option(DMODEM_GUI_SSH "Build libdmodemssh (libssh) for the Remote page" ${_ssh_default})
|
||||
|
||||
add_subdirectory(core)
|
||||
enable_testing()
|
||||
add_subdirectory(core/test)
|
||||
add_subdirectory(ssh)
|
||||
if(DMODEM_GUI_SSH)
|
||||
add_subdirectory(ssh)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_subdirectory(windows)
|
||||
|
||||
@@ -24,7 +24,7 @@ libdmodemctl. Thus they operate in the same way.
|
||||
- **Settings**: each modem setting as a native control, from AT!M
|
||||
- **Call Stats**: the rate, modulation, error control and line figures of the last call (AT#UD, ATI11)
|
||||
- **Line settings**: a SIP account, a USB modem, or a modem that already runs (dmodemd, or a hardware modem such as the MultiTech MT9234MU)
|
||||
- **Windows 95 and later**: plain Win32, built with Open Watcom. On Windows 9x, the app connects to a modem through TCP or a COM port
|
||||
- **Windows 95 and later**: plain Win32, built with [clang-retro](https://clang-retro.github.io/). On Windows 9x, the app connects to a modem through TCP or a COM port
|
||||
|
||||
| | Windows | macOS | Linux |
|
||||
| --- | --- | --- | --- |
|
||||
@@ -43,14 +43,30 @@ Linux:
|
||||
libsndfile1-dev
|
||||
cmake -S . -B build && cmake --build build && ./build/linux/dmodem-gui
|
||||
|
||||
Windows: use `cmake -S . -B build -A Win32 && cmake --build build --config Release`.
|
||||
For Windows 95 and later, use `windows/build-watcom.sh` with Open Watcom 2.0.
|
||||
Windows: we build the Windows app with clang-retro. Get its toolchain
|
||||
package (`clang-dos-linux-x86_64.tar.xz` or `clang-dos-windows-x86_64.zip`,
|
||||
from the [nightly release](https://github.com/clang-retro/dos-sdk/releases/tag/nightly)).
|
||||
Then set `CLANG_DOS` to the directory of the package:
|
||||
|
||||
# Windows 95, 98, ME, NT 4.0 and later (no SSH, no C runtime DLL)
|
||||
cmake -S . -B build/win9x -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCLANG_DOS=/opt/clang-dos -DCMAKE_TOOLCHAIN_FILE=cmake/clang-retro.cmake
|
||||
cmake --build build/win9x
|
||||
|
||||
# Windows 7 and later, with SSH
|
||||
cmake -S . -B build/win7 -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCLANG_DOS=/opt/clang-dos -DCMAKE_TOOLCHAIN_FILE=cmake/clang-retro.cmake \
|
||||
-DCLANG_RETRO_CONFIG=win7 -DDMODEM_GUI_SSH=ON
|
||||
cmake --build build/win7
|
||||
|
||||
The app is in `windows/dmodem.exe` of the build directory. MSVC
|
||||
(`cmake -S . -B build -A Win32`) and MinGW also build the same code.
|
||||
|
||||
macOS: first use `cmake -S . -B build -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 && cmake --build build`
|
||||
(this builds libssh, for SSH). Then use `brew install xcodegen && cd macos && xcodegen && open DModem.xcodeproj`.
|
||||
|
||||
The first CMake build downloads libssh and mbedTLS for SSH. This always
|
||||
occurs on Windows and macOS. On Linux, it occurs if the libssh of the system
|
||||
occurs on Windows (when SSH is on) and macOS. On Linux, it occurs if the libssh of the system
|
||||
is older than 0.11.
|
||||
|
||||
The Settings page needs a dmodemd with AT!M (the main branch of D-Modem
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
# CMake toolchain file for clang-retro (https://clang-retro.github.io/):
|
||||
# the Windows app for Windows 95 and later, built on Linux or Windows.
|
||||
#
|
||||
# cmake -S . -B build/retro -DCLANG_DOS=/opt/clang-dos \
|
||||
# -DCMAKE_TOOLCHAIN_FILE=cmake/clang-retro.cmake
|
||||
#
|
||||
# CLANG_DOS is the unpacked clang-dos toolchain package (the environment
|
||||
# variable CLANG_DOS also sets it). CLANG_RETRO_CONFIG is the --config
|
||||
# file of the target (default win32-picolibc: Windows 95, 98, ME, NT 4.0
|
||||
# and later, with no C runtime DLL).
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_VERSION 4.0)
|
||||
set(CMAKE_SYSTEM_PROCESSOR i386)
|
||||
|
||||
if(NOT CLANG_DOS AND DEFINED ENV{CLANG_DOS})
|
||||
set(CLANG_DOS "$ENV{CLANG_DOS}")
|
||||
endif()
|
||||
if(NOT CLANG_DOS)
|
||||
message(FATAL_ERROR "Set CLANG_DOS to the clang-dos toolchain package")
|
||||
endif()
|
||||
set(CLANG_DOS "${CLANG_DOS}" CACHE PATH "The clang-dos toolchain package")
|
||||
set(CLANG_RETRO_CONFIG win32-picolibc CACHE STRING "The clang-retro --config file (without .cfg)")
|
||||
# (try_compile projects see these two)
|
||||
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CLANG_DOS CLANG_RETRO_CONFIG)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(_exe .exe)
|
||||
else()
|
||||
set(_exe "")
|
||||
endif()
|
||||
# (the --config file is a mandatory argument of the compilers, not a flag,
|
||||
# so that a -DCMAKE_C_FLAGS of a project, or of an ExternalProject, keeps it)
|
||||
set(_cfg "--config=${CLANG_DOS}/bin/${CLANG_RETRO_CONFIG}.cfg")
|
||||
set(CMAKE_C_COMPILER "${CLANG_DOS}/bin/clang${_exe}" "${_cfg}")
|
||||
set(CMAKE_CXX_COMPILER "${CLANG_DOS}/bin/clang++${_exe}" "${_cfg}")
|
||||
set(CMAKE_RC_COMPILER "${CLANG_DOS}/bin/llvm-windres${_exe}")
|
||||
set(CMAKE_AR "${CLANG_DOS}/bin/llvm-ar${_exe}")
|
||||
set(CMAKE_RANLIB "${CLANG_DOS}/bin/llvm-ranlib${_exe}")
|
||||
# windres runs the preprocessor of clang for the target
|
||||
set(CMAKE_RC_FLAGS_INIT "--target=pe-i386 --preprocessor-arg=${_cfg}")
|
||||
|
||||
list(APPEND CMAKE_FIND_ROOT_PATH "${CLANG_DOS}")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
@@ -88,8 +88,8 @@ static const uint8_t cbm_cbm[8] = {
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* the profiles (in the struct's order: no designated initialisers for
|
||||
Open Watcom) */
|
||||
/* the profiles (in the struct's order: no designated initialisers, for
|
||||
older compilers) */
|
||||
|
||||
/* a DEC terminal */
|
||||
#define DEC(id, label, term, telnet, level, features, da1, da2, home) \
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@
|
||||
* A C port of the D-Modem app's shared Kotlin emulator
|
||||
* (D-Modem/app: shared/src/commonMain/kotlin/org/dmodem/app/terminal),
|
||||
* kept close to it so that a change there can be carried here: the same
|
||||
* parts, the same names where C allows, the same behaviour. C99 as
|
||||
* Open Watcom takes it (no designated initialisers, no VLAs).
|
||||
* parts, the same names where C allows, the same behaviour. C99 with
|
||||
* no designated initialisers and no VLAs, for older compilers too.
|
||||
*/
|
||||
#ifndef DMC_VTINT_H
|
||||
#define DMC_VTINT_H
|
||||
|
||||
+20
-5
@@ -197,8 +197,8 @@ same on all platforms, and you do not need to install anything:
|
||||
If the system has libssh 0.11 or later (Linux), libssh and mbedTLS come from
|
||||
the system. If not, the build makes them from their release tarballs, and
|
||||
checks them by hash (`ssh/cmake/BundledLibssh.cmake`). This always occurs on
|
||||
Windows and macOS. The Windows 95 build (Open Watcom) has no libssh. If it
|
||||
finds the `ssh.exe` of Windows (Windows 10 1809 and later), it runs it in a
|
||||
Windows and macOS. The Windows 95 build has no libssh, because mbedTLS and
|
||||
libssh need Windows Vista or later (`BCryptGenRandom`). If it finds the `ssh.exe` of Windows (Windows 10 1809 and later), it runs it in a
|
||||
pseudo console.
|
||||
|
||||
| | Telnet and rlogin | SSH | Kept in |
|
||||
@@ -262,9 +262,24 @@ Windows 95 to Windows 11:
|
||||
Winsock 1.1 (`wsock32`, `WSAAsyncSelect`) and the 4.0 `OPENFILENAME`.
|
||||
- No `SetHandleInformation` (NT only). The app uses `DuplicateHandle` to
|
||||
make the pipe from dmodemd non-inheritable.
|
||||
- Open Watcom 2.0 builds the app (`windows/build-watcom.sh`: `runtime
|
||||
windows=4.0`, the static C library), as CI does. MinGW and MSVC build the
|
||||
same code with CMake.
|
||||
- clang-retro builds the app (`cmake/clang-retro.cmake`, a CMake toolchain
|
||||
file), as CI does. Its toolchain package comes from the
|
||||
`clang-retro/dos-sdk/.github/actions/setup-toolchain` action, or from
|
||||
`packaging/get-toolchain.sh` in that repository. `CLANG_DOS` is the
|
||||
directory of the package. `CLANG_RETRO_CONFIG` is the `--config` file:
|
||||
- `win32-picolibc` (the default): Windows 95, 98, ME, NT 4.0 and later.
|
||||
picolibc is the C library, and it is linked into the app. Thus the app
|
||||
needs no `msvcrt.dll`, which some installations of Windows 95 do not
|
||||
have. This build has no libssh (`DMODEM_GUI_SSH` is OFF).
|
||||
- `win7`: Windows 7 and later, with libssh (`-DDMODEM_GUI_SSH=ON`). This
|
||||
is the minimum Windows version of dmodemd too.
|
||||
- CI examines the imports of the Windows 95 build with `check-imports.py`
|
||||
of clang-retro, for Windows 9x and for NT 4.0. The build fails if the app
|
||||
uses a function that these versions do not have. CI also runs the tests
|
||||
of the two builds in Wine.
|
||||
- picolibc has no `_snprintf`, `_stricmp` or `_strnicmp`. `app.h` gives
|
||||
these names to `snprintf`, `strcasecmp` and `strncasecmp`.
|
||||
- MinGW and MSVC also build the same code with CMake.
|
||||
|
||||
dmodemd itself needs Windows 7 or later. On Windows 9x and NT 4, the app
|
||||
uses a COM port by default. It can also connect to a dmodemd on another
|
||||
|
||||
@@ -14,13 +14,19 @@ set(_args
|
||||
-DCMAKE_INSTALL_PREFIX=${_prefix}
|
||||
-DCMAKE_INSTALL_LIBDIR=lib
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
|
||||
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
|
||||
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT})
|
||||
# (a toolchain file names the compiler itself)
|
||||
if(CMAKE_TOOLCHAIN_FILE)
|
||||
list(APPEND _args -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
|
||||
else()
|
||||
list(APPEND _args -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER})
|
||||
endif()
|
||||
# (cmake/clang-retro.cmake)
|
||||
if(CLANG_DOS)
|
||||
list(APPEND _args -DCLANG_DOS=${CLANG_DOS} -DCLANG_RETRO_CONFIG=${CLANG_RETRO_CONFIG})
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
list(APPEND _args -DCMAKE_SYSTEM_NAME=iOS)
|
||||
@@ -62,6 +68,11 @@ set(_ssh_args)
|
||||
if(ANDROID)
|
||||
list(APPEND _ssh_args -DCMAKE_C_FLAGS=-DS_IWRITE=S_IWUSR)
|
||||
endif()
|
||||
# (clang-retro's clang, newer than MinGW's GCC, makes an error of
|
||||
# src/threads/mbedtls.c's casts of libssh's mutex callbacks)
|
||||
if(CLANG_DOS)
|
||||
list(APPEND _ssh_args -DCMAKE_C_FLAGS=-Wno-error=incompatible-function-pointer-types)
|
||||
endif()
|
||||
|
||||
# (WITH_SERVER: libssh runs a client's callbacks for the channels the
|
||||
# server opens, the forwarded agent's, only when it's built with it)
|
||||
@@ -88,8 +99,9 @@ target_compile_definitions(dmodem_libssh INTERFACE LIBSSH_STATIC=1)
|
||||
target_link_libraries(dmodem_libssh INTERFACE ${_prefix}/lib/${_ssh_lib} ${_mbed_paths})
|
||||
if(WIN32)
|
||||
target_link_libraries(dmodem_libssh INTERFACE ws2_32 iphlpapi bcrypt shell32 advapi32)
|
||||
# (MinGW's libssh locks with winpthreads)
|
||||
if(MINGW)
|
||||
# (MinGW's libssh locks with winpthreads; clang-retro's sysroots have
|
||||
# none, and there libssh locks with Win32's own)
|
||||
if(MINGW AND NOT CLANG_DOS)
|
||||
target_link_libraries(dmodem_libssh INTERFACE pthread)
|
||||
endif()
|
||||
elseif(UNIX)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# The Windows app with MinGW or MSVC (the Windows 95 build is Open
|
||||
# Watcom's: build-watcom.sh). ANSI, for the same code to build with both.
|
||||
# The Windows app with MinGW, MSVC or clang-retro (the Windows 95 build:
|
||||
# cmake/clang-retro.cmake). ANSI, for the same code to build with all.
|
||||
enable_language(CXX)
|
||||
enable_language(RC)
|
||||
add_executable(dmodem WIN32
|
||||
@@ -29,3 +29,7 @@ else()
|
||||
target_compile_options(dmodem PRIVATE -Wall -Wextra -Wno-unused-parameter)
|
||||
target_link_options(dmodem PRIVATE -static)
|
||||
endif()
|
||||
# (picolibc starts main, unless the entry point is WinMain's)
|
||||
if(CLANG_RETRO_CONFIG MATCHES "picolibc")
|
||||
target_link_options(dmodem PRIVATE -Wl,-e,WinMainCRTStartup)
|
||||
endif()
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Builds dmodem.exe with Open Watcom 2.0, for Windows 95 and later:
|
||||
# ANSI Win32, the Windows 95 common controls, Winsock 1.1, the static
|
||||
# Watcom C library. WATCOM must name Open Watcom's directory, and its
|
||||
# binaries be on the PATH (on Linux, $WATCOM/binl64 or binl).
|
||||
#
|
||||
# windows/build-watcom.sh [the output directory, build/watcom]
|
||||
set -eu
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
root=$(dirname "$here")
|
||||
out=${1:-$root/build/watcom}
|
||||
mkdir -p "$out"
|
||||
cd "$out"
|
||||
|
||||
: "${WATCOM:?set WATCOM to Open Watcom's directory}"
|
||||
inc="-i=$WATCOM/h -i=$WATCOM/h/nt -i=$root/core/include -i=$root/core/src"
|
||||
# 386 code, the stack calling convention's names as Win32's, C99
|
||||
copts="-q -bt=nt -bm -3r -ox -w4 -zq -za99 $inc"
|
||||
cppopts="-q -bt=nt -bm -3r -ox -w4 -zq -xs $inc -i=$here/src"
|
||||
|
||||
# every file compiled, so that one run shows all the errors
|
||||
objs=""
|
||||
failed=0
|
||||
for f in "$root"/core/src/*.c; do
|
||||
# (core_: the library's names apart from the app's, voice.c and voice.cpp)
|
||||
o=core_$(basename "$f" .c).obj
|
||||
wcc386 $copts -fo="$o" "$f" || failed=1
|
||||
objs="$objs $o"
|
||||
done
|
||||
for f in "$here"/src/*.cpp; do
|
||||
o=$(basename "$f" .cpp).obj
|
||||
wpp386 $cppopts -fo="$o" "$f" || failed=1
|
||||
objs="$objs $o"
|
||||
done
|
||||
[ $failed = 0 ] || exit 1
|
||||
wrc -q -r -bt=nt -i="$WATCOM/h/nt" -i="$here/src" -i="$here/res" \
|
||||
-fo=app.res "$here/res/app.rc"
|
||||
|
||||
{
|
||||
echo "system nt_win"
|
||||
echo "name dmodem.exe"
|
||||
echo "option quiet"
|
||||
echo "option stack=256k"
|
||||
# Windows 95 and NT 4 take a subsystem version of 4.0
|
||||
echo "runtime windows=4.0"
|
||||
for o in $objs; do echo "file $o"; done
|
||||
echo "library comctl32.lib, wsock32.lib, comdlg32.lib, winmm.lib, msacm32.lib"
|
||||
echo "option resource=app.res"
|
||||
} > dmodem.lnk
|
||||
wlink @dmodem.lnk
|
||||
ls -l dmodem.exe
|
||||
+13
-2
@@ -4,8 +4,8 @@
|
||||
*
|
||||
* app.h - the Windows app: plain Win32 in C++98, ANSI, the common
|
||||
* controls of Windows 95, so the one .exe runs on Windows 95,
|
||||
* 98 and ME and on NT 4 through Windows 11. Built with Open
|
||||
* Watcom (windows/build-watcom.sh), or MinGW or MSVC (CMake).
|
||||
* 98 and ME and on NT 4 through Windows 11. Built with
|
||||
* clang-retro (cmake/clang-retro.cmake), or MinGW or MSVC.
|
||||
*
|
||||
* The modem is reached one of three ways (Link):
|
||||
* - dmodemd started by the app on this PC (Windows 7 and later, as
|
||||
@@ -33,6 +33,17 @@
|
||||
|
||||
#include "dmodemctl.h"
|
||||
|
||||
/* (picolibc, the C library of the clang-retro build, has the C99 and
|
||||
POSIX names and not the names of Microsoft's C library) */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef __PICOLIBC__
|
||||
#include <strings.h>
|
||||
#define _snprintf snprintf
|
||||
#define _stricmp strcasecmp
|
||||
#define _strnicmp strncasecmp
|
||||
#endif
|
||||
|
||||
/* (older headers, Open Watcom's among them, without the 64-bit names) */
|
||||
#ifndef GWLP_USERDATA
|
||||
#define GWLP_USERDATA GWL_USERDATA
|
||||
|
||||
@@ -32,7 +32,6 @@ static char proc_line[1024];
|
||||
static int proc_n;
|
||||
static char port_out[8192]; /* what the DTE has yet to take */
|
||||
static int port_out_n;
|
||||
static DWORD start_tick;
|
||||
static int connect_tries;
|
||||
|
||||
static int64_t now_ms()
|
||||
@@ -322,7 +321,6 @@ static bool start_dmodemd()
|
||||
proc = pi.hProcess;
|
||||
proc_out = rd;
|
||||
proc_n = 0;
|
||||
start_tick = GetTickCount();
|
||||
connect_tries = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -390,3 +390,12 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmd, int show)
|
||||
WSACleanup();
|
||||
return (int)msg.wParam;
|
||||
}
|
||||
|
||||
#ifdef __PICOLIBC__
|
||||
/* (picolibc's start-up code needs a main, also when the entry point is
|
||||
WinMainCRTStartup, which calls WinMain: see windows/CMakeLists.txt) */
|
||||
int main(void)
|
||||
{
|
||||
return WinMain(GetModuleHandleA(NULL), NULL, (LPSTR)"", SW_SHOWDEFAULT);
|
||||
}
|
||||
#endif
|
||||
@@ -13,7 +13,7 @@
|
||||
* and asks Pageant (or else OpenSSH's own agent) for its keys; or logs
|
||||
* in by the agent alone, or by a key file: OpenSSH's, PEM or PuTTY's
|
||||
* .ppk, which can also be imported into .ssh in OpenSSH's form.
|
||||
* The Windows 95 build (Open Watcom, no libssh) runs Windows' own
|
||||
* The Windows 95 build (clang-retro, win32-picolibc: no libssh) runs Windows' own
|
||||
* ssh.exe in a pseudo console (ConPTY) instead, when it finds one
|
||||
* (Windows 10 1809 and later): the ConPTY calls are looked up at run
|
||||
* time and its output read from a timer.
|
||||
|
||||
Reference in new issue
Block a user