Download src/build.sh from HelloSun/dosmqtt: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/spaces/HelloSun/dosmqtt/resolve/main/src/build.sh
- Command line
-
hf download hf://spaces/HelloSun/dosmqtt/src/build.sh
-
curl -L -o build.sh https://huggingface.co/spaces/HelloSun/dosmqtt/resolve/main/src/build.sh
1.78 kB
| # Build A.EXE and B.EXE (16-bit DOS, small/compact model) with Open Watcom 1.9 against mTCP. | |
| # Needs deps/ (tools/fetch_deps.sh). Output: build/A.EXE, build/B.EXE | |
| # NOTE: do NOT use Open Watcom 2.0 beta: EXEs it builds print "End: heap is corrupted!". | |
| set -euo pipefail | |
| ROOT="$(cd "$(dirname "$0")/.." && pwd)"; D="${DEPS:-$ROOT/deps}"; HERE="$ROOT/src" | |
| export WATCOM="$D/ow19" PATH="$D/ow19/binl:$PATH" INCLUDE="$D/ow19/h" | |
| MTCP_SRC="$(echo "$D"/mtcp-src/mTCP-src_*)" | |
| OUT="$ROOT/build"; rm -rf "$OUT/mtcp" "$OUT/a" "$OUT/b"; mkdir -p "$OUT/mtcp" | |
| # Lowercase mirror of the mTCP sources (Linux is case sensitive, mTCP is not). | |
| for d in TCPINC TCPLIB INCLUDE; do | |
| l="$(echo $d | tr A-Z a-z)"; mkdir -p "$OUT/mtcp/$l" | |
| for f in "$MTCP_SRC/$d"/*; do | |
| sed -E 's/^(\s*#\s*include\s+["<])([^">]+)([">])/\1\L\2\3/' "$f" > "$OUT/mtcp/$l/$(basename "$f" | tr A-Z a-z)" | |
| done | |
| done | |
| LIBS="packet arp eth ip tcp tcpsockm udp utils dns timer trace" | |
| for app in a b g; do | |
| B="$OUT/$app"; mkdir -p "$B"; cp "$HERE/$app.cfg" "$HERE/$app.cpp" "$HERE/mqtt.h" "$B/" | |
| FLAGS="-0 -mc -DCFG_H=\"$app.cfg\" -oh -os -s -zp2 -zpw -we -i=$OUT/mtcp/tcpinc -i=$OUT/mtcp/include -i=$B" | |
| ( cd "$B" | |
| for l in $LIBS; do wpp "$OUT/mtcp/tcplib/$l.cpp" $FLAGS -fo=$l.obj >/dev/null; done | |
| wasm -0 -mc "$OUT/mtcp/tcplib/ipasm.asm" -fo=ipasm.obj >/dev/null | |
| wpp $app.cpp $FLAGS -fo=$app.obj | grep -v "^Open Watcom\|^Version\|^Copyright\|^Portions\|^Source code\|^See https" || true | |
| wlink system dos option map option eliminate option stack=4096 name $app.exe \ | |
| file $(for l in $LIBS ipasm $app; do printf "$l.obj,"; done | sed 's/,$//') >link.log 2>&1 || { cat link.log; exit 1; } | |
| ) | |
| U="$(echo $app | tr a-z A-Z)"; cp "$B/$app.exe" "$OUT/$U.EXE"; ls -l "$OUT/$U.EXE" | |
| done | |