Skip to content

Commit 4cff877

Browse files
committed
update Open Watcom support
1 parent 3a54c98 commit 4cff877

14 files changed

+81
-71
lines changed

.github/workflows/ci-build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- reopened
99
- synchronize
1010
push:
11+
workflow_dispatch:
1112

1213
jobs:
1314
build:

build.sh

+43-42
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export COMPILER=watcom
3131
if [ -z "$WATCOM" ]; then
3232
export WATCOM=$HOME/watcom
3333
export PATH=$PATH:$WATCOM/binl
34+
export INCLUDE=$INCLUDE:$WATCOM/lh
3435
fi
3536
export PATH=$PATH:.
3637

@@ -42,39 +43,39 @@ export XMS_SWAP=1
4243
while (( "$#" )); do
4344
case "$1" in
4445
-h)
45-
echo Build FreeCOM
46-
echo Usage: %0 [-r] [clean] [no-xms-swap] [debug] [language]
47-
echo -r: Rebuild -- Clean before proceed
48-
echo clean: Remove *.OBJ, *.COM, *.LIB, etc. files, then exit
49-
echo no-xms-swap: Build FreeCOM without XMS-Only Swap support
50-
echo debug: Build FreeCOM with debug settings.
51-
echo You can select for which language to built FreeCOM by setting
52-
echo the environment variable LNG before running this script, e.g.:
53-
echo EXPORT LNG=german
54-
echo selects the German language. For available language see STRINGS\*.LNG
55-
exit 0
56-
;;
46+
echo Build FreeCOM
47+
echo Usage: %0 [-r] [clean] [no-xms-swap] [debug] [language]
48+
echo -r: Rebuild -- Clean before proceed
49+
echo clean: Remove *.OBJ, *.COM, *.LIB, etc. files, then exit
50+
echo no-xms-swap: Build FreeCOM without XMS-Only Swap support
51+
echo debug: Build FreeCOM with debug settings.
52+
echo You can select for which language to built FreeCOM by setting
53+
echo the environment variable LNG before running this script, e.g.:
54+
echo EXPORT LNG=german
55+
echo selects the German language. For available language see STRINGS\*.LNG
56+
exit 0
57+
;;
5758
no-xms-swap)
58-
unset XMS_SWAP
59-
;;
59+
unset XMS_SWAP
60+
;;
6061
debug)
61-
export DEBUG=1
62-
;;
62+
export DEBUG=1
63+
;;
6364
watcom)
64-
export COMPILER=watcom
65-
;;
65+
export COMPILER=watcom
66+
;;
6667
wc)
67-
export COMPILER=watcom
68-
;;
68+
export COMPILER=watcom
69+
;;
6970
gcc)
70-
export COMPILER=gcc
71-
;;
71+
export COMPILER=gcc
72+
;;
7273
upx)
73-
WITH_UPX="yes"
74-
;;
74+
WITH_UPX="yes"
75+
;;
7576
*)
76-
break
77-
;;
77+
break
78+
;;
7879
esac
7980
shift
8081
done
@@ -86,14 +87,14 @@ echo Building FreeCOM for language $LNG
8687

8788
if [ -z "$MAKE" ]; then
8889
case "$COMPILER" in
89-
watcom)
90-
export MAKE="wmake -ms -h -f"
91-
;;
92-
gcc)
93-
export MAKE="make -f gnumake.mak"
94-
;;
95-
*)
96-
;;
90+
watcom)
91+
export MAKE="wmake -ms -h -f"
92+
;;
93+
gcc)
94+
export MAKE="make -f gnumake.mak"
95+
;;
96+
*)
97+
;;
9798
esac
9899
echo Make is $MAKE.
99100
fi
@@ -102,19 +103,19 @@ fi
102103

