Patch started for ST
Hi folks,
I started working on st which doesn't recognize GNU OS.
Somehow I have managed to jack up the md.h file. If some brave soul feels like checking this out, I
would appreciate it.
Thanks,
Barry deFreese
diff -Nur -x '*.orig' -x '*~' st-1.9//Makefile st-1.9.new//Makefile
--- st-1.9//Makefile 2012-06-06 03:49:34.000000000 +0000
+++ st-1.9.new//Makefile 2012-06-06 03:52:24.000000000 +0000
@@ -96,6 +96,7 @@
openbsd-debug openbsd-optimized \
osf1-debug osf1-optimized \
solaris-debug solaris-optimized \
+ gnu-debug gnu-optimized \
solaris-64-debug solaris-64-optimized
#
@@ -190,6 +191,16 @@
endif
endif
+ifeq ($(OS), GNU)
+EXTRA_OBJS = $(TARGETDIR)/md.o
+SFLAGS = -fPIC
+LDFLAGS = -shared -soname=$(SONAME) -lc
+OTHER_FLAGS = -Wall
+ifeq ($(shell test -f /usr/include/sys/epoll.h && echo yes), yes)
+DEFINES += -DMD_HAVE_EPOLL
+endif
+endif
+
ifeq ($(OS), NETBSD)
SFLAGS = -fPIC
LDFLAGS = -shared -soname=$(SONAME) -lc
@@ -465,5 +476,10 @@
solaris-64-optimized:
$(MAKE) OS="SOLARIS_64" BUILD="OPT"
+gnu-debug:
+ $(MAKE) OS="GNU" BUILD="DBG"
+gnu-optimized:
+ $(MAKE) OS="GNU" BUILD="OPT"
+
##########################
diff -Nur -x '*.orig' -x '*~' st-1.9//md.h st-1.9.new//md.h
--- st-1.9//md.h 2012-06-06 03:52:06.000000000 +0000
+++ st-1.9.new//md.h 2012-06-06 03:56:15.000000000 +0000
@@ -609,6 +609,47 @@
#define MD_GET_UTIME() \
return (gethrtime() / 1000)
+#elif defined (GNU)
+
+/*
+ * These are properties of the GNU kernel and are the same on every
+ * flavor and architecture.
+ */
+#define MD_USE_BSD_ANON_MMAP
+#define MD_ACCEPT_NB_NOT_INHERITED
+#define MD_ALWAYS_UNSERIALIZED_ACCEPT
+/*
+ * GNU syste is Posix.1g compliant.
+ */
+#define MD_HAVE_SOCKLEN_T
+
+/*
+ * All architectures have the gettimeofday
+ * function but if you know of a faster way, use it.
+ */
+#define MD_GET_UTIME() \
+ struct timeval tv; \
+ (void) gettimeofday(&tv, NULL); \
+ return (tv.tv_sec * 1000000LL + tv.tv_usec)
+
+#if defined(__i386__)
+#define MD_STACK_GROWS_DOWN
+#define MD_USE_BUILTIN_SETJMP
+
+#if defined(__GLIBC__) && __GLIBC__ >= 2
+#ifndef JB_SP
+#define JB_SP 4
+#endif
+#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[JB_SP]
+#else
+/* not an error but certainly cause for caution */
+#error "Untested use of old glibc on i386"
+#define MD_GET_SP(_t) (_t)->context[0].__jmpbuf[0].__sp
+#endif
+#else
+#error Unknown CPU architecture
+#endif
+
#else
#error Unknown OS
#endif /* OS */
diff -Nur -x '*.orig' -x '*~' st-1.9//osguess.sh st-1.9.new//osguess.sh
--- st-1.9//osguess.sh 2012-06-06 03:52:05.000000000 +0000
+++ st-1.9.new//osguess.sh 2012-06-06 03:52:24.000000000 +0000
@@ -37,6 +37,7 @@
*-dec-osf* ) OS=OSF1 ;;
*-solaris2* ) OS=SOLARIS ;;
*-darwin* ) OS=DARWIN ;;
+ *-gnu* ) OS=GNU ;;
* ) OS=
echo "Sorry, unsupported OS"
exit 1 ;;
Reply to: