mirror of
https://github.com/D-Modem/gui.git
synced 2026-11-28 14:19:58 -08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20f47c88f4 | ||
|
|
9dc5682e6d |
No files matched your search
+94
-47
@@ -1,6 +1,6 @@
|
||||
# Builds and tests the app (windows/) and the library that it uses
|
||||
# (core/, ssh/): on Windows 95 to Windows 11, and on Linux, macOS and
|
||||
# Haiku over clang-retro MFC's portable Win32 layer (winport/)
|
||||
# (core/, ssh/): on Windows 95 to Windows 11, and on Linux and macOS over
|
||||
# clang-retro MFC's portable Win32 layer (winport/)
|
||||
name: Build
|
||||
|
||||
# The nightly release (nightly.yml) takes its files from this
|
||||
@@ -250,51 +250,6 @@ jobs:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: dmodem-win32-macos-${{ matrix.arch }}.tar.gz
|
||||
|
||||
# The app for Haiku (x86_64), cross-built on Linux with the runner's
|
||||
# clang against a sysroot of Haiku's own packages (D-Modem's
|
||||
# platforms/haiku/haiku_sysroot.py, which checks them against the
|
||||
# repositories' SHA-256). Nothing here runs the app: that needs a
|
||||
# Haiku guest. Refer to docs/haiku.md.
|
||||
winport-haiku:
|
||||
name: Windows app on Haiku, the modem built in (clang-retro MFC's Win32 layer)
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: clang-retro/mfc
|
||||
path: mfc
|
||||
submodules: recursive
|
||||
- name: Packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
cmake ninja-build clang lld llvm libzstd1 python3
|
||||
- name: Haiku packages cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: haiku-packages
|
||||
key: haiku-packages-${{ hashFiles('external/D-Modem/platforms/haiku/haiku_sysroot.py') }}
|
||||
- name: Sysroot
|
||||
run: python3 external/D-Modem/platforms/haiku/haiku_sysroot.py haiku-sysroot --cache haiku-packages
|
||||
- name: Build
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$PWD/cmake/haiku.cmake" \
|
||||
-DHAIKU_SYSROOT="$PWD/haiku-sysroot" \
|
||||
-DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC="$PWD/mfc"
|
||||
cmake --build build --target dmodem-win32
|
||||
- name: The built-in modem is in the app
|
||||
run: llvm-nm build/winport/dmodem-win32 | grep -q dmodem_embed_start
|
||||
- name: Package
|
||||
run: tar -C build/winport -czf dmodem-win32-haiku-x86_64.tar.gz dmodem-win32
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dmodem-win32-haiku
|
||||
path: dmodem-win32-haiku-x86_64.tar.gz
|
||||
|
||||
# The app for Mac OS X 10.4 (Tiger) and later, PowerPC and Intel
|
||||
# (i386), as one fat program, over the Mac OS X 10.0-10.5 port of
|
||||
# clang-retro MFC (cmake/macosx-legacy.cmake). All of it builds on
|
||||
@@ -380,3 +335,95 @@ jobs:
|
||||
with:
|
||||
name: dmodem-win32-macosx-legacy
|
||||
path: dmodem-win32-macosx10.4.tar.gz
|
||||
|
||||
# The Windows app (windows/) on the classic Mac OS (Mac OS 9) on
|
||||
# PowerPC, with the modem built in, over the Toolbox backend of
|
||||
# clang-retro MFC (cmake/macos9.cmake). All of it builds on Linux:
|
||||
# clang of clang-retro/llvm (llvm-prebuilt), and the C and C++
|
||||
# libraries of clang-retro/mac-sdk (picolibc, GCC 15.2's libstdc++
|
||||
# and LLVM's libunwind, kept in the cache).
|
||||
winport-macos9:
|
||||
name: Windows app on Mac OS 9 (PowerPC), the modem built in
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GCC_VERSION: 15.2.0
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: clang-retro/mfc
|
||||
path: mfc
|
||||
submodules: recursive
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: clang-retro/mac-sdk
|
||||
path: mac-sdk
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: clang-retro/picolibc
|
||||
path: picolibc
|
||||
- name: Packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
cmake ninja-build meson make zstd xz-utils
|
||||
- name: clang (clang-retro/llvm, llvm-prebuilt)
|
||||
run: |
|
||||
asset=$(gh api repos/clang-retro/llvm/releases/tags/llvm-prebuilt --jq \
|
||||
'[.assets[] | select(.name | startswith("llvm-linux-"))] | sort_by(.created_at) | last | .name')
|
||||
echo "Using $asset"
|
||||
echo "LLVM_ASSET=$asset" >> "$GITHUB_ENV"
|
||||
gh release download llvm-prebuilt -R clang-retro/llvm -p "$asset" -O llvm.tar.zst
|
||||
mkdir -p "$RUNNER_TEMP/llvm"
|
||||
tar --zstd -xf llvm.tar.zst -C "$RUNNER_TEMP/llvm"
|
||||
rm llvm.tar.zst
|
||||
"$RUNNER_TEMP/llvm/bin/clang" --version | head -1
|
||||
echo "MACOS9_LLVM=$RUNNER_TEMP/llvm" >> "$GITHUB_ENV"
|
||||
echo "MACOS9_SDK=$PWD/mac-sdk" >> "$GITHUB_ENV"
|
||||
echo "SDK_REV=$(git -C mac-sdk rev-parse HEAD)-$(git -C picolibc rev-parse HEAD)" >> "$GITHUB_ENV"
|
||||
- uses: actions/cache@v4
|
||||
id: maclibs
|
||||
with:
|
||||
path: mac-sdk/lib
|
||||
key: mac-sdk-lib-${{ env.SDK_REV }}-${{ env.LLVM_ASSET }}-gcc${{ env.GCC_VERSION }}
|
||||
- name: mac-sdk's libraries (runtime, C library, C++ library)
|
||||
if: steps.maclibs.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
# (LLVM: only compiler-rt's builtins and libunwind)
|
||||
git clone -q --depth 1 --filter=blob:none --sparse \
|
||||
https://github.com/clang-retro/llvm "$RUNNER_TEMP/llvm-src"
|
||||
git -C "$RUNNER_TEMP/llvm-src" sparse-checkout set compiler-rt/lib/builtins libunwind
|
||||
# (GCC: the release, for libstdc++)
|
||||
curl -sSfL "https://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz" \
|
||||
| tar -xJ -C "$RUNNER_TEMP"
|
||||
export CLANG="$MACOS9_LLVM/bin/clang" LLVM_SRC="$RUNNER_TEMP/llvm-src"
|
||||
cd mac-sdk
|
||||
sh runtime/build.sh > rt.log 2>&1 || { tail -50 rt.log; exit 1; }
|
||||
PICOLIBC_SRC="$GITHUB_WORKSPACE/picolibc" sh runtime/build-libc.sh > libc.log 2>&1 \
|
||||
|| { tail -50 libc.log; exit 1; }
|
||||
CPUS=ppc GCC_SRC="$RUNNER_TEMP/gcc-$GCC_VERSION" sh runtime/build-libstdcxx.sh > cxx.log 2>&1 \
|
||||
|| { tail -50 cxx.log; exit 1; }
|
||||
ls lib/ppc
|
||||
- name: Build
|
||||
run: |
|
||||
cmake -S . -B build/os9 -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$PWD/cmake/macos9.cmake" \
|
||||
-DCLANG_RETRO_MFC="$PWD/mfc" \
|
||||
-DDMODEM_GUI_WINPORT=ON -DDMODEM_GUI_EMBED=ON -DDMODEM_GUI_SSH=OFF
|
||||
cmake --build build/os9 --target dmodem-win32
|
||||
- name: Check the program
|
||||
run: |
|
||||
f=build/os9/winport/dmodem-win32.bin
|
||||
# (MacBinary: the type APPL in the header, and the modem inside)
|
||||
head -c 128 "$f" | grep -q APPL
|
||||
grep -q "User-Agent" "$f"
|
||||
mkdir -p out
|
||||
cp "$f" out/dmodem-win32-macos9.bin
|
||||
ls -l out
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dmodem-win32-macos9
|
||||
path: out/dmodem-win32-macos9.bin
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
take dmodem-win32-macos dmodem-win32-macos-arm64.tar.gz
|
||||
take dmodem-win32-macos-x86_64 dmodem-win32-macos-x86_64.tar.gz
|
||||
take dmodem-win32-macosx-legacy dmodem-win32-macosx10.4.tar.gz
|
||||
take dmodem-win32-haiku dmodem-win32-haiku-x86_64.tar.gz
|
||||
take dmodem-win32-macos9 dmodem-win32-macos9.bin
|
||||
(cd out && sha256sum * > SHA256SUMS)
|
||||
ls -l out
|
||||
{
|
||||
@@ -92,7 +92,7 @@ jobs:
|
||||
echo "| \`dmodem-win32-macos-arm64.tar.gz\` | The app on macOS with the modem built in, arm64 (Apple silicon) |"
|
||||
echo "| \`dmodem-win32-macos-x86_64.tar.gz\` | The app on macOS with the modem built in, x86_64 (Intel Mac) |"
|
||||
echo "| \`dmodem-win32-macosx10.4.tar.gz\` | The app on Mac OS X 10.4 (Tiger) and later with the modem built in, one program for PowerPC and Intel (i386). Not tested on a Mac yet |"
|
||||
echo "| \`dmodem-win32-haiku-x86_64.tar.gz\` | The app on Haiku R1/beta6 and later with the modem built in, x86_64. Needs \`pkgman install libusb\` |"
|
||||
echo "| \`dmodem-win32-macos9.bin\` | The app on Mac OS 9 (PowerPC) with the modem built in, in MacBinary. Not tested on a Mac yet |"
|
||||
echo "| \`SHA256SUMS\` | The SHA-256 of each file |"
|
||||
if [ -f missing ]; then
|
||||
echo
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
# D-Modem desktop app
|
||||
|
||||
The D-Modem desktop app is one Win32 app for Windows, macOS, Linux and
|
||||
Haiku. The
|
||||
The D-Modem desktop app is one Win32 app for Windows, macOS and Linux. The
|
||||
site of the app is <https://d-modem.github.io/gui/>.
|
||||
|
||||
The app has the modem built in, so it needs no dmodemd (refer to
|
||||
@@ -23,11 +22,11 @@ thin Win32 shell over one small C library, libdmodemctl.
|
||||
- **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). **Look for a modem** finds the modem and its port
|
||||
|
||||
| | Windows | macOS | Linux | Haiku |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Toolkit | Win32, C++ | Win32, over the Cocoa layer of [clang-retro MFC](https://github.com/clang-retro/mfc) | Win32, over the X11 and Wayland layer of clang-retro MFC | Win32, over the Interface Kit layer of clang-retro MFC |
|
||||
| Built with | [clang-retro](https://clang-retro.github.io/), MinGW or MSVC | clang | clang | clang (cross-built on Linux) |
|
||||
| Runs on | Windows 95 and later | arm64 (Apple silicon) and x86_64 (Intel Mac). Also Mac OS X 10.4 and later on PowerPC and i386 | x86_64 | R1/beta6 and later, x86_64 |
|
||||
| | Windows | macOS | Linux |
|
||||
| --- | --- | --- | --- |
|
||||
| Toolkit | Win32, C++ | Win32, over the Cocoa layer of [clang-retro MFC](https://github.com/clang-retro/mfc) | Win32, over the X11 and Wayland layer of clang-retro MFC |
|
||||
| Built with | [clang-retro](https://clang-retro.github.io/), MinGW or MSVC | clang | clang |
|
||||
| Runs on | Windows 95 and later | arm64 (Apple silicon) and x86_64 (Intel Mac). Also Mac OS X 10.4 and later on PowerPC and i386, and Mac OS 9 on PowerPC | x86_64 |
|
||||
|
||||
The source code of the app is the same on each system. Refer to "The
|
||||
Windows app on Linux and macOS" in [Design](docs/design.md).
|
||||
@@ -40,7 +39,7 @@ Windows app on Linux and macOS" in [Design](docs/design.md).
|
||||
|
||||
The [nightly release](https://github.com/D-Modem/gui/releases/tag/nightly)
|
||||
has the app from the newest build of `main`: for Windows 95 and later, for
|
||||
Windows 7 and later, for Linux, for macOS, and for Haiku. A workflow
|
||||
Windows 7 and later, for Linux, and for macOS. A workflow
|
||||
(`.github/workflows/nightly.yml`) replaces the release one time each day.
|
||||
When `main` has no new commits, the release does not change. When the
|
||||
main branch of D-Modem changes, a workflow moves the built-in modem to it
|
||||
@@ -68,7 +67,6 @@ For Windows (with clang-retro) and macOS, refer to
|
||||
- [The site](https://d-modem.github.io/gui/): the home page, the downloads and all the pages below
|
||||
- [Features](docs/features.md): each page and menu of the app
|
||||
- [Building](docs/building.md): Windows with clang-retro, and the app on Linux and macOS
|
||||
- [The app on Haiku](docs/haiku.md): install, build, serial ports and limits
|
||||
- [The built-in modem](docs/embedded-modem.md): the modem inside the app, with no dmodemd
|
||||
- [Design](docs/design.md): how the app is built, hardware modems (the MultiTech MT9234MU), the Windows 9x notes, and the app on Linux and macOS
|
||||
- [libdmodemctl](core/include/dmodemctl.h): the API of the library
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# The platform file of the classic Mac OS (cmake/macos9.cmake): a POSIX
|
||||
# system for CMake, over the C library of clang-retro/mac-sdk. A program
|
||||
# is a MacBinary II file (.bin) that mac-sdk's tools/macapp.py links.
|
||||
set(UNIX 1)
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".bin")
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
||||
@@ -1,20 +0,0 @@
|
||||
# haiku.cmake - the toolchain file for the app on Haiku (x86_64), built
|
||||
# on Linux with Clang and lld. It is the toolchain file of D-Modem
|
||||
# (external/D-Modem/platforms/haiku/haiku.cmake), which the modem in the
|
||||
# app uses too.
|
||||
#
|
||||
# python3 external/D-Modem/platforms/haiku/haiku_sysroot.py haiku-sysroot
|
||||
# cmake -S . -B build/haiku -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
# -DCMAKE_TOOLCHAIN_FILE=cmake/haiku.cmake -DHAIKU_SYSROOT=$PWD/haiku-sysroot \
|
||||
# -DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc
|
||||
#
|
||||
# Refer to docs/haiku.md.
|
||||
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../external/D-Modem/platforms/haiku/haiku.cmake")
|
||||
message(FATAL_ERROR "cmake/haiku.cmake: no external/D-Modem (git submodule update --init)")
|
||||
endif()
|
||||
# (the roots that a project gives, as libssh's build gets the prefix of
|
||||
# mbedTLS, stay with the sysroot, which D-Modem's file sets)
|
||||
set(_dmodem_find_roots ${CMAKE_FIND_ROOT_PATH})
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../external/D-Modem/platforms/haiku/haiku.cmake")
|
||||
list(APPEND CMAKE_FIND_ROOT_PATH ${_dmodem_find_roots})
|
||||
list(REMOVE_DUPLICATES CMAKE_FIND_ROOT_PATH)
|
||||
@@ -0,0 +1,73 @@
|
||||
# CMake toolchain file for the classic Mac OS on PowerPC (Mac OS 8.6 to
|
||||
# 9.2). It builds the Windows app (winport/) over the Toolbox backend of
|
||||
# clang-retro MFC, on Linux.
|
||||
#
|
||||
# cmake -S . -B build/macos9 -DCMAKE_TOOLCHAIN_FILE=cmake/macos9.cmake \
|
||||
# -DMACOS9_LLVM=/opt/llvm -DMACOS9_SDK=/path/to/mac-sdk \
|
||||
# -DCLANG_RETRO_MFC=/path/to/mfc -DDMODEM_GUI_WINPORT=ON
|
||||
#
|
||||
# You need these:
|
||||
# MACOS9_LLVM clang of clang-retro/llvm (the llvm-prebuilt release)
|
||||
# MACOS9_SDK a clang-retro/mac-sdk checkout, with its runtime, C and
|
||||
# C++ libraries in lib/ (runtime/build.sh,
|
||||
# runtime/build-libc.sh, runtime/build-libstdcxx.sh)
|
||||
# CLANG_RETRO_MFC a clang-retro/mfc checkout (port/compat/macos)
|
||||
# The environment variables of the same names also set them.
|
||||
#
|
||||
# CMake builds the static libraries. tools/macapp.py of mac-sdk links each
|
||||
# program into a PowerPC application (a MacBinary II file, .bin).
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
||||
set(CMAKE_SYSTEM_NAME MacOS9)
|
||||
set(CMAKE_SYSTEM_VERSION 9.2)
|
||||
set(CMAKE_SYSTEM_PROCESSOR powerpc)
|
||||
|
||||
foreach(_v MACOS9_LLVM MACOS9_SDK CLANG_RETRO_MFC)
|
||||
if(NOT ${_v} AND DEFINED ENV{${_v}})
|
||||
set(${_v} "$ENV{${_v}}")
|
||||
endif()
|
||||
if(NOT ${_v})
|
||||
message(FATAL_ERROR "Set ${_v} (cmake/macos9.cmake)")
|
||||
endif()
|
||||
set(${_v} "${${_v}}" CACHE PATH "" FORCE)
|
||||
# (the builds that D-Modem configures with this file see them too)
|
||||
set(ENV{${_v}} "${${_v}}")
|
||||
endforeach()
|
||||
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES MACOS9_LLVM MACOS9_SDK CLANG_RETRO_MFC)
|
||||
|
||||
set(MACOS9_TARGET powerpc-apple-macos9)
|
||||
set(_lib "${MACOS9_SDK}/lib")
|
||||
# The headers: GCC's C++ library of mac-sdk, port/compat/macos of
|
||||
# clang-retro MFC (the POSIX declarations that picolibc does not have),
|
||||
# the C library, then the Toolbox. These are mandatory arguments of the
|
||||
# compilers, with the target: a -DCMAKE_C_FLAGS of a project or an
|
||||
# ExternalProject keeps them.
|
||||
set(_common -isystem ${CLANG_RETRO_MFC}/port/compat/macos -isystem ${_lib}/include
|
||||
-I${MACOS9_SDK}/include -DMAC_LIBC -D_GNU_SOURCE
|
||||
-femulated-tls -ffunction-sections -fdata-sections)
|
||||
set(CMAKE_C_COMPILER "${MACOS9_LLVM}/bin/clang" "--target=${MACOS9_TARGET}" ${_common})
|
||||
set(CMAKE_CXX_COMPILER "${MACOS9_LLVM}/bin/clang++" "--target=${MACOS9_TARGET}"
|
||||
-nostdinc++ -isystem ${_lib}/include/c++/15.2.0/${MACOS9_TARGET}
|
||||
-isystem ${_lib}/include/c++/15.2.0 ${_common} -fexceptions -frtti)
|
||||
set(CMAKE_AR "${MACOS9_LLVM}/bin/llvm-ar")
|
||||
set(CMAKE_RANLIB "${MACOS9_LLVM}/bin/llvm-ranlib")
|
||||
|
||||
# The tests of CMake and of the projects compile and do not link: the
|
||||
# linker is macapp.py, which makes a Mac application
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
# A program: macapp.py links its objects and libraries with the C and
|
||||
# C++ libraries of mac-sdk (MACOS9_APP_SIZE: the partition in KB)
|
||||
set(MACOS9_APP_SIZE 16384 CACHE STRING "The partition of a program, in KB")
|
||||
find_program(MACOS9_PYTHON NAMES python3 python REQUIRED)
|
||||
# (macapp.py adds the C++ library only for C++ sources, not for objects:
|
||||
# a C++ program names libstdc++.a and libunwind.a, which throws the
|
||||
# exceptions, itself)
|
||||
set(_macapp "${CMAKE_COMMAND} -E env CLANG=${MACOS9_LLVM}/bin/clang ${MACOS9_PYTHON} ${MACOS9_SDK}/tools/macapp.py --cpu ppc --size ${MACOS9_APP_SIZE} --name <TARGET_NAME> -o <TARGET> -- <OBJECTS> <LINK_LIBRARIES>")
|
||||
set(CMAKE_C_LINK_EXECUTABLE "${_macapp}")
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "${_macapp} ${_lib}/ppc/libstdc++.a ${_lib}/ppc/libunwind.a")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "${_lib}")
|
||||
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)
|
||||
+38
-5
@@ -52,11 +52,6 @@ for an Intel Mac on a Mac with Apple silicon, add
|
||||
`-DCMAKE_OSX_ARCHITECTURES=x86_64` to the first command. Set one
|
||||
architecture only. The app cannot be a universal binary.
|
||||
|
||||
## Haiku
|
||||
|
||||
You build the app for Haiku (x86_64) on Linux, with clang and a sysroot
|
||||
of Haiku's packages. Refer to [The app on Haiku](haiku.md#build).
|
||||
|
||||
## Mac OS X 10.4 and later (PowerPC and Intel)
|
||||
|
||||
The app for Mac OS X 10.4 (Tiger) and later builds on Linux. It uses the
|
||||
@@ -91,6 +86,44 @@ Then join the two programs into one fat program:
|
||||
(`time.h`, `signal.h` and `net/if.h`). The built-in modem needs D-Modem
|
||||
with the changes for 10.4 to 10.6 (`docs/macos-details.md` in D-Modem).
|
||||
|
||||
## Mac OS 9 (PowerPC)
|
||||
|
||||
The app for the classic Mac OS on PowerPC builds on Linux. It uses the
|
||||
Toolbox backend of clang-retro MFC and the toolchain file
|
||||
`cmake/macos9.cmake`. You need these items:
|
||||
|
||||
- clang of [clang-retro/llvm](https://github.com/clang-retro/llvm) (its
|
||||
`llvm-prebuilt` release).
|
||||
- A [clang-retro/mac-sdk](https://github.com/clang-retro/mac-sdk)
|
||||
checkout with its PowerPC libraries in `lib/`. Build them with
|
||||
`runtime/build.sh`, `runtime/build-libc.sh` (it needs a
|
||||
[clang-retro/picolibc](https://github.com/clang-retro/picolibc)
|
||||
checkout) and `runtime/build-libstdcxx.sh` (it needs the GCC 15.2.0
|
||||
release and the libunwind of clang-retro/llvm). mac-sdk's
|
||||
`docs/cxx.md` tells more.
|
||||
|
||||
Build the app:
|
||||
|
||||
export MACOS9_LLVM=/path/to/llvm MACOS9_SDK=/path/to/mac-sdk
|
||||
cmake -S . -B build/os9 -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/macos9.cmake \
|
||||
-DCLANG_RETRO_MFC=/path/to/mfc -DDMODEM_GUI_WINPORT=ON \
|
||||
-DDMODEM_GUI_EMBED=ON -DDMODEM_GUI_SSH=OFF
|
||||
cmake --build build/os9 --target dmodem-win32
|
||||
|
||||
The result is `build/os9/winport/dmodem-win32.bin`, an application in
|
||||
MacBinary format. `mac-sdk/tools/macapp.py` links it. The memory
|
||||
partition of the app is 16 MB (`MACOS9_APP_SIZE`, in KB).
|
||||
|
||||
These items are different on Mac OS 9:
|
||||
|
||||
- There is no SSH (`DMODEM_GUI_SSH=OFF`).
|
||||
- There is no debug information. Clang cannot write DWARF into XCOFF
|
||||
objects.
|
||||
- `cmake/Platform/MacOS9.cmake` gives the CMake system `MacOS9`. The
|
||||
built-in modem needs D-Modem with the changes for this system
|
||||
(`docs/macos-details.md` in D-Modem).
|
||||
|
||||
## The library only
|
||||
|
||||
With no `DMODEM_GUI_WINPORT`, a build on Linux or macOS makes only
|
||||
|
||||
+1
-1
@@ -587,7 +587,7 @@ code is the same as on Windows.
|
||||
alphabetical order, with no Bluetooth devices). To use another device,
|
||||
set the environment variable `WINPORT_COMn`. For example, with
|
||||
`WINPORT_COM5=/dev/ttyUSB0`, `COM5` is `/dev/ttyUSB0`.
|
||||
- CI builds the app on Linux, on macOS for arm64 and x86_64, and on Linux for Mac OS X 10.4 (PowerPC and i386, `cmake/macosx-legacy.cmake`). On Linux, `winport/test/smoke.sh`
|
||||
- CI builds the app on Linux, on macOS for arm64 and x86_64, and on Linux for Mac OS X 10.4 (PowerPC and i386, `cmake/macosx-legacy.cmake`) and for Mac OS 9 (PowerPC, `cmake/macos9.cmake`). On Linux, `winport/test/smoke.sh`
|
||||
starts the app in Xvfb three times: with a TCP line, with a dmodemd
|
||||
that the app starts (`winport/test/dmodemd`, a test dmodemd), and with
|
||||
the built-in modem on a SIP line with no account. For the first two,
|
||||
|
||||
+8
-10
@@ -20,7 +20,7 @@ When `main` has no new commits, the release does not change.
|
||||
| macOS, arm64 (Apple silicon) | [`dmodem-win32-macos-arm64.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-macos-arm64.tar.gz) | The app on macOS, with the built-in modem. |
|
||||
| macOS, x86_64 (Intel Mac) | [`dmodem-win32-macos-x86_64.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-macos-x86_64.tar.gz) | The app on macOS, with the built-in modem. |
|
||||
| Mac OS X 10.4 and later, PowerPC and Intel | [`dmodem-win32-macosx10.4.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-macosx10.4.tar.gz) | The app with the built-in modem. One program for PowerPC (G3, G4, G5) and Intel (i386). It is not tested on a Mac yet. |
|
||||
| Haiku R1/beta6 and later, x86_64 | [`dmodem-win32-haiku-x86_64.tar.gz`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-haiku-x86_64.tar.gz) | The app on Haiku, with the built-in modem. It needs libusb. |
|
||||
| Mac OS 9, PowerPC | [`dmodem-win32-macos9.bin`](https://github.com/D-Modem/gui/releases/download/nightly/dmodem-win32-macos9.bin) | The app with the built-in modem, in MacBinary format. It is not tested on a Mac yet. |
|
||||
| All | [`SHA256SUMS`](https://github.com/D-Modem/gui/releases/download/nightly/SHA256SUMS) | The SHA-256 of each file. |
|
||||
|
||||
If a file is not in the release, the newest build did not make it. The
|
||||
@@ -60,6 +60,13 @@ The result for the file must be `OK`.
|
||||
`tar -xzf dmodem-win32-macosx10.4.tar.gz`.
|
||||
3. Start the app. Type `./dmodem-win32`.
|
||||
|
||||
## Install on Mac OS 9
|
||||
|
||||
1. Download `dmodem-win32-macos9.bin`. The file is for PowerPC Macs.
|
||||
2. Decode the file with StuffIt Expander. The file is in MacBinary
|
||||
format.
|
||||
3. Double-click the app. The app needs 16 MB of memory.
|
||||
|
||||
## Install on Linux
|
||||
|
||||
1. Install the libraries. On Ubuntu 24.04, type
|
||||
@@ -68,15 +75,6 @@ The result for the file must be `OK`.
|
||||
3. Extract the file. Type `tar -xzf dmodem-win32-linux-x86_64.tar.gz`.
|
||||
4. Start the app. Type `./dmodem-win32`.
|
||||
|
||||
## Install on Haiku
|
||||
|
||||
1. Install libusb. In a Terminal, type `pkgman install libusb`.
|
||||
2. Download `dmodem-win32-haiku-x86_64.tar.gz`.
|
||||
3. Extract the file. Type `tar -xzf dmodem-win32-haiku-x86_64.tar.gz`.
|
||||
4. Start the app. Type `./dmodem-win32`.
|
||||
|
||||
For more information, refer to [The app on Haiku](haiku.md).
|
||||
|
||||
## Build the app
|
||||
|
||||
To build the app from the source code, refer to [Building](building.md).
|
||||
@@ -80,6 +80,7 @@ Windows and macOS, the build links libusb (LGPL-2.1) statically, as
|
||||
| Linux | Done. CI builds it, checks that the library is in the app, and starts the built-in modem in Xvfb (`winport/test/smoke.sh`). |
|
||||
| macOS | Done (arm64 and x86_64). CI builds it for each architecture, and checks that the library is in the app. It is not tested on a Mac yet. |
|
||||
| Mac OS X 10.4 and later | Done (PowerPC and i386, one fat program). CI builds it on Linux, and checks that the library is in each part of the program. It is not tested on a Mac yet. |
|
||||
| Mac OS 9 (PowerPC) | Done. CI builds it on Linux with the C and C++ libraries of clang-retro/mac-sdk. There are no ptys: the modem gives its DTE on a socket. It is not tested on a Mac yet. |
|
||||
|
||||
### Windows 95
|
||||
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
# The app on Haiku
|
||||
|
||||
The Windows app also runs on Haiku (x86_64). The app is the same Win32
|
||||
source code. It runs over the portable Win32 layer of
|
||||
[clang-retro MFC](https://github.com/clang-retro/mfc), which shows the
|
||||
windows with Haiku's Interface Kit. The built-in modem is in the app, as
|
||||
on the other systems.
|
||||
|
||||
<img src="images/haiku-modem.png" width="49%" alt="The Modem page of the app on Haiku"> <img src="images/haiku-line-settings.png" width="49%" alt="The Line Settings dialog of the app on Haiku">
|
||||
|
||||
## Requirements
|
||||
|
||||
- Haiku R1/beta6 or later, x86_64. The app was tested on R1/beta6.
|
||||
- libusb. In a Terminal, type `pkgman install libusb`.
|
||||
|
||||
## Install
|
||||
|
||||
1. Download `dmodem-win32-haiku-x86_64.tar.gz` from the
|
||||
[nightly release](https://github.com/D-Modem/gui/releases/tag/nightly).
|
||||
2. Open a Terminal in the download folder.
|
||||
3. Extract the file. Type `tar -xzf dmodem-win32-haiku-x86_64.tar.gz`.
|
||||
4. Start the app. Type `./dmodem-win32`.
|
||||
|
||||
The app keeps its settings in `~/config/settings/libmfc`.
|
||||
|
||||
## Build
|
||||
|
||||
You build the app on Linux. The build uses the system's clang and a
|
||||
sysroot that has Haiku's own packages.
|
||||
|
||||
1. Install the tools. On Ubuntu 24.04, type
|
||||
`sudo apt install cmake ninja-build clang lld llvm libzstd1 python3`.
|
||||
2. Get [clang-retro MFC](https://github.com/clang-retro/mfc) and the
|
||||
D-Modem submodule (`git submodule update --init`).
|
||||
3. Make the sysroot. The script downloads Haiku's packages and examines
|
||||
them against the SHA-256 of their repositories:
|
||||
|
||||
python3 external/D-Modem/platforms/haiku/haiku_sysroot.py haiku-sysroot
|
||||
|
||||
4. Build the app:
|
||||
|
||||
cmake -S . -B build/haiku -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/haiku.cmake \
|
||||
-DHAIKU_SYSROOT=$PWD/haiku-sysroot \
|
||||
-DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc
|
||||
cmake --build build/haiku --target dmodem-win32
|
||||
|
||||
The app is `build/haiku/winport/dmodem-win32`. Copy it to the Haiku
|
||||
computer.
|
||||
|
||||
`cmake/haiku.cmake` includes the toolchain file of D-Modem
|
||||
(`external/D-Modem/platforms/haiku/haiku.cmake`). The CI job
|
||||
`winport-haiku` (`.github/workflows/build.yml`) does these steps. It does
|
||||
not start the app.
|
||||
|
||||
## Serial ports and modems
|
||||
|
||||
Haiku keeps the serial ports in `/dev/ports`:
|
||||
|
||||
- `pc_serial0`, `pc_serial1` and on are the serial ports of the computer.
|
||||
- `usb0`, `usb1` and on are the USB serial adapters and the CDC-ACM USB
|
||||
modems. Haiku's `usb_serial` driver makes these ports.
|
||||
|
||||
In **Line settings**, the **Port** list shows the ports of `/dev/ports`,
|
||||
for example `/dev/ports/usb0`. You can also type `COM1` (the first port
|
||||
by name), `COM2` (the second port), and so on.
|
||||
|
||||
**Look for a modem** does these steps:
|
||||
|
||||
1. It finds the ports in `/dev/ports`.
|
||||
2. It finds the USB devices with Haiku's USB Kit. It gives each `usbN`
|
||||
port the name of its device (the maker and the product).
|
||||
3. If a CDC-ACM device tells that it takes AT commands, the app selects
|
||||
its port as the modem.
|
||||
|
||||
Haiku has no driver for the MultiTech MT9234MU. If you connect this
|
||||
modem, **Look for a modem** tells you that Haiku cannot use it. Use a
|
||||
modem with a serial port, or a CDC-ACM USB modem.
|
||||
|
||||
## Keys
|
||||
|
||||
The keys are those of a PC keyboard:
|
||||
|
||||
| Key on the keyboard | Key in the app |
|
||||
| --- | --- |
|
||||
| Control | Control. For example, Control+C copies. |
|
||||
| Alt (Haiku's Command key, by default) | Alt. For example, Alt+M opens the **Modem** menu. |
|
||||
| Windows (Haiku's Option key) | Windows |
|
||||
|
||||
## Limits
|
||||
|
||||
- The app has no sound on Haiku. The **Phone** page cannot play or
|
||||
record the call.
|
||||
- The app cannot print. Only "Save as PDF" is available.
|
||||
- The Deskbar shows a generic icon for the app.
|
||||
- The USB modems were not tested on Haiku yet. QEMU's USB serial adapter
|
||||
does not operate with Haiku, so the tests used the serial port of the
|
||||
computer only.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 50 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
+1
-1
@@ -92,7 +92,7 @@ same way on each system.
|
||||
| | Windows | macOS | Linux |
|
||||
| --- | --- | --- | --- |
|
||||
| Toolkit | Win32, C++ | Win32, over the Cocoa layer of clang-retro MFC | Win32, over the X11 and Wayland layer of clang-retro MFC |
|
||||
| Runs on | Windows 95 and later | arm64 (Apple silicon) and x86_64 (Intel Mac). Also Mac OS X 10.4 and later on PowerPC and i386 | x86_64 |
|
||||
| Runs on | Windows 95 and later | arm64 (Apple silicon) and x86_64 (Intel Mac). Also Mac OS X 10.4 and later on PowerPC and i386, and Mac OS 9 on PowerPC | x86_64 |
|
||||
| Built-in modem | Yes | Yes | Yes |
|
||||
|
||||
Refer to [Design](design.md).
|
||||
|
||||
Vendored
+1
-1
Submodule external/D-Modem updated: c591ea2024...351268cd9c.
@@ -17,7 +17,6 @@ nav:
|
||||
- Features: features.md
|
||||
- The built-in modem: embedded-modem.md
|
||||
- Building: building.md
|
||||
- The app on Haiku: haiku.md
|
||||
- Design: design.md
|
||||
- "libdmodemctl API": https://github.com/D-Modem/gui/blob/main/core/include/dmodemctl.h
|
||||
- Documentation style: STYLE.md
|
||||
@@ -38,11 +38,6 @@ if(WIN32)
|
||||
elseif(UNIX)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(dmodemssh PUBLIC Threads::Threads)
|
||||
# Haiku has the sockets in libnetwork and strsep (for libssh) in
|
||||
# libbsd, not in libroot
|
||||
if(HAIKU)
|
||||
target_link_libraries(dmodemssh PUBLIC network bsd)
|
||||
endif()
|
||||
endif()
|
||||
if(MSVC)
|
||||
target_compile_options(dmodemssh PRIVATE /W4 /wd4996)
|
||||
|
||||
@@ -35,10 +35,6 @@ if(MACOSX_LEGACY_TARGET)
|
||||
list(APPEND _args -D${_v}=${${_v}})
|
||||
endforeach()
|
||||
endif()
|
||||
# (cmake/haiku.cmake: D-Modem's Haiku toolchain file)
|
||||
if(HAIKU_SYSROOT)
|
||||
list(APPEND _args -DHAIKU_SYSROOT=${HAIKU_SYSROOT} -DHAIKU_TRIPLE=${HAIKU_TRIPLE})
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
list(APPEND _args -DCMAKE_SYSTEM_NAME=iOS)
|
||||
endif()
|
||||
@@ -97,11 +93,6 @@ if(CLANG_DOS)
|
||||
list(APPEND _ssh_args -DHAVE_ARPA_INET_H= -DHAVE_IO_H= -DHAVE_TERMIOS_H=)
|
||||
endif()
|
||||
endif()
|
||||
# (Haiku: getaddrinfo is in libnetwork, which libssh's check does not
|
||||
# link with)
|
||||
if(HAIKU)
|
||||
list(APPEND _ssh_args -DHAVE_GETADDRINFO=1)
|
||||
endif()
|
||||
list(APPEND _ssh_args "-DCMAKE_C_FLAGS=${_ssh_cflags}")
|
||||
|
||||
# (WITH_SERVER: libssh runs a client's callbacks for the channels the
|
||||
|
||||
@@ -150,31 +150,3 @@ dmodem_patch(src/misc.c
|
||||
|
||||
#define dmodem_if_nametoindex if_nametoindex /* D-Modem */
|
||||
")
|
||||
|
||||
# The terminal modes that Haiku's termios.h does not have (IMAXBEL,
|
||||
# VREPRINT, VWERASE, VLNEXT, VDISCARD): sent only where they are.
|
||||
dmodem_patch(src/ttyopts.c
|
||||
" SSH_ENCODE_INPUT_OPT(IMAXBEL)
|
||||
"
|
||||
"#ifdef IMAXBEL /* D-Modem: not on Haiku */
|
||||
SSH_ENCODE_INPUT_OPT(IMAXBEL)
|
||||
#endif
|
||||
")
|
||||
dmodem_patch(src/ttyopts.c
|
||||
" SSH_ENCODE_CC_OPT(VREPRINT)
|
||||
SSH_ENCODE_CC_OPT(VWERASE)
|
||||
SSH_ENCODE_CC_OPT(VLNEXT)
|
||||
"
|
||||
"#ifdef VREPRINT /* D-Modem: not on Haiku */
|
||||
SSH_ENCODE_CC_OPT(VREPRINT)
|
||||
SSH_ENCODE_CC_OPT(VWERASE)
|
||||
SSH_ENCODE_CC_OPT(VLNEXT)
|
||||
#endif
|
||||
")
|
||||
dmodem_patch(src/ttyopts.c
|
||||
" SSH_ENCODE_CC_OPT(VDISCARD)
|
||||
"
|
||||
"#ifdef VDISCARD /* D-Modem: not on Haiku */
|
||||
SSH_ENCODE_CC_OPT(VDISCARD)
|
||||
#endif
|
||||
")
|
||||
@@ -13,12 +13,6 @@
|
||||
* USB maker and product of each port. A MultiTech MT9234MU with no
|
||||
* firmware has no port: ports_problem() tells you what to do.
|
||||
* - macOS (winport/): the /dev/cu.* devices.
|
||||
* - Haiku (winport/): the devices in /dev/ports: pc_serial0 and the
|
||||
* other ports of the computer, and usb0 and the other USB serial
|
||||
* ports and USB modems (CDC-ACM) of the usb_serial driver, with the
|
||||
* USB maker and product of each one from the USB Kit
|
||||
* (ports_haiku.cpp). A CDC-ACM device that takes AT commands is a
|
||||
* modem.
|
||||
*/
|
||||
#include "app.h"
|
||||
|
||||
@@ -288,118 +282,6 @@ void ports_problem(char *out, int n)
|
||||
out[0] = '\0';
|
||||
}
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
|
||||
#include "ports_haiku.h"
|
||||
|
||||
/* the directory of the serial ports (a test can give another one) */
|
||||
#ifndef PORTS_DEVDIR
|
||||
#define PORTS_DEVDIR "/dev/ports"
|
||||
#endif
|
||||
|
||||
/* Compares two port names for qsort: in the order of their names. */
|
||||
static int by_name(const void *a, const void *b)
|
||||
{
|
||||
return strcmp(((const PortInfo *)a)->name, ((const PortInfo *)b)->name);
|
||||
}
|
||||
|
||||
/* Gives the ports of /dev/ports in the order of their names, with the
|
||||
names of their USB devices and the CDC-ACM modems from the USB Kit. */
|
||||
int ports_list(PortInfo *out, int max)
|
||||
{
|
||||
int count = 0;
|
||||
DIR *d = opendir(PORTS_DEVDIR);
|
||||
if (!d)
|
||||
return 0;
|
||||
struct dirent *e;
|
||||
while ((e = readdir(d)) != NULL) {
|
||||
const char *n = e->d_name;
|
||||
if (n[0] == '.')
|
||||
continue;
|
||||
char path[64];
|
||||
_snprintf(path, sizeof(path), PORTS_DEVDIR "/%s", n);
|
||||
path[sizeof(path) - 1] = '\0';
|
||||
/* (usb_serial names each USB port usbN: a serial adapter
|
||||
or a CDC-ACM modem; the ports of the computer are
|
||||
pc_serialN) */
|
||||
count = add(out, count, max, path,
|
||||
!strncmp(n, "usb", 3) ? "USB serial port or modem" :
|
||||
!strncmp(n, "pc_serial", 9) ? "Serial port" : NULL,
|
||||
0);
|
||||
}
|
||||
closedir(d);
|
||||
/* (the order of COM1, COM2 and on in clang-retro MFC) */
|
||||
qsort(out, (size_t)count, sizeof(out[0]), by_name);
|
||||
|
||||
/* The USB devices with a usbN port, in the order of their places
|
||||
on the buses, which is the order that usb_serial numbers them
|
||||
in when the computer starts. When there are as many devices as
|
||||
usbN ports, each port gets the maker, the product and the modem
|
||||
flag of its device. */
|
||||
HaikuUsbSerial usb[32];
|
||||
int n_usb = haiku_usb_serial(usb, 32), n_serial = 0;
|
||||
for (int i = 0; i < n_usb; i++)
|
||||
if (usb[i].has_port)
|
||||
usb[n_serial++] = usb[i];
|
||||
int n_ports = 0;
|
||||
for (int i = 0; i < count; i++)
|
||||
if (!strncmp(out[i].name, PORTS_DEVDIR "/usb", sizeof(PORTS_DEVDIR "/usb") - 1))
|
||||
n_ports++;
|
||||
if (n_serial > 0 && n_serial == n_ports) {
|
||||
int k = 0;
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (strncmp(out[i].name, PORTS_DEVDIR "/usb", sizeof(PORTS_DEVDIR "/usb") - 1))
|
||||
continue;
|
||||
if (usb[k].desc[0])
|
||||
copy(out[i].desc, usb[k].desc, sizeof(out[i].desc));
|
||||
const char *mt = NULL;
|
||||
for (int m = 0; m < N_MULTITECH; m++) {
|
||||
char pid[8];
|
||||
_snprintf(pid, sizeof(pid), "%04x", usb[k].product);
|
||||
pid[sizeof(pid) - 1] = '\0';
|
||||
if (usb[k].vendor == 0x06e0 && !_stricmp(pid, multitech[m].product))
|
||||
mt = multitech[m].name;
|
||||
}
|
||||
if (mt)
|
||||
copy(out[i].desc, mt, sizeof(out[i].desc));
|
||||
out[i].modem = usb[k].modem || mt;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
modems_first(out, count);
|
||||
return count;
|
||||
}
|
||||
|
||||
/* Tells why a modem that is connected has no port on Haiku (the
|
||||
MultiTech MT9234MU has no driver), or gives an empty string. */
|
||||
void ports_problem(char *out, int n)
|
||||
{
|
||||
if (n <= 0)
|
||||
return;
|
||||
out[0] = '\0';
|
||||
/* A MultiTech modem with no usbN port: usb_serial has no driver
|
||||
for its USB UART (a TI TUSB3410). */
|
||||
HaikuUsbSerial usb[32];
|
||||
int n_usb = haiku_usb_serial(usb, 32);
|
||||
for (int i = 0; i < n_usb; i++) {
|
||||
if (usb[i].vendor != 0x06e0 || usb[i].has_port)
|
||||
continue;
|
||||
for (int m = 0; m < N_MULTITECH; m++) {
|
||||
char pid[8];
|
||||
_snprintf(pid, sizeof(pid), "%04x", usb[i].product);
|
||||
pid[sizeof(pid) - 1] = '\0';
|
||||
if (_stricmp(pid, multitech[m].product))
|
||||
continue;
|
||||
_snprintf(out, (size_t)n,
|
||||
"%s: Haiku has no serial port driver for "
|
||||
"this modem. Use a modem with a serial port, "
|
||||
"or a CDC-ACM USB modem.", multitech[m].name);
|
||||
out[n - 1] = '\0';
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else /* Linux */
|
||||
|
||||
/* the root of sysfs (a test can give another one) */
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* Copyright (C) 2026 D-Modem Authors
|
||||
*
|
||||
* ports_haiku.cpp - the USB serial devices of a Haiku computer, from
|
||||
* the USB Kit, for ports.cpp ("Look for a modem").
|
||||
*
|
||||
* This file uses Haiku's headers and none of the Windows headers (their
|
||||
* types clash). ports.cpp calls haiku_usb_serial() and matches the
|
||||
* devices to the usbN ports of the usb_serial driver.
|
||||
*/
|
||||
#if defined(__HAIKU__)
|
||||
|
||||
#include "ports_haiku.h"
|
||||
|
||||
#include <USBKit.h>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/* The vendors of the USB serial adapters that usb_serial knows: FTDI,
|
||||
KLSI, Prolific, Silicon Labs and WinChipHead */
|
||||
static const uint16 serial_vendors[] = { 0x0403, 0x05e9, 0x067b, 0x10c4, 0x1a86 };
|
||||
|
||||
/* Gives the paths of the USB devices under dir (/dev/bus/usb), in the
|
||||
order of their names, each hub with the devices on it after it. */
|
||||
static void walk(const std::string &dir, std::vector<std::string> *out)
|
||||
{
|
||||
DIR *d = opendir(dir.c_str());
|
||||
if (!d)
|
||||
return;
|
||||
std::vector<std::string> names;
|
||||
struct dirent *e;
|
||||
while ((e = readdir(d)) != NULL)
|
||||
if (e->d_name[0] != '.')
|
||||
names.push_back(e->d_name);
|
||||
closedir(d);
|
||||
std::sort(names.begin(), names.end());
|
||||
for (const std::string &n : names) {
|
||||
std::string p = dir + "/" + n;
|
||||
struct stat st;
|
||||
if (stat(p.c_str(), &st) != 0)
|
||||
continue;
|
||||
if (S_ISDIR(st.st_mode))
|
||||
walk(p, out);
|
||||
else if (n != "hub")
|
||||
out->push_back(p);
|
||||
}
|
||||
}
|
||||
|
||||
/* Tells if a device has a CDC-ACM interface (class 2, subclass 2), and
|
||||
if that interface takes AT commands (protocol 1, V.250): a modem. */
|
||||
static bool acm(const BUSBDevice &dev, bool *at)
|
||||
{
|
||||
*at = false;
|
||||
bool found = dev.Class() == 2 && dev.Subclass() == 2;
|
||||
if (found && dev.Protocol() == 1)
|
||||
*at = true;
|
||||
const BUSBConfiguration *c = dev.ActiveConfiguration();
|
||||
if (!c && dev.CountConfigurations() > 0)
|
||||
c = dev.ConfigurationAt(0);
|
||||
for (uint32 i = 0; c && i < c->CountInterfaces(); i++) {
|
||||
const BUSBInterface *itf = c->InterfaceAt(i);
|
||||
if (!itf || itf->Class() != 2 || itf->Subclass() != 2)
|
||||
continue;
|
||||
found = true;
|
||||
if (itf->Protocol() == 1)
|
||||
*at = true;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
/* Gives the USB devices (at most max, hubs not included) in the order
|
||||
of their places on the USB buses, with the vendors and products, if
|
||||
usb_serial makes a port for each, and if each is a modem. */
|
||||
int haiku_usb_serial(HaikuUsbSerial *out, int max)
|
||||
{
|
||||
std::vector<std::string> paths;
|
||||
walk("/dev/bus/usb", &paths);
|
||||
int n = 0;
|
||||
for (const std::string &p : paths) {
|
||||
if (n >= max)
|
||||
break;
|
||||
BUSBDevice dev(p.c_str());
|
||||
if (dev.InitCheck() != B_OK || dev.IsHub())
|
||||
continue;
|
||||
bool at = false;
|
||||
bool is_acm = acm(dev, &at);
|
||||
bool serial = is_acm;
|
||||
for (uint16 v : serial_vendors)
|
||||
if (dev.VendorID() == v)
|
||||
serial = true;
|
||||
HaikuUsbSerial *s = &out[n];
|
||||
memset(s, 0, sizeof(*s));
|
||||
s->vendor = dev.VendorID();
|
||||
s->product = dev.ProductID();
|
||||
s->has_port = serial;
|
||||
s->modem = at;
|
||||
const char *maker = dev.ManufacturerString();
|
||||
const char *product = dev.ProductString();
|
||||
snprintf(s->desc, sizeof(s->desc), "%s%s%s", maker ? maker : "",
|
||||
maker && *maker && product && *product ? " " : "",
|
||||
product ? product : "");
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* Copyright (C) 2026 D-Modem Authors
|
||||
*
|
||||
* ports_haiku.h - the USB devices of a Haiku computer (ports_haiku.cpp),
|
||||
* for ports.cpp. It uses neither the Windows headers
|
||||
* nor Haiku's, so that both files can include it.
|
||||
*/
|
||||
#ifndef DMODEM_PORTS_HAIKU_H
|
||||
#define DMODEM_PORTS_HAIKU_H
|
||||
|
||||
/* A USB device, as the USB Kit tells it */
|
||||
typedef struct HaikuUsbSerial {
|
||||
unsigned short vendor, product;
|
||||
int has_port; /* usb_serial makes a usbN port for it */
|
||||
int modem; /* a CDC-ACM interface that takes AT commands */
|
||||
char desc[128]; /* its maker and product, from the device */
|
||||
} HaikuUsbSerial;
|
||||
|
||||
/* Gives the USB devices (at most max, hubs not included), in the order
|
||||
of their places on the USB buses. */
|
||||
int haiku_usb_serial(HaikuUsbSerial *out, int max);
|
||||
|
||||
#endif
|
||||
@@ -71,6 +71,17 @@ static HANDLE proc;
|
||||
#endif
|
||||
#define ATTR_PSEUDOCONSOLE 0x00020016
|
||||
|
||||
/* (the Win32 layer of clang-retro MFC has no console API and no COORD:
|
||||
the Windows app on another system with no SSH, as on the classic Mac
|
||||
OS. There, the look-up of ConPTY fails and SSH is not available.) */
|
||||
#if defined(DMODEM_WINPORT) && !defined(_COORD_DEFINED)
|
||||
#define _COORD_DEFINED
|
||||
typedef struct _COORD {
|
||||
SHORT X;
|
||||
SHORT Y;
|
||||
} COORD;
|
||||
#endif
|
||||
|
||||
typedef long (WINAPI *CreatePCFn)(COORD, HANDLE, HANDLE, DWORD, void **);
|
||||
typedef long (WINAPI *ResizePCFn)(void *, COORD);
|
||||
typedef void (WINAPI *ClosePCFn)(void *);
|
||||
|
||||
+16
-27
@@ -1,14 +1,8 @@
|
||||
# The Windows app (windows/) for Linux, macOS and Haiku, over the
|
||||
# portable Win32 layer of clang-retro MFC (libwinport, in port/ of that
|
||||
# project).
|
||||
# The Windows app (windows/) for Linux and macOS, over the portable Win32
|
||||
# layer of clang-retro MFC (libwinport, in port/ of that project).
|
||||
#
|
||||
# cmake -B build -DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc \
|
||||
# -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
||||
#
|
||||
# Haiku, from Linux (cmake/haiku.cmake and docs/haiku.md):
|
||||
#
|
||||
# cmake -B build -DDMODEM_GUI_WINPORT=ON -DCLANG_RETRO_MFC=/path/to/mfc \
|
||||
# -DCMAKE_TOOLCHAIN_FILE=cmake/haiku.cmake -DHAIKU_SYSROOT=/path/to/sysroot
|
||||
enable_language(CXX)
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
@@ -46,14 +40,14 @@ else()
|
||||
set(_arch_linux x86_64)
|
||||
set(_arch_apple x86_64)
|
||||
endif()
|
||||
if(MACOSX_LEGACY_TARGET)
|
||||
if(MACOS9_TARGET)
|
||||
# The classic Mac OS on PowerPC (cmake/macos9.cmake)
|
||||
set(WINPORT_TARGET "${MACOS9_TARGET}")
|
||||
elseif(MACOSX_LEGACY_TARGET)
|
||||
# Mac OS X 10.4 and later (cmake/macosx-legacy.cmake)
|
||||
set(WINPORT_TARGET "${MACOSX_LEGACY_TARGET}")
|
||||
elseif(APPLE)
|
||||
set(WINPORT_TARGET "${_arch_apple}-apple-macos11")
|
||||
elseif(HAIKU)
|
||||
# (the Haiku toolchain file gives the triple and the sysroot)
|
||||
set(WINPORT_TARGET "${HAIKU_TRIPLE}")
|
||||
else()
|
||||
set(WINPORT_TARGET "${_arch_linux}-linux-gnu")
|
||||
endif()
|
||||
@@ -68,7 +62,10 @@ ProcessorCount(_ncpu)
|
||||
if(_ncpu EQUAL 0)
|
||||
set(_ncpu 1)
|
||||
endif()
|
||||
if(MACOSX_LEGACY_TARGET)
|
||||
if(MACOS9_TARGET)
|
||||
# (the Makefile sets the flags of mac-sdk's C and C++ libraries itself)
|
||||
set(_winport_make_args BIN=${MACOS9_LLVM}/bin MACSDK=${MACOS9_SDK})
|
||||
elseif(MACOSX_LEGACY_TARGET)
|
||||
# (the Makefile sets the flags of the 10.4 SDK and libc++ itself.
|
||||
# winhelp_file.cpp uses std::abs with no <cstdlib>: the libc++ of the
|
||||
# sysroot does not give it through <algorithm>.)
|
||||
@@ -76,10 +73,6 @@ if(MACOSX_LEGACY_TARGET)
|
||||
SDK=${MACOSX_LEGACY_SDK} LIBCXX=${MACOSX_LEGACY_SYSROOT}
|
||||
CCTOOLS=${MACOSX_LEGACY_CCTOOLS}/bin/powerpc-apple-darwin8-
|
||||
"CXXFLAGS=-O2 -include cstdlib")
|
||||
elseif(HAIKU)
|
||||
# (Haiku's C++ library is libstdc++, which the sysroot has)
|
||||
set(_winport_make_args STDLIB= CXX=${_winport_cxx} AR=${CMAKE_AR}
|
||||
SYSROOT=${HAIKU_SYSROOT})
|
||||
else()
|
||||
set(_winport_make_args STDLIB= CXX=${_winport_cxx} AR=${CMAKE_AR})
|
||||
endif()
|
||||
@@ -127,20 +120,16 @@ if(DMODEM_GUI_EMBED AND TARGET dmodem_embed)
|
||||
target_link_libraries(dmodem-win32 PRIVATE dmodem_embed)
|
||||
target_compile_definitions(dmodem-win32 PRIVATE DMODEM_GUI_EMBED)
|
||||
endif()
|
||||
if(MACOSX_LEGACY_TARGET)
|
||||
if(MACOS9_TARGET)
|
||||
# (cmake/macos9.cmake links with macapp.py: the C and C++ libraries of
|
||||
# mac-sdk, and the Toolbox. The cooperative threads are in its C
|
||||
# library.)
|
||||
elseif(MACOSX_LEGACY_TARGET)
|
||||
# (cmake/macosx-legacy.cmake adds port/compat/macosx, the C library
|
||||
# functions that 10.4 does not have)
|
||||
target_link_libraries(dmodem-win32 PRIVATE "-framework Cocoa" "-framework OpenGL" pthread)
|
||||
elseif(APPLE)
|
||||
target_link_libraries(dmodem-win32 PRIVATE "-framework Cocoa" pthread)
|
||||
elseif(HAIKU)
|
||||
# (the USB devices for Look for a modem, from the USB Kit:
|
||||
# windows/src/ports_haiku.cpp, with Haiku's headers only)
|
||||
target_sources(dmodem-win32 PRIVATE "${_win}/src/ports_haiku.cpp")
|
||||
# (libbe: the Interface Kit; libdevice: the USB Kit; libnetwork: the
|
||||
# sockets; libbsd: dl_iterate_phdr. libroot has the rest, dlopen and
|
||||
# the threads too.)
|
||||
target_link_libraries(dmodem-win32 PRIVATE be device network bsd)
|
||||
else()
|
||||
target_link_libraries(dmodem-win32 PRIVATE dl pthread)
|
||||
endif()
|
||||
@@ -148,7 +137,7 @@ endif()
|
||||
# The install on Linux (cmake --install): the app, its desktop entry,
|
||||
# its AppStream data and its icon. Also the firmware of the MultiTech
|
||||
# MT9234MU (the licence is unknown: firmware/README.md).
|
||||
if(UNIX AND NOT APPLE AND NOT HAIKU)
|
||||
if(UNIX AND NOT APPLE AND NOT MACOS9_TARGET)
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS dmodem-win32 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES data/io.github.d_modem.DModem.desktop
|
||||
|
||||
Reference in new issue
Block a user