Skip to contentSkip to conversation

Port to HP NonStop

PATCH/RFC Joachim Schmitz 2 participants 5 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

---
This needs the 4 compat-poll patches posted earlier. Needs a different link order in Makefile: libintl before libiconv. This may affect other platforms, so needs some checking. Also I'm not really sure how to best #ifdef the #include <strings.h> and the typedef (u)intptr_t.
Furthermore the -DHAVE_STRING_H=1, needed for compat/fnmatch/fnmatch.c doesn't look quite right to me?

 Makefile          | 54 +++++++++++++++++++++++++++++++++++++++++++++++++-----
 git-compat-util.h | 10 +++++++++-
 2 files changed, 58 insertions(+), 6 deletions(-)
Makefile +51 -5
index 3d40860..b1d4ef5 100644
@@ -1324,6 +1324,52 @@ ifeq ($(uname_S),Minix)
 	NO_CURL =
 	NO_EXPAT =
 endif
+ifeq ($(uname_S),NONSTOP_KERNEL)
+	CC = cc -c99 # needs some C99 features, "inline" is just one of them
+	# INLINE='' would just replace one set of warnings with another and
+	# still not compile in c89 mode, for non-const array initializations
+	CFLAGS = -g -O0 # disable all optimization, seems to result in bad code,
+	# with -O1 or -O0 /usr/local/libexec/git-core/git-pack-objects
+	# abends on "git push"
+	prefix = /usr/local
+	# our's are in ${prefix}/bin
+	PERL_PATH = ${prefix}/bin/perl
+	PYTHON_PATH = ${prefix}/bin/python
+
+	# as detected by './configure'
+	#NO_CURL = YesPlease # missdetected, disabled, see below
+	NEEDS_SSL_WITH_CURL = YesPlease # added manually, see above
+	HAVE_LIBCHARSET_H=YesPlease
+	NEEDS_LIBICONV = YesPlease # needs libiconv first, changed further down
+	NO_SYS_SELECT_H=UnfortunatelyYes
+	NO_D_TYPE_IN_DIRENT = YesPlease
+	NO_HSTRERROR=YesPlease
+	NO_STRCASESTR=YesPlease
+	NO_FNMATCH_CASEFOLD = YesPlease
+	NO_MEMMEM = YesPlease
+	NO_STRLCPY = YesPlease
+	NO_SETENV = YesPlease
+	NO_UNSETENV = YesPlease
+	NO_MKDTEMP = YesPlease
+	NO_MKSTEMPS = YesPlease
+	OLD_ICONV=UnfortunatelyYes # currently libiconv-1.9.1
+	NO_REGEX=YesPlease # Why? ToDo?
+	NO_PTHREADS=UnfortunatelyYes # ToDo? Using PUT, maybe?
+	#CFLAGS += -put # not suffient? Seems the wrong fnmatch.h gets included?
+	#CFLAGS += -DFNM_CASEFOLD=16 # (1 << 4), to get dir.c compiled!?!
+	#CFLAGS += -Icompat/fnmatch # this doesn't help
+
+	# not detected (nor checked for) by './configure'
+	COMPAT_CFLAGS += -DSA_RESTART=0 # we don't have SA_RESTART on NonStop
+	COMPAT_CFLAGS += -DHAVE_STRING_H=1 # needed in compat/fnmatch/fnmatch.c
+	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
+	NO_NSEC = YesPlease
+	NO_PREAD = YesPlease
+	NO_MMAP = YesPlease
+	NO_POLL = YesPlease
+	MKDIR_WO_TRAILING_SLASH = YesPlease
+	NO_SETITIMER = UnfortunatelyYes
+endif
 ifneq (,$(findstring MINGW,$(uname_S)))
 	pathsep = ;
 	NO_PREAD = YesPlease
@@ -1555,6 +1599,11 @@ else
 	LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
 endif
 endif
+ifndef NO_GETTEXT
+ifndef LIBC_CONTAINS_LIBINTL
+	EXTLIBS += -lintl
+endif
+endif
 ifdef NEEDS_LIBICONV
 	ifdef ICONVDIR
 		BASIC_CFLAGS += -I$(ICONVDIR)/include
@@ -1567,11 +1616,6 @@ endif
 ifdef NEEDS_LIBGEN
 	EXTLIBS += -lgen
 endif
-ifndef NO_GETTEXT
-ifndef LIBC_CONTAINS_LIBINTL
-	EXTLIBS += -lintl
-endif
-endif
 ifdef NEEDS_SOCKET
 	EXTLIBS += -lsocket
 endif
git-compat-util.h +9 -1
index 24b5432..7e70361 100644
@@ -74,7 +74,8 @@
 # define _XOPEN_SOURCE 500
 # endif
 #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \
-      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__)
+      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \
+      !defined(__TANDEM)
 #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #endif
