[DGD] MSys patch for DGD
Jared Maddox
absinthdraco at gmail.com
Sun Aug 7 04:51:19 CEST 2011
I've tried sending this once before, but apparently the mail server
doesn't like attachments, so I'm inlining it this time.
Anyways, I've recently finished a patch to compile DGD on the MSys
system (I didn't like how 'heavy' MSVC++ was). I've tested it
(compiled, executed, telnetted in, issued the shutdown command), and
the patch seems to work on my system. However, I do not know how the
patch will act on a *nix system (I expect it to be fine, but I might
have goofed somewhere), and I don't know how the patch will act with a
non-GNU make. Also, should I submit this to DGD hub, or make a
sourceforge project to hold the patch, or what? Here's the contents of
the patch file:
diff -rupN dgd//Changelog dgd-msys//Changelog
--- dgd//Changelog 2011-03-22 10:54:08 -0500
+++ dgd-msys//Changelog 2011-08-04 00:54:11 -0500
@@ -3,6 +3,12 @@ This file lists all changes to the DGD o
All changes prior to this release on 2010-02-03 can be found
in doc/Changelog.Dworkin
+2011-07-24/2011-08-04
+
+ Jared Maddox (absinthdraco at gmail.com)
+
+ Extended 1.4.7 to support MSys enviroment.
+
2011-03-22
Felix Croes (felix at dworkin.nl)
diff -rupN dgd//src/Makefile dgd-msys//src/Makefile
--- dgd//src/Makefile 2011-03-22 10:54:08 -0500
+++ dgd-msys//src/Makefile 2011-08-04 00:41:36 -0500
@@ -16,13 +16,27 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-HOST= DARWIN
-DEFINES=-D$(HOST) #-DNETWORK_EXTENSIONS #-DDUMP_FUNCS #-DCO_THROTTLE=50
+
+ifeq ($(OS),Windows_NT)
+ HOST= WIN32
+ PLATFORM_DEFINES= -D_WIN32_WINNT=0x501
+else
+ HOST= DARWIN
+ PLATFORM_DEFINES=
+endif
+
+DEFINES=-D$(HOST) $(PLATFORM_DEFINES) #-DNETWORK_EXTENSIONS
#-DDUMP_FUNCS #-DCO_THROTTLE=50
DEBUG= -O -g
CCFLAGS=$(DEFINES) $(DEBUG)
CFLAGS= -I. -Icomp -Ilex -Ied -Iparser -Ikfun $(CCFLAGS)
LDFLAGS=
-LIBS= -ldl # FreeBSD may require "make HOST=FREEBSD LIBS="
+
+ifeq ($(OS),Windows_NT)
+ LIBS= -lws2_32 -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32
+else
+ LIBS= -ldl # FreeBSD may require "make HOST=FREEBSD LIBS="
+endif
+
LINTFLAGS=-abcehpruz
CC= gcc
LD= $(CC)
@@ -45,7 +59,7 @@ a.out: $(OBJ) always
cd kfun; $(DMAKE) 'CC=$(CC)' 'CCFLAGS=$(CCFLAGS)' dgd
cd lpc; $(DMAKE) 'DMAKE=$(DMAKE)' 'CC=$(CC)' 'CCFLAGS=$(CCFLAGS)' \
'YACC=$(YACC)' 'LIBS=$(LIBS)' dgd
- cd host; $(DMAKE) 'CC=$(CC)' 'CCFLAGS=$(CCFLAGS)' dgd
+ cd host; $(DMAKE) 'HOST=$(HOST)' 'DMAKE=$(DMAKE)' 'CC=$(CC)'
'CCFLAGS=$(CCFLAGS)' dgd
$(LD) $(DEBUG) $(LDFLAGS) -o $@ $(OBJ) `cat comp/dgd` `cat lex/dgd` \
`cat ed/dgd` `cat parser/dgd` `cat kfun/dgd` `cat lpc/dgd` \
`cat host/dgd` $(LIBS)
@@ -93,7 +107,7 @@ clean:
cd parser; $(DMAKE) clean
cd kfun; $(DMAKE) clean
cd lpc; $(DMAKE) clean
- cd host; $(DMAKE) clean
+ cd host; $(DMAKE) 'HOST=$(HOST)' clean
path.o config.o dgd.o: comp/node.h comp/compile.h
diff -rupN dgd//src/host/Makefile dgd-msys//src/host/Makefile
--- dgd//src/host/Makefile 2011-03-22 10:54:08 -0500
+++ dgd-msys//src/host/Makefile 2011-08-03 23:04:08 -0500
@@ -17,16 +17,26 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
HOST= DARWIN
-DEFINES=-D$(HOST)
DEBUG= -O -g
CCFLAGS=$(DEFINES) $(DEBUG)
CFLAGS= -I. -I.. $(CCFLAGS)
LINTFLAGS=-abcehpruz
CC= gcc
+DMAKE= make
-SRC= local.c random.c dirent.c dload.c time.c connect.c xfloat.c
-OBJ= local.o random.o dirent.o dload.o time.o connect.o crypt.o xfloat.o asn.o
-SUBOBJ= local.o random.o dirent.o dload.o time.o crypt.o xfloat.o asn.o
+ifeq ($(HOST),WIN32)
+ DEFINES=-D$(HOST)
+
+ SRC= connect.c dload.c dosfile.c local.c time.c windgd.c xfloat.c
+ OBJ= connect.o dload.o dosfile.o local.o time.o windgd.o crypt.o
xfloat.o asn.o
+ SUBOBJ= connect.o dload.o dosfile.o local.o time.o windgd.o crypt.o
xfloat.o asn.o
+else
+ DEFINES=-D$(HOST)
+
+ SRC= local.c random.c dirent.c dload.c time.c connect.c xfloat.c
+ OBJ= local.o random.o dirent.o dload.o time.o connect.o crypt.o xfloat.o asn.o
+ SUBOBJ= local.o random.o dirent.o dload.o time.o crypt.o xfloat.o asn.o
+endif
dgd: $(OBJ)
@for i in $(OBJ); do echo host/$$i; done > dgd
@@ -41,6 +51,28 @@ clean:
rm -f dgd sub $(SRC) $(OBJ)
+ifeq ($(HOST),WIN32)
+
+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/$@ $@
+
+else
+
local.c: unix/local.c
cp unix/$@ $@
@@ -59,9 +91,14 @@ time.c: unix/time.c
connect.c: unix/connect.c
cp unix/$@ $@
+endif
+
xfloat.c: simfloat.c
cp simfloat.c $@
+
$(OBJ): ../dgd.h ../host.h ../config.h ../alloc.h ../error.h
+
connect.o: ../hash.h ../comm.h
+
xfloat.o: ../xfloat.h
diff -rupN dgd//src/host/win32/connect.c dgd-msys//src/host/win32/connect.c
--- dgd//src/host/win32/connect.c 2011-03-22 10:54:08 -0500
+++ dgd-msys//src/host/win32/connect.c 2011-08-03 22:52:16 -0500
@@ -22,6 +22,7 @@
# include <ws2tcpip.h>
# include <process.h>
# define INCLUDE_FILE_IO
+
# include "dgd.h"
# include "hash.h"
# include "comm.h"
diff -rupN dgd//src/host/win32/windgd.c dgd-msys//src/host/win32/windgd.c
--- dgd//src/host/win32/windgd.c 2011-03-22 10:54:08 -0500
+++ dgd-msys//src/host/win32/windgd.c 2011-08-03 22:53:15 -0500
@@ -18,7 +18,7 @@
*/
#include <windows.h>
-#include "dgd.h"
+# include "dgd.h"
extern void conn_intr(void);
More information about the DGD
mailing list