103104
gnumake_subst () {
104105
$SED -e 's@^!@@' \
105-
-e 's@^include "\(.*\)"@include \1@' \
106-
-e 's@^include $(TOP)/config.mak@include $(TOP)/gnuconf.mak@' \
107-
-e 's@if \(.*\) == \(.*\)[\r$]@ifeq (\1,\2)@' \
108-
-e 's@^CC =@CC :=@' \
109-
-e 's@^INCLUDEPATH =@INCLUDEPATH :=@' \
110-
-e 's/\(-f obj.*$<\)/\1 -o $@/' \
111-
< $1/$2 > $1/$3
106+
-e 's@^include "\(.*\)"@include \1@' \
107+
-e 's@^include $(TOP)/config.mak@include $(TOP)/gnuconf.mak@' \
108+
-e 's@if \(.*\) == \(.*\)[\r$]@ifeq (\1,\2)@' \
109+
-e 's@^CC =@CC :=@' \
110+
-e 's@^INCLUDEPATH =@INCLUDEPATH :=@' \
111+
-e 's/\(-f obj.*$<\)/\1 -o $@/' \
112+
< $1/$2 > $1/$3
112113
}
113114

114115
if $MAKE -? 2>&1 | grep -q gnu; then
115116
gnumake_subst . config.mak gnuconf.mak
116117
for i in suppl utils strings criter lib cmd; do
117-
gnumake_subst $i $i.mak gnumake.mak
118+
gnumake_subst $i $i.mak gnumake.mak
118119
done
119120
gnumake_subst suppl/src suppl.mak gnumake.mak
120121
gnumake_subst strings/strings strings.mak gnumake.mak

ci_build.sh

+9-10
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@ else
99
fi
1010
echo CI_BUILD_DIR is \"${CI_BUILD_DIR}\"
1111

