forked from mirrors/nixpkgs
Patch for aterm library on mingw (see meta-devel-list)
Moved all the shell fixes to fix-builder.sh, which is now always invoked. Added aterm to the list of packages provided by mingw.nix svn path=/nixpkgs/trunk/; revision=6152
This commit is contained in:
parent
deaacb7a0f
commit
97202ee3b7
|
@ -6,7 +6,9 @@ stdenv.mkDerivation {
|
|||
url = http://nix.cs.uu.nl/dist/tarballs/aterm-2.4.2.tar.gz;
|
||||
md5 = "18617081dd112d85e6c4b1b552628114";
|
||||
};
|
||||
patches = [./aterm-alias-fix-2.patch];
|
||||
patches =
|
||||
[./aterm-alias-fix-2.patch] ++
|
||||
(if stdenv.system == "i686-mingw" then [./mingw-asm.patch] else []);
|
||||
meta = {
|
||||
homepage = http://www.cwi.nl/htbin/sen1/twiki/bin/view/SEN1/ATerm;
|
||||
license = "LGPL";
|
||||
|
|
269
pkgs/development/libraries/aterm/mingw-asm.patch
Normal file
269
pkgs/development/libraries/aterm/mingw-asm.patch
Normal file
|
@ -0,0 +1,269 @@
|
|||
diff -urN aterm-2.4.2-old/aterm/gc.c aterm-2.4.2/aterm/gc.c
|
||||
--- aterm-2.4.2-old/aterm/gc.c 2004-06-01 10:29:02.000000000 +0200
|
||||
+++ aterm-2.4.2/aterm/gc.c 2006-08-17 15:17:28.000000000 +0200
|
||||
@@ -230,71 +230,17 @@
|
||||
AFun oddSym;
|
||||
#endif
|
||||
|
||||
-#ifdef WIN32
|
||||
-
|
||||
- unsigned int r_eax, r_ebx, r_ecx, r_edx, \
|
||||
- r_esi, r_edi, r_esp, r_ebp;
|
||||
- ATerm reg[8], *real_term;
|
||||
-
|
||||
- __asm {
|
||||
- /* Get the registers into local variables to check them
|
||||
- for aterms later. */
|
||||
- mov r_eax, eax
|
||||
- mov r_ebx, ebx
|
||||
- mov r_ecx, ecx
|
||||
- mov r_edx, edx
|
||||
- mov r_esi, esi
|
||||
- mov r_edi, edi
|
||||
- mov r_esp, esp
|
||||
- mov r_ebp, ebp
|
||||
- }
|
||||
- /* Put the register-values into an array */
|
||||
- reg[0] = (ATerm) r_eax;
|
||||
- reg[1] = (ATerm) r_ebx;
|
||||
- reg[2] = (ATerm) r_ecx;
|
||||
- reg[3] = (ATerm) r_edx;
|
||||
- reg[4] = (ATerm) r_esi;
|
||||
- reg[5] = (ATerm) r_edi;
|
||||
- reg[6] = (ATerm) r_esp;
|
||||
- reg[7] = (ATerm) r_ebp;
|
||||
-
|
||||
- for(i=0; i<8; i++) {
|
||||
- real_term = AT_isInsideValidTerm(reg[i]);
|
||||
- if (real_term != NULL) {
|
||||
- AT_markTerm(real_term);
|
||||
- }
|
||||
- if (AT_isValidSymbol((Symbol)reg[i])) {
|
||||
- AT_markSymbol((Symbol)reg[i]);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /* The register variables are on the stack aswell
|
||||
- I set them to zero so they won't be processed again when
|
||||
- the stack is traversed. The reg-array is also in the stack
|
||||
- but that will be adjusted later */
|
||||
- r_eax = 0;
|
||||
- r_ebx = 0;
|
||||
- r_ecx = 0;
|
||||
- r_edx = 0;
|
||||
- r_esi = 0;
|
||||
- r_edi = 0;
|
||||
- r_esp = 0;
|
||||
- r_ebp = 0;
|
||||
-
|
||||
-#else
|
||||
- sigjmp_buf env;
|
||||
+ jmp_buf env;
|
||||
|
||||
/* Traverse possible register variables */
|
||||
- sigsetjmp(env,0);
|
||||
+ setjmp(env);
|
||||
|
||||
start = (ATerm *)env;
|
||||
- stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf)));
|
||||
+ stop = ((ATerm *)(((char *)env) + sizeof(jmp_buf)));
|
||||
mark_memory(start, stop);
|
||||
-#endif
|
||||
|
||||
stackTop = stack_top();
|
||||
|
||||
-
|
||||
start = MIN(stackTop, stackBot);
|
||||
stop = MAX(stackTop, stackBot);
|
||||
|
||||
@@ -343,67 +289,14 @@
|
||||
AFun oddSym;
|
||||
#endif
|
||||
|
||||
-#ifdef WIN32
|
||||
-
|
||||
- unsigned int r_eax, r_ebx, r_ecx, r_edx, \
|
||||
- r_esi, r_edi, r_esp, r_ebp;
|
||||
- ATerm reg[8], *real_term;
|
||||
-
|
||||
- __asm {
|
||||
- /* Get the registers into local variables to check them
|
||||
- for aterms later. */
|
||||
- mov r_eax, eax
|
||||
- mov r_ebx, ebx
|
||||
- mov r_ecx, ecx
|
||||
- mov r_edx, edx
|
||||
- mov r_esi, esi
|
||||
- mov r_edi, edi
|
||||
- mov r_esp, esp
|
||||
- mov r_ebp, ebp
|
||||
- }
|
||||
- /* Put the register-values into an array */
|
||||
- reg[0] = (ATerm) r_eax;
|
||||
- reg[1] = (ATerm) r_ebx;
|
||||
- reg[2] = (ATerm) r_ecx;
|
||||
- reg[3] = (ATerm) r_edx;
|
||||
- reg[4] = (ATerm) r_esi;
|
||||
- reg[5] = (ATerm) r_edi;
|
||||
- reg[6] = (ATerm) r_esp;
|
||||
- reg[7] = (ATerm) r_ebp;
|
||||
-
|
||||
- for(i=0; i<8; i++) {
|
||||
- real_term = AT_isInsideValidTerm(reg[i]);
|
||||
- if (real_term != NULL) {
|
||||
- AT_markTerm_young(real_term);
|
||||
- }
|
||||
- if (AT_isValidSymbol((Symbol)reg[i])) {
|
||||
- AT_markSymbol_young((Symbol)reg[i]);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /* The register variables are on the stack aswell
|
||||
- I set them to zero so they won't be processed again when
|
||||
- the stack is traversed. The reg-array is also in the stack
|
||||
- but that will be adjusted later */
|
||||
- r_eax = 0;
|
||||
- r_ebx = 0;
|
||||
- r_ecx = 0;
|
||||
- r_edx = 0;
|
||||
- r_esi = 0;
|
||||
- r_edi = 0;
|
||||
- r_esp = 0;
|
||||
- r_ebp = 0;
|
||||
-
|
||||
-#else
|
||||
- sigjmp_buf env;
|
||||
+ jmp_buf env;
|
||||
|
||||
/* Traverse possible register variables */
|
||||
- sigsetjmp(env,0);
|
||||
+ setjmp(env);
|
||||
|
||||
start = (ATerm *)env;
|
||||
- stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf)));
|
||||
+ stop = ((ATerm *)(((char *)env) + sizeof(jmp_buf)));
|
||||
mark_memory_young(start, stop);
|
||||
-#endif
|
||||
|
||||
stackTop = stack_top();
|
||||
start = MIN(stackTop, stackBot);
|
||||
diff -urN aterm-2.4.2-old/test/randgen.c aterm-2.4.2/test/randgen.c
|
||||
--- aterm-2.4.2-old/test/randgen.c 2002-06-06 10:16:29.000000000 +0200
|
||||
+++ aterm-2.4.2/test/randgen.c 2006-08-17 16:09:47.000000000 +0200
|
||||
@@ -14,8 +14,13 @@
|
||||
#if HAVE_LRAND48 && HAVE_SRAND48
|
||||
/* Use the rand48() suite */
|
||||
#else
|
||||
-#define lrand48() random()
|
||||
-#define srand48(s) srandom(s)
|
||||
+# ifdef WIN32
|
||||
+# define lrand48() rand()
|
||||
+# define srand48(s) srand(s)
|
||||
+# else
|
||||
+# define lrand48() random()
|
||||
+# define srand48(s) srandom(s)
|
||||
+# endif
|
||||
#endif
|
||||
|
||||
/*}}} */
|
||||
diff -urN aterm-2.4.2-old/test/termstats.c aterm-2.4.2/test/termstats.c
|
||||
--- aterm-2.4.2-old/test/termstats.c 2001-10-09 16:35:21.000000000 +0200
|
||||
+++ aterm-2.4.2/test/termstats.c 2006-08-17 17:15:53.000000000 +0200
|
||||
@@ -1,7 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
+#ifndef WIN32
|
||||
#include <sys/times.h>
|
||||
+#endif
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
|
||||
@@ -14,7 +16,9 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
+#ifndef WIN32
|
||||
struct tms start, end;
|
||||
+#endif
|
||||
ATerm top = NULL;
|
||||
ATerm t, t2;
|
||||
ATbool dobafsize = ATfalse;
|
||||
@@ -29,16 +33,24 @@
|
||||
|
||||
ATinit(argc, argv, &top);
|
||||
|
||||
+#ifndef WIN32
|
||||
times(&start);
|
||||
+#endif
|
||||
t = ATreadFromFile(stdin);
|
||||
+#ifndef WIN32
|
||||
times(&end);
|
||||
textread = end.tms_utime-start.tms_utime;
|
||||
+#endif
|
||||
|
||||
tmp_file = tmpfile();
|
||||
+#ifndef WIN32
|
||||
times(&start);
|
||||
+#endif
|
||||
ATwriteToTextFile(t, tmp_file);
|
||||
+#ifndef WIN32
|
||||
times(&end);
|
||||
textwrite = end.tms_utime-start.tms_utime;
|
||||
+#endif
|
||||
|
||||
subterms = AT_calcSubterms(t);
|
||||
symbols = AT_calcUniqueSymbols(t);
|
||||
@@ -56,37 +68,52 @@
|
||||
printf(" bytes p/node : %8.2f\n", ((double)incore)/((double)subterms));
|
||||
printf("text size : %8d\n",textsize);
|
||||
printf(" bytes p/node : %8.2f\n", ((double)textsize)/((double)subterms));
|
||||
+
|
||||
+#ifndef WIN32
|
||||
printf("text read time : %8.2fs\n", ((double)textread)/((double)CLK_TCK));
|
||||
printf(" per node : %8.2fus\n", ((double)textread*1000000.0/subterms)/((double)CLK_TCK));
|
||||
printf("text write time : %8.2fs\n", ((double)textwrite)/((double)CLK_TCK));
|
||||
printf(" per node : %8.2fus\n", ((double)textwrite*1000000.0/subterms)/((double)CLK_TCK));
|
||||
+#endif
|
||||
|
||||
if(dobafsize) {
|
||||
struct stat stats;
|
||||
+#ifndef WIN32
|
||||
clock_t bafread, bafwrite;
|
||||
+#endif
|
||||
FILE *file = fopen("/tmp/test.baf", "wb+");
|
||||
int fd = fileno(file);
|
||||
|
||||
+#ifndef WIN32
|
||||
times(&start);
|
||||
+#endif
|
||||
ATwriteToBinaryFile(t, file);
|
||||
+#ifndef WIN32
|
||||
times(&end);
|
||||
bafwrite = end.tms_utime-start.tms_utime;
|
||||
+#endif
|
||||
fflush(file);
|
||||
fstat(fd, &stats);
|
||||
bafsize = (int)stats.st_size;
|
||||
fseek(file, 0, SEEK_SET);
|
||||
+#ifndef WIN32
|
||||
times(&start);
|
||||
+#endif
|
||||
t2 = ATreadFromBinaryFile(file);
|
||||
+#ifndef WIN32
|
||||
times(&end);
|
||||
bafread = end.tms_utime-start.tms_utime;
|
||||
+#endif
|
||||
printf("baf size : %8d\n", bafsize);
|
||||
printf(" bytes p/node : %8.2f\n", ((double)bafsize)/((double)subterms));
|
||||
printf(" bits p/node : %8.2f\n", ((double)bafsize*8)/((double)subterms));
|
||||
printf(" comp.wrs.text : %8.2f%%\n", 100.0-((double)bafsize*100)/((textsize)));
|
||||
+#ifndef WIN32
|
||||
printf("baf write time : %8.2fs\n", ((double)bafwrite)/((double)CLK_TCK));
|
||||
printf(" per node : %8.2fus\n", ((double)bafwrite*1000000.0/subterms)/((double)CLK_TCK));
|
||||
printf("baf read time : %8.2fs\n", ((double)bafread)/((double)CLK_TCK));
|
||||
printf(" per node : %8.2fus\n", ((double)bafread*1000000.0/subterms)/((double)CLK_TCK));
|
||||
+#endif
|
||||
fclose(file);
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ let {
|
|||
if attrs ? builder then
|
||||
[./fix-builder.sh attrs.builder]
|
||||
else
|
||||
./default-builder.sh
|
||||
[./fix-builder.sh ./default-builder.sh]
|
||||
)
|
||||
];
|
||||
inherit stdenv system;
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
# Workaround MSYS shell problem
|
||||
|
||||
if test -z "$out"; then
|
||||
stdenv="$STDENV"
|
||||
out="$OUT"
|
||||
src="$SRC"
|
||||
srcs="$SRCS"
|
||||
buildInputs="$BUILDINPUTS"
|
||||
propagatedBuildInputs="$PROPAGATEDBUILDINPUTS"
|
||||
succeedOnFailure="$SUCCEEDONFAILURE"
|
||||
stdenv=$STDENV
|
||||
out=$OUT
|
||||
src=$SRC
|
||||
srcs=$SRCS
|
||||
buildInputs=$BUILDINPUTS
|
||||
propagatedBuildInputs=$PROPAGATEDBUILDINPUTS
|
||||
succeedOnFailure=$SUCCEEDONFAILURE
|
||||
patches=$PATCHES
|
||||
doCheck=$DOCHECK
|
||||
fi
|
||||
|
||||
source $@
|
||||
|
|
|
@ -2,16 +2,6 @@ set -e
|
|||
|
||||
test -z $NIX_GCC && NIX_GCC=@GCC@
|
||||
|
||||
# Workaround MSYS shell problem
|
||||
if test -z "$out"; then
|
||||
out="$OUT"
|
||||
src="$SRC"
|
||||
srcs="$SRCS"
|
||||
buildInputs="$BUILDINPUTS"
|
||||
propagatedBuildInputs="$PROPAGATEDBUILDINPUTS"
|
||||
succeedOnFailure="$SUCCEEDONFAILURE"
|
||||
fi
|
||||
|
||||
# Set up the initial path.
|
||||
PATH=
|
||||
for i in $NIX_GCC @INITIALPATH@; do
|
||||
|
|
|
@ -5,6 +5,6 @@ let {
|
|||
};
|
||||
|
||||
body = {
|
||||
inherit (pkgs) zlib getopt realCurl;
|
||||
inherit (pkgs) zlib getopt realCurl aterm;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue