summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeri Harris <keri@gentoo.org>2010-09-05 05:48:09 +0000
committerKeri Harris <keri@gentoo.org>2010-09-05 05:48:09 +0000
commit39fdb954f9a71e8964c905fe7855a1fa436451c0 (patch)
tree3c17357cfafbc3846b06f77c29e488c48897ed2c /dev-lang/mercury
parentx86 stable wrt bug #335319 (diff)
downloadhistorical-39fdb954f9a71e8964c905fe7855a1fa436451c0.tar.gz
historical-39fdb954f9a71e8964c905fe7855a1fa436451c0.tar.bz2
historical-39fdb954f9a71e8964c905fe7855a1fa436451c0.zip
Version bump
Package-Manager: portage-2.1.8.3/cvs/Linux x86_64
Diffstat (limited to 'dev-lang/mercury')
-rw-r--r--dev-lang/mercury/ChangeLog17
-rw-r--r--dev-lang/mercury/Manifest15
-rw-r--r--dev-lang/mercury/files/mercury-10.04.1-boehm_gc.patch133
-rw-r--r--dev-lang/mercury/files/mercury-10.04.1-default-grade.patch274
-rw-r--r--dev-lang/mercury/files/mercury-10.04.1-docs.patch21
-rw-r--r--dev-lang/mercury/files/mercury-10.04.1-linker-flags.patch80
-rw-r--r--dev-lang/mercury/files/mercury-10.04.1-multilib.patch232
-rw-r--r--dev-lang/mercury/files/mercury-10.04.1-no-reconf.patch59
-rw-r--r--dev-lang/mercury/files/mercury-10.04.1-sparc-llds-base-grade.patch12
-rw-r--r--dev-lang/mercury/files/mercury-10.04.1-tests-sandbox.patch64
-rw-r--r--dev-lang/mercury/files/mercury-10.04.1-tests-static-link.patch11
-rw-r--r--dev-lang/mercury/files/mercury-10.04.1-tests-workspace.patch29
-rw-r--r--dev-lang/mercury/mercury-10.04.1.ebuild175
13 files changed, 1120 insertions, 2 deletions
diff --git a/dev-lang/mercury/ChangeLog b/dev-lang/mercury/ChangeLog
index bbe1ccf0d2a9..90526506b875 100644
--- a/dev-lang/mercury/ChangeLog
+++ b/dev-lang/mercury/ChangeLog
@@ -1,6 +1,21 @@
# ChangeLog for dev-lang/mercury
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/mercury/ChangeLog,v 1.114 2010/09/05 01:56:03 keri Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/mercury/ChangeLog,v 1.115 2010/09/05 05:48:09 keri Exp $
+
+*mercury-10.04.1 (05 Sep 2010)
+
+ 05 Sep 2010; <keri@gentoo.org> +mercury-10.04.1.ebuild,
+ +files/mercury-10.04.1-boehm_gc.patch,
+ +files/mercury-10.04.1-default-grade.patch,
+ +files/mercury-10.04.1-docs.patch,
+ +files/mercury-10.04.1-linker-flags.patch,
+ +files/mercury-10.04.1-multilib.patch,
+ +files/mercury-10.04.1-no-reconf.patch,
+ +files/mercury-10.04.1-sparc-llds-base-grade.patch,
+ +files/mercury-10.04.1-tests-sandbox.patch,
+ +files/mercury-10.04.1-tests-static-link.patch,
+ +files/mercury-10.04.1-tests-workspace.patch:
+ Version bump
05 Sep 2010; <keri@gentoo.org> files/mercury-10.04-multilib.patch:
Install runtime jars into mercury libdir
diff --git a/dev-lang/mercury/Manifest b/dev-lang/mercury/Manifest
index 59a8a004950f..19f8c2c84993 100644
--- a/dev-lang/mercury/Manifest
+++ b/dev-lang/mercury/Manifest
@@ -20,6 +20,16 @@ AUX mercury-10.04-tests-mercury-float.patch 2056 RMD160 0eeda80258e9e675be1866d4
AUX mercury-10.04-tests-sandbox.patch 2932 RMD160 2cb2b82e4d282c31ecfd350e732f5ccf505debb9 SHA1 922226b4344ca2833da734d7ab271c756a440a62 SHA256 9e67a417ce59d0e0e9c698a3573902829222ad28462ff246809bd7c6318e15ed
AUX mercury-10.04-tests-static-link.patch 568 RMD160 72a38e289d1e7f76e4dfdae21c42322d452b8fcf SHA1 76b78ee37ac2b3ef4ddc804485d7bd10a9720dff SHA256 f37e8399aed753a947062d40573ba5205ef62ecfbbe87ecb8632cf1895002663
AUX mercury-10.04-tests-workspace.patch 1058 RMD160 34f0623fdf595bdd4c098cf57573178a622fc4e4 SHA1 e6afeec2e55d8b61dbf6359fb03289534059f86c SHA256 7551204ad0bd0fdbe6b17d29bd44d7ab4ae5a1f1b51d32391e368bbb747a3d1d
+AUX mercury-10.04.1-boehm_gc.patch 5932 RMD160 a7432297f4a03af8072444f05d1f3a22282620cb SHA1 c98916c2459e677b34e6fbfbd163a89a4571b22b SHA256 eb88c6a4560e6bb7adf2b27271543bdd4bc9b69bde726109ef719fcaeb48585a
+AUX mercury-10.04.1-default-grade.patch 9273 RMD160 d66b819f9a21e07de7cccda39c64c87c5cb2f1da SHA1 459b5340fd57035843a85b883432c2a96ca6b5f4 SHA256 41b5329f001812584eba7b9a70553cc09bfaff9c66baff2a64305625111942ee
+AUX mercury-10.04.1-docs.patch 890 RMD160 03cbff1254b61261cbca8fa2d518f02c3544bf42 SHA1 327891efea1c84d68326564e435ea093b91fc262 SHA256 492b3a92e93359330648f51f8b82d9d8b7addb22ba56bd7bfc8489aaedbc1764
+AUX mercury-10.04.1-linker-flags.patch 3661 RMD160 ad568f11077e30a4dadfd96a31b32bdf832c00e0 SHA1 235e88def696d2588a0ea7ede2df15cfafc276dd SHA256 3a4d1cceffcb5e659a0e7910a1d538099bd1c6aded524d67c8d4854c4f359d2f
+AUX mercury-10.04.1-multilib.patch 11698 RMD160 cc84d5b4cb35ccbb143903ad74991ccda760774b SHA1 8b476a0822570ad663dd8b29f6da37d9dd0c8272 SHA256 f247d7f8b312e1dca80b203bd7fd7e56ec79669b4de89eb4efc662dc8a50d4d3
+AUX mercury-10.04.1-no-reconf.patch 2058 RMD160 b94029c812ad662f8ec95eabebfc30451b2d0fb0 SHA1 c273f5ffa5b89dd52b04f60a7c3e61b6ca5e3c1e SHA256 f2edfaa6f7944357e9aebe0e916b6c7b8db604a419af0be8a989d74f30a19c85
+AUX mercury-10.04.1-sparc-llds-base-grade.patch 555 RMD160 8e109c99d239336f6268ab2d7866c4a454c474b5 SHA1 76344d65560488627d7f485e7b91211d4c422b3b SHA256 64944f246a102867ee24538533603e179c9bd8324dfdcf04dcc6cbcb3237d707
+AUX mercury-10.04.1-tests-sandbox.patch 2972 RMD160 beaac1ff68613a165c273f6f463c94372095bba2 SHA1 2819c6dbb1d80983581f39eb3e7da265240018fa SHA256 619a33f5e944b6899fed6dc178abfef811554d60bca716dc972bf200aef4a41f
+AUX mercury-10.04.1-tests-static-link.patch 572 RMD160 cd7c1e31cde2e3f3264b9037cb8eec58d3fbbb15 SHA1 8375c73e51d10a59a5679fc17227b03c4b4517fe SHA256 a2bab04b4c91b76ba1cffe6d5bf2d769cb3bdeaa8537e0629898ba24815b4e14
+AUX mercury-10.04.1-tests-workspace.patch 1072 RMD160 5dcaaa165622d434248b4705594e31d93a5bab19 SHA1 0f098ef3547c3ea1cf998413f7e364dddd39429a SHA256 476eb36def1e0e55e07b059bceb2cf070a10feb596aa0691d52528de44306adb
AUX mercury-10.04_beta1-atomic-ops.patch 568 RMD160 e557798f12ac9325ed6b251c1bc7dc87d36e1225 SHA1 0ea7f1c346b69aa73d387b5bdee12e34e482b129 SHA256 90720443306685422a7c2bf9f3fa2193feef4eda71de38a474cc0303381ce5e1
AUX mercury-10.04_beta1-boehm_gc.patch 4231 RMD160 a8f7f12d5768156de83d90362e81094084f3fd35 SHA1 8a595992e162f48ccacb63fb6df497e361901f2c SHA256 45eafb8b94538336f0de13085359aa1b9998fd2c99d67c735b71f4e09b8e786e
AUX mercury-10.04_beta1-docs.patch 804 RMD160 8b04f68882da22485d6db8c1a0184d37870dc2b5 SHA1 efdb8948178b9287664bd8ad6e8896b10affb213 SHA256 55bafac83acd9da404da9b626ab7a6e137a13f1169c9612caa6908f2f7152096
@@ -31,13 +41,16 @@ AUX mercury-10.04_beta1-tests-subdir.patch 504 RMD160 25273c94dd44ed9c461e6cc7dd
AUX mercury-10.04_beta1-tests-workspace.patch 1093 RMD160 8fb5883e52f2810594172643bbf4af4002396429 SHA1 cd4eaac0580644bc9787277eb63975e5cd85535a SHA256 9091d6dd37ca299163b37a560ae19477d827281d41836b9306c0a5caf7b6b36f
DIST mercury-compiler-0.13.1.tar.gz 15938824 RMD160 a0a80cd2ac7393cf084b79d40230bd1efe795c5f SHA1 919eb45ba34c503fc2e7391225e52a5cfbb80616 SHA256 b1f4984e00ad917824d3340dcf2a41bede39fe02ef2e516351467f4761985196
DIST mercury-compiler-10.04-beta.tar.gz 27795148 RMD160 3c3aeca9d96d2294d2dc7bd4c4cc0c5c6c14aee8 SHA1 b88ab410c1337c1f357eca6fdb517faa1496c64b SHA256 5a21e0cfd3998c1529be88ebd40c75835387052d12db8cf5e8a93379cdc955cd
+DIST mercury-compiler-10.04.1.tar.gz 24600120 RMD160 99f998845ad5c952860cd5ba3051c948dc7f3397 SHA1 9d9135d171128ce53cc77680423c5fd5e4ea4530 SHA256 63fa2b5661ab34bcb7d199c7686753c7c20b85b989c18e67f682f00cd91a02bb
DIST mercury-compiler-10.04.tar.gz 24586705 RMD160 fe9b131a272ab314618cde59463e5b55686126e3 SHA1 3ae0d596ad079d62bfb6ae41bc0ab0a5d78db6fa SHA256 ecb930c2b26f804648f6432503937a669de4c2c9e85dec9a60ef65f729fbbcda
DIST mercury-tests-0.13.1.tar.gz 986644 RMD160 779609ba5c985e562b0962434c9281c07ddaa5cb SHA1 7f08467e6642daa4fce9136e12b4e5ca2ac41b9d SHA256 f6c8250b9996584d3c7cd6cc0609716027b127e54b2aedf5ebfcab98a44159dc
DIST mercury-tests-10.04-beta.tar.gz 5876463 RMD160 b29179ae78b1dcb0619684228abac0d6cd4471a8 SHA1 3fed8b5fbe840e844df725f386a08836825d48da SHA256 4c1bf8eece8f95fdf13eeaef8dc5ea4fee30646d20fed684fe6eb710d5234833
+DIST mercury-tests-10.04.1.tar.gz 1332741 RMD160 e7880a095d071f4fcdce69f9e656e67dfe09de63 SHA1 4e9a9a1c12a1e435442822d28810cd209f9212b0 SHA256 1e05cb3fa3a673ab1c0464c9616181bdd07f5b09681f58f021a2da3bc5c05c26
DIST mercury-tests-10.04.tar.gz 1329423 RMD160 c85e489eea4e36fef6d12fb9bf4e7cd01bb2e7fd SHA1 32ca9267d58d2cbb7d144c1501803f0a7b92f145 SHA256 d56a76b4a2c8c2cc878b7a7cd04fd34b4069cef1316155a942f4372425d45085
EBUILD mercury-0.13.1-r2.ebuild 3350 RMD160 8a1635d8c301751b2da7260785baaa788b81b620 SHA1 2aae241faf85518b6bb6d162939b2f293eb67649 SHA256 af0a034331b9a7acb0d0a7dea42fc84aafcf9e66de2b6fceddc623f975689c44
EBUILD mercury-10.04-r1.ebuild 4397 RMD160 ac0c5f73a0468ad0b975c7b4e45fd962cd3d1b42 SHA1 b7d1d4b635f916f1be1a4fc496c2d80f9949ab30 SHA256 55dfdb3ae95f0dfc74014d2f87085d568316c84d78d74805e30c8674f8ece543
+EBUILD mercury-10.04.1.ebuild 4724 RMD160 a4d46cd3f895f42d278e1b3b3ef98e6103bac624 SHA1 127e2eec5f21a63e385c100dd4f1c795668cf24c SHA256 733576e06b1aeda4ff904967f0a39a4106ecfc4221e72cf1ccdeea765388518c
EBUILD mercury-10.04.ebuild 4150 RMD160 565ad36c8253f0da62f6a4256cbf45d2655a6223 SHA1 3f6363b22b7b4dcd0fe731f404d6d8dadb6cebff SHA256 943ee918a3113d45d268f4091de5a0767d05e99194f121771ce43c3a9c71eba0
EBUILD mercury-10.04_beta1.ebuild 3561 RMD160 b608b732acdfccb4a8ccdc4728bdd0b9f3f28283 SHA1 319302199665f6e4ffa9aaff95128fcd8a7d63a0 SHA256 ffbba59515166327f79a698086d516f14fcbcfc8c76f58dbf1116eaa8eb16626
-MISC ChangeLog 22923 RMD160 32f928810001d680f38c84d38856182fafb23519 SHA1 e2941eb5f1034f1ff8c548032358e6f1764a1483 SHA256 885ecfd1e94eaf980398e6b7c4128bc47e39784edcd3890555645b0de4070770
+MISC ChangeLog 23479 RMD160 7e944cd7314b7cd7540326ff951266a3aa11f56a SHA1 c0df9030bf125a9365e13508507c3adb390be143 SHA256 55327150e8c594f01e4ae5c4be74149552c56821ff0d23ec7ab902b5195cdc97
MISC metadata.xml 318 RMD160 b9e62c5b9d04f43a6570cfcadd6a6c9a2b9e3f6f SHA1 67893d667419e727696eb2c386565794fd137418 SHA256 5e64767eb2ff6b10d88b169c87648d62b534356fb94c5407a253aeafc2d16935
diff --git a/dev-lang/mercury/files/mercury-10.04.1-boehm_gc.patch b/dev-lang/mercury/files/mercury-10.04.1-boehm_gc.patch
new file mode 100644
index 000000000000..948193a6dc67
--- /dev/null
+++ b/dev-lang/mercury/files/mercury-10.04.1-boehm_gc.patch
@@ -0,0 +1,133 @@
+diff -urN mercury-compiler-10.04.1.orig/boehm_gc/Makefile.direct mercury-compiler-10.04.1/boehm_gc/Makefile.direct
+--- mercury-compiler-10.04.1.orig/boehm_gc/Makefile.direct 2010-02-24 20:04:32.000000000 +1300
++++ mercury-compiler-10.04.1/boehm_gc/Makefile.direct 2010-09-05 09:07:10.000000000 +1200
+@@ -407,6 +407,7 @@
+ ./if_mach SPARC SOLARIS $(CC) -c -o mach_dep2.o $(srcdir)/sparc_mach_dep.S
+ ./if_mach SPARC OPENBSD $(AS) -o mach_dep2.o $(srcdir)/sparc_sunos4_mach_dep.s
+ ./if_mach SPARC NETBSD $(AS) -o mach_dep2.o $(srcdir)/sparc_netbsd_mach_dep.s
++ ./if_mach SPARC LINUX $(CC) -c -o mach_dep2.o $(SPECIALCFLAGS) $(srcdir)/sparc_generic_mach_dep.c
+ ./if_mach SPARC "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
+ ./if_mach SPARC "" ld -r -o mach_dep.o mach_dep1.o mach_dep2.o
+ ./if_mach IA64 "" as $(AS_ABI_FLAG) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
+diff -urN mercury-compiler-10.04.1.orig/boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/sparc.h mercury-compiler-10.04.1/boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/sparc.h
+--- mercury-compiler-10.04.1.orig/boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/sparc.h 2010-02-23 19:28:41.000000000 +1300
++++ mercury-compiler-10.04.1/boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/sparc.h 2010-09-05 09:07:10.000000000 +1200
+@@ -39,32 +39,6 @@
+
+ #define AO_HAVE_test_and_set_full
+
+-#ifndef AO_NO_SPARC_V9
+-/* Returns nonzero if the comparison succeeded. */
+-AO_INLINE int
+-AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) {
+- char ret;
+- __asm__ __volatile__ ("membar #StoreLoad | #LoadLoad\n\t"
+-# if defined(__arch64__)
+- "casx [%2],%0,%1\n\t"
+-# else
+- "cas [%2],%0,%1\n\t" /* 32-bit version */
+-# endif
+- "membar #StoreLoad | #StoreStore\n\t"
+- "cmp %0,%1\n\t"
+- "be,a 0f\n\t"
+- "mov 1,%0\n\t"/* one insn after branch always executed */
+- "clr %0\n\t"
+- "0:\n\t"
+- : "=r" (ret), "+r" (new_val)
+- : "r" (addr), "0" (old)
+- : "memory", "cc");
+- return (int)ret;
+-}
+-
+-#define AO_HAVE_compare_and_swap_full
+-#endif /* AO_NO_SPARC_V9 */
+-
+ /* FIXME: This needs to be extended for SPARC v8 and v9. */
+ /* SPARC V8 also has swap. V9 has CAS. */
+ /* There are barriers like membar #LoadStore. */
+diff -urN mercury-compiler-10.04.1.orig/boehm_gc/sparc_generic_mach_dep.c mercury-compiler-10.04.1/boehm_gc/sparc_generic_mach_dep.c
+--- mercury-compiler-10.04.1.orig/boehm_gc/sparc_generic_mach_dep.c 1970-01-01 12:00:00.000000000 +1200
++++ mercury-compiler-10.04.1/boehm_gc/sparc_generic_mach_dep.c 2010-09-05 09:07:10.000000000 +1200
+@@ -0,0 +1,82 @@
++# include "private/gc_priv.h"
++
++/* On register window machines, we need a way to force registers into */
++/* the stack. Return sp. */
++# ifdef SPARC
++ asm(" .seg \"text\"");
++# if defined(SVR4) || defined(NETBSD) || defined(FREEBSD)
++ asm(" .globl GC_save_regs_in_stack");
++ asm("GC_save_regs_in_stack:");
++ asm(" .type GC_save_regs_in_stack,#function");
++# else
++ asm(" .globl _GC_save_regs_in_stack");
++ asm("_GC_save_regs_in_stack:");
++# endif
++# if defined(__arch64__) || defined(__sparcv9)
++ asm(" save %sp,-128,%sp");
++ asm(" flushw");
++ asm(" ret");
++ asm(" restore %sp,2047+128,%o0");
++# else
++ asm(" ta 0x3 ! ST_FLUSH_WINDOWS");
++ asm(" retl");
++ asm(" mov %sp,%o0");
++# endif
++# ifdef SVR4
++ asm(" .GC_save_regs_in_stack_end:");
++ asm(" .size GC_save_regs_in_stack,.GC_save_regs_in_stack_end-GC_save_regs_in_stack");
++# endif
++# ifdef LINT
++ word GC_save_regs_in_stack() { return(0 /* sp really */);}
++# endif
++# endif
++
++/* GC_clear_stack_inner(arg, limit) clears stack area up to limit and */
++/* returns arg. Stack clearing is crucial on SPARC, so we supply */
++/* an assembly version that's more careful. Assumes limit is hotter */
++/* than sp, and limit is 8 byte aligned. */
++#if defined(ASM_CLEAR_CODE)
++# ifdef SUNOS4
++ asm(".globl _GC_clear_stack_inner");
++ asm("_GC_clear_stack_inner:");
++# else
++ asm(".globl GC_clear_stack_inner");
++ asm("GC_clear_stack_inner:");
++ asm(".type GC_save_regs_in_stack,#function");
++# endif
++#if defined(__arch64__) || defined(__sparcv9)
++ asm("mov %sp,%o2"); /* Save sp */
++ asm("add %sp,2047-8,%o3"); /* p = sp+bias-8 */
++ asm("add %o1,-2047-192,%sp"); /* Move sp out of the way, */
++ /* so that traps still work. */
++ /* Includes some extra words */
++ /* so we can be sloppy below. */
++ asm("loop:");
++ asm("stx %g0,[%o3]"); /* *(long *)p = 0 */
++ asm("cmp %o3,%o1");
++ asm("bgu,pt %xcc, loop"); /* if (p > limit) goto loop */
++ asm("add %o3,-8,%o3"); /* p -= 8 (delay slot) */
++ asm("retl");
++ asm("mov %o2,%sp"); /* Restore sp., delay slot */
++#else
++ asm("mov %sp,%o2"); /* Save sp */
++ asm("add %sp,-8,%o3"); /* p = sp-8 */
++ asm("clr %g1"); /* [g0,g1] = 0 */
++ asm("add %o1,-0x60,%sp"); /* Move sp out of the way, */
++ /* so that traps still work. */
++ /* Includes some extra words */
++ /* so we can be sloppy below. */
++ asm("loop:");
++ asm("std %g0,[%o3]"); /* *(long long *)p = 0 */
++ asm("cmp %o3,%o1");
++ asm("bgu loop "); /* if (p > limit) goto loop */
++ asm("add %o3,-8,%o3"); /* p -= 8 (delay slot) */
++ asm("retl");
++ asm("mov %o2,%sp"); /* Restore sp., delay slot */
++#endif /* old SPARC */
++ /* First argument = %o0 = return value */
++# ifdef SVR4
++ asm(" .GC_clear_stack_inner_end:");
++ asm(" .size GC_clear_stack_inner,.GC_clear_stack_inner_end-GC_clear_stack_inner");
++# endif
++#endif
diff --git a/dev-lang/mercury/files/mercury-10.04.1-default-grade.patch b/dev-lang/mercury/files/mercury-10.04.1-default-grade.patch
new file mode 100644
index 000000000000..a0b1898645ed
--- /dev/null
+++ b/dev-lang/mercury/files/mercury-10.04.1-default-grade.patch
@@ -0,0 +1,274 @@
+diff -ur mercury-compiler-10.04.1.orig/Makefile mercury-compiler-10.04.1/Makefile
+--- mercury-compiler-10.04.1.orig/Makefile 2010-07-12 04:31:01.000000000 +1200
++++ mercury-compiler-10.04.1/Makefile 2010-09-05 09:02:03.000000000 +1200
+@@ -69,6 +69,6 @@
+ $(MMAKE) uninstall
+
+ .DEFAULT:
+- $(MMAKE) $@
++ $(MMAKE) MMAKEFLAGS=$(PARALLEL) $@
+
+ #-----------------------------------------------------------------------------#
+diff -ur mercury-compiler-10.04.1.orig/Mmakefile mercury-compiler-10.04.1/Mmakefile
+--- mercury-compiler-10.04.1.orig/Mmakefile 2009-10-20 17:07:24.000000000 +1300
++++ mercury-compiler-10.04.1/Mmakefile 2010-09-05 09:02:03.000000000 +1200
+@@ -286,6 +286,47 @@
+ mdbcomp browser ssdb trace
+ +cd deep_profiler && $(SUBDIR_MMAKE)
+
++.PHONY: default_grade
++default_grade:
++ +if test "$(DEFAULT_GRADE)" != "$(GRADE)"; then \
++ gc_grade=`scripts/ml --grade $(DEFAULT_GRADE) --print-gc-grade`; \
++ IWS=`/bin/pwd`/install_grade_dir.$(DEFAULT_GRADE); \
++ ( \
++ scripts/prepare_install_dir $${IWS} && \
++ ( cd $${IWS}/boehm_gc && \
++ $(SUBDIR_MMAKE) MC=mmc GRADE=$(DEFAULT_GRADE) WORKSPACE=$${IWS} \
++ GC_GRADE=$${gc_grade} libgrade ) && \
++ ( cd $${IWS}/runtime && \
++ $(SUBDIR_MMAKE) MC=mmc GRADE=$(DEFAULT_GRADE) WORKSPACE=$${IWS} \
++ libgrade ) && \
++ ( cd $${IWS}/library && \
++ $(SUBDIR_MMAKE) MC=mmc GRADE=$(DEFAULT_GRADE) WORKSPACE=$${IWS} \
++ depend && \
++ $(SUBDIR_MMAKE) MC=mmc GRADE=$(DEFAULT_GRADE) WORKSPACE=$${IWS} \
++ libgrade ) && \
++ ( cd $${IWS}/mdbcomp && \
++ $(SUBDIR_MMAKE) MC=mmc GRADE=$(DEFAULT_GRADE) WORKSPACE=$${IWS} \
++ depend && \
++ $(SUBDIR_MMAKE) MC=mmc GRADE=$(DEFAULT_GRADE) WORKSPACE=$${IWS} \
++ libgrade ) && \
++ ( cd $${IWS}/browser && \
++ $(SUBDIR_MMAKE) MC=mmc GRADE=$(DEFAULT_GRADE) WORKSPACE=$${IWS} \
++ depend && \
++ $(SUBDIR_MMAKE) MC=mmc GRADE=$(DEFAULT_GRADE) WORKSPACE=$${IWS} \
++ libgrade ) && \
++ ( cd $${IWS}/ssdb && \
++ $(SUBDIR_MMAKE) MC=mmc GRADE=$(DEFAULT_GRADE) WORKSPACE=$${IWS} \
++ depend && \
++ $(SUBDIR_MMAKE) MC=mmc GRADE=$(DEFAULT_GRADE) WORKSPACE=$${IWS} \
++ libgrade ) && \
++ ( cd $${IWS}/trace && \
++ $(SUBDIR_MMAKE) MC=mmc GRADE=$(DEFAULT_GRADE) WORKSPACE=$${IWS} \
++ libgrade ) && \
++ true \
++ ) || \
++ { exit 1; }; \
++ fi;
++
+ #-----------------------------------------------------------------------------#
+
+ .PHONY: tags
+diff -ur mercury-compiler-10.04.1.orig/boehm_gc/Mmakefile mercury-compiler-10.04.1/boehm_gc/Mmakefile
+--- mercury-compiler-10.04.1.orig/boehm_gc/Mmakefile 2010-02-27 02:16:44.000000000 +1300
++++ mercury-compiler-10.04.1/boehm_gc/Mmakefile 2010-09-05 09:02:03.000000000 +1200
+@@ -176,6 +176,9 @@
+
+ # No need to install the Boehm collector for grades which don't use it.
+
++.PHONY: libgrade
++libgrade:
++
+ .PHONY: install_headers
+ install_headers:
+
+@@ -187,6 +190,9 @@
+
+ else
+
++.PHONY: libgrade
++libgrade: lib$(GC_GRADE).$A lib$(GC_GRADE).$(EXT_FOR_SHARED_LIB)
++
+ .PHONY: install_headers
+ install_headers: install_dirs
+ cp $(HEADERS) $(INSTALL_INC_DIR)
+diff -ur mercury-compiler-10.04.1.orig/browser/Mmakefile mercury-compiler-10.04.1/browser/Mmakefile
+--- mercury-compiler-10.04.1.orig/browser/Mmakefile 2010-05-10 18:31:55.000000000 +1200
++++ mercury-compiler-10.04.1/browser/Mmakefile 2010-09-05 09:02:03.000000000 +1200
+@@ -256,16 +256,28 @@
+
+ # there is no browser in the .NET or Erlang backends
+
++.PHONY: libgrade
++libgrade:
++
+ .PHONY: install_library
+ install_library:
+
+ else ifneq (,$(findstring java,$(GRADE)))
+
++.PHONY: libgrade
++libgrade:
++
+ .PHONY: install_library
+ install_library: lib$(BROWSER_LIB_NAME).install
+
+ else
+
++.PHONY: libgrade
++libgrade: \
++ lib$(BROWSER_LIB_NAME).$A \
++ lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB) \
++ all-ints
++
+ .PHONY: install_library
+ install_library: \
+ lib$(BROWSER_LIB_NAME).install_library \
+diff -ur mercury-compiler-10.04.1.orig/library/Mmakefile mercury-compiler-10.04.1/library/Mmakefile
+--- mercury-compiler-10.04.1.orig/library/Mmakefile 2010-05-20 21:29:30.000000000 +1200
++++ mercury-compiler-10.04.1/library/Mmakefile 2010-09-05 09:02:03.000000000 +1200
+@@ -493,6 +493,9 @@
+
+ # XXX some modules in the browser directory need library.int3
+
++.PHONY: libgrade
++libgrade: mercury.dll
++
+ .PHONY: install_library
+ install_library: mercury.dll install_grade_dirs install_gac \
+ install_strong_name lib$(STD_LIB_NAME).install_grade_hdrs \
+@@ -531,6 +534,9 @@
+
+ else
+
++.PHONY: libgrade
++libgrade: lib$(STD_LIB_NAME)
++
+ # we depend on lib$(STD_LIB_NAME) because lib$(STD_LIB_NAME).install_library
+ # doesn't make library.int3, but some modules in the browser directory need it.
+
+@@ -541,6 +547,9 @@
+
+ else #ifneq ($(MMAKE_USE_MMC_MAKE),yes)
+
++.PHONY: libgrade
++libgrade: lib$(STD_LIB_NAME) all-ints
++
+ .PHONY: install_mercury
+ install_mercury: install_library
+
+diff -ur mercury-compiler-10.04.1.orig/mdbcomp/Mmakefile mercury-compiler-10.04.1/mdbcomp/Mmakefile
+--- mercury-compiler-10.04.1.orig/mdbcomp/Mmakefile 2010-05-10 18:32:00.000000000 +1200
++++ mercury-compiler-10.04.1/mdbcomp/Mmakefile 2010-09-05 09:02:03.000000000 +1200
+@@ -215,16 +215,28 @@
+
+ # there is no debugger in the .NET or Erlang backends
+
++.PHONY: libgrade
++libgrade:
++
+ .PHONY: install_library
+ install_library:
+
+ else ifneq (,$(findstring java,$(GRADE)))
+
++.PHONY: libgrade
++libgrade:
++
+ .PHONY: install_library
+ install_library: lib$(MDBCOMP_LIB_NAME).install
+
+ else
+
++.PHONY: libgrade
++libgrade: \
++ lib$(MDBCOMP_LIB_NAME).$A \
++ lib$(MDBCOMP_LIB_NAME).$(EXT_FOR_SHARED_LIB) \
++ all-ints
++
+ .PHONY: install_library
+ install_library: \
+ lib$(MDBCOMP_LIB_NAME).install_library \
+diff -ur mercury-compiler-10.04.1.orig/runtime/Mmakefile mercury-compiler-10.04.1/runtime/Mmakefile
+--- mercury-compiler-10.04.1.orig/runtime/Mmakefile 2010-07-16 03:24:52.000000000 +1200
++++ mercury-compiler-10.04.1/runtime/Mmakefile 2010-09-05 09:02:03.000000000 +1200
+@@ -466,6 +466,9 @@
+ # mercury/library/Mmakefile.)
+ # (Runtime support for the Erlang backend is in the library directory.)
+
++.PHONY: libgrade
++libgrade:
++
+ .PHONY: install_headers
+ install_headers:
+
+@@ -478,6 +481,9 @@
+ else
+ ifeq ($(findstring il,$(GRADE)),il)
+
++.PHONY: libgrade
++libgrade: $(DOTNET_DLLS)
++
+ .PHONY: install_headers
+ install_headers:
+
+@@ -492,6 +498,9 @@
+
+ else
+
++.PHONY: libgrade
++libgrade: lib$(RT_LIB_NAME).$A lib$(RT_LIB_NAME).$(EXT_FOR_SHARED_LIB)
++
+ # mercury_conf.h needs to be in a separate directory so it can be
+ # overridden by a different configuration.
+ .PHONY: install_headers
+diff -ur mercury-compiler-10.04.1.orig/ssdb/Mmakefile mercury-compiler-10.04.1/ssdb/Mmakefile
+--- mercury-compiler-10.04.1.orig/ssdb/Mmakefile 2010-05-10 18:32:00.000000000 +1200
++++ mercury-compiler-10.04.1/ssdb/Mmakefile 2010-09-05 09:02:03.000000000 +1200
+@@ -250,16 +250,28 @@
+
+ # there is no ssdb in the .NET or Erlang backends
+
++.PHONY: libgrade
++libgrade:
++
+ .PHONY: install_library
+ install_library:
+
+ else ifneq (,$(findstring java,$(GRADE)))
+
++.PHONY: libgrade
++libgrade:
++
+ .PHONY: install_library
+ install_library: lib$(SSDB_LIB_NAME).install
+
+ else
+
++.PHONY: libgrade
++libgrade: \
++ lib$(SSDB_LIB_NAME).$A \
++ lib$(SSDB_LIB_NAME).$(EXT_FOR_SHARED_LIB) \
++ all-ints
++
+ .PHONY: install_library
+ install_library: \
+ lib$(SSDB_LIB_NAME).install_library \
+diff -ur mercury-compiler-10.04.1.orig/trace/Mmakefile mercury-compiler-10.04.1/trace/Mmakefile
+--- mercury-compiler-10.04.1.orig/trace/Mmakefile 2008-07-30 05:58:58.000000000 +1200
++++ mercury-compiler-10.04.1/trace/Mmakefile 2010-09-05 09:02:03.000000000 +1200
+@@ -324,6 +324,9 @@
+
+ # there is no tracing in the .NET, Java, Erlang backends
+
++.PHONY: libgrade
++libgrade:
++
+ .PHONY: install_headers
+ install_headers:
+
+@@ -332,6 +335,13 @@
+
+ else
+
++.PHONY: libgrade
++libgrade: \
++ lib$(TRACE_LIB_NAME).$A \
++ lib$(TRACE_LIB_NAME).$(EXT_FOR_SHARED_LIB) \
++ lib$(EVENTSPEC_LIB_NAME).$A \
++ lib$(EVENTSPEC_LIB_NAME).$(EXT_FOR_SHARED_LIB)
++
+ .PHONY: install_headers
+ install_headers: $(HDRS) $(LIB_GLOBALS_H)
+ cp `vpath_find $(HDRS) $(LIB_GLOBALS_H)` $(INSTALL_INC_DIR)
diff --git a/dev-lang/mercury/files/mercury-10.04.1-docs.patch b/dev-lang/mercury/files/mercury-10.04.1-docs.patch
new file mode 100644
index 000000000000..c50d1d455599
--- /dev/null
+++ b/dev-lang/mercury/files/mercury-10.04.1-docs.patch
@@ -0,0 +1,21 @@
+diff -ur mercury-compiler-10.04.1.orig/doc/Mmakefile mercury-compiler-10.04.1/doc/Mmakefile
+--- mercury-compiler-10.04.1.orig/doc/Mmakefile 2010-07-07 01:42:07.000000000 +1200
++++ mercury-compiler-10.04.1/doc/Mmakefile 2010-09-05 09:13:40.000000000 +1200
+@@ -120,7 +120,7 @@
+ # formatted versions of the man pages.
+ # But it might make sense to add them.
+ .PHONY: all
+-all: $(INFOPAGES) $(DVI) $(HTML) manpages $(MDB_DOC)
++all: $(INFOPAGES) $(HTML) manpages $(MDB_DOC)
+ #all: ps pdf text formatted_manpages
+
+ #-----------------------------------------------------------------------------#
+@@ -351,7 +351,7 @@
+ # versions of the documentation. If they are added they should
+ # be installed here.
+ .PHONY: install
+-install: install_info install_html install_dvi install_manpages \
++install: install_info install_html install_manpages \
+ install_mdb_doc
+ # install_text install_ps
+
diff --git a/dev-lang/mercury/files/mercury-10.04.1-linker-flags.patch b/dev-lang/mercury/files/mercury-10.04.1-linker-flags.patch
new file mode 100644
index 000000000000..7a08ebcb7b37
--- /dev/null
+++ b/dev-lang/mercury/files/mercury-10.04.1-linker-flags.patch
@@ -0,0 +1,80 @@
+diff -ur mercury-compiler-10.04.1.orig/boehm_gc/Makefile.direct mercury-compiler-10.04.1/boehm_gc/Makefile.direct
+--- mercury-compiler-10.04.1.orig/boehm_gc/Makefile.direct 2010-02-24 20:04:32.000000000 +1300
++++ mercury-compiler-10.04.1/boehm_gc/Makefile.direct 2010-09-05 17:42:33.000000000 +1200
+@@ -351,7 +351,7 @@
+ -ldl `./threadlibs`
+ ./if_not_there on_sparc_sunos5_so $(MAKE) dyn_load.o
+ ./if_not_there on_sparc_sunos5_so \
+- $(LINK_SHARED_OBJ) -o lib$(GC_GRADE).so $(OBJS) dyn_load.o -lc
++ $(LINK_SHARED_OBJ) -o lib$(GC_GRADE).so $(OBJS) dyn_load.o -lc $(EXTRA_LDFLAGS)
+
+ # Darwin shared library version of the gc.
+ lib$(GC_GRADE).dylib: $(OBJS) $(UTILS)
+diff -ur mercury-compiler-10.04.1.orig/library/Mmakefile mercury-compiler-10.04.1/library/Mmakefile
+--- mercury-compiler-10.04.1.orig/library/Mmakefile 2010-09-05 11:44:16.000000000 +1200
++++ mercury-compiler-10.04.1/library/Mmakefile 2010-05-20 21:29:30.000000000 +1200
+@@ -268,8 +268,8 @@
+ [ -d jmercury/runtime ] || cp -r ../java/runtime jmercury
+
+ install_mer_rt: $(RT_LIB_NAME).jar
+- mkdir -p $(INSTALL_LIBDIR)/lib/$(GRADE)
+- cp $(RT_LIB_NAME).jar $(INSTALL_LIBDIR)/lib/$(GRADE)
++ mkdir -p $(INSTALL_PREFIX)/lib/mercury/lib/$(GRADE)
++ cp $(RT_LIB_NAME).jar $(INSTALL_PREFIX)/lib/mercury/lib/$(GRADE)
+
+ else
+
+diff -ur mercury-compiler-10.04.1.orig/runtime/Mmakefile mercury-compiler-10.04.1/runtime/Mmakefile
+--- mercury-compiler-10.04.1.orig/runtime/Mmakefile 2010-07-16 03:24:52.000000000 +1200
++++ mercury-compiler-10.04.1/runtime/Mmakefile 2010-09-05 17:42:33.000000000 +1200
+@@ -387,7 +387,7 @@
+ $(LINK_SHARED_OBJ) $(ERROR_UNDEFINED) \
+ -o lib$(RT_LIB_NAME).so $(PIC_OBJS) \
+ $(SHLIB_RPATH_OPT)$(FINAL_INSTALL_MERC_GC_LIB_DIR) \
+- $(LDFLAGS) $(LDLIBS) $(THREADLIBS) \
++ $(ALL_LDFLAGS) $(LDLIBS) $(THREADLIBS) \
+ $(SHARED_LIBS)
+
+ # For Darwin we should pass the -install_name option.
+diff -ur mercury-compiler-10.04.1.orig/trace/Mmakefile mercury-compiler-10.04.1/trace/Mmakefile
+--- mercury-compiler-10.04.1.orig/trace/Mmakefile 2008-07-30 05:58:58.000000000 +1200
++++ mercury-compiler-10.04.1/trace/Mmakefile 2010-09-05 17:42:33.000000000 +1200
+@@ -273,6 +273,7 @@
+ $(LINK_SHARED_OBJ) $(ERROR_UNDEFINED) \
+ -o lib$(TRACE_LIB_NAME).so $(TRACE_PIC_OBJS) \
+ $(RPATH_1)$(RPATH_2) \
++ $(ALL_LDFLAGS) \
+ $(TRACE_LDFLAGS) $(TRACE_LDLIBS) $(THREADLIBS) \
+ $(SHARED_LIBS)
+
+@@ -280,6 +281,7 @@
+ $(LINK_SHARED_OBJ) $(ERROR_UNDEFINED) \
+ -o lib$(EVENTSPEC_LIB_NAME).so $(EVENTSPEC_PIC_OBJS) \
+ $(RPATH_1)$(RPATH_2) \
++ $(ALL_LDFLAGS) \
+ $(EVENTSPEC_LDFLAGS) $(EVENTSPEC_LDLIBS) $(THREADLIBS) \
+ $(SHARED_LIBS)
+
+diff -ur mercury-compiler-10.04.1.orig/util/Mmakefile mercury-compiler-10.04.1/util/Mmakefile
+--- mercury-compiler-10.04.1.orig/util/Mmakefile 2010-07-12 04:31:03.000000000 +1200
++++ mercury-compiler-10.04.1/util/Mmakefile 2010-09-05 17:42:33.000000000 +1200
+@@ -41,16 +41,16 @@
+
+ .c:
+ $(MGNUC) --no-mercury-stdlib-dir \
+- $(GRADEFLAGS) $(ALL_MGNUCFLAGS) -o $@ $< $(GETOPT_SRC)
++ $(GRADEFLAGS) $(ALL_MGNUCFLAGS) $(ALL_LDFLAGS) -o $@ $< $(GETOPT_SRC)
+
+ mkinit: mkinit.c mkinit_common.c mkinit_common.h
+ $(MGNUC) --no-mercury-stdlib-dir \
+- $(GRADEFLAGS) $(ALL_MGNUCFLAGS) -o $@ \
++ $(GRADEFLAGS) $(ALL_MGNUCFLAGS) $(ALL_LDFLAGS) -o $@ \
+ mkinit.c mkinit_common.c $(GETOPT_SRC)
+
+ mkinit_erl: mkinit_erl.c mkinit_common.c mkinit_common.h
+ $(MGNUC) --no-mercury-stdlib-dir \
+- $(GRADEFLAGS) $(ALL_MGNUCFLAGS) -o $@ \
++ $(GRADEFLAGS) $(ALL_MGNUCFLAGS) $(ALL_LDFLAGS) -o $@ \
+ mkinit_erl.c mkinit_common.c $(GETOPT_SRC)
+
+ tags:
diff --git a/dev-lang/mercury/files/mercury-10.04.1-multilib.patch b/dev-lang/mercury/files/mercury-10.04.1-multilib.patch
new file mode 100644
index 000000000000..ba62e85fdf67
--- /dev/null
+++ b/dev-lang/mercury/files/mercury-10.04.1-multilib.patch
@@ -0,0 +1,232 @@
+diff -ur mercury-compiler-10.04.1.orig/compiler/file_util.m mercury-compiler-10.04.1/compiler/file_util.m
+--- mercury-compiler-10.04.1.orig/compiler/file_util.m 2009-10-14 18:28:32.000000000 +1300
++++ mercury-compiler-10.04.1/compiler/file_util.m 2010-09-05 15:35:56.000000000 +1200
+@@ -261,7 +261,7 @@
+ ( InstallNamePath0 = "" ->
+ globals.lookup_string_option(Globals, install_prefix, InstallPrefix),
+ grade_directory_component(Globals, GradeDir),
+- InstallNamePath = InstallPrefix / "lib" / "mercury" / "lib" / GradeDir
++ InstallNamePath = InstallPrefix / "@libdir@" / "mercury" / "lib" / GradeDir
+ ;
+ InstallNamePath = InstallNamePath0
+ ),
+diff -ur mercury-compiler-10.04.1.orig/compiler/libs.file_util.c mercury-compiler-10.04.1/compiler/libs.file_util.c
+--- mercury-compiler-10.04.1.orig/compiler/libs.file_util.c 2010-08-30 04:35:03.000000000 +1200
++++ mercury-compiler-10.04.1/compiler/libs.file_util.c 2010-09-05 11:29:44.000000000 +1200
+@@ -856,7 +856,7 @@
+ MR_tempr1 = MR_sv(1);
+ MR_sv(1) = MR_r1;
+ MR_r1 = MR_tempr1;
+- MR_r2 = (MR_Word) MR_string_const("lib", 3);
++ MR_r2 = (MR_Word) MR_string_const("@libdir@", 3);
+ }
+ MR_np_call_localret_ent(fn__f_100_105_114_95_95_47_2_0,
+ libs__file_util__get_install_name_option_3_0_i8);
+diff -ur mercury-compiler-10.04.1.orig/compiler/make.program_target.c mercury-compiler-10.04.1/compiler/make.program_target.c
+--- mercury-compiler-10.04.1.orig/compiler/make.program_target.c 2010-08-30 04:37:52.000000000 +1200
++++ mercury-compiler-10.04.1/compiler/make.program_target.c 2010-09-05 08:58:59.000000000 +1200
+@@ -5422,7 +5422,7 @@
+ make__program_target__install_grade_init_6_0_i2);
+ MR_def_label(make__program_target__install_grade_init_6_0,2)
+ MR_MAYBE_INIT_LOCAL_THREAD_ENGINE_BASE
+- MR_r2 = (MR_Word) MR_string_const("lib", 3);
++ MR_r2 = (MR_Word) MR_string_const("@libdir@", 3);
+ MR_np_call_localret_ent(fn__f_100_105_114_95_95_47_2_0,
+ make__program_target__install_grade_init_6_0_i3);
+ MR_def_label(make__program_target__install_grade_init_6_0,3)
+@@ -5873,7 +5873,7 @@
+ make__program_target__make_grade_install_dirs_6_0_i2);
+ MR_def_label(make__program_target__make_grade_install_dirs_6_0,2)
+ MR_MAYBE_INIT_LOCAL_THREAD_ENGINE_BASE
+- MR_r2 = (MR_Word) MR_string_const("lib", 3);
++ MR_r2 = (MR_Word) MR_string_const("@libdir@", 3);
+ MR_np_call_localret_ent(fn__f_100_105_114_95_95_47_2_0,
+ make__program_target__make_grade_install_dirs_6_0_i3);
+ MR_def_label(make__program_target__make_grade_install_dirs_6_0,3)
+@@ -6318,7 +6318,7 @@
+ MR_GOTO_LAB(make__program_target__install_library_grade_files_10_0_i11);
+ }
+ MR_r1 = MR_sv(10);
+- MR_r2 = (MR_Word) MR_string_const("lib", 3);
++ MR_r2 = (MR_Word) MR_string_const("@libdir@", 3);
+ MR_np_call_localret_ent(fn__f_100_105_114_95_95_47_2_0,
+ make__program_target__install_library_grade_files_10_0_i14);
+ MR_def_label(make__program_target__install_library_grade_files_10_0,14)
+@@ -6382,7 +6382,7 @@
+ MR_GOTO_LAB(make__program_target__install_library_grade_files_10_0_i20);
+ }
+ MR_r1 = MR_sv(10);
+- MR_r2 = (MR_Word) MR_string_const("lib", 3);
++ MR_r2 = (MR_Word) MR_string_const("@libdir@", 3);
+ MR_np_call_localret_ent(fn__f_100_105_114_95_95_47_2_0,
+ make__program_target__install_library_grade_files_10_0_i23);
+ MR_def_label(make__program_target__install_library_grade_files_10_0,23)
+@@ -6448,7 +6448,7 @@
+ MR_def_label(make__program_target__install_library_grade_files_10_0,20)
+ MR_MAYBE_INIT_LOCAL_THREAD_ENGINE_BASE
+ MR_r1 = MR_sv(10);
+- MR_r2 = (MR_Word) MR_string_const("lib", 3);
++ MR_r2 = (MR_Word) MR_string_const("@libdir@", 3);
+ MR_np_call_localret_ent(fn__f_100_105_114_95_95_47_2_0,
+ make__program_target__install_library_grade_files_10_0_i30);
+ MR_def_label(make__program_target__install_library_grade_files_10_0,30)
+@@ -6585,7 +6585,7 @@
+ make__program_target__make_install_dirs_5_0_i2);
+ MR_def_label(make__program_target__make_install_dirs_5_0,2)
+ MR_MAYBE_INIT_LOCAL_THREAD_ENGINE_BASE
+- MR_r2 = (MR_Word) MR_string_const("lib", 3);
++ MR_r2 = (MR_Word) MR_string_const("@libdir@", 3);
+ MR_np_call_localret_ent(fn__f_100_105_114_95_95_47_2_0,
+ make__program_target__make_install_dirs_5_0_i3);
+ MR_def_label(make__program_target__make_install_dirs_5_0,3)
+@@ -6806,7 +6806,7 @@
+ make__program_target__install_library_7_0_i11);
+ MR_def_label(make__program_target__install_library_7_0,11)
+ MR_MAYBE_INIT_LOCAL_THREAD_ENGINE_BASE
+- MR_r2 = (MR_Word) MR_string_const("lib", 3);
++ MR_r2 = (MR_Word) MR_string_const("@libdir@", 3);
+ MR_np_call_localret_ent(fn__f_100_105_114_95_95_47_2_0,
+ make__program_target__install_library_7_0_i12);
+ MR_def_label(make__program_target__install_library_7_0,12)
+@@ -10596,7 +10596,7 @@
+ make__program_target__install_ints_and_headers_8_0_i13);
+ MR_def_label(make__program_target__install_ints_and_headers_8_0,13)
+ MR_MAYBE_INIT_LOCAL_THREAD_ENGINE_BASE
+- MR_r2 = (MR_Word) MR_string_const("lib", 3);
++ MR_r2 = (MR_Word) MR_string_const("@libdir@", 3);
+ MR_np_call_localret_ent(fn__f_100_105_114_95_95_47_2_0,
+ make__program_target__install_ints_and_headers_8_0_i14);
+ MR_def_label(make__program_target__install_ints_and_headers_8_0,14)
+@@ -11222,7 +11222,7 @@
+ make__program_target__install_grade_ints_and_headers_9_0_i5);
+ MR_def_label(make__program_target__install_grade_ints_and_headers_9_0,5)
+ MR_MAYBE_INIT_LOCAL_THREAD_ENGINE_BASE
+- MR_r2 = (MR_Word) MR_string_const("lib", 3);
++ MR_r2 = (MR_Word) MR_string_const("@libdir@", 3);
+ MR_np_call_localret_ent(fn__f_100_105_114_95_95_47_2_0,
+ make__program_target__install_grade_ints_and_headers_9_0_i6);
+ MR_def_label(make__program_target__install_grade_ints_and_headers_9_0,6)
+diff -ur mercury-compiler-10.04.1.orig/compiler/make.program_target.m mercury-compiler-10.04.1/compiler/make.program_target.m
+--- mercury-compiler-10.04.1.orig/compiler/make.program_target.m 2010-05-20 21:29:30.000000000 +1200
++++ mercury-compiler-10.04.1/compiler/make.program_target.m 2010-09-05 15:35:08.000000000 +1200
+@@ -1370,7 +1370,7 @@
+ ),
+
+ globals.lookup_string_option(Globals, install_prefix, Prefix),
+- LibDir = Prefix/"lib"/"mercury",
++ LibDir = Prefix/"@libdir@"/"mercury",
+ list.map_foldl(
+ install_subdir_file(Globals, SubdirLinkSucceeded, LibDir/"ints",
+ ModuleName),
+@@ -1424,7 +1424,7 @@
+ globals.lookup_accumulating_option(Globals, extra_library_header,
+ ExtraHdrs),
+ globals.lookup_string_option(Globals, install_prefix, Prefix),
+- IncDir = Prefix / "lib" / "mercury" / "inc",
++ IncDir = Prefix / "@libdir@" / "mercury" / "inc",
+ list.foldl2(install_extra_header(Globals, IncDir), ExtraHdrs,
+ yes, ExtraHdrsSucceeded, !IO).
+
+@@ -1572,19 +1572,19 @@
+ globals.lookup_string_option(Globals, install_prefix, Prefix),
+
+ ( string.prefix(GradeDir, "java") ->
+- GradeLibDir = Prefix/"lib"/"mercury"/"lib"/GradeDir,
++ GradeLibDir = Prefix/"@libdir@"/"mercury"/"lib"/GradeDir,
+ install_file(Globals, JarFileName, GradeLibDir, LibsSucceeded,
+ !IO),
+ InitSucceeded = yes
+ ; string.prefix(GradeDir, "erlang") ->
+- GradeLibDir = Prefix/"lib"/"mercury"/"lib"/GradeDir,
++ GradeLibDir = Prefix/"@libdir@"/"mercury"/"lib"/GradeDir,
+ % Our "Erlang archives" are actually directories.
+ install_directory(Globals, ErlangArchiveFileName, GradeLibDir,
+ LibsSucceeded, !IO),
+ install_grade_init(Globals, GradeDir, ModuleName, InitSucceeded,
+ !IO)
+ ;
+- GradeLibDir = Prefix/"lib"/"mercury"/"lib"/GradeDir,
++ GradeLibDir = Prefix/"@libdir@"/"mercury"/"lib"/GradeDir,
+ maybe_install_library_file(Globals, "static", LibFileName,
+ GradeLibDir, LibSuccess, !IO),
+ ( LibFileName = SharedLibFileName ->
+@@ -1615,7 +1615,7 @@
+
+ install_grade_init(Globals, GradeDir, ModuleName, Succeeded, !IO) :-
+ globals.lookup_string_option(Globals, install_prefix, Prefix),
+- GradeModulesDir = Prefix / "lib" / "mercury" / "modules" / GradeDir,
++ GradeModulesDir = Prefix / "@libdir@" / "mercury" / "modules" / GradeDir,
+ module_name_to_file_name(Globals, ModuleName, ".init", do_not_create_dirs,
+ InitFileName, !IO),
+ install_file(Globals, InitFileName, GradeModulesDir, Succeeded, !IO).
+@@ -1632,7 +1632,7 @@
+ (
+ MaybeImports = yes(Imports),
+ globals.lookup_string_option(Globals, install_prefix, Prefix),
+- LibDir = Prefix/"lib"/"mercury",
++ LibDir = Prefix/"@libdir@"/"mercury",
+
+ globals.get_target(Globals, Target),
+ globals.lookup_bool_option(Globals, highlevel_code, HighLevelCode),
+@@ -1784,7 +1784,7 @@
+
+ make_install_dirs(Globals, Result, LinkResult, !IO) :-
+ globals.lookup_string_option(Globals, install_prefix, Prefix),
+- LibDir = Prefix/"lib"/"mercury",
++ LibDir = Prefix/"@libdir@"/"mercury",
+ make_directory(LibDir/"inc", Result1, !IO),
+ make_directory(LibDir/"modules", Result2, !IO),
+
+@@ -1815,7 +1815,7 @@
+
+ make_grade_install_dirs(Globals, Grade, Result, LinkResult, !IO) :-
+ globals.lookup_string_option(Globals, install_prefix, Prefix),
+- LibDir = Prefix/"lib"/"mercury",
++ LibDir = Prefix/"@libdir@"/"mercury",
+
+ GradeIntsSubdir = LibDir/"ints"/Grade/"Mercury",
+ make_directory(GradeIntsSubdir, Result1, !IO),
+diff -ur mercury-compiler-10.04.1.orig/library/Mmakefile mercury-compiler-10.04.1/library/Mmakefile
+--- mercury-compiler-10.04.1.orig/library/Mmakefile 2010-09-05 11:44:16.000000000 +1200
++++ mercury-compiler-10.04.1/library/Mmakefile 2010-09-05 09:02:39.000000000 +1200
+@@ -268,8 +268,8 @@
+ [ -d jmercury/runtime ] || cp -r ../java/runtime jmercury
+
+ install_mer_rt: $(RT_LIB_NAME).jar
+- mkdir -p $(INSTALL_PREFIX)/lib/mercury/lib/$(GRADE)
+- cp $(RT_LIB_NAME).jar $(INSTALL_PREFIX)/lib/mercury/lib/$(GRADE)
++ mkdir -p $(INSTALL_LIBDIR)/lib/$(GRADE)
++ cp $(RT_LIB_NAME).jar $(INSTALL_LIBDIR)/lib/$(GRADE)
+
+ else
+
+diff -ur mercury-compiler-10.04.1.orig/scripts/Mmake.vars.in mercury-compiler-10.04.1/scripts/Mmake.vars.in
+--- mercury-compiler-10.04.1.orig/scripts/Mmake.vars.in 2010-05-20 21:29:31.000000000 +1200
++++ mercury-compiler-10.04.1/scripts/Mmake.vars.in 2010-09-05 08:59:58.000000000 +1200
+@@ -688,17 +688,17 @@
+ INSTALL_PREFIX = @prefix@
+ FINAL_INSTALL_PREFIX = @prefix@
+ INSTALL_BINDIR = $(INSTALL_PREFIX)/bin
+-INSTALL_LIBDIR = $(INSTALL_PREFIX)/lib/mercury
+-FINAL_INSTALL_LIBDIR = $(FINAL_INSTALL_PREFIX)/lib/mercury
++INSTALL_LIBDIR = $(INSTALL_PREFIX)/@libdir@/mercury
++FINAL_INSTALL_LIBDIR = $(FINAL_INSTALL_PREFIX)/@libdir@/mercury
+ INSTALL_INFO_DIR = $(INSTALL_PREFIX)/info
+-INSTALL_DVI_DIR = $(INSTALL_PREFIX)/lib/mercury/doc
+-INSTALL_TEXT_DIR = $(INSTALL_PREFIX)/lib/mercury/doc
+-INSTALL_PS_DIR = $(INSTALL_PREFIX)/lib/mercury/doc
+-INSTALL_PDF_DIR = $(INSTALL_PREFIX)/lib/mercury/doc
++INSTALL_DVI_DIR = $(INSTALL_PREFIX)/@libdir@/mercury/doc
++INSTALL_TEXT_DIR = $(INSTALL_PREFIX)/@libdir@/mercury/doc
++INSTALL_PS_DIR = $(INSTALL_PREFIX)/@libdir@/mercury/doc
++INSTALL_PDF_DIR = $(INSTALL_PREFIX)/@libdir@/mercury/doc
+ INSTALL_MAN_DIR = $(INSTALL_PREFIX)/man
+-INSTALL_HTML_DIR = $(INSTALL_PREFIX)/lib/mercury/html
+-INSTALL_MDB_DOC_DIR = $(INSTALL_PREFIX)/lib/mercury/mdb
+-INSTALL_ELISP_DIR = $(INSTALL_PREFIX)/lib/mercury/elisp
++INSTALL_HTML_DIR = $(INSTALL_PREFIX)/@libdir@/mercury/html
++INSTALL_MDB_DOC_DIR = $(INSTALL_PREFIX)/@libdir@/mercury/mdb
++INSTALL_ELISP_DIR = $(INSTALL_PREFIX)/@libdir@/mercury/elisp
+ INSTALL_CGI_DIR = @CGIDIR@
+
+ # You should not need to override anything below here
diff --git a/dev-lang/mercury/files/mercury-10.04.1-no-reconf.patch b/dev-lang/mercury/files/mercury-10.04.1-no-reconf.patch
new file mode 100644
index 000000000000..6d3cf73f8446
--- /dev/null
+++ b/dev-lang/mercury/files/mercury-10.04.1-no-reconf.patch
@@ -0,0 +1,59 @@
+diff -ur mercury-compiler-10.04.1.orig/runtime/Mmakefile mercury-compiler-10.04.1/runtime/Mmakefile
+--- mercury-compiler-10.04.1.orig/runtime/Mmakefile 2010-07-16 03:24:52.000000000 +1200
++++ mercury-compiler-10.04.1/runtime/Mmakefile 2010-09-05 09:15:31.000000000 +1200
+@@ -455,8 +455,6 @@
+ mkdir -p $(INSTALL_GRADE_MODULE_DIR)
+ -[ -d $(INSTALL_MERC_LIB_DIR) ] || mkdir -p $(INSTALL_MERC_LIB_DIR)
+ -[ -d $(INSTALL_CONF_DIR) ] || mkdir -p $(INSTALL_CONF_DIR)
+- -[ -d $(INSTALL_RECONF_DIR)/runtime ] || \
+- mkdir -p $(INSTALL_RECONF_DIR)/runtime
+
+ ifneq "$(filter java% erlang%,$(GRADE))" ""
+
+@@ -502,7 +500,6 @@
+ rm -f $(INSTALL_INC_DIR)/mercury_conf.h
+ cp `vpath_find mercury_conf.h` $(INSTALL_CONF_DIR)
+ -chmod u+w $(INSTALL_CONF_DIR)/mercury_conf.h
+- cp `vpath_find mercury_conf.h.in` $(INSTALL_RECONF_DIR)/runtime
+ cp `vpath_find $(MACHHDRS)` $(INSTALL_INC_DIR)/machdeps
+
+ .PHONY: install_init
+diff -ur mercury-compiler-10.04.1.orig/scripts/Mmakefile mercury-compiler-10.04.1/scripts/Mmakefile
+--- mercury-compiler-10.04.1.orig/scripts/Mmakefile 2009-09-02 11:54:38.000000000 +1200
++++ mercury-compiler-10.04.1/scripts/Mmakefile 2010-09-05 09:15:31.000000000 +1200
+@@ -24,17 +24,13 @@
+ canonical_grade \
+ mdb \
+ mdprof \
+- mercury.bat \
+- mercury_config \
+ mercury_update_interface \
+ mgnuc \
+- mkfifo_using_mknod \
+ ml \
+ mmake \
+ mmc \
+ mprof \
+- mtags \
+- prepare_install_dir
++ mtags
+
+ SCRIPTS = $(NONCONF_SCRIPTS) $(CONF_SCRIPTS)
+
+@@ -113,8 +109,6 @@
+ [ -d $(INSTALL_LIBDIR)/mdb ] || mkdir -p $(INSTALL_LIBDIR)/mdb
+ [ -d $(INSTALL_CONF_DIR) ] || mkdir -p $(INSTALL_CONF_DIR)
+ [ -d $(INSTALL_ELISP_DIR) ] || mkdir -p $(INSTALL_ELISP_DIR)
+- [ -d $(INSTALL_RECONF_DIR)/scripts ] || \
+- mkdir -p $(INSTALL_RECONF_DIR)/scripts
+
+ .PHONY: install_mmake
+ install_mmake: Mmake.vars Mmake.rules install_dirs
+@@ -132,7 +126,6 @@
+ -for file in $(SCRIPTS); do \
+ chmod u+w $(INSTALL_BINDIR)/$$file ;\
+ done
+- cp *.in *.sh-subr $(SCRIPTS) $(INSTALL_RECONF_DIR)/scripts
+ -rm -f $(INSTALL_BINDIR)/mmake.old
+
+ .PHONY: install_config
diff --git a/dev-lang/mercury/files/mercury-10.04.1-sparc-llds-base-grade.patch b/dev-lang/mercury/files/mercury-10.04.1-sparc-llds-base-grade.patch
new file mode 100644
index 000000000000..424e123a1699
--- /dev/null
+++ b/dev-lang/mercury/files/mercury-10.04.1-sparc-llds-base-grade.patch
@@ -0,0 +1,12 @@
+diff -ur mercury-compiler-10.04.1.orig/configure mercury-compiler-10.04.1/configure
+--- mercury-compiler-10.04.1.orig/configure 2010-08-29 19:27:34.000000000 +1200
++++ mercury-compiler-10.04.1/configure 2010-09-05 09:11:36.000000000 +1200
+@@ -10805,7 +10805,7 @@
+ # The asm_fast and reg grades also do not currently work on Linux/PPC.
+ #
+ case "$host" in
+- i*86*apple*darwin*|x86_64*apple*darwin*|powerpc*-linux-gnu)
++ i*86*apple*darwin*|x86_64*apple*darwin*|powerpc*-linux-gnu|sparc*-linux-gnu)
+ BEST_LLDS_BASE_GRADE=none
+ ;;
+ esac
diff --git a/dev-lang/mercury/files/mercury-10.04.1-tests-sandbox.patch b/dev-lang/mercury/files/mercury-10.04.1-tests-sandbox.patch
new file mode 100644
index 000000000000..90efcf5d78e6
--- /dev/null
+++ b/dev-lang/mercury/files/mercury-10.04.1-tests-sandbox.patch
@@ -0,0 +1,64 @@
+diff -ur mercury-tests-10.04.1.orig/hard_coded/dir_test.exp mercury-tests-10.04.1/hard_coded/dir_test.exp
+--- mercury-tests-10.04.1.orig/hard_coded/dir_test.exp 2007-09-21 15:21:35.000000000 +1200
++++ mercury-tests-10.04.1/hard_coded/dir_test.exp 2010-09-05 09:40:36.000000000 +1200
+@@ -130,7 +130,6 @@
+ "foo"/"bar/baz" = "foo\bar\baz".
+ "foo/"/"bar/baz" = "foo\bar\baz".
+ checking whether `unwritable' is readable...ok
+-unwritable file found to be unwritable
+ current_directory succeeded: hard_coded
+ make_directory succeeded
+ make_directory succeeded
+diff -ur mercury-tests-10.04.1.orig/hard_coded/dir_test.exp2 mercury-tests-10.04.1/hard_coded/dir_test.exp2
+--- mercury-tests-10.04.1.orig/hard_coded/dir_test.exp2 2007-10-01 18:40:43.000000000 +1300
++++ mercury-tests-10.04.1/hard_coded/dir_test.exp2 2010-09-05 09:40:36.000000000 +1200
+@@ -127,7 +127,6 @@
+ "foo"/"bar/baz" = "foo/bar/baz".
+ "foo/"/"bar/baz" = "foo/bar/baz".
+ checking whether `unwritable' is readable...ok
+-unwritable file found to be unwritable
+ current_directory succeeded: hard_coded
+ make_directory succeeded
+ make_directory succeeded
+diff -ur mercury-tests-10.04.1.orig/hard_coded/dir_test.exp3 mercury-tests-10.04.1/hard_coded/dir_test.exp3
+--- mercury-tests-10.04.1.orig/hard_coded/dir_test.exp3 2007-10-01 18:40:43.000000000 +1300
++++ mercury-tests-10.04.1/hard_coded/dir_test.exp3 2010-09-05 09:40:36.000000000 +1200
+@@ -130,7 +130,6 @@
+ "foo"/"bar/baz" = "foo/bar/baz".
+ "foo/"/"bar/baz" = "foo/bar/baz".
+ checking whether `unwritable' is readable...ok
+-unwritable file found to be unwritable
+ current_directory succeeded: hard_coded
+ make_directory succeeded
+ make_directory succeeded
+diff -ur mercury-tests-10.04.1.orig/hard_coded/dir_test.exp4 mercury-tests-10.04.1/hard_coded/dir_test.exp4
+--- mercury-tests-10.04.1.orig/hard_coded/dir_test.exp4 2010-03-04 13:39:48.000000000 +1300
++++ mercury-tests-10.04.1/hard_coded/dir_test.exp4 2010-09-05 09:40:36.000000000 +1200
+@@ -127,7 +127,6 @@
+ "foo"/"bar/baz" = "foo/bar/baz".
+ "foo/"/"bar/baz" = "foo/bar/baz".
+ checking whether `unwritable' is readable...ok
+-unwritable file found to be unwritable
+ current_directory succeeded: hard_coded
+ make_directory succeeded
+ make_directory succeeded
+diff -ur mercury-tests-10.04.1.orig/hard_coded/dir_test.m mercury-tests-10.04.1/hard_coded/dir_test.m
+--- mercury-tests-10.04.1.orig/hard_coded/dir_test.m 2010-02-09 16:39:39.000000000 +1300
++++ mercury-tests-10.04.1/hard_coded/dir_test.m 2010-09-05 09:40:36.000000000 +1200
+@@ -50,16 +50,6 @@
+ io__write(ReadResult),
+ io__nl,
+
+- io__check_file_accessibility("unwritable",
+- [read, write], WriteResult),
+- ( { WriteResult = ok } ->
+- io__write_string(
+- "Error: unwritable file found to be writable\n")
+- ;
+- io__write_string(
+- "unwritable file found to be unwritable\n")
+- ),
+-
+ % Execute permissions are not handled correctly on all platforms so
+ % just check that it doesn't crash.
+ io__check_file_accessibility("unwritable",
diff --git a/dev-lang/mercury/files/mercury-10.04.1-tests-static-link.patch b/dev-lang/mercury/files/mercury-10.04.1-tests-static-link.patch
new file mode 100644
index 000000000000..b33e868821e8
--- /dev/null
+++ b/dev-lang/mercury/files/mercury-10.04.1-tests-static-link.patch
@@ -0,0 +1,11 @@
+--- mercury-tests-10.04.1.orig/hard_coded/Mmakefile 2010-05-03 22:27:02.000000000 +1200
++++ mercury-tests-10.04.1/hard_coded/Mmakefile 2010-07-28 20:17:50.000000000 +1200
+@@ -677,7 +677,7 @@
+ PROGS = $(ORDINARY_PROGS) $(PROF_PROGS) $(BROKEN_FOR_LCC_PROGS) \
+ $(CLOSURE_LAYOUT_PROGS) $(NON_PROFDEEP_PROGS) \
+ $(BACKEND_PROGS) $(NONDET_C_PROGS) \
+- $(C_AND_GC_ONLY_PROGS) $(STATIC_LINK_PROGS) \
++ $(C_AND_GC_ONLY_PROGS) \
+ $(CHAR_REP_PROGS) $(C_ONLY_PROGS) \
+ $(DOTNET_PROGS) $(JAVA_PROGS) $(SOLVER_PROGS) \
+ $(TRAILED_PROGS) $(MUTABLE_PROGS) $(TRACE_GOAL_ENV_PROGS) \
diff --git a/dev-lang/mercury/files/mercury-10.04.1-tests-workspace.patch b/dev-lang/mercury/files/mercury-10.04.1-tests-workspace.patch
new file mode 100644
index 000000000000..a0a6968a560a
--- /dev/null
+++ b/dev-lang/mercury/files/mercury-10.04.1-tests-workspace.patch
@@ -0,0 +1,29 @@
+--- mercury-tests-10.04.1.orig/Mmake.common 2010-02-15 19:49:51.000000000 +1300
++++ mercury-tests-10.04.1/Mmake.common 2010-09-05 09:34:38.000000000 +1200
+@@ -79,8 +79,8 @@
+ -include $(TESTS_DIR)/Mmake.params
+
+ MCFLAGS += --flags $(TESTS_DIR)/TESTS_FLAGS
+-ifdef WORKSPACE_FLAGS
+-MCFLAGS += --flags $(TESTS_DIR)/WS_FLAGS
++ifdef WORKSPACE
++MCFLAGS += --flags $(TESTS_DIR)/WS_FLAGS.ws
+ endif
+
+ # Avoid trying to make this file with `mmc --make' if it doesn't exist.
+--- mercury-compiler-10.04.1.orig/configure 2010-08-29 19:27:34.000000000 +1200
++++ mercury-compiler-10.04.1/configure 2010-09-05 09:37:11.000000000 +1200
+@@ -14798,10 +14798,10 @@
+ test_flags="tests/TESTS_FLAGS"
+ test_mdbrc="tests/mdbrc"
+ else
+- if test -e ../tests/TESTS_FLAGS.in
++ if test -e ../mercury-tests-10.04.1/TESTS_FLAGS.in
+ then
+- test_flags="../tests/TESTS_FLAGS"
+- test_mdbrc="../tests/mdbrc"
++ test_flags="../mercury-tests-10.04.1/TESTS_FLAGS"
++ test_mdbrc="../mercury-tests-10.04.1/mdbrc"
+ else
+ test_flags=""
+ test_mdbrc=""
diff --git a/dev-lang/mercury/mercury-10.04.1.ebuild b/dev-lang/mercury/mercury-10.04.1.ebuild
new file mode 100644
index 000000000000..1bf5b643cdc1
--- /dev/null
+++ b/dev-lang/mercury/mercury-10.04.1.ebuild
@@ -0,0 +1,175 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/mercury/mercury-10.04.1.ebuild,v 1.1 2010/09/05 05:48:09 keri Exp $
+
+inherit elisp-common eutils flag-o-matic java-pkg-opt-2 multilib
+
+MY_P=${PN}-compiler-${PV}
+
+DESCRIPTION="Mercury is a modern general-purpose logic/functional programming language"
+HOMEPAGE="http://www.cs.mu.oz.au/research/mercury/index.html"
+SRC_URI="http://www.mercury.cs.mu.oz.au/download/files/${MY_P}.tar.gz
+ test? ( http://www.mercury.cs.mu.oz.au/download/files/mercury-tests-${PV}.tar.gz )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+
+IUSE="debug emacs erlang java minimal readline test threads"
+
+DEPEND="!dev-libs/mpatrol
+ !dev-util/mono-debugger
+ readline? ( sys-libs/readline )
+ erlang? ( dev-lang/erlang )
+ java? ( >=virtual/jdk-1.5 )"
+
+RDEPEND="${DEPEND}
+ emacs? ( virtual/emacs )"
+
+S="${WORKDIR}"/${MY_P}
+TESTDIR="${WORKDIR}"/${PN}-tests-${PV}
+
+SITEFILE=50${PN}-gentoo.el
+
+src_unpack() {
+ unpack ${A}
+
+ epatch "${FILESDIR}"/${P}-multilib.patch
+ epatch "${FILESDIR}"/${P}-linker-flags.patch
+ epatch "${FILESDIR}"/${P}-default-grade.patch
+ epatch "${FILESDIR}"/${P}-boehm_gc.patch
+ epatch "${FILESDIR}"/${P}-sparc-llds-base-grade.patch
+ epatch "${FILESDIR}"/${P}-docs.patch
+ epatch "${FILESDIR}"/${P}-no-reconf.patch
+
+ sed -i -e "s/@libdir@/$(get_libdir)/" \
+ "${S}"/compiler/file_util.m \
+ "${S}"/compiler/libs.file_util.c \
+ "${S}"/compiler/make.program_target.m \
+ "${S}"/compiler/make.program_target.c \
+ "${S}"/scripts/Mmake.vars.in
+
+ touch "${S}"/compiler/*.date
+ touch "${S}"/compiler/*.date0
+ touch "${S}"/compiler/*.date3
+ touch "${S}"/compiler/*.int
+ touch "${S}"/compiler/*.int0
+ touch "${S}"/compiler/*.int2
+ touch "${S}"/compiler/*.int3
+ touch "${S}"/compiler/*.c_date
+ touch "${S}"/compiler/*.c
+
+ if use test; then
+ epatch "${FILESDIR}"/${P}-tests-workspace.patch
+ epatch "${FILESDIR}"/${P}-tests-sandbox.patch
+ epatch "${FILESDIR}"/${P}-tests-static-link.patch
+ fi
+}
+
+src_compile() {
+ strip-flags
+
+ local myconf
+ myconf="--libdir=/usr/$(get_libdir) \
+ --disable-gcc-back-end \
+ --disable-aditi-back-end \
+ --disable-deep-profiler \
+ --disable-dotnet-grades \
+ $(use_enable erlang erlang-grade) \
+ $(use_enable java java-grade) \
+ $(use_enable debug debug-grades) \
+ $(use_enable threads par-grades) \
+ $(use_enable !minimal most-grades) \
+ $(use_with readline)"
+
+ econf \
+ ${myconf} \
+ || die "econf failed"
+ emake \
+ PARALLEL=${MAKEOPTS} \
+ EXTRA_MLFLAGS=--no-strip \
+ EXTRA_LDFLAGS="${LDFLAGS}" \
+ EXTRA_LD_LIBFLAGS="${LDFLAGS}" \
+ || die "emake failed"
+
+ emake \
+ PARALLEL=${MAKEOPTS} \
+ EXTRA_MLFLAGS=--no-strip \
+ EXTRA_LDFLAGS="${LDFLAGS}" \
+ EXTRA_LD_LIBFLAGS="${LDFLAGS}" \
+ MERCURY_COMPILER="${S}"/compiler/mercury_compile \
+ default_grade || die "emake default_grade failed"
+}
+
+src_test() {
+ TEST_GRADE=`scripts/ml --print-grade`
+ if [ -d "${S}"/install_grade_dir.${TEST_GRADE} ] ; then
+ TWS="${S}"/install_grade_dir.${TEST_GRADE}
+ cp browser/mer_browser.init "${TWS}"/browser/
+ cp mdbcomp/mer_mdbcomp.init "${TWS}"/mdbcomp/
+ cp runtime/mer_rt.init "${TWS}"/runtime/
+ cp ssdb/mer_ssdb.init "${TWS}"/ssdb/
+ else
+ TWS="${S}"
+ fi
+
+ cd "${TESTDIR}"
+ sed -i -e "s:@WORKSPACE@:${TWS}:" WS_FLAGS.ws
+
+ PATH="${TWS}"/scripts:"${TWS}"/util:"${TWS}"/slice:"${PATH}" \
+ TERM="" \
+ WORKSPACE="${TWS}" \
+ MERCURY_COMPILER="${TWS}"/compiler/mercury_compile \
+ MERCURY_CONFIG_DIR="${TWS}" \
+ MMAKE_DIR="${TWS}"/scripts \
+ MERCURY_SUPPRESS_STACK_TRACE=yes \
+ GRADE=${TEST_GRADE} \
+ MERCURY_ALL_LOCAL_C_INCL_DIRS=" -I${TWS}/boehm_gc \
+ -I${TWS}/boehm_gc/include \
+ -I${TWS}/runtime \
+ -I${TWS}/library \
+ -I${TWS}/mdbcomp \
+ -I${TWS}/browser \
+ -I${TWS}/trace" \
+ mmake || die "mmake test failed"
+}
+
+src_install() {
+ emake \
+ PARALLEL=${MAKEOPTS} \
+ EXTRA_LDFLAGS="${LDFLAGS}" \
+ EXTRA_LD_LIBFLAGS="${LDFLAGS}" \
+ MERCURY_COMPILER="${S}"/compiler/mercury_compile \
+ INSTALL_PREFIX="${D}"/usr \
+ INSTALL_MAN_DIR="${D}"/usr/share/man \
+ INSTALL_INFO_DIR="${D}"/usr/share/info \
+ INSTALL_HTML_DIR="${D}"/usr/share/doc/${PF}/html \
+ INSTALL_ELISP_DIR="${D}/${SITELISP}"/${PN} \
+ install || die "make install failed"
+
+ if use emacs; then
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}" \
+ || die "elisp-site-file-install failed"
+ fi
+
+ dodoc \
+ BUGS HISTORY LIMITATIONS NEWS README README.Linux \
+ README.Linux-Alpha README.Linux-m68k README.Linux-PPC \
+ RELEASE_NOTES TODO VERSION WORK_IN_PROGRESS
+
+ if use erlang; then
+ dodoc README.Erlang
+ fi
+
+ if use java; then
+ dodoc README.Java
+ fi
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}