* The installed ATerm 2.5 headers refer to SIZEOF_LONG etc., which are

not set anywhere.  This causes other packages to break on 64-bit
  platforms unless they happen to define those macros.  So don't rely
  on them.

svn path=/nixpkgs/trunk/; revision=20194
This commit is contained in:
Eelco Dolstra 2010-02-23 14:43:09 +00:00
parent a13774ecfe
commit fe7b877afd
2 changed files with 60 additions and 0 deletions

View File

@ -11,6 +11,10 @@ stdenv.mkDerivation {
patches = [
# Fix for http://bugzilla.sen.cwi.nl:8080/show_bug.cgi?id=841
./max-long.patch
# Patch the ATerm header files so that they don't rely on
# SIZEOF_LONG, SIZEOF_INT and SIZEOF_VOID_P being set.
./sizeof.patch
];
doCheck = true;

View File

@ -0,0 +1,56 @@
diff -rc -x '*~' aterm-2.5-orig/aterm/aterm.c aterm-2.5/aterm/aterm.c
*** aterm-2.5-orig/aterm/aterm.c 2007-02-27 23:41:31.000000000 +0100
--- aterm-2.5/aterm/aterm.c 2010-02-23 15:10:38.000000000 +0100
***************
*** 150,155 ****
--- 150,157 ----
if (initialized)
return;
+ assert(sizeof(long) == sizeof(void *));
+
/*{{{ Handle arguments */
for (lcv=1; lcv < argc; lcv++) {
diff -rc -x '*~' aterm-2.5-orig/aterm/encoding.h aterm-2.5/aterm/encoding.h
*** aterm-2.5-orig/aterm/encoding.h 2007-02-27 23:41:31.000000000 +0100
--- aterm-2.5/aterm/encoding.h 2010-02-23 15:36:05.000000000 +0100
***************
*** 10,24 ****
{
#endif/* __cplusplus */
! #if SIZEOF_LONG > 4
! #define AT_64BIT
#endif
! #if SIZEOF_LONG != SIZEOF_VOID_P
! #error Size of long is not the same as the size of a pointer
#endif
! #if SIZEOF_INT > 4
#error Size of int is not 32 bits
#endif
--- 10,30 ----
{
#endif/* __cplusplus */
! #include <limits.h>
!
! #ifndef SIZEOF_LONG
! #if ULONG_MAX > 4294967295
! #define SIZEOF_LONG 8
! #else
! #define SIZEOF_LONG 4
! #endif
#endif
! #if SIZEOF_LONG > 4
! #define AT_64BIT
#endif
! #if UINT_MAX > 4294967295
#error Size of int is not 32 bits
#endif