[FYI] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh

11 messages, 2 authors, 2016-06-15 · open the first message on its own page

[FYI] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh

From: Brandon Casey <hidden>
Date: 2016-06-15 22:45:11

This email describes how I have successfully compiled git on IRIX6.5 with the
native MIPSpro compiler version 7.4.4m and successfully run nearly all of the
tests using the Korn shell.

A series of 7 patches will follow this email. The patches work around a couple
of flaws in the IRIX c99 compiler, and the not-quite-recent build environment.

A build script is provided at the end of this email.

The GIT_SKIP_TESTS environment variable was used to skip tests which still fail.
The tests which still fail do so because of an ancient iconv, with one exception:
the t5000 tests which fail are due to the installed gnu tar being too old.

Two lingering concerns:
  1) Building with -Ofast produced an executable which segfaulted and could not
     pass the tests.
  2) Building without THREADED_DELTA_SEARCH=1 produced an executable which
     segfaulted and could not pass the tests.

I have no debugger.

Otherwise, I've been using this executable somewhat and have not experienced any
problems. Maybe it will be useful to others.

 Makefile                      |   12 ++++++++++++
 git-compat-util.h             |   12 +++++++++++-
 t/lib-git-svn.sh              |    3 +++
 t/t1002-read-tree-m-u-2way.sh |   10 ++++++----
 t/t9301-fast-export.sh        |    1 -
 t/test-lib.sh                 |    2 +-
 templates/Makefile            |    2 +-
 unpack-trees.c                |    3 ++-
 8 files changed, 36 insertions(+), 9 deletions(-)

-brandon


#!/bin/sh

GIT_SKIP_TESTS='
   t3900.1[0-289] t3900.2[023]
   t3901.*
   t5000.1[0-24-689] t5000.2[01]
   t5100.[56] t5100.1[02]
   t9301.4
'

export GIT_SKIP_TESTS

# NO_C99_FORMAT is required since this c99 compiler does not understand %td,
# and probably not %zu.

exec gmake \
    CC=c99 \
    CFLAGS='-n32 -O2' \
    SHELL_PATH='/bin/ksh' \
    TAR=gtar \
    NO_C99_FORMAT=1 \
    NO_CURL=1 \
    NO_OPENSSL=1 \
    NO_TCLTK=1 \
    NO_PERL_MAKEMAKER=1 \
    THREADED_DELTA_SEARCH=1

[PATCH] Makefile: add section for SGI IRIX

From: Brandon Casey <hidden>
Date: 2016-06-15 22:45:11

---
 Makefile |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index 52c67c1..890694c 100644
--- a/Makefile
+++ b/Makefile
@@ -705,6 +705,18 @@ ifeq ($(uname_S),GNU)
 	# GNU/Hurd
 	NO_STRLCPY=YesPlease
 endif
+ifeq ($(uname_S),IRIX)
+	NO_SETENV = YesPlease
+	NO_UNSETENV = YesPlease
+	NO_STRCASESTR = YesPlease
+	NO_MEMMEM = YesPlease
+	NO_MKDTEMP = YesPlease
+	NO_EXTERNAL_GREP = UnfortunatelyYes
+	SHELL_PATH = /usr/gnu/bin/bash
+	ifdef NO_C99_FORMAT
+		BASIC_CFLAGS += -Dinline=__inline
+	endif
+endif
 ifeq ($(uname_S),IRIX64)
 	NO_IPV6=YesPlease
 	NO_SETENV=YesPlease
-- 
1.6.0.13.ge1c8

[PATCH] git-compat-util.h: adjust for SGI IRIX 6.5

From: Brandon Casey <hidden>
Date: 2016-06-15 22:45:11

Don't define _XOPEN_SOURCE
Do    define _SGI_SOURCE
Declare the _xpg5 versions of *snprintf() along with wrapper macros

