From 5ccb6f64f44671a01d457bcd3afd863055347363 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 23 Feb 2010 12:26:35 +0000 Subject: [PATCH 1/2] * Run ATerm's `make check'. --- externals/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/externals/Makefile.am b/externals/Makefile.am index 7f68eee6c..0afb26cb6 100644 --- a/externals/Makefile.am +++ b/externals/Makefile.am @@ -25,6 +25,7 @@ build-aterm: have-aterm CC="$(CC)" ./configure --prefix=$$pfx/inst-aterm \ --disable-shared --enable-static && \ $(MAKE) && \ + $(MAKE) check && \ $(MAKE) install) touch build-aterm endif From 7db2831d3a76bc239bb7a9f7573152ce12413c29 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 23 Feb 2010 16:17:21 +0000 Subject: [PATCH 2/2] * Use ATerm 2.5. --- externals/Makefile.am | 16 +++++---- externals/max-long.patch | 77 ++++++++++++++++++++++++++++++++++++++++ externals/sizeof.patch | 56 +++++++++++++++++++++++++++++ release.nix | 10 +++--- 4 files changed, 147 insertions(+), 12 deletions(-) create mode 100644 externals/max-long.patch create mode 100644 externals/sizeof.patch diff --git a/externals/Makefile.am b/externals/Makefile.am index 0afb26cb6..c9bc05d71 100644 --- a/externals/Makefile.am +++ b/externals/Makefile.am @@ -1,16 +1,18 @@ # CWI ATerm -ATERM = aterm-2.4.2-fixes-r2 +ATERM = aterm-2.5 -$(ATERM).tar.bz2: +$(ATERM).tar.gz: @echo "Nix requires the CWI ATerm library to build." - @echo "Please download version 2.4.2-fixes-r2 from" - @echo " http://nixos.org/tarballs/aterm-2.4.2-fixes-r2.tar.bz2" + @echo "Please download version 2.5 from" + @echo " http://nixos.org/tarballs/aterm-2.5.tar.gz" @echo "and place it in the externals/ directory." false -$(ATERM): $(ATERM).tar.bz2 - bunzip2 < $(srcdir)/$(ATERM).tar.bz2 | tar xvf - +$(ATERM): $(ATERM).tar.gz + gzip -d < $(srcdir)/$(ATERM).tar.gz | tar xvf - + patch -d $(ATERM) -p1 < ./max-long.patch + patch -d $(ATERM) -p1 < ./sizeof.patch have-aterm: $(MAKE) $(ATERM) @@ -67,7 +69,7 @@ endif all: build-aterm build-bzip2 -EXTRA_DIST = $(ATERM).tar.bz2 $(BZIP2).tar.gz +EXTRA_DIST = $(ATERM).tar.gz $(BZIP2).tar.gz max-long.patch sizeof.patch ext-clean: $(RM) -f have-aterm build-aterm have-bzip2 build-bzip2 diff --git a/externals/max-long.patch b/externals/max-long.patch new file mode 100644 index 000000000..a2f260b97 --- /dev/null +++ b/externals/max-long.patch @@ -0,0 +1,77 @@ +diff -rc aterm-2.8-orig/aterm/hash.c aterm-2.8/aterm/hash.c +*** aterm-2.8-orig/aterm/hash.c 2008-11-10 13:54:22.000000000 +0100 +--- aterm-2.8/aterm/hash.c 2009-01-27 18:14:14.000000000 +0100 +*************** +*** 93,146 **** + } + + /*}}} */ +- /*{{{ static long calc_long_max() */ +- static long calc_long_max() +- { +- long try_long_max; +- long long_max; +- long delta; +- +- try_long_max = 1; +- do { +- long_max = try_long_max; +- try_long_max = long_max * 2; +- } while (try_long_max > 0); +- +- delta = long_max; +- while (delta > 1) { +- while (long_max + delta < 0) { +- delta /= 2; +- } +- long_max += delta; +- } +- +- return long_max; +- +- } +- /*}}} */ + /*{{{ static long calculateNewSize(sizeMinus1, nrdel, nrentries) */ + + static long calculateNewSize + (long sizeMinus1, long nr_deletions, long nr_entries) + { +- +- /* Hack: LONG_MAX (limits.h) is often unreliable, we need to find +- * out the maximum possible value of a signed long dynamically. +- */ +- static long st_long_max = 0; +- +- /* the resulting length has the form 2^k-1 */ +- + if (nr_deletions >= nr_entries/2) { + return sizeMinus1; + } + +! if (st_long_max == 0) { +! st_long_max = calc_long_max(); +! } +! +! if (sizeMinus1 > st_long_max / 2) { +! return st_long_max-1; + } + + return (2*sizeMinus1)+1; +--- 93,109 ---- + } + + /*}}} */ + /*{{{ static long calculateNewSize(sizeMinus1, nrdel, nrentries) */ + + static long calculateNewSize + (long sizeMinus1, long nr_deletions, long nr_entries) + { + if (nr_deletions >= nr_entries/2) { + return sizeMinus1; + } + +! if (sizeMinus1 > LONG_MAX / 2) { +! return LONG_MAX-1; + } + + return (2*sizeMinus1)+1; diff --git a/externals/sizeof.patch b/externals/sizeof.patch new file mode 100644 index 000000000..2649cc564 --- /dev/null +++ b/externals/sizeof.patch @@ -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 +! +! #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 + diff --git a/release.nix b/release.nix index c90cb536d..e9afe9c9e 100644 --- a/release.nix +++ b/release.nix @@ -31,8 +31,8 @@ let # Include the ATerm and Bzip2 tarballs in the distribution. preConfigure = '' - stripHash ${aterm242fixes.src} - cp -pv ${aterm242fixes.src} externals/$strippedName + stripHash ${aterm.src} + cp -pv ${aterm.src} externals/$strippedName stripHash ${bzip2.src} cp -pv ${bzip2.src} externals/$strippedName @@ -77,7 +77,7 @@ let configureFlags = '' --disable-init-state - --with-aterm=${aterm242fixes} --with-bzip2=${bzip2} + --with-aterm=${aterm} --with-bzip2=${bzip2} ''; }; @@ -98,7 +98,7 @@ let configureFlags = '' --disable-init-state - --with-aterm=${aterm242fixes} --with-bzip2=${bzip2} + --with-aterm=${aterm} --with-bzip2=${bzip2} --enable-static-nix ''; }; @@ -123,7 +123,7 @@ let configureFlags = '' --disable-init-state --disable-shared - --with-aterm=${aterm242fixes} --with-bzip2=${bzip2} + --with-aterm=${aterm} --with-bzip2=${bzip2} ''; lcovFilter = ["*/boost/*" "*-tab.*"];