Build legacy drivers and publish per-OS packages with web activation and DEB

This commit is contained in:
2026-11-27 20:55:31 +00:00
96 changed files with 3204 additions and 25 deletions

View File

@@ -12,7 +12,7 @@ done
grep -Fq '#include "config.h"' "$root/include/net.h" || exit 1
sed -i '0,/#include "config.h"/s//#include "config.h"\n#undef SIOCIPXNCPCONN\n#undef CALL_NWCONN_OVER_SOCKET\n#define CALL_NWCONN_OVER_SOCKET 0/' "$root/include/net.h"
find "$root/src" "$root/include" -type f \( -name '*.c' -o -name '*.h' \) -exec sed -Ei 's@/proc/net/ipx(_interface|_route)?(["\x27])@/run/mars-pcap/ipx\1\2@g' {} +
if grep -En '\bsocket[[:space:]]*\([[:space:]]*(AF|PF)_IPX\b' "$root"/src/*.c; then echo 'Unported direct IPX socket call' >&2; exit 1; fi
if grep -En '\bsocket[[:space:]]*\([[:space:]]*(AF|PF)_IPX\b' "$root"/src/emutli.c "$root"/src/emutli1.c; then echo 'Unported direct IPX socket call' >&2; exit 1; fi
cp "$here/src/shim.h" "$root/include/mars_pcap_shim.h"
cat >> "$root/src/CMakeLists.txt" <<'CMAKE'
# MARS_PCAP_PORT_V1
@@ -58,3 +58,20 @@ f="$root/src/ftrustee.c"
cp "$here/upstream-adapter/mars_trustee.inc" "$root/src/"
sed -i '/^int main(int argc, char \*argv\[\])/i #include "mars_trustee.inc"' "$f"
sed -i '/^ localinit();/a\ if (argc > 1 \&\& !strcmp(argv[1], "--mars-admin")) return mt_admin(argc, argv);' "$f"
# Modern glibc removed sys_errlist/sys_nerr; strerror preserves error text.
sed -i -e 's/errnum > 0 \&\& errnum < _sys_nerr/errnum > 0/g' -e 's/errnum >= 0 \&\& errnum < _sys_nerr/errnum >= 0/g' -e 's/_sys_errlist\[errnum\]/strerror(errnum)/g' "$root/src/tools.c"
# Use libc poll declarations with the native admin adapter; retain the old
# select-based helper under a private name instead of interposing libc poll.
python3 - "$root" <<'PY'
import pathlib,sys,re
root=pathlib.Path(sys.argv[1])
p=root/'include/emutli.h';s=p.read_text();s=re.sub(r'struct pollfd \{.*?#define POLLPRI[^\n]*', '#include <poll.h>', s, flags=re.S);s=re.sub(r'extern int poll\([^;]+;', '',s);p.write_text(s)
p=root/'src/emutli.c';s=p.read_text().replace('int poll(', 'int mars_legacy_poll(');p.write_text(s)
PY
# LOCALSTATEDIR is absolute in our build; avoid //var (network-path DESTDIR error).
sed -i 's@"/${CMAKE_INSTALL_LOCALSTATEDIR}/@"${CMAKE_INSTALL_LOCALSTATEDIR}/@g' "$root/cmake/modules/MarsNweInstallDirs.cmake"
# Upstream renamed the printer helper to _prn without updating installation.
sed -i 's@install(FILES prn DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})@install(FILES _prn DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR} RENAME prn)@' "$root/opt/CMakeLists.txt"