From 4c58d4c7e2e7e94293f11bd2b7484219c89b1c6b Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Wed, 7 Feb 2024 18:40:30 +0000 Subject: [PATCH] CI: Add DOS builds 1/ Watcom 1.9 a) Kernel and other directories building fine b) Share doesn't support Watcom for TSR. 2/ Turbo C 2.01 a) Kernel build needs some functions that are missing. b) Sys not building for the same reason, c) Share building nicely. d) Need to figure out how to get tc201 compiler to Github Actions 3/ IA16-GCC a) not currently supported by build.bat so commented out --- .github/workflows/ci-build.yml | 5 +-- ci_build.sh | 78 +++++++++++++++++++++++++++++++--- ci_prereq.sh | 63 +++++++++++++++++++++++++++ 3 files changed, 137 insertions(+), 9 deletions(-) create mode 100755 ci_prereq.sh diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 37e16a5..74348dd 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -23,10 +23,7 @@ jobs: submodules: recursive - name: Package install - run: | - sudo add-apt-repository ppa:tkchia/build-ia16 - sudo apt update - sudo apt install gcc-ia16-elf libi86-ia16-elf nasm upx qemu-system-x86 mtools util-linux bash + run: ./ci_prereq.sh - name: build run: ./ci_build.sh diff --git a/ci_build.sh b/ci_build.sh index 2ddc95f..2edbf63 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -15,15 +15,20 @@ OWTAR=ow-snapshot.tar.xz # GCC mkdir _output/gcc -git clean -x -d -f -e test -e _output -e _watcom -e $OWTAR +git clean -x -d -f -e test -e _output -e _downloads -e _watcom -e $OWTAR make -C country clean make all COMPILER=gcc mv -n bin/KGC*.map bin/KGC*.sys _output/gcc/. mv -n bin/country.sys _output/gcc/. # GCC share -(cd share && make clobber && env COMPILER=gcc ./build.sh) -mv -n share/share.com _output/gcc/. -mv -n share/share.map _output/gcc/. +( + cd share + git submodule update --init --recursive + git clean -x -d -f + env COMPILER=gcc ./build.sh +) +mv -n share/src/share.com _output/gcc/. +mv -n share/src/share.map _output/gcc/. # Watcom if [ ! -d _watcom ] ; then @@ -37,10 +42,73 @@ export PATH=$BUILD_DIR/bin:$PATH:$BUILD_DIR/_watcom/binl64 export WATCOM=$BUILD_DIR/_watcom mkdir _output/wc -git clean -x -d -f -e test -e _output -e _watcom -e $OWTAR +git clean -x -d -f -e test -e _output -e _downloads -e _watcom -e $OWTAR make -C country clean make all COMPILER=owlinux mv -n bin/KWC*.map bin/KWC*.sys _output/wc/. mv -n bin/country.sys _output/wc/. +## DOS (GCC) +#mkdir _output/gcc_dos +#git clean -x -d -f -e test -e _output -e _downloads -e _watcom -e $OWTAR +#{ +# echo set COMPILER=GCC +# echo set MAKE=make +# echo set XCPU=386 +# echo set XFAT=32 +# echo set XNASM='C:\\devel\\nasm\\nasm' +# echo set OLDPATH=%PATH% +# echo set PATH='C:\\devel\\i16gnu\\bin;C:\\bin;%OLDPATH%' +#} | unix2dos > config.bat + +#dosemu -td -q -K . -E "build.bat" + +# DOS (Watcom) +mkdir _output/wc_dos +git clean -x -d -f -e test -e _output -e _downloads -e _watcom -e $OWTAR +{ + echo set COMPILER=WATCOM + echo set WATCOM='C:\\devel\\watcomc' + echo set MAKE=wmake /ms + echo set XCPU=386 + echo set XFAT=32 + echo set XNASM='C:\\devel\\nasm\\nasm' + echo set OLDPATH=%PATH% + echo set PATH='C:\\devel\\watcomc\\binw;C:\\bin;%OLDPATH%' +} | unix2dos > config.bat + +dosemu -td -q -K . -E "build.bat" +mv -n bin/KWC*.map bin/KWC*.sys _output/wc_dos/. +mv -n bin/country.sys _output/wc_dos/. + + +# DOS (Turbo C 2.01) +if [ -d ${HOME}/.dosemu/drive_c/tc201 ] ; then + mkdir _output/tc_dos + git clean -x -d -f -e test -e _output -e _downloads -e _watcom -e $OWTAR + { + echo set COMPILER=TC2 + echo set TC2_BASE='C:\\tc201' + echo set MAKE=make + echo set XCPU=386 + echo set XFAT=32 + echo set XNASM=nasm + echo set OLDPATH=%PATH% + echo set PATH='%TC2_BASE%;C:\\devel\\nasm;C:\\bin;%OLDPATH%' + } | unix2dos > config.bat + + dosemu -td -q -K . -E "build.bat lfn" + mv -n bin/KTC*.map bin/KTC*.sys _output/tc_dos/. + mv -n bin/country.sys _output/tc_dos/. + # TC share + ( + cd share + git submodule update --init --recursive + git clean -x -d -f + env COMPILER=tcc2-emu ./build.sh + ) + mv -n share/src/share.com _output/tc_dos/. + mv -n share/src/share.map _output/tc_dos/. +fi + echo done diff --git a/ci_prereq.sh b/ci_prereq.sh new file mode 100755 index 0000000..e5d2e80 --- /dev/null +++ b/ci_prereq.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +set -e + +sudo add-apt-repository -y ppa:tkchia/build-ia16 +sudo add-apt-repository -y ppa:dosemu2/ppa +sudo apt update + +# for cross building +sudo apt install gcc-ia16-elf libi86-ia16-elf nasm upx qemu-system-x86 mtools util-linux bash + +# for building with DOS using an emulator +sudo apt install dosemu2 dos2unix +# Perhaps later we should build using Freecom from published package + +mkdir -p _downloads +cd _downloads + +HERE=$(pwd) + +#IBIBLIO_PATH='http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/devel' +IBIBLIO_PATH='https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/repositories/1.3/devel' + +# get gnumake for DOS +[ -f djgpp_mk.zip ] || wget --no-verbose ${IBIBLIO_PATH}/djgpp_mk.zip + +# get nasm for DOS +[ -f nasm.zip ] || wget --no-verbose ${IBIBLIO_PATH}/nasm.zip + +# get upx for DOS +[ -f upx.zip ] || wget --no-verbose ${IBIBLIO_PATH}/upx.zip + +# grab ia16-gcc from ibiblio.org +#[ -f i16gcc.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16gcc.zip +#[ -f i16newli.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16newli.zip +#[ -f i16butil.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16butil.zip +#[ -f i16lbi86.zip ] || wget --no-verbose ${IBIBLIO_PATH}/i16lbi86.zip + +# get watcom for DOS +[ -f watcomc.zip ] || wget --no-verbose ${IBIBLIO_PATH}/watcomc.zip + +mkdir -p ${HOME}/.dosemu/drive_c +cd ${HOME}/.dosemu/drive_c && ( + + mkdir -p bin + unzip -L -q ${HERE}/djgpp_mk.zip + cp -p devel/djgpp/bin/make.exe bin/. + unzip -L -q ${HERE}/upx.zip + cp -p devel/upx/upx.exe bin/. + echo PATH to make and upx binaries is 'c:/bin' + + unzip -L -q ${HERE}/nasm.zip + echo PATH to nasm binary is 'c:/devel/nasm' + +# unzip -L -q ${HERE}/i16gcc.zip +# unzip -L -q ${HERE}/i16newli.zip +# unzip -L -q ${HERE}/i16butil.zip +# unzip -L -q ${HERE}/i16lbi86.zip +# echo PATH to ia16 binaries is 'c:/devel/i16gnu/bin' + + unzip -L -q ${HERE}/watcomc.zip + echo PATH to watcom binaries is 'c:/devel/watcomc/binw' +)