Skip to content

Commit

Permalink
SCP: Update NAT support to libslirp 4.8.0
Browse files Browse the repository at this point in the history
Rip-n-replace the older slirp implementation with libslirp 4.8.0 and a
minimal glib stub implementation. No SIMH-specific modifications were
made to libslirp so that future updates are easier to apply.

Other changes:

- ETHER: Move UNIT service activation earlier

  Move the UNIT service activation to after the packet is placed in the
  Ethernet interface's read queue, vs where the "wakeup" was in the
  reader thread's loop. If AIO ism't pending for the UNIT, the UNIT gets
  scheduled via sim_activate_abs(). Uses sim_unit_aio_pending()

  Solves a mystery stall when trying to FTP NetBSD's pkgsrc archive.

- SCP: sim_unit_aio_pending()

  Add a predicate function that returns TRUE if the UNIT has pending
  asynchronous I/O work to be done. Used in _eth_callback (sim_ether.c)
  to schedule the UNIT's service function if necessary (no need to
  schedule the service function if it's already going to be called.)
  Does not depend on being in the main SIM thread.

- SCP: sim_misc_debug()

  sim_misc_debug() enables debug output from non-devices, e.g., libslirp's
  debug output, for consistent output formatting.

  This change includes a separate debugging mutex, which removes the
  dependency (dual use) on the AIO mutex.

- CONSOLE: Don't repeatedly call GetConsoleMode() on Win32 each time
  sim_console_write() is called. Use an output function pointer to
  invoke WriteConsoleA (console output) or WriteFile (output is not a
  console).

- CMake

  - Clang updates for Windows (CLANG64 environment from MinGW64).

  - MinGW64 environment: Place binaries under BIN/$MSYSTEM, keep
    BIN/Win32/_config_ reserved for MS-compiled simulators.

- Fix printf() formats for MinGW64-related compiles.