12+
# Open Watcom
1213
OWTAR=ow-snapshot.tar.xz
13-
14-
# Get Watcom compiler
1514
if [ ! -d _watcom ] ; then
16-
if [ ! -f $OWTAR ] ; then
17-
echo "Downloading OpenWatcom compiler"
18-
wget --no-verbose https://github.com/open-watcom/open-watcom-v2/releases/download/2023-02-01-Build/$OWTAR
19-
fi
20-
echo "Extracting OpenWatcom compiler"
15+
mkdir -p _downloads
2116
mkdir _watcom
22-
tar -C _watcom -xf $OWTAR
17+
if [ ! -f _downloads/$OWTAR ] ; then
18+
(cd _downloads && wget --no-verbose https://github.com/open-watcom/open-watcom-v2/releases/download/Last-CI-build/$OWTAR)
19+
fi
20+
(cd _watcom && tar -xf ../_downloads/$OWTAR)
2321
fi
2422
export PATH=$CI_BUILD_DIR/bin:$PATH:$CI_BUILD_DIR/_watcom/binl64
2523
export WATCOM=$CI_BUILD_DIR/_watcom
24+
export INCLUDE=$INCLUDE:$CI_BUILD_DIR/_watcom/lh
2625

2726
# Output directory
2827
rm -rf _output
@@ -35,7 +34,7 @@ LANGUAGES="english dutch finnish french german italian polish pt pt_br russian s
3534
for lng in ${LANGUAGES} ; do
3635
# Do full clean for rebuild of each language
3736
echo "Do full clean"
38-
git clean -x -d -f -e _output -e _watcom -e $OWTAR >/dev/null 2>&1
37+
git clean -x -d -f -e _output -e _watcom -e _download >/dev/null 2>&1
3938
export LNG=${lng}
4039
./build.sh gcc
4140
TGT="_output/gcc/${LNG}"
@@ -47,7 +46,7 @@ done
4746
for lng in ${LANGUAGES} ; do
4847
# Do full clean for rebuild of each language
4948
echo "Do full clean"
50-
git clean -x -d -f -e _output -e _watcom -e $OWTAR >/dev/null 2>&1
49+
git clean -x -d -f -e _output -e _watcom -e _download >/dev/null 2>&1
5150
export LNG=${lng}
5251
./build.sh wc
5352
TGT="_output/wc/${LNG}"

clean.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ call %0 strings\strings\ strings.lib strings.lst strings.rsp makefile
1616
call %0 criter\ criter criter1 context.def context.inc context.h_c
1717
call %0 cmd\ cmds.lib cmds.lst cmds.rsp echolib.bat
1818
call %0 lib\ freecom.lib freecom.lst freecom.rsp echolib.bat
19-
call %0 shell\ command.exe command.map command.rsp echoto.bat
19+
call %0 shell\ command.exe command.map command.rsp
2020
call %0 tools\ tools.mak
2121

2222
call %0 strings\*. cfg obj exe

clean.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cd ../strings && rm -f strings.lib strings.lst strings.log
1010
cd ../criter && rm -f criter criter1 context.def context.inc context.h_c
1111
cd ../cmd && rm -f cmds.lib cmds.lst cmds.rsp echolib.bat
1212
cd ../lib && rm -f freecom.lib freecom.lst freecom.rsp echolib.bat
13-
cd ../shell && rm -f command.exe command.map command.rsp echoto.bat
13+
cd ../shell && rm -f command.exe command.map command.rsp
1414
cd ../strings && rm -f *.cfg *.obj *.exe
1515
cd ../strings/strings && rm -f strings.lib strings.lst strings.rsp *.c *.obj *.o makefile
1616
cd ../../tools && rm -f tools.mak *.icd *.cfg *.obj *.map *.exe *.com

config.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define IGNORE_ENHANCED_INPUT
12
/*
23
* config.h - Used to configure what will be compiled into the shell.
34
*

config.std

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
DIRSEP = \ #a backslash
33
RMFILES = ..\scripts\rmfiles
44
RMFILES2 = ..\..\scripts\rmfiles
5-
ECHOTO0 = echoto
65
ECHOTO = $(TOP)\scripts\echoto
76
CP = copy
87
CLO =

docs/pt_br/config.mak

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ INCLUDEPATH = $(CC_BASE_PATH)\INCLUDE;$(SUPPL_INC_PATH)
1414
## Que programas usar
1515
CC = $(BINPATH)\TCC +$(CFG)
1616
AR = $(BINPATH)\Tlib
17-
LD = $(BINPATH)\Tlink
17+
LD_DEPS = command.rsp
18+
LD = $(BINPATH)\Tlink @$(LD_DEPS)
1819
NASM = nasm.exe
1920

2021
## Adicione -DDEBUG=1 a seguir para ativar o suporte a depuração para arquivos assembly

mkfiles/bc5.mak

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ INCLUDEPATH = -I$(CC_BASE_PATH)\INCLUDE
77
CC = $(BINPATH)\BCC # Borland C++
88
CL = $(CC)
99
AR = $(BINPATH)\Tlib /C
10-
LD = $(BINPATH)\Tlink /m/s/l /c/d /i
10+
LD_DEPS = command.rsp
11+
LD = $(BINPATH)\Tlink /m/s/l /c/d /i @$(LD_DEPS)
1112
LIBLIST = ,
1213
ECHOLIB = echolib
1314

mkfiles/gcc.mak

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ DIRSEP = /
33
RMFILES = rm -f
44
RMFILES2 = rm -f
55
ECHOTO = echo >>
6-
ECHOTO0 = echo >>
76
CP = cp
87
NASMFLAGS := $(NASMFLAGS) -felf
98
SHELL_MMODEL_COMP=cmodel=small
@@ -14,7 +13,7 @@ CC = ia16-elf-gcc -c
1413
CL = ia16-elf-gcc -mcmodel=small
1514
CLO = -o $@
1615
AR = ia16-elf-ar crsv
17-
LD = $(CL) $(CFLAGS1) -o command.exe $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) command.ld $(LIBS) -Wl,-Map,command.map \#
16+
LD = $(CL) $(CFLAGS1) -o command.exe $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) command.ld $(LIBS) -Wl,-Map,command.map
1817
LIBLIST = >
1918
ECHOLIB = echo >>
2019

mkfiles/tc2.mak

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ INCLUDEPATH = -I$(CC_BASE_PATH)\INCLUDE
55
CC = $(BINPATH)\TCC # Turbo C/C++
66
CL = $(CC)
77
AR = $(BINPATH)\Tlib /C
8-
LD = $(BINPATH)\Tlink /m/s/l /c/d
8+
LD_DEPS = command.rsp
9+
LD = $(BINPATH)\Tlink /m/s/l /c/d @$(LD_DEPS)
910
LIBLIST = ,
1011
ECHOLIB = echolib
1112

mkfiles/turbocpp.mak

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ INCLUDEPATH = -I$(CC_BASE_PATH)\INCLUDE
77
CC = $(BINPATH)\TCC # Turbo C/C++
88
CL = $(CC)
99
AR = $(BINPATH)\Tlib /C
10-
LD = $(BINPATH)\Tlink /m/s/l /c/d
10+
LD_DEPS = command.rsp
11+
LD = $(BINPATH)\Tlink /m/s/l /c/d @$(LD_DEPS)
1112
LIBLIST = ,
1213
ECHOLIB = echolib
1314

mkfiles/watcom.mak

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ DIRSEP = /
33
RMFILES = rm -f
44
RMFILES2 = rm -f
55
ECHOTO = echo >>
6-
ECHOTO0 = echo >>
76
CP = cp
87
!endif
98

@@ -16,18 +15,18 @@ CP = cp
1615
CC_BASE_PATH = $(WATCOM)
1716
!ifdef __LINUX__
1817
BINPATH = $(CC_BASE_PATH)/binl
19-
LD = $(CL) -l=dos -fe=command.exe $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(LIBS) -\"op map,statics,verbose,stack=4k\" $#
2018
!else
2119
!ifdef Win64
2220
BINPATH = $(CC_BASE_PATH)\BINNT
2321
!else
2422
BINPATH = $(CC_BASE_PATH)\BINW
2523
!endif
26-
LD = wlinker /ma/nologo
2724
!endif
25+
LD_DEPS = command.rsp
26+
LD = *$(BINPATH)$(DIRSEP)wlink sys dos op q,statics,verbose @$(LD_DEPS)
2827
LIBPATH = $(CC_BASE_PATH)$(DIRSEP)lib
2928
INCLUDEPATH = -I$(CC_BASE_PATH)$(DIRSEP)h
30-
CC = $(BINPATH)$(DIRSEP)wcc -zq -fo=.obj
29+
CC = $(BINPATH)$(DIRSEP)wcc -zq -fo=.obj -bt=dos
3130
CL = $(BINPATH)$(DIRSEP)wcl -zq -fo=.obj -bcl=dos
3231
AR = $(BINPATH)$(DIRSEP)wlib -n -c
3332
LIBLIST = >
@@ -50,4 +49,4 @@ CFLAGS1 = -os-s-wx
5049
$(BINPATH)\wlink sys DOS f $< lib $(SUPPL_LIB_PATH)\SUPPL_$(SHELL_MMODEL).LIB op q
5150
!endif
5251
.c.obj:
53-
$(CC) $< -bt=dos @$(CFG)
52+
$(CC) $< @$(CFG)

shell/command.mak

+12-5
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ LIBS = ..$(DIRSEP)cmd$(DIRSEP)cmds.lib ..$(DIRSEP)lib$(DIRSEP)freecom.lib \
2929
..$(DIRSEP)strings$(DIRSEP)strings.lib \
3030
$(SUPPL_LIB_PATH)$(DIRSEP)suppl_$(SHELL_MMODEL).lib $(LIBC)
3131

32-
echoto.bat: ../scripts/echoto.bat
33-
$(CP) ..$(DIRSEP)scripts$(DIRSEP)echoto.bat .
32+
ECHOTO0 = ..$(DIRSEP)scripts$(DIRSEP)echoto.bat
3433

35-
command.rsp : echoto.bat
34+
command.rsp : $(ECHOTO0)
35+
!if $(COMPILER) == WATCOM
36+
$(RMFILES) $@
37+
%append $@ name command.exe
38+
%append $@ opt map
39+
for %f in ($(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4)) do %append $@ file %f
40+
for %f in ($(LIBS)) do %append $@ lib %f
41+
!else
3642
$(RMFILES) command.rsp
3743
$(ECHOTO0) command.rsp $(OBJ1)+
3844
$(ECHOTO0) command.rsp $(OBJ2)+
@@ -41,6 +47,7 @@ command.rsp : echoto.bat
4147
$(ECHOTO0) command.rsp command.exe
4248
$(ECHOTO0) command.rsp command.map
4349
$(ECHOTO0) command.rsp $(LIBS)
50+
!endif
4451

45-
command.exe : $(CFG) $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(LIBS) command.rsp
46-
$(LD) @command.rsp
52+
command.exe : $(CFG) $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(LIBS) $(LD_DEPS)
53+
$(LD)

0 commit comments

Comments
 (0)