@@ -98,6 +99,9 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
+#ifdef __TANDEM /* or HAVE_STRINGS_H or !NO_STRINGS_H? */
+#include <strings.h> /* for strcasecmp() */
+#endif
 #include <errno.h>
 #include <limits.h>
 #include <sys/param.h>
@@ -141,6 +145,10 @@
 #else
 #include <stdint.h>
 #endif
+#ifdef __TANDEM /* or NO_INTPTR_T resp. NO_UINTPTR_T? */
+typedef int intptr_t;
+typedef unsigned int uintptr_t;
+#endif
 #if defined(__CYGWIN__)
 #undef _XOPEN_SOURCE
 #include <grp.h>
Signature · 1 line
1.7.12
#1 lore raw
Quoted 2 lines · Joachim Schmitz

Needs a different link order in Makefile: libintl before libiconv. This may affect other platforms, so needs some checking.

It will, and it needs customization, not checking.

Quoted 2 lines

Also I'm not really sure how to best #ifdef the #include <strings.h> and the typedef (u)intptr_t.

For now, nobody needs these, so enclosing in TANDEM is fine. When another platform is found to need the same change, which might be unlikely, new symbols that NONSTOP_KERNEL and that other platform share can be introduced to replace these #ifdefs.

Quoted 123 lines

Furthermore the -DHAVE_STRING_H=1, needed for compat/fnmatch/fnmatch.c doesn't look quite right to me?

 Makefile          | 54 +++++++++++++++++++++++++++++++++++++++++++++++++-----
 git-compat-util.h | 10 +++++++++-
 2 files changed, 58 insertions(+), 6 deletions(-)
Makefile +51 -5
index 3d40860..b1d4ef5 100644
@@ -1324,6 +1324,52 @@ ifeq ($(uname_S),Minix)
 	NO_CURL =
 	NO_EXPAT =
 endif
+ifeq ($(uname_S),NONSTOP_KERNEL)
+	CC = cc -c99 # needs some C99 features, "inline" is just one of them
+	# INLINE='' would just replace one set of warnings with another and
+	# still not compile in c89 mode, for non-const array initializations
+	CFLAGS = -g -O0 # disable all optimization, seems to result in bad code,
+	# with -O1 or -O0 /usr/local/libexec/git-core/git-pack-objects
+	# abends on "git push"
+	prefix = /usr/local
+	# our's are in ${prefix}/bin
+	PERL_PATH = ${prefix}/bin/perl
+	PYTHON_PATH = ${prefix}/bin/python
+
+	# as detected by './configure'
+	#NO_CURL = YesPlease # missdetected, disabled, see below
+	NEEDS_SSL_WITH_CURL = YesPlease # added manually, see above
+	HAVE_LIBCHARSET_H=YesPlease
+	NEEDS_LIBICONV = YesPlease # needs libiconv first, changed further down
+	NO_SYS_SELECT_H=UnfortunatelyYes
+	NO_D_TYPE_IN_DIRENT = YesPlease
+	NO_HSTRERROR=YesPlease
+	NO_STRCASESTR=YesPlease
+	NO_FNMATCH_CASEFOLD = YesPlease
+	NO_MEMMEM = YesPlease
+	NO_STRLCPY = YesPlease
+	NO_SETENV = YesPlease
+	NO_UNSETENV = YesPlease
+	NO_MKDTEMP = YesPlease
+	NO_MKSTEMPS = YesPlease
+	OLD_ICONV=UnfortunatelyYes # currently libiconv-1.9.1
+	NO_REGEX=YesPlease # Why? ToDo?
+	NO_PTHREADS=UnfortunatelyYes # ToDo? Using PUT, maybe?
+	#CFLAGS += -put # not suffient? Seems the wrong fnmatch.h gets included?
+	#CFLAGS += -DFNM_CASEFOLD=16 # (1 << 4), to get dir.c compiled!?!
+	#CFLAGS += -Icompat/fnmatch # this doesn't help
+
+	# not detected (nor checked for) by './configure'
+	COMPAT_CFLAGS += -DSA_RESTART=0 # we don't have SA_RESTART on NonStop
+	COMPAT_CFLAGS += -DHAVE_STRING_H=1 # needed in compat/fnmatch/fnmatch.c
+	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
+	NO_NSEC = YesPlease
+	NO_PREAD = YesPlease
+	NO_MMAP = YesPlease
+	NO_POLL = YesPlease
+	MKDIR_WO_TRAILING_SLASH = YesPlease
+	NO_SETITIMER = UnfortunatelyYes
+endif
 ifneq (,$(findstring MINGW,$(uname_S)))
 	pathsep = ;
 	NO_PREAD = YesPlease
@@ -1555,6 +1599,11 @@ else
 	LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
 endif
 endif
+ifndef NO_GETTEXT
+ifndef LIBC_CONTAINS_LIBINTL
+	EXTLIBS += -lintl
+endif
+endif
 ifdef NEEDS_LIBICONV
 	ifdef ICONVDIR
 		BASIC_CFLAGS += -I$(ICONVDIR)/include
