Fixing Borland build.

Alex Cherepanov <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Organization Coscript Software
Message-ID <[email protected]>
Fix make files and portability layer to compile on
Borland 5.5 freeware compiler.

Current portability status:
MSVC 6      -- compiles and runs
Borland 5.5 -- compiles and runs
Watcom      -- compiles most of the files

Watcom cannot call exported functions locally. (At least
it is not obvious how to do it).

Watcom cannot re-use some object files compiled for DLL in EXE.
borland.diff (text/plain, 6.5 KB)
Index: gs/src/winint.mak
===================================================================
RCS file: /cvs/ghostscript/gs/src/winint.mak,v
retrieving revision 1.19
diff -b -u -r1.19 winint.mak
--- gs/src/winint.mak	13 Aug 2003 16:04:14 -0000	1.19
+++ gs/src/winint.mak	14 Aug 2003 16:25:50 -0000
@@ -167,7 +167,7 @@
 $(GLOBJ)dwtrace.obj: $(GLSRC)dwtrace.c $(AK)\
  $(dwimg_h) $(dwtrace_h)\
  $(gscdefs_h) $(stdpre_h) $(gsdll_h) $(vdtrace_h)
-	$(GLCPP) $(COMPILE_FOR_EXE) $(GLO_)dwtrace.obj $(GLSRC)dwtrace.c
+	$(GLCPP) $(COMPILE_FOR_EXE) $(GLO_)dwtrace.obj $(C_) $(GLSRC)dwtrace.c
 
 $(PSOBJ)dwmain.obj: $(PSSRC)dwmain.c $(AK)\
  $(iapi_h) $(vdtrace_h) $(dwmain_h) $(dwdll_h) $(dwtext_h) $(dwimg_h) $(dwtrace_h) \
Index: gs/src/bcwin32.mak
===================================================================
RCS file: /cvs/ghostscript/gs/src/bcwin32.mak,v
retrieving revision 1.28
diff -b -u -r1.28 bcwin32.mak
--- gs/src/bcwin32.mak	20 May 2003 19:52:29 -0000	1.28
+++ gs/src/bcwin32.mak	14 Aug 2003 16:25:50 -0000
@@ -39,7 +39,10 @@
 
 # Define the root directory for Ghostscript installation.
 
+!ifndef AROOTDIR
 AROOTDIR=c:/gs
+!endif
+
 GSROOTDIR=$(AROOTDIR)/gs$(GS_DOT_VERSION)
 
 # Define the directory that will hold documentation at runtime.
@@ -59,7 +62,9 @@
 # see the "File searching" section of Use.htm for full details.
 # Because of this, setting SEARCH_HERE_FIRST to 0 is not recommended.
 
+!ifndef SEARCH_HERE_FIRST
 SEARCH_HERE_FIRST=1
+!endif
 
 # Define the name of the interpreter initialization file.
 # (There is no reason to change this.)
@@ -71,19 +76,25 @@
 # Setting DEBUG=1 includes debugging features (-Z switch) in the code.  The
 # compiled code is substantially slower and larger.
 
+!ifndef DEBUG
 DEBUG=0
+!endif
 
 # Setting TDEBUG=1 includes symbol table information for the debugger, and
 # also enables stack checking.  The compiled code is substantially slower
 # and larger.
 
+!ifndef TDEBUG
 TDEBUG=0
+!endif
 
 # Setting NOPRIVATE=1 makes private (static) procedures and variables
 # public, so they are visible to the debugger and profiler.  There is no
 # execution time or space penalty, just larger .OBJ and .EXE files.
 
+!ifndef NOPRIVATE
 NOPRIVATE=0
+!endif
 
 # Define the names of the executable files.
 
@@ -104,14 +115,18 @@
 # To build two small executables and a large DLL, use MAKEDLL=1.
 # To build two large executables, use MAKEDLL=0.
 
+!ifndef MAKEDLL
 MAKEDLL=1
+!endif
 
 # If you want multi-thread-safe compilation, set MULTITHREAD=1; if not, set
 # MULTITHREAD=0.  MULTITHREAD=0 produces slightly smaller and faster code,
 # but MULTITHREAD=1 is required if you use any "asynchronous" output
 # drivers.
 
+!ifndef MULTITHREAD
 MULTITHREAD=1
+!endif
 
 # Define the directory where the IJG JPEG library sources are stored,
 # and the major version of the library that is stored there.
@@ -148,7 +163,9 @@
 
 # Define any other compilation flags.
 
+!ifndef CFLAGS
 CFLAGS=
+!endif
 
 # Do not edit the next group of lines.
 
@@ -200,6 +217,7 @@
 !endif
 !endif
 
+!ifndef COMPBASE
 !if $(BUILDER_VERSION) == 0
 COMPBASE=c:\bc
 COMPBASE16=$(COMPBASE)
@@ -216,6 +234,7 @@
 COMPBASE=c:\Borland\BCC55
 #COMPBASE16=$(COMPBASE)
 !endif
+!endif
 
 COMPDIR=$(COMPBASE)\bin
 INCDIR=$(COMPBASE)\include
@@ -534,7 +553,7 @@
 # The graphical small EXE loader
 $(GS_XE): $(GSDLL_DLL)  $(DWOBJ) $(GSCONSOLE_XE)\
  $(GS_OBJ).res $(PSSRCDIR)\dwmain32.def $(SETUP_TARGETS)
-	$(LINK) /Tpe /aa $(LCT) @&&!
+	$(LINK) /L$(LIBDIR) /Tpe /aa $(LCT) @&&!
 $(LIBDIR)\c0w32 +
 $(DWOBJ) +
 ,$(GS_XE),$(PSOBJ)$(GS), +
@@ -547,7 +566,7 @@
 # The console mode small EXE loader
 !if $(BUILDER_VERSION) == 5
 $(GSCONSOLE_XE): $(OBJC) $(GS_OBJ).res $(PSSRCDIR)\dw32c.def
-	$(LINK) /Tpe /ap $(LCT) $(DEBUGLINK) @&&!
+	$(LINK) /L$(LIBDIR) /Tpe /ap $(LCT) $(DEBUGLINK) @&&!
 $(LIBDIR)\c0x32 +
 $(OBJC) +
 ,$(GSCONSOLE_XE),$(PSOBJ)$(GSCONSOLE), +
@@ -559,7 +578,7 @@
 !else
 
 $(GSCONSOLE_XE): $(OBJC) $(GS_OBJ).res $(PSSRCDIR)\dw32c.def
-	$(LINK) /Tpe /ap $(LCT) $(DEBUGLINK) @&&!
+	$(LINK) /L$(LIBDIR) /Tpe /ap $(LCT) $(DEBUGLINK) @&&!
 $(LIBDIR)\c0w32 +
 $(OBJC) +
 ,$(GSCONSOLE_XE),$(PSOBJ)$(GSCONSOLE), +
@@ -576,7 +595,7 @@
 	-del $(PSGEN)gswin32.tr
 	copy $(ld_tr) $(PSGEN)gswin32.tr
 	echo $(LIBDIR)\c0d32 $(PSOBJ)gsdll + >> $(PSGEN)gswin32.tr
-	$(LINK) $(LCT) /Tpd /aa @$(PSGEN)gswin32.tr $(INTASM) ,$(GSDLL_DLL),$(PSOBJ)$(GSDLL),@$(GLGENDIR)\lib.tr @$(LIBCTR),$(PSSRCDIR)\gsdll32.def,$(GSDLL_OBJ).res
+	$(LINK) /L$(LIBDIR) $(LCT) /Tpd /aa @$(PSGEN)gswin32.tr $(INTASM) ,$(GSDLL_DLL),$(PSOBJ)$(GSDLL),@$(GLGENDIR)\lib.tr @$(LIBCTR),$(PSSRCDIR)\gsdll32.def,$(GSDLL_OBJ).res
 
 !else
 # The big graphical EXE
@@ -586,7 +605,7 @@
 	copy $(ld_tr) $(PSGEN)gswin32.tr
 	echo $(LIBDIR)\c0w32 $(PSOBJ)gsdll + >> $(PSGEN)gswin32.tr
 	echo $(DWOBJNO) $(INTASM) >> $(PSGEN)gswin32.tr
-	$(LINK) $(LCT) /Tpe /aa @$(PSGEN)gswin32.tr ,$(GS_XE),$(PSOBJ)$(GS),@$(GLGENDIR)\lib.tr @$(LIBCTR),$(PSSRCDIR)\dwmain32.def,$(GS_OBJ).res
+	$(LINK) /L$(LIBDIR) $(LCT) /Tpe /aa @$(PSGEN)gswin32.tr ,$(GS_XE),$(PSOBJ)$(GS),@$(GLGENDIR)\lib.tr @$(LIBCTR),$(PSSRCDIR)\dwmain32.def,$(GS_OBJ).res
 
 # The big console mode EXE
 $(GSCONSOLE_XE):  $(GS_ALL) $(DEVS_ALL)\
@@ -595,7 +614,7 @@
 	copy $(ld_tr) $(PSGEN)gswin32.tr
 	echo $(LIBDIR)\c0w32 $(PSOBJ)gsdll + >> $(PSGEN)gswin32.tr
 	echo $(OBJCNO) $(INTASM) >> $(PSGEN)gswin32.tr
-	$(LINK) $(LCT) /Tpe /ap @$(PSGEN)gswin32.tr ,$(GSCONSOLE_XE),$(PSOBJ)$(GSCONSOLE),@$(GLGENDIR)\lib.tr @$(LIBCTR),$(PSSRCDIR)\dw32c.def,$(GS_OBJ).res
+	$(LINK) /L$(LIBDIR) $(LCT) /Tpe /ap @$(PSGEN)gswin32.tr ,$(GSCONSOLE_XE),$(PSOBJ)$(GSCONSOLE),@$(GLGENDIR)\lib.tr @$(LIBCTR),$(PSSRCDIR)\dw32c.def,$(GS_OBJ).res
 !endif
 
 # Access to 16 spooler from Win32s
Index: gs/src/unistd_.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/unistd_.h,v
retrieving revision 1.8
diff -b -u -r1.8 unistd_.h
--- gs/src/unistd_.h	10 Apr 2003 18:45:12 -0000	1.8
+++ gs/src/unistd_.h	14 Aug 2003 16:25:50 -0000
@@ -36,10 +36,17 @@
 #  include <io.h>
 #endif
 
-#if defined(_MSC_VER) || defined(__BORLANDC__) && defined(__WIN32__) 
+#if defined(_MSC_VER) 
 #  define fsync(handle) _commit(handle)
 #  define read(fd, buf, len) _read(fd, buf, len)
+#  define isatty(fd) _isatty(fd)
+#  define setmode(fd, mode) _setmode(fd, mode)
 #  define fstat(fd, buf) _fstat(fd, buf)
+#elif defined(__BORLANDC__) && defined(__WIN32__) 
+#  define fsync(handle) _commit(handle)
+#  define read(fd, buf, len) _read(fd, buf, len)
+#  define isatty(fd) _isatty(fd)
+#  define setmode(fd, mode) _setmode(fd, mode)
 #else
 #  include <unistd.h>
 #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.