- makefile

  - SDL2_ttf: Only generate info messages iff BESM6 is going to be
    compiled. Do no generate SDL TTF or missing font file warnings when
    compiling pdp11 or any other simulator.

  - SYS_LDFLAGS: System (non-feature) libraries that should be appended to
    the compiler's command line, such as -lm, -lpthread, -lrt and -ldl.

  - Detect features required by the libslirp.a library by compiling a
    small configuration program. (NOTE: This technique can be expanded
    to detect other simulator-required or SIMH-required features.)

  - Use a library, BIN/libslirp.dir/libslirp.a, to provide libslirp
    support rather than compiling libslirp/src/*.c for each simulator that
    uses networking support.

  - Per-simulator "_LDFLAGS" so that only only the libraries needed are
    provided to the compiler. Only added to simulators that use video and
    networking. No real point in dragging SDL2_ttf into simulators other
    than BESM6, for example.
  • Loading branch information
bscottm committed Dec 6, 2024
1 parent 2437b13 commit 493ccec
Show file tree
Hide file tree
Showing 256 changed files with 27,808 additions and 14,574 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ defaults:

jobs:
cmake-builds:
name: CMake
uses: ./.github/workflows/cmake-builds.yml

makefile:
Expand All @@ -40,28 +41,26 @@ jobs:
- scelbi 3b2 i701 i704 i7010 i7070 i7080 i7090 sigma uc15 i650 sel32 intel-mds ibm1130
steps:
- uses: actions/checkout@v4
## Workaround for remnant symlinks in /usr/local pointing back to
## macOS frameworks.
##
## Future: Will have to keep an eye on SDL_ttf's Python dependency
## so that the correct/appropriate Python version is removed.
- name: Remnant symlink cleanup (macOS)

## Nuke homebrew and start with a clean instance:
- name: Reinstall HomeBrew (macOS)
if: ${{runner.os == 'macOS'}}
run: |
brew unlink python@3 || true
brew uninstall --ignore-dependencies python@3 || true
brew unlink [email protected] || true
brew uninstall --ignore-dependencies [email protected] || true
for f in $(find /usr/local/bin -type l -print); do \
(readlink $f | grep -q -s "/Library") && echo Removing "$f" && rm -f "$f"; \
done || exit 0
/usr/bin/sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
[ -d /opt/homebrew ] && ( sudo rm -rf /opt/homebrew/* || true )
[ -d /usr/local ] && ( sudo rm -rf /usr/local/* || true )
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
## Install our regular dependencies.
- name: Install dependencies (macOS)
if: ${{runner.os == 'macOS'}}
run: sh -ex .travis/deps.sh osx
run: |
sh -ex .travis/deps.sh osx
- name: Install dependencies (Linux)
if: ${{runner.os == 'Linux'}}
run: sh -ex .travis/deps.sh linux

- name: makefile build
env:
SIM: ${{matrix.simulators}}
Expand Down
83 changes: 56 additions & 27 deletions .github/workflows/cmake-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
run: |
sh -ex .travis/deps.sh linux
sudo apt install -ym ninja-build
- name: cmake-builder.sh
run: |
cmake/cmake-builder.sh --config Release --flavor ninja --lto --notest --parallel --verbose --cpack_suffix x86_64-${{matrix.os}}
Expand All @@ -47,7 +48,7 @@ jobs:


cmake-macOS:
name: macOS 12+
name: macOS
runs-on: ${{ matrix.os }}
strategy:
#-
Expand All @@ -57,32 +58,35 @@ jobs:
# that the build produces.
#
# (*) "artefact" for the rest of the Anglosphere -
#
# As of 18 NOV 2024, Github deprecated macos-12.
matrix:
os: [macos-12, macos-13, macos-14]
os: [macos-13, macos-14]

env:
CPACK_SUFFIX: ${{matrix.os != 'macos-14' && 'x86_64' || 'm1'}}.${{matrix.os}}

steps:
- uses: actions/checkout@v4

## Workaround for remnant symlinks in /usr/local pointing back to
## macOS frameworks.
##
## Future: Will have to keep an eye on SDL_ttf's Python dependency
## so that the correct/appropriate Python version is removed.
- name: Remnant symlink cleanup
run: |
brew unlink python@3 || true
brew uninstall --ignore-dependencies python@3 || true
brew unlink [email protected] || true
brew uninstall --ignore-dependencies [email protected] || true
for f in $(find /usr/local/bin -type l -print); do \
(readlink $f | grep -q -s "/Library") && echo Removing "$f" && rm -f "$f"; \
done || exit 0
## Nuke homebrew and start with a clean instance.
- name: Reinstall HomeBrew (macOS)
run: |
/usr/bin/sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
[ -d /opt/homebrew ] && ( sudo rm -rf /opt/homebrew/* || true )
[ -d /usr/local ] && ( sudo rm -rf /usr/local/* || true )
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- name: Install dependencies
run: sh -ex .travis/deps.sh osx
run: |
sh -ex .travis/deps.sh osx
- name: libslirp module
run: |
git submodule sync
git submodule set-url -- libslirp https://gitlab.freedesktop.org/bscottmichel/libslirp-minimal.git
git submodule set-branch --branch incr-minimal libslirp
git submodule update --init --recursive --remote
- name: cmake-builder.sh
run: |
Expand Down Expand Up @@ -123,6 +127,12 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: libslirp module
run: |
git submodule sync
git submodule set-url -- libslirp https://gitlab.freedesktop.org/bscottmichel/libslirp-minimal.git
git submodule set-branch --branch incr-minimal libslirp
git submodule update --init --recursive --remote
- name: Install v141_xp (XP toolkit) and build SIMH
shell: pwsh
run: |
Expand Down Expand Up @@ -189,8 +199,25 @@ jobs:
cmake-vs2022:
name: VS 2022 Win10 native VCPKG
runs-on: windows-latest
strategy:
#-
# The CMake builds produce artifacts (*) and the runner image's name is
# used in the artifact's name, simh-4.1.0-x86_64-ubuntu-20.04.deb.
# Consequently, each runner image is enumerated for each artifact (*)
# that the build produces.
#
# (*) "artefact" for the rest of the Anglosphere
#-
matrix:
build: [vs2022, vs2022-x64]
steps:
- uses: actions/checkout@v4
- name: libslirp module
run: |
git submodule sync
git submodule set-url -- libslirp https://gitlab.freedesktop.org/bscottmichel/libslirp-minimal.git
git submodule set-branch --branch incr-minimal libslirp
git submodule update --init --recursive --remote
- name: vs2022 build
shell: pwsh
run: |
Expand All @@ -206,34 +233,36 @@ jobs:
Push-Location $env:VCPKG_ROOT
git pull
Pop-Location
./cmake/cmake-builder.ps1 -flavor vs2022 -config Release -clean -lto -verbose -notest -cpack_suffix win32-native
./cmake/cmake-builder.ps1 -flavor ${{matrix.build}} -config Release -clean -lto -verbose `
-notest `
-cpack_suffix ${{matrix.build}}
- name: SIMH simulator suite test
shell: pwsh
run: |
./cmake/cmake-builder.ps1 -flavor vs2022 -config Release -testOnly
./cmake/cmake-builder.ps1 -flavor ${{matrix.build}} -config Release -testOnly
## Install isn't strictly necessary, but it's a good way to see what dependencies
## (IMPORTED_RUNTIME_ARTIFACTS) get installed.
- name: Install
shell: pwsh
run: |
cmake/cmake-builder.ps1 -config Release -flavor vs2022 -installOnly
cmake/cmake-builder.ps1 -config Release -flavor ${{matrix.build}} -installOnly
- name: SIMH packaging
shell: pwsh
run: |
cd cmake\build-vs2022
cd cmake\build-${{matrix.build}}
cpack -G "NSIS;WIX;ZIP" -C Release
- name: Upload ZIP
uses: actions/upload-artifact@v4
with:
name: simh-4.1.0-win32-vs2022.zip
path: cmake/build-vs2022/simh-4.1.0-win32-native.zip
name: simh-4.1.0-${{matrix.build}}.zip
path: cmake/build-${{matrix.build}}/simh-4.1.0-${{matrix.build}}.zip
- name: Upload EXE installer
uses: actions/upload-artifact@v4
with:
name: simh-4.1.0-win32-vs2022.exe
path: cmake/build-vs2022/simh-4.1.0-win32-native.exe
name: simh-4.1.0-${{matrix.build}}.exe
path: cmake/build-${{matrix.build}}/simh-4.1.0-${{matrix.build}}.exe
- name: Upload MSI installer
uses: actions/upload-artifact@v4
with:
name: simh-4.1.0-win32-vs2022.msi
path: cmake/build-vs2022/simh-4.1.0-win32-native.msi
name: simh-4.1.0-${{matrix.build}}.msi
path: cmake/build-${{matrix.build}}/simh-4.1.0-${{matrix.build}}.msi
15 changes: 14 additions & 1 deletion .travis/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ install_linux() {
sudo apt-get install -ym cmake cmake-data
}

install_mingw32() {
## Doesn't have libpcap or cmake's extra modules. Not that this
## makes much of a difference.
pacman -S --needed mingw-w64-i686-ninja \
mingw-w64-i686-cmake \
mingw-w64-i686-gcc \
mingw-w64-i686-make \
mingw-w64-i686-pcre \
mingw-w64-i686-freetype \
mingw-w64-i686-SDL2 \
mingw-w64-i686-SDL2_ttf
}

install_mingw64() {
pacman -S --needed mingw-w64-x86_64-ninja \
mingw-w64-x86_64-cmake \
Expand Down Expand Up @@ -71,7 +84,7 @@ install_clang64() {


case "$1" in
osx|macports|linux|mingw64|ucrt64|clang64)
osx|macports|linux|mingw32|mingw64|ucrt64|clang64)
install_"$1"
;;
arch-linux)
Expand Down
Loading

0 comments on commit 493ccec

Please sign in to comment.