Defining _XOPEN_SOURCE prevents many of the common functions and macros
from being defined. _Not_ setting _XOPEN_SOURCE, and instead setting
_SGI_SOURCE, provides all of the XPG4, XPG5, BSD, POSIX functions and
declarations, _BUT_ provides a horribly broken snprintf(). The provided
snprintf() can not be worked around using git's compat workaround, since
SGI's vsnprintf() always returns the number of characters written into
the string, instead of -1 which is what git's compat version expects.
SGI does have a working snprintf(), but it is only provided when
_NO_XOPEN5 evaluates to zero, and this only happens if _XOPEN_SOURCE is
defined which, as mentioned above, prevents many other common functions
and defines. The working *snprintf() functions are named _xpg5_vsnprintf()
and _xpg5_snprintf(), so declarations for these two functions were added
to git-compat-util.h and macros were added for vsnprintf and snprintf to
call these versions.
---
 git-compat-util.h |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index cf89cdf..f22707c 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -39,13 +39,14 @@
 /* Approximation of the length of the decimal representation of this type. */
 #define decimal_length(x)	((int)(sizeof(x) * 2.56 + 0.5) + 1)
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__)  && !defined(__USLC__) && !defined(_M_UNIX)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)  && !defined(__USLC__) && !defined(_M_UNIX) && !defined(sgi)
 #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
 #define _ALL_SOURCE 1
 #define _GNU_SOURCE 1
 #define _BSD_SOURCE 1
+#define _SGI_SOURCE 1
 
 #include <unistd.h>
 #include <stdio.h>
