Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI add Watcom and optionally Turbo C 2.01 builds #137

Merged
merged 7 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
pull_request:
types:
- opened
- edited
- ready_for_review
- reopened
- synchronize
Expand All @@ -23,10 +22,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
Expand Down
7 changes: 7 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ cd ..\kernel
%MAKE% production
if errorlevel 1 goto abort-cd

echo.
echo Process COUNTRY +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
cd ..\country
%MAKE% DIRSEP=\ CP=copy production
if errorlevel 1 goto abort-cd

echo.
echo Process SETVER +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo.
Expand Down
78 changes: 73 additions & 5 deletions ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
82 changes: 82 additions & 0 deletions ci_prereq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/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'
IBIBLIO_PATH='https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/repositories/1.3'

BASE=${IBIBLIO_PATH}/base

# get FreeDOS kernel
[ -f kernel.zip ] || wget --no-verbose ${BASE}/kernel.zip

# get FreeCOM
[ -f freecom.zip ] || wget --no-verbose ${BASE}/freecom.zip

DEVEL=${IBIBLIO_PATH}/devel

# get gnumake for DOS
[ -f djgpp_mk.zip ] || wget --no-verbose ${DEVEL}/djgpp_mk.zip

# get nasm for DOS
[ -f nasm.zip ] || wget --no-verbose ${DEVEL}/nasm.zip

# get upx for DOS
[ -f upx.zip ] || wget --no-verbose ${DEVEL}/upx.zip

# grab ia16-gcc from ibiblio.org
#[ -f i16gcc.zip ] || wget --no-verbose ${DEVEL}/i16gcc.zip
#[ -f i16newli.zip ] || wget --no-verbose ${DEVEL}/i16newli.zip
#[ -f i16butil.zip ] || wget --no-verbose ${DEVEL}/i16butil.zip
#[ -f i16lbi86.zip ] || wget --no-verbose ${DEVEL}/i16lbi86.zip

# get watcom for DOS
[ -f watcomc.zip ] || wget --no-verbose ${DEVEL}/watcomc.zip

mkdir -p ${HOME}/.dosemu/drive_c
cd ${HOME}/.dosemu/drive_c && (

mkdir -p bin

# Boot files
unzip -L -q ${HERE}/kernel.zip
cp -p bin/kernl386.sys ./kernel.sys
unzip -L -q ${HERE}/freecom.zip
cp -p bin/command.com ./command.com
cp -p /usr/share/dosemu/dosemu2-cmds-0.3/c/fdconfig.sys .

# Development files
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'
)
24 changes: 23 additions & 1 deletion ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ if [ ! -f _output/wc/KWC${KVER}.sys ] ; then
exit 1
fi

echo GCC and Watcom kernels have all been built
if [ ! -f _output/wc_dos/KWC38632.sys ] ; then
echo Watcom DOS built kernel not present
exit 1
fi

if [ ! -f _output/tc_dos/KTC38632.sys ] && [ -d ${HOME}/.dosemu/drive_c/tc201 ] ; then
echo Turbo C 2.01 built kernel not present
exit 1
fi

echo Kernels have all been built
find _output -ls

cd test
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ecm-pushbx I'd like to add to your boot test here. The DOS built kernels are built for 386, but they don't have to be I just thought I'd add some variety. Is there any special command line required for them? BTW there is no Turbo C version at present, as it fails to build sys, kernel and maybe more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any special command line required for them?

Just call the test script with ./test.sh ../_output/PATH/FILE.sys diskID bootID 'boot ID: ' after chdir to the repo's test/ directory, where PATH and FILE point to your kernel and ID is something unique, ideally with 4 or less letters. (I'd suggest wcd for Watcom DOS and tcd for Turbo C DOS.) It's called like that here:

if ! ./test.sh ../_output/gcc/KGC${KVER}.sys diskgc bootgc 'boot gcc: '

The three parameters to test.sh are called:

KERNELPATHNAME="$1"
DISKETTE="$2"
BOOT="$3"
testrunname="$4"

Quoted from

if [[ -z "$1" || -z "$2" || -z "$3" ]]

Expand All @@ -26,5 +36,17 @@ then
echo OpenWatcom boot test failed
exit 2
fi
if ! ./test.sh ../_output/wc_dos/KWC38632.sys diskwcd bootwcd 'boot wcd: '
then
echo 'OpenWatcom(DOS) boot test failed'
exit 2
fi
if [ -d ${HOME}/.dosemu/drive_c/tc201 ] ; then
if ! ./test.sh ../_output/tc_dos/KTC38632.sys disktcd boottcd 'boot tcd: '
then
echo 'Turbo C 2.01 boot test failed'
exit 2
fi
fi
cd ..
exit 0
2 changes: 1 addition & 1 deletion country
Submodule country updated 1 files
+6 −1 Makefile
8 changes: 1 addition & 7 deletions kernel/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS6) $(OBJS7) $(OBJS8)

# *Explicit Rules*

production: ../bin/$(TARGET).sys ../bin/country.sys
production: ../bin/$(TARGET).sys

../bin/$(TARGET).sys: kernel.sys
$(CP) kernel.sys ..$(DIRSEP)bin
Expand All @@ -42,12 +42,6 @@ kernel.sys: kernel.exe ../utils/exeflat.exe ../utils/upxentry.bin ../utils/upxde
kernel.exe: $(TARGET).lnk $(OBJS) $(LIBS)
$(LINK) @$(TARGET).lnk;

../bin/country.sys:
# warning, both cd and -C options required, cd for wmake, -C for gmake
cd ..$(DIRSEP)country
$(MAKE) -C ..$(DIRSEP)country all
$(CP) ..$(DIRSEP)country$(DIRSEP)country.sys ..$(DIRSEP)bin$(DIRSEP)country.sys

clobber: clean
-$(RM) kernel.exe kernel.sys status.me

Expand Down
7 changes: 7 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ export

ifeq ($(OS),Windows_NT)
BUILDENV ?= windows
DIRSEP=\
CP=copy
else
BUILDENV ?= linux
DIRSEP=/
CP=cp
endif

ifeq ($(BUILDENV),windows)
Expand Down Expand Up @@ -115,6 +119,7 @@ all:
cd boot && $(MAKE) production
cd sys && $(MAKE) production
cd kernel && $(MAKE) production
cd country && $(MAKE) DIRSEP=$(DIRSEP) CP=$(CP) production
cd setver && $(MAKE) production
$(MAKEREMOVE)

Expand All @@ -126,6 +131,7 @@ clean:
cd boot && $(MAKE) clean
cd sys && $(MAKE) clean
cd kernel && $(MAKE) clean
cd country && $(MAKE) clean
cd setver && $(MAKE) clean
$(MAKEREMOVE)

Expand All @@ -137,5 +143,6 @@ clobber:
cd boot && $(MAKE) clobber
cd sys && $(MAKE) clobber
cd kernel && $(MAKE) clobber
cd country && $(MAKE) clobber
cd setver && $(MAKE) clobber
$(MAKEREMOVE)
2 changes: 1 addition & 1 deletion share