Skip to content

Commit 3aacd03

Browse files
committed
Compiling with Embarcadero C++ 7.20
1 parent d83ac67 commit 3aacd03

22 files changed

+1233
-15
lines changed

docs/hacking/compiling.rst

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,53 @@
11
Compiling Instructions
22
======================
33

4-
Remember that PWMAngband can only be built and run under Windows. If you're
5-
using Linux, get the PWMAngband binaries directly and use WinE.
4+
PWMAngband is usually built and run under Windows. If you're using Linux, you
5+
can get the PWMAngband binaries directly and use WinE. Otherwise, a few
6+
makefiles have been added to compile under Linux. Check the compiling.txt for
7+
that.
68

79
PWMAngband comes with various text files that explain how to compile the game
810
and several batch files that actually do the job.
911

10-
PWMAngband uses Borland C++ as compiler tool. You can download a free version
11-
of the compiler (see for example: https://edn.embarcadero.com/article/20633).
12+
PWMAngband uses Borland C++ 6.0 as compiler tool and IDE for coding and
13+
debugging. For a free version, check Embarcadero C++ 7.20 from
14+
https://www.embarcadero.com/free-tools/ccompiler.
1215

1316
How to build all libraries required to run the WIN client
1417
---------------------------------------------------------
1518

1619
Just follow the instructions given in the WIN.txt file located in the /src
1720
directory. This will generate the ZLIB and LIBPNG libraries using the WIN.bat
1821
file in the same directory.
22+
For Embarcadero C++ 7.20, follow the instructions given in the WIN.txt file
23+
located in the /bcc32c subdirectory instead.
1924

2025
How to build all SDL libraries required to run the SDL client
2126
-------------------------------------------------------------
2227

2328
Just follow the instructions given in the SDL.txt file located in the /src
2429
directory. This will generate the SDL, FREETYPE, SDL_TTF, SDL_IMAGE, LIBMAD and
2530
SDL_MIXER libraries using the SDL.bat file in the same directory.
31+
For Embarcadero C++ 7.20, there is no easy way to compile the SDL libraries due
32+
to incompatibility between the code and the compiler. There will be thousands
33+
of compile errors that you'll have to fix manually.
2634

2735
How to build the PWMAngband client
2836
----------------------------------
2937

3038
This is done by running the client.bat file in the /src directory. This will
3139
generate the mangclient_gcu.exe, mangclient_sdl.exe and mangclient.exe
3240
executable files corresponding to the GCU, SDL and WIN client.
41+
For Embarcadero C++ 7.20, run the client.bat file located in the /bcc32c
42+
subdirectory instead.
3343

3444
How to build the PWMAngband server
3545
----------------------------------
3646

3747
This is done by running the server.bat file in the /src directory. This will
3848
generate the mangband.exe executable file corresponding to the server.
49+
For Embarcadero C++ 7.20, run the server.bat file located in the /bcc32c
50+
subdirectory instead.
3951

4052
The clean.bat file will delete all generated binaries in case you want to
4153
recompile everything from scratch.

src/WIN.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ How to build all libraries required to run the WIN client:
55
- Download and unzip LIBPNG 1.6.37 in the same root directory as your \PWMAngband folder:
66
http://sourceforge.net/projects/libpng/files
77
- Replace the pngwrite.c file by the one from the \PWMAngband\src\fix folder to fix a linker error
8-
- Edit makefile.bc32 in the lpng1637\scripts directory:
9-
set ZLIB_DIR=..\zlib-1.2.11
8+
- Find ZLIB_DIR in lpng1637\scripts\makefile.bc32 and set ZLIB_DIR=..\zlib-1.2.11 instead
109
- Run \PWMAngband\src\WIN.bat

src/_SDL/SDL_config_win32.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
/* This is a set of defines to configure the SDL features */
2929

30-
#if defined(__GNUC__) || defined(__DMC__)
30+
#if defined(__GNUC__) || defined(__DMC__) || defined(__BCC7__)
3131
#define HAVE_STDINT_H 1
3232
#elif defined(_MSC_VER)
3333
typedef signed __int8 int8_t;

src/bcc32c/Makefile.libpng

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Makefile for libpng
2+
# 32-bit Borland C++ (Note: All modules are compiled in C mode)
3+
# To build the library, do:
4+
# "make -fmakefile.bc32"
5+
#
6+
# -------------------- 32-bit Borland C++ --------------------
7+
8+
### Absolutely necessary for this makefile to work
9+
.AUTODEPEND
10+
11+
## Where zlib.h, zconf.h and zlib.lib are
12+
ZLIB_DIR=..\zlib-1.2.11
13+
14+
## Compiler, linker, librarian and other tools
15+
CC=bcc32c
16+
LD=bcc32c
17+
LIB=tlib
18+
CP=copy
19+
20+
# -3 = 386, -4 = 486, -5 = Pentium etc.
21+
!ifndef TARGET_CPU
22+
#TARGET_CPU=-6
23+
!endif
24+
25+
# Use this if you don't want Borland's fancy exception handling
26+
# (Caution: doesn't work with CBuilderX)
27+
#NOEHLIB=noeh32.lib
28+
29+
!ifdef DEBUG
30+
CDEBUG=-v
31+
LDEBUG=-v
32+
!else
33+
CDEBUG=
34+
LDEBUG=
35+
!endif
36+
37+
# STACKOFLOW=1
38+
!ifdef STACKOFLOW
39+
CDEBUG=$(CDEBUG) -N
40+
LDEBUG=$(LDEBUG) -N
41+
!endif
42+
43+
# -O2 optimize for speed
44+
# -d merge duplicate strings
45+
# -k- turn off standard stack frame
46+
# -w display all warnings
47+
CPPFLAGS=-I$(ZLIB_DIR)
48+
CFLAGS=-O2 -d -w $(TARGET_CPU) $(CDEBUG)
49+
50+
# -M generate map file
51+
LDFLAGS=-L$(ZLIB_DIR) -M $(LDEBUG)
52+
53+
# Pre-built configuration
54+
# See scripts\pnglibconf.mak for more options
55+
!ifndef PNGLIBCONF_H_PREBUILT
56+
PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
57+
!endif
58+
59+
## Variables
60+
OBJS = \
61+
png.obj \
62+
pngerror.obj \
63+
pngget.obj \
64+
pngmem.obj \
65+
pngpread.obj \
66+
pngread.obj \
67+
pngrio.obj \
68+
pngrtran.obj \
69+
pngrutil.obj \
70+
pngset.obj \
71+
pngtrans.obj \
72+
pngwio.obj \
73+
pngwrite.obj \
74+
pngwtran.obj \
75+
pngwutil.obj
76+
77+
LIBOBJS = \
78+
+png.obj \
79+
+pngerror.obj \
80+
+pngget.obj \
81+
+pngmem.obj \
82+
+pngpread.obj \
83+
+pngread.obj \
84+
+pngrio.obj \
85+
+pngrtran.obj \
86+
+pngrutil.obj \
87+
+pngset.obj \
88+
+pngtrans.obj \
89+
+pngwio.obj \
90+
+pngwrite.obj \
91+
+pngwtran.obj \
92+
+pngwutil.obj
93+
94+
LIBNAME=libpng.lib
95+
96+
## Implicit rules
97+
# Braces let make "batch" calls to the compiler,
98+
# 2 calls instead of 12; space is important.
99+
.c.obj:
100+
$(CC) $(CPPFLAGS) $(CFLAGS) -c {$*.c }
101+
102+
.c.exe:
103+
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $*.c \
104+
$(LIBNAME) zlib.lib $(NOEHLIB)
105+
106+
.obj.exe:
107+
$(LD) $(LDFLAGS) $*.obj $(LIBNAME) zlib.lib $(NOEHLIB)
108+
109+
## Major targets
110+
all: libpng pngtest
111+
112+
libpng: $(LIBNAME)
113+
114+
pngtest: pngtest.exe
115+
116+
test: pngtest.exe
117+
pngtest
118+
119+
## Minor Targets
120+
121+
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
122+
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
123+
124+
png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
125+
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
126+
pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
127+
pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
128+
pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
129+
pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
130+
pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
131+
pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
132+
pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
133+
pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
134+
pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
135+
pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
136+
pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
137+
pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
138+
pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
139+
pngtest.obj: pngtest.c png.h pngconf.h pnglibconf.h
140+
141+
$(LIBNAME): $(OBJS)
142+
-del $(LIBNAME)
143+
$(LIB) $(LIBNAME) @&&|
144+
$(LIBOBJS), libpng
145+
|
146+
147+
# Cleanup
148+
clean:
149+
-del pnglibconf.h
150+
-del *.obj
151+
-del $(LIBNAME)
152+
-del pngtest.exe
153+
-del *.lst
154+
-del *.map
155+
-del *.tds
156+
-del pngout.png
157+
158+
# End of makefile for libpng

src/bcc32c/Makefile.zlib

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Makefile for zlib
2+
# Borland C++ for Win32
3+
#
4+
# Usage:
5+
# make -f win32/Makefile.bor
6+
# make -f win32/Makefile.bor LOCAL_ZLIB=-DASMV OBJA=match.obj OBJPA=+match.obj
7+
8+
# ------------ Borland C++ ------------
9+
10+
# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
11+
# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or
12+
# added to the declaration of LOC here:
13+
LOC = $(LOCAL_ZLIB)
14+
15+
CC = bcc32c
16+
AS = bcc32c
17+
LD = bcc32c
18+
AR = tlib
19+
CFLAGS = -a -d -O2 $(LOC)
20+
ASFLAGS = $(LOC)
21+
LDFLAGS = $(LOC)
22+
23+
24+
# variables
25+
ZLIB_LIB = zlib.lib
26+
27+
OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
28+
OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
29+
#OBJA =
30+
OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
31+
OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
32+
#OBJPA=
33+
34+
35+
# targets
36+
all: $(ZLIB_LIB)
37+
38+
.c.obj:
39+
$(CC) -c $(CFLAGS) $<
40+
41+
.asm.obj:
42+
$(AS) -c $(ASFLAGS) $<
43+
44+
adler32.obj: adler32.c zlib.h zconf.h
45+
46+
compress.obj: compress.c zlib.h zconf.h
47+
48+
crc32.obj: crc32.c zlib.h zconf.h crc32.h
49+
50+
deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
51+
52+
gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
53+
54+
gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
55+
56+
gzread.obj: gzread.c zlib.h zconf.h gzguts.h
57+
58+
gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
59+
60+
infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
61+
inffast.h inffixed.h
62+
63+
inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
64+
inffast.h
65+
66+
inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
67+
inffast.h inffixed.h
68+
69+
inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
70+
71+
trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
72+
73+
uncompr.obj: uncompr.c zlib.h zconf.h
74+
75+
zutil.obj: zutil.c zutil.h zlib.h zconf.h
76+
77+
78+
# For the sake of the old Borland make,
79+
# the command line is cut to fit in the MS-DOS 128 byte limit:
80+
$(ZLIB_LIB): $(OBJ1) $(OBJ2) $(OBJA)
81+
-del $(ZLIB_LIB)
82+
$(AR) $(ZLIB_LIB) $(OBJP1)
83+
$(AR) $(ZLIB_LIB) $(OBJP2)
84+
$(AR) $(ZLIB_LIB) $(OBJPA)
85+
86+
87+
# cleanup
88+
clean:
89+
-del $(ZLIB_LIB)
90+
-del *.obj
91+
-del *.exe
92+
-del *.tds
93+
-del zlib.bak
94+
-del foo.gz

src/bcc32c/WIN.bat

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cd ..\..\..\zlib-1.2.11
2+
make -f win32\Makefile.zlib
3+
pause
4+
copy zlib.lib ..\PWMAngband\src\win
5+
pause
6+
cd ..\lpng1637
7+
make -f scripts\makefile.libpng
8+
pause
9+
copy libpng.lib ..\PWMAngband\src\win
10+
pause
11+
copy png.h ..\PWMAngband\src\win
12+
copy pnglibconf.h ..\PWMAngband\src\win
13+
copy pngconf.h ..\PWMAngband\src\win
14+
pause

src/bcc32c/WIN.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
How to build all libraries required to run the WIN client:
2+
3+
- Download and unzip ZLIB 1.2.11 in the same root directory as your \PWMAngband folder:
4+
http://zlib.net
5+
- Copy \PWMAngband\src\bcc32c\Makefile.zlib into \zlib-1.2.11\win32
6+
- Download and unzip LIBPNG 1.6.37 in the same root directory as your \PWMAngband folder:
7+
http://sourceforge.net/projects/libpng/files
8+
- Copy \PWMAngband\src\bcc32c\Makefile.libpng into \lpng1637\scripts
9+
- Run \PWMAngband\src\bcc32c\WIN.bat

src/bcc32c/clean.bat

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
make -f makefile.bcc clean
2+
pause

src/bcc32c/client.bat

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
del ..\client\c-cmd.obj
2+
del ..\client\main.obj
3+
del ..\client\set_focus.obj
4+
del ..\client\sound-core.obj
5+
del ..\client\ui-display.obj
6+
make -f makefile.gcu
7+
pause
8+
del ..\client\c-cmd.obj
9+
del ..\client\main.obj
10+
del ..\client\set_focus.obj
11+
del ..\client\sound-core.obj
12+
del ..\client\ui-display.obj
13+
make -f makefile.sdl
14+
pause
15+
del ..\client\c-cmd.obj
16+
del ..\client\main.obj
17+
del ..\client\set_focus.obj
18+
del ..\client\sound-core.obj
19+
del ..\client\ui-display.obj
20+
make -f makefile.bcc
21+
pause
22+
move mangclient_gcu.exe ..\..\mangclient_gcu.exe
23+
move mangclient_sdl.exe ..\..\mangclient_sdl.exe
24+
move mangclient.exe ..\..\mangclient.exe

0 commit comments

Comments
 (0)