@@ -262,6 +263,15 @@ extern int git_snprintf(char *str, size_t maxsize,
 #define vsnprintf git_vsnprintf
 extern int git_vsnprintf(char *str, size_t maxsize,
 			 const char *format, va_list ap);
+#elif defined(sgi)
+extern int      _xpg5_vsnprintf(char * __restrict,
+                        __SGI_LIBC_NAMESPACE_QUALIFIER size_t,
+                        const char * __restrict, /* va_list */ char *);
+#define vsnprintf _xpg5_vsnprintf
+extern int      _xpg5_snprintf(char * __restrict,
+                        __SGI_LIBC_NAMESPACE_QUALIFIER size_t,
+                        const char * __restrict, ...);
+#define snprintf _xpg5_snprintf
 #endif
 
 #ifdef __GLIBC_PREREQ
-- 
1.6.0.13.ge1c8

[PATCH] unpack-trees.c: work around run-time array initialization flaw on IRIX 6.5

From: Brandon Casey <hidden>
Date: 2016-06-15 22:45:11

The c99 MIPSpro Compiler version 7.4.4m on IRIX 6.5 does not properly
initialize run-time initialized arrays. An array which is initialized with
fewer elements than the length of the array should have the unitialized
elements initialized to zero. This compiler does perform proper
initialization when static initialization parameters are used. So, work
around this by initializing with static elements, followed by a simple
assignment.
---
 unpack-trees.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/unpack-trees.c b/unpack-trees.c
index cba0aca..de7cb0b 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -143,7 +143,8 @@ static inline int call_unpack_fn(struct cache_entry **src, struct unpack_trees_o
 
 static int unpack_index_entry(struct cache_entry *ce, struct unpack_trees_options *o)
 {
-	struct cache_entry *src[5] = { ce, };
+	struct cache_entry *src[5] = { NULL, };
+	src[0] = ce;
 
 	o->pos++;
 	if (ce_stage(ce)) {
-- 
1.6.0.13.ge1c8

[PATCH] templates/Makefile: work around SGI install which assumes / if ROOT not defined

From: Brandon Casey <hidden>
Date: 2016-06-15 22:45:11

---

Hmm, I'm thinking that this is probably only an issue when path is
not absolute, since I didn't have any problems installing the
executables. Possibly, a more general fix is to provide the
absolute path here.

-brandon

 templates/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/templates/Makefile b/templates/Makefile
index 9f3f1fc..3ea63e1 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,7 +29,7 @@ boilerplates.made : $(bpsrc)
 		case "$$boilerplate" in *~) continue ;; esac && \
 		dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
 		dir=`expr "$$dst" : '\(.*\)/'` && \
-		$(INSTALL) -d -m 755 blt/$$dir && \
+		ROOT=./ $(INSTALL) -d -m 755 blt/$$dir && \
 		case "$$boilerplate" in \
 		*--) ;; \
 		*) cp -p $$boilerplate blt/$$dst ;; \
-- 
1.6.0.13.ge1c8

[PATCH] test-lib.sh: work around ksh's trap shortcomings

From: Brandon Casey <hidden>
Date: 2016-06-15 22:45:11

In ksh, if trap is called within a function with 0 or EXIT as its signal,
then the trap will be executed at the time the function returns. This
causes a problem in the test functions since 'trap - exit' is called
within the test_done function in order to remove the trap which calls
die() on exit. This means trap has to be called from the scripts top-level.
Do so using an alias.

Additionally, there is some strangeness with respect to aliases and
sourced script files; the alias hack doesn't work. So call 'trap - 0'
directly in lib-git-svn.sh before calling the test_done function.
---
 t/lib-git-svn.sh |    3 +++
 t/test-lib.sh    |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index a841df2..e2e8cf3 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -3,6 +3,7 @@
 if test -n "$NO_SVN_TESTS"
 then
 	test_expect_success 'skipping git-svn tests, NO_SVN_TESTS defined' :
+	trap - exit
 	test_done
 	exit
 fi
@@ -15,6 +16,7 @@ svn >/dev/null 2>&1
 if test $? -ne 1
 then
     test_expect_success 'skipping git-svn tests, svn not found' :
+    trap - exit
     test_done
     exit
 fi
@@ -39,6 +41,7 @@ then
 		err='Perl SVN libraries not found or unusable, skipping test'
 	fi
 	test_expect_success "$err" :
+	trap - exit
 	test_done
 	exit
 fi
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 11c0275..6a3fc93 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -415,7 +415,6 @@ test_create_repo () {
 }
 
 test_done () {
-	trap - exit
 	test_results_dir="$TEST_DIRECTORY/test-results"
 	mkdir -p "$test_results_dir"
 	test_results_path="$test_results_dir/${0%-*}-$$"
@@ -457,6 +456,7 @@ test_done () {
 
 	esac
 }
+alias test_done='trap - exit && test_done'
 
 # Test the binaries we have just built.  The tests are kept in
 # t/ subdirectory and are run in 'trash directory' subdirectory.
-- 
1.6.0.13.ge1c8

[PATCH] t1002-read-tree-m-u-2way.sh: use 'git diff -U0' rather than 'diff -U0'

From: Brandon Casey <hidden>
Date: 2016-06-15 22:45:11

Some old platforms have an old diff which doesn't have the -U option.
'git diff' can be used in its place. Adjust the comparison function to
strip git's additional header lines to make this possible.

Signed-off-by: Brandon Casey <redacted>
---
 t/t1002-read-tree-m-u-2way.sh |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh
index aa9dd58..5e40cec 100755
--- a/t/t1002-read-tree-m-u-2way.sh
+++ b/t/t1002-read-tree-m-u-2way.sh
@@ -14,6 +14,8 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
 compare_change () {
 	sed >current \
+	    -e '1{/^diff --git /d;}' \
+	    -e '2{/^index /d;}' \
 	    -e '/^--- /d; /^+++ /d; /^@@ /d;' \
 	    -e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /' "$1"
 	test_cmp expected current
@@ -75,7 +77,7 @@ test_expect_success \
      git update-index --add yomin &&
      git read-tree -m -u $treeH $treeM &&
      git ls-files --stage >4.out || return 1
-     diff -U0 M.out 4.out >4diff.out
+     git diff -U0 --no-index M.out 4.out >4diff.out
      compare_change 4diff.out expected &&
      check_cache_at yomin clean &&
      sum bozbar frotz nitfol >actual4.sum &&
@@ -94,7 +96,7 @@ test_expect_success \
      echo yomin yomin >yomin &&
      git read-tree -m -u $treeH $treeM &&
      git ls-files --stage >5.out || return 1
-     diff -U0 M.out 5.out >5diff.out
+     git diff -U0 --no-index M.out 5.out >5diff.out
      compare_change 5diff.out expected &&
      check_cache_at yomin dirty &&
      sum bozbar frotz nitfol >actual5.sum &&
@@ -206,7 +208,7 @@ test_expect_success \
      git update-index --add nitfol &&
      git read-tree -m -u $treeH $treeM &&
      git ls-files --stage >14.out || return 1
-     diff -U0 M.out 14.out >14diff.out
+     git diff -U0 --no-index M.out 14.out >14diff.out
      compare_change 14diff.out expected &&
      sum bozbar frotz >actual14.sum &&
      grep -v nitfol M.sum > expected14.sum &&
@@ -227,7 +229,7 @@ test_expect_success \
      echo nitfol nitfol nitfol >nitfol &&
      git read-tree -m -u $treeH $treeM &&
      git ls-files --stage >15.out || return 1
-     diff -U0 M.out 15.out >15diff.out
+     git diff -U0 --no-index M.out 15.out >15diff.out
      compare_change 15diff.out expected &&
      check_cache_at nitfol dirty &&
      sum bozbar frotz >actual15.sum &&
-- 
1.6.0.13.ge1c8

[PATCH] t9301-fast-export.sh: don't unset config variable while we're skipping test 4

From: Brandon Casey <hidden>
Date: 2016-06-15 22:45:11

---


This is necessary if t9301.4 is included in the GIT_SKIP_TESTS
environment variable.

-brandon


 t/t9301-fast-export.sh |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index c19b4a2..475aadd 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -190,7 +190,6 @@ export GIT_COMMITTER_NAME='C O Mitter'
 
 test_expect_success 'setup copies' '
 
-	git config --unset i18n.commitencoding &&
 	git checkout -b copy rein &&
 	git mv file file3 &&
 	git commit -m move1 &&
-- 
1.6.0.13.ge1c8

Re: [FYI] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh

From: Brandon Casey <hidden>
Date: 2016-06-15 22:45:11

I hope these messages threaded correctly for everyone.

They show up correctly on gmane, but not for me in Thunderbird.

For me, the Message-Id of the first message is:
  giNXZFTxzY3B65dQob7CwvwwfSKlZpw_60oz81RxU5UN3PsTT_3dMQ@cipher.nrlssc.navy.mil
and this is what I provide to git-send-email.

But when I receive a message sent in such a way back from vger (i.e. using
git-send-email to set In-Reply-To), the In-Reply-To field looks like:

  48A9FDCE.3070906@nrlssc.navy.mil

so thunderbird does not nest the replies beneath the original message.

-brandon

Re: [FYI] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh

From: Boyd Lynn Gerber <hidden>
Date: 2016-06-15 22:45:11

I would have liked to see 

Subject : patch [0/7] How to compile IRIX 6.5 w/ MIPSpro compiler/ksh
...
Subject : patch [7/7] How to compile IRIX 6.5 w/ MIPSpro compiler/ksh

It would be easier to follow all your patches with all the other email on 
the lists.

Thanks,

--
Boyd Gerber [off-list ref]
ZENEZ	1042 East Fort Union #135, Midvale Utah  84047

Re: [FYI] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh

From: Brandon Casey <hidden>
Date: 2016-06-15 22:45:11

Boyd Lynn Gerber wrote:
I would have liked to see 

Subject : patch [0/7] How to compile IRIX 6.5 w/ MIPSpro compiler/ksh
...
Subject : patch [7/7] How to compile IRIX 6.5 w/ MIPSpro compiler/ksh

It would be easier to follow all your patches with all the other email on 
the lists.
whoops, yeah, I should have done that. Sorry.

-brandon
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help