[DGD] DGD For MSys, mark 2
Jared Maddox
absinthdraco at gmail.com
Fri Jan 4 12:09:43 CET 2013
So, after making some more build changes to reflect info from the
MinGW/MSys mailing list, I tried to apply the resulting patch to make
certain that a file I created in the process showed up. Surprise! The
patch wouldn't apply! Since I used likely the exact same options as on
the previous patch, I've redone both to get them to apply. Just cd
into the base directory, and issue "patch -p1 <" with the patch file
behind the lesser-than sign. I'll be sending the new-new patch in
another email, here's the new-old patch:
diff -rNu dgd-master/README dgd-msys/README
--- dgd-master/README 2012-12-15 05:35:42 -0600
+++ dgd-msys/README 2013-01-02 03:20:40 -0600
@@ -1,3 +1,19 @@
+WARNING:
+ This is a modified and UNTESTED VERSION of DGD. It was altered on Januray
+ 2nd, 2013, by Jared Maddox, to add support for the MSys environment. If you
+ want a known-good version, then look to the sources described below.
+
+ KNOWN BUGS:
+ For some reason, "make clean" didn't clean:
+ comp/parser.h
+ comp/parser.c
+ host/dosfile.c
+ host/dosfile.o
+ host/windgd.c
+ host/windgd.o
+
+
+
This file was written for release 1.4 of DGD, Dworkin's Game Driver.
DGD is a rewrite from scratch of the LPMud server. It runs on Windows, MacOS
diff -rNu dgd-master/src/Makefile dgd-msys/src/Makefile
--- dgd-master/src/Makefile 2012-12-15 05:35:42 -0600
+++ dgd-msys/src/Makefile 2013-01-02 02:56:34 -0600
@@ -17,6 +17,25 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
OS=$(shell uname -s)
+
+ # Added by Jared Maddox on Jan 2, 2013.
+ # If you're running into a bug while compiling this, it's likely my
+ # fault.
+ #
+ # In addition to the other changes that I've made, I replaced all
+ # instances of "a.out" with $(EXECUTABLE). This localizes the executable
+ # name up here, near the top of the file. I'm not very savy on Make, but
+ # I think it also allows the executable name to be overridden from the
+ # command line, which isn't necessary, but is nice.
+ #
+PLATFORM_DEFINES=
+EXECUTABLE= a.out
+ifeq ($(OS),MINGW32_NT-5.1)
+ HOST=WIN32
+ PLATFORM_DEFINES= -D_WIN32_WINNT=0x501
+ EXECUTABLE= a.exe
+endif
+
ifeq ($(OS),Darwin)
HOST=DARWIN
endif
@@ -39,12 +58,12 @@
$(error HOST is undefined)
endif
-DEFINES=-D$(HOST) # -DSLASHSLASH -DNETWORK_EXTENSIONS -DCLOSURES
-DCO_THROTTLE=50
+DEFINES=-D$(HOST) $(PLATFORM_DEFINES) # -DSLASHSLASH
-DNETWORK_EXTENSIONS -DCLOSURES -DCO_THROTTLE=50
DEBUG= -O -g
CCFLAGS=$(DEFINES) $(DEBUG)
CFLAGS= -I. -Icomp -Ilex -Ied -Iparser -Ikfun $(CCFLAGS)
LDFLAGS=
-LIBS= -ldl
+
LINTFLAGS=-abcehpruz
CC= gcc
LD= $(CC)
@@ -58,6 +77,13 @@
LIBS+=-lsocket -lnsl
endif
+ # Basically transfered from my old port. Not certain HOW much of this is
+ # required, but likely more than you'd think.
+ #
+ifeq ($(OS),MINGW32_NT-5.1)
+ LIBS= -lws2_32 -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32
+endif
+
SRC= alloc.c error.c hash.c swap.c str.c array.c object.c sdata.c data.c \
path.c editor.c comm.c call_out.c interpret.c config.c ext.c dgd.c
OBJ= alloc.o error.o hash.o swap.o str.o array.o object.o sdata.o data.o \
@@ -65,7 +91,7 @@
COMPOBJ=alloc.o error.o hash.o path.o str.o array.o object.o sdata.o data.o \
interpret.o config.o ext.o
-a.out: $(OBJ) always
+$(EXECUTABLE): $(OBJ) always
cd comp; $(MAKE) 'CC=$(CC)' 'CCFLAGS=$(CCFLAGS)' 'YACC=$(YACC)' dgd
cd lex; $(MAKE) 'CC=$(CC)' 'CCFLAGS=$(CCFLAGS)' dgd
cd ed; $(MAKE) 'CC=$(CC)' 'CCFLAGS=$(CCFLAGS)' dgd
@@ -79,13 +105,13 @@
`cat host/dgd` $(LIBS)
always:
- @rm -f a.out
+ @rm -f $(EXECUTABLE)
-all: a.out
+all: $(EXECUTABLE)
-$(BIN)/driver: a.out
+$(BIN)/driver: $(EXECUTABLE)
-mv $(BIN)/driver $(BIN)/driver.old
- cp a.out $(BIN)/driver
+ cp $(EXECUTABLE) $(BIN)/driver
install: $(BIN)/driver
@@ -111,12 +137,12 @@
comp/parser.h: comp/parser.y
cd comp; $(MAKE) 'YACC=$(YACC)' parser.h
-comp/a.out:
+comp/$(EXECUTABLE):
cd comp; $(MAKE) 'CC=$(CC)' 'HOST=$(HOST)' 'CCFLAGS=$(CCFLAGS)' \
- 'YACC=$(YACC)' 'LIBS=$(LIBS)' a.out
+ 'YACC=$(YACC)' 'LIBS=$(LIBS)' $(EXECUTABLE)
clean:
- rm -f a.out $(OBJ) comp.sub lex.sub ed.sub
+ rm -f $(EXECUTABLE) $(OBJ) comp.sub lex.sub ed.sub
cd comp; $(MAKE) clean
cd lex; $(MAKE) clean
cd ed; $(MAKE) clean
diff -rNu dgd-master/src/host/Makefile dgd-msys/src/host/Makefile
--- dgd-master/src/host/Makefile 2012-12-15 05:35:42 -0600
+++ dgd-msys/src/host/Makefile 2013-01-02 02:44:53 -0600
@@ -37,16 +37,34 @@
SYSV_STYLE=1
endif
-SRC= local.c dirent.c dload.c time.c connect.c xfloat.c
-SUBOBJ= local.o dirent.o dload.o time.o crypt.o xfloat.o asn.o
-ifdef SYSV_STYLE
- SRC+=lrand48.c
- SUBOBJ+=lrand48.o
+# Added by Jared Maddox, Jan 2, 2013
+# Note: This was basically just copied from my old DGD-for-MSys version,
+# expect untested bugs.
+#
+ifneq ($(HOST),WIN32)
+ # This was just indented from what was already in this file, so it
+ # should be fine.
+ #
+
+ SRC= local.c dirent.c dload.c time.c connect.c xfloat.c
+ SUBOBJ= local.o dirent.o dload.o time.o crypt.o xfloat.o asn.o
+ ifdef SYSV_STYLE
+ SRC+=lrand48.c
+ SUBOBJ+=lrand48.o
+ else
+ SRC+=random.c
+ SUBOBJ+=random.o
+ endif
+ OBJ= $(SUBOBJ) connect.o
else
- SRC+=random.c
- SUBOBJ+=random.o
+ # This, in comparison, was copied from my previous implementation. Don't
+ # depend on it being bug-free.
+ #
+
+ SRC= local.c dload.c time.c connect.c xfloat.c dosfile.c windgd.c
+ OBJ= $(SUBOBJ) connect.o dosfile.o windgd.o
+ SUBOBJ= local.o dload.o time.o crypt.o xfloat.o asn.o
endif
-OBJ= $(SUBOBJ) connect.o
dgd: $(OBJ)
@for i in $(OBJ); do echo host/$$i; done > dgd
@@ -60,6 +78,12 @@
clean:
rm -f dgd sub $(SRC) $(OBJ)
+# Next, we have the copy rules.
+#
+ifneq ($(HOST),WIN32)
+ # These are the versions that already existed here, but wrapped to
+ # control their use.
+ #
local.c: unix/local.c
cp unix/$@ $@
@@ -82,6 +106,34 @@
connect.c: unix/connect.c
cp unix/$@ $@
+else
+ # And here we have the forms that I've copied from my old
+ # implementation.
+ #
+
+connect.c: win32/connect.c
+ cp win32/$@ $@
+
+dload.c: win32/dload.c
+ cp win32/$@ $@
+
+dosfile.c: win32/dosfile.c
+ cp win32/$@ $@
+
+local.c: win32/local.c
+ cp win32/$@ $@
+
+time.c: win32/time.c
+ cp win32/$@ $@
+
+windgd.c: win32/windgd.c
+ cp win32/$@ $@
+
+endif
+ # Finally, we go on to what we can count on for both versions.
+ #
+
+
xfloat.c: simfloat.c
cp simfloat.c $@
More information about the DGD
mailing list