@@ -1567,11 +1616,6 @@ endif
 ifdef NEEDS_LIBGEN
 	EXTLIBS += -lgen
 endif
-ifndef NO_GETTEXT
-ifndef LIBC_CONTAINS_LIBINTL
-	EXTLIBS += -lintl
-endif
-endif
 ifdef NEEDS_SOCKET
 	EXTLIBS += -lsocket
 endif
git-compat-util.h +9 -1
index 24b5432..7e70361 100644
@@ -74,7 +74,8 @@
 # define _XOPEN_SOURCE 500
 # endif
 #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \
-      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__)
+      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \
+      !defined(__TANDEM)
 #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #endif
@@ -98,6 +99,9 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
+#ifdef __TANDEM /* or HAVE_STRINGS_H or !NO_STRINGS_H? */
+#include <strings.h> /* for strcasecmp() */
+#endif
 #include <errno.h>
 #include <limits.h>
 #include <sys/param.h>
@@ -141,6 +145,10 @@
 #else
 #include <stdint.h>
 #endif
+#ifdef __TANDEM /* or NO_INTPTR_T resp. NO_UINTPTR_T? */
+typedef int intptr_t;
+typedef unsigned int uintptr_t;
+#endif
 #if defined(__CYGWIN__)
 #undef _XOPEN_SOURCE
 #include <grp.h>
#2 lore raw
Quoted 6 lines

From: Junio C Hamano [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 9:57 AM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: [PATCH/RFC] Port to HP NonStop

Quoted 6 lines
Quoted 2 lines · Joachim Schmitz

Needs a different link order in Makefile: libintl before libiconv. This may affect other platforms, so needs some checking.

It will, and it needs customization, not checking.

How?

Quoted 7 lines
Quoted 2 lines

Also I'm not really sure how to best #ifdef the #include <strings.h> and the typedef (u)intptr_t.

For now, nobody needs these, so enclosing in TANDEM is fine. When another platform is found to need the same change, which might be unlikely, new symbols that NONSTOP_KERNEL and that other platform share can be introduced to replace these #ifdefs.

OK, I'm fine with that. So the git-compat-util.h part of my patch can go in as posted, right? With or without the comments?

Bye, Jojo

#3 lore raw
Quoted 6 lines · Joachim Schmitz
Quoted 6 lines

From: Junio C Hamano [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 9:57 AM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: [PATCH/RFC] Port to HP NonStop

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines · Joachim Schmitz

Needs a different link order in Makefile: libintl before libiconv. This may affect other platforms, so needs some checking.

It will, and it needs customization, not checking.

How?

By not moving things around to affect other people, but having them in the order you want only for your platform (and other future ports that need similar treatment)?

For example, if you need libintl before libiconv, a quick and dirty way may be

Makefile +3 -0
index a49d1db..9b2cfd6 100644
@@ -1552,6 +1552,9 @@ ifdef NEEDS_LIBICONV
 	else
 		ICONV_LINK =
 	endif
+	ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
+		ICONV_LINK += -lintl
+	endif
 	EXTLIBS += $(ICONV_LINK) -liconv
 endif
 ifdef NEEDS_LIBGEN

and your linker command line may have "-lintl -liconv -lintl" but that wouldn't be an error, and you know you won't be affecting other platforms that do not use NEEDS_LIBINTL_BEFORE_LIBICONV, no?

#4 lore raw
Quoted 45 lines

From: Junio C Hamano [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 7:03 PM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: [PATCH/RFC] Port to HP NonStop

Quoted 6 lines · Joachim Schmitz
Quoted 6 lines

From: Junio C Hamano [mailto:[email protected]]
Sent: Tuesday, September 18, 2012 9:57 AM
To: Joachim Schmitz
Cc: [email protected]
Subject: Re: [PATCH/RFC] Port to HP NonStop

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines · Joachim Schmitz

Needs a different link order in Makefile: libintl before libiconv. This may affect other platforms, so needs some checking.

It will, and it needs customization, not checking.

How?

By not moving things around to affect other people, but having them in the order you want only for your platform (and other future ports that need similar treatment)?

For example, if you need libintl before libiconv, a quick and dirty way may be

Makefile +3 -0
index a49d1db..9b2cfd6 100644
@@ -1552,6 +1552,9 @@ ifdef NEEDS_LIBICONV
 	else
 		ICONV_LINK =
 	endif
+	ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
+		ICONV_LINK += -lintl
+	endif
 	EXTLIBS += $(ICONV_LINK) -liconv
 endif
 ifdef NEEDS_LIBGEN
Quoted 3 lines

and your linker command line may have "-lintl -liconv -lintl" but that wouldn't be an error, and you know you won't be affecting other platforms that do not use NEEDS_LIBINTL_BEFORE_LIBICONV, no?

OK, sounds good, I'll try that and submit an updated patch if it works that way (and I'm pretty sure it does).

Anything else I should change in my patch?