summaryrefslogtreecommitdiff
path: root/dev-lang/polyml
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /dev-lang/polyml
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'dev-lang/polyml')
-rw-r--r--dev-lang/polyml/Manifest22
-rw-r--r--dev-lang/polyml/files/polyml-5.4.1-asm.patch28
-rw-r--r--dev-lang/polyml/files/polyml-5.4.1-configure.patch11
-rw-r--r--dev-lang/polyml/files/polyml-5.5.0-asm.patch10
-rw-r--r--dev-lang/polyml/files/polyml-5.5.0-configure.patch138
-rw-r--r--dev-lang/polyml/files/polyml-5.5.0-x-it-basis.patch21
-rw-r--r--dev-lang/polyml/files/polyml-5.5.1-inputN-return-for-zero-chars.patch33
-rw-r--r--dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch141
-rw-r--r--dev-lang/polyml/files/polyml-5.5.2-r1952-check_for_negative_sized_array.patch13
-rw-r--r--dev-lang/polyml/files/polyml-5.5.2-r1954_Fix_segfault_in_FFI_when_malloc_runs_out_of_memory.patch112
-rw-r--r--dev-lang/polyml/files/polyml-5.5.2-r2007_Ensure_the_large_object_cache_pointer_is_cleared.patch27
-rw-r--r--dev-lang/polyml/files/polyml-5.5.2-r2009_Initialise_the_largeObjectCache_fully_in_the_constructor.patch21
-rw-r--r--dev-lang/polyml/metadata.xml17
-rw-r--r--dev-lang/polyml/polyml-5.4.1.ebuild44
-rw-r--r--dev-lang/polyml/polyml-5.5.0.ebuild50
-rw-r--r--dev-lang/polyml/polyml-5.5.1.ebuild71
-rw-r--r--dev-lang/polyml/polyml-5.5.2.ebuild71
-rw-r--r--dev-lang/polyml/polyml-5.6.ebuild52
18 files changed, 882 insertions, 0 deletions
diff --git a/dev-lang/polyml/Manifest b/dev-lang/polyml/Manifest
new file mode 100644
index 000000000000..e06e56ff40c5
--- /dev/null
+++ b/dev-lang/polyml/Manifest
@@ -0,0 +1,22 @@
+AUX polyml-5.4.1-asm.patch 1026 BLAKE2B adb541bddcc00957fca16a50f841b8572da68b0cd5a085da3e28473c58a3e95e93f6277ad76b8349e19ec168a8a898d1c5f9d86e7f0d7fd0aa0fec4204e5346f SHA512 bf19cedff74b11feba72c0ba2f5a9b6ee8169b5bb1b783d3559640070025ca0e7627d751bc703c41d812025d6909cba56101e49f0199f2aee310bc95ca4f2d6d
+AUX polyml-5.4.1-configure.patch 459 BLAKE2B e97785d1581259f8fa8102034d6b6e3b7c43c5337afeef75c903753cc69bd3174175781fcf5dac498f85339f40e05f7c636e2b95ecf9fa9dcdc3749d841baee2 SHA512 4e3a5e6651c8b6b9cb018f72f100755eee0265ad7dd0ba57030b7bce95670ff35e7191661be469b59206266f5eb51042d98504601311629bc2e83ed36a0cef8f
+AUX polyml-5.5.0-asm.patch 351 BLAKE2B 7fb6afeeefafbbc15dd9088ed417688dbbdc007c9d9c380675797af1a9c620779eeae7aec2fe43e04a6e06c0b2786261adae2c71c69b8ab679ba3449ba69ea7c SHA512 92a14615483aaac76e708ae19fccab132f80223ebaad7a390482af164335199a7d2e52be8726cc96d7971efae73a9cdf0284ec96f014af606edce2024d5b3996
+AUX polyml-5.5.0-configure.patch 4658 BLAKE2B 7ab06882eb18efd3ee3e90e65d1cd5aae3437080e4d675b6406f46637d59ef33229823b58330fbfcf0020714ebc51105e90f8fdcca9215ab934de39b68fd75c4 SHA512 d4a8ee5d41469d958d7f61a6608c5d4bd50e5497fadcd5333b2a94cd253c65d27f493bd743574eb3ccab37a39fdb2182e25106443f1855b30be1a70c9d450cc6
+AUX polyml-5.5.0-x-it-basis.patch 562 BLAKE2B f883eb0f72ca5678318472feaf41a009bb9f418431d78c126252f55d67f7ec0339ec7337a87c578373d66c0e9120f6db0d9480f5010f5a925a3cfb6a4ea201ab SHA512 ed5864b7ce5767133a47d914b5b439177e5c841669870292f90a73edee2e505aff6883b9a80baf0036d87bf728038ffa4609f9bacde4a704bfca291aa9cf50a4
+AUX polyml-5.5.1-inputN-return-for-zero-chars.patch 1476 BLAKE2B 38c9fa12ee5755493f8e3883d8f1e9045fb7f79586b5ee0c9e1d3d4e6180d939eba07052b092f7a714ebceceb90a5615f6890392b20dfe3b1c695e40df0d90c0 SHA512 998e9eb09a3b35bbbb6a9748e0b19c423f2204ccfb3f5a6de3173ca91f67d523884743f382052c22d14655310265ef7f8259e5104c61f9ab2b9a52f7257a011f
+AUX polyml-5.5.1-optimize-closure.patch 6695 BLAKE2B 421c5da3accc302f201be6f8a137d24014ec9b3ba3ec6c67175ffea37b08d4a9379bcf560f2ffe5a7180b67a5cacbfec6f76fcfccd3f2b923a345255856b6ecc SHA512 7cf1c66114058c8b3c9ceed3a84fe9a99f0cf063cce3364be79c7402353e8e29c5082cfedef16a32f38cb4275b0b3622db88cf7746115d1c43c483635a46f147
+AUX polyml-5.5.2-r1952-check_for_negative_sized_array.patch 548 BLAKE2B ea01cee4f83d87fe0793fc69a020c7dec9e2a54572acdea64850eb32a80cc3160c3c30031c823db93a1ed4454de21da916bb321bc4104f189ecf977737c14e60 SHA512 d979c6542a2a983ab1b536e8b983d4d0a154f4f5e00f3d4161dd38f965f63ea5bd339785904690928a715ec43cb2a296f535ff6af1da522b096ffae0bba759a4
+AUX polyml-5.5.2-r1954_Fix_segfault_in_FFI_when_malloc_runs_out_of_memory.patch 4089 BLAKE2B 8407734817afa2902ca115f129c3feb0197082848921a6a41389c49516329b0c6294d9a381b143cfe1b2a1855b1916a49fc50de8f969a6c5bffc87b7c10ff982 SHA512 8b4f174ace31a839ea592402c10068af62f03227a43a663ea17ea5eefecf52472fc6a3437cd99f1593de7d575af57ae4b8156756695623c7db0f9e726e5f21a6
+AUX polyml-5.5.2-r2007_Ensure_the_large_object_cache_pointer_is_cleared.patch 1247 BLAKE2B 7df0a97bdb56d264b090bebad500d4f1f4354d8d66feed289a4f535e63d3357a33a6533acd4170e7c4e69bf477f56355684b3037f0c895adad299de20cf246d0 SHA512 ac2d1baff1c8d743ee783ac81f31df12cc4598874dd5a9a7855cd06fb179af2c64bc02a87d85a72238f19c805128143693839bd0a58d9a4002bc75fae985303b
+AUX polyml-5.5.2-r2009_Initialise_the_largeObjectCache_fully_in_the_constructor.patch 951 BLAKE2B c2aa5777c35d27d0c403f6676b323a280e43c30bbacdcbfc6535d39b66031b11e6e40074ecd3fb72b40953942fb53cb88d62f82e47cff072a4e53ca973615019 SHA512 644e90f26ef80aa8e945257eafa4da1ee2da9d353db40b5c6e367d032f41db4a6589a2527bce9d84d45794d88d31edaeb3cea53d57b4421bf209f6c07be69cf0
+DIST polyml-5.6.tar.gz 6066166 BLAKE2B dc7e35ad1f51f270f9043736bca8b3d8a96e208dfa2833a2de3c06c969e8bb9d5e92c3ab025e4e55539188a9d6d5000b7befdd3cfc17aa3b0e54315778ab71b0 SHA512 cd4f25c225831dec512f7136dfda4ba31abd6939d9e8e0cacdb6d48212488b56ba5969c76e76fcbfcfa83d015a67d9cf62457286086f3c2b3f7914a7939d7b59
+DIST polyml.5.4.1.tar.gz 6107319 BLAKE2B 1fdff3b26fa7554a0f3d31cca0dc4a4e013fb930e6295cd6107012bc67e87db1f64916087edb34e403c3e1a88b26bff947c1cc9d946fe93ac7a1144434d15081 SHA512 4a7b404ed648b5a9fd9d52917214688d15f4f9a5f4570ba13b52a8304bde1cc4b534f539ffc3c9554283816ae130e4c898a179d776df6d3220fba9743a19b175
+DIST polyml.5.5.1.tar.gz 5465794 BLAKE2B 0ae6973c866cdf33e0eeb26475c95f26f11eca13458ab52c2c6fd3f4b3034cd5e71a7e4dbff5574070a11833479bff2723066bfc71367d71cd6e4f9f17a5cba1 SHA512 283954c8bf5599d83ea69916b827b1acae7137fe4add67537026092da2e6f1a89d71d3a394dbba599bbe9e967ded1446f39f4d81afb90301532db6be949f7a6f
+DIST polyml.5.5.2.tar.gz 5599140 BLAKE2B 08b7c4be7c52bd8f57c53f6caa24be7ab457c7419459192f33369bf3c7024002ffd98dfd7af4db53c3a2484f9c966010a635f4e09e9edf8a62b5d5230f9a04bf SHA512 248c2a38c4691898bc1243a041f4683bf227d9c8a98c6c3545af2a8a3249ed5ed96f33f90cb2dede8809b42f33c0557650147302cfe046a5fba965ccd93cbc5b
+DIST polyml.5.5.tar.gz 5504389 BLAKE2B 8ad51504e4bc4a3f6090052d641389b7378aa56295ebe8503ea09082a0bb85ee157c04ac19ca66ab8b8c8b49b0d645339d499ea7d4eba18eae6f90be8afcc907 SHA512 4725c2e4a786b8c63bc6fc1cadad0de818ed935014d51040af43defa07b03ba7bedb2185bfb2e39a0db7284479e79e698b31ec7fe8463c306b668de1eda69b89
+EBUILD polyml-5.4.1.ebuild 882 BLAKE2B 33f67a532e3df08bdeba0daf156a89e04e8dd43b3d8968e62b0523fc9a6124f9b5d0ce942189ef3fb7c14f9c768868a1964cfbb99875951a5814aa941ce2e9aa SHA512 02f154c766878c6df26d0b49260a8410e1c4d1faefa02d41d84ea01ac0e3ae95de9b12c80f085bda3492dc3dae0b39dc94f5e891a8a5bec736ecd3dd3f3ffbd4
+EBUILD polyml-5.5.0.ebuild 1121 BLAKE2B c32bffc9837edaa9dbe300f448006f06ae19bf55e29285859476f52de198df6997093d310a24ac9541ef5c372c9159db3c875a9abaef34bee7389448aa331fed SHA512 2b0462751288f026c6770639aaaaff37546bea6d363f016412b2909cc9738d98c2b059aab24f6198cfc7051cf06ef2ba89c76d48a037f95f442befc05be5a005
+EBUILD polyml-5.5.1.ebuild 1806 BLAKE2B 1ecd752ae24a16765064f85dc6aa380b1762b839c8d065c679e2bceab3946d918d574162b5a495dfcc75bed91ddc45862f15795407d24b55604ff68688ecb3d6 SHA512 95d7210500e6135b9b1858ccecdd734339083f2ffca5237c4a61d77b7afe4fe140f335bfd5e5702defe21a8c9987f1f81dd446a9a90b261d4588c48509e89538
+EBUILD polyml-5.5.2.ebuild 1963 BLAKE2B 0afb1711c472cccedc5be5fd0ae16a0334ca86339e29d7b34a027dbde181543b0fc76e9419dc2733cf99bd1bd9a153ba716bc9436c562a339e4c3112dea35f8b SHA512 1f090742acbe4b175a3d26fd785ae5958f8dec0bda6d7fd6a3feeec43bee3606f6b877da4f3dc1401edf67e5ef0bb5bf21e3609beebaf1b651669ef44482cda7
+EBUILD polyml-5.6.ebuild 1103 BLAKE2B eb24c91df3f50e129ef150aacd7d72d921ca70c35533684427c26bd6fa49fe201e43dd740aa5f4ee3739feb14965104acf7b93230f3fbfb61a6af7748dc18be4 SHA512 79af51e535496ad4af010f5d915c83da35b2a4adcded6eded435f452cecc9b79d0a6c711faac3e7a0ca345f853f6de962bc45fdfaf8568b2cdd5d21bce1433ad
+MISC metadata.xml 562 BLAKE2B d0e0542c0805b1d57891bb765ac23cb32f2b37b07ba3986730adc7dc1b720203065483c090fdc8919a1ee2dce965a26d0f570af29f54e0ec7c0acd8ff43e4441 SHA512 be1481ffb11ab311905e734a6eb02883ff25f08d4698ed6dcab4ab76a380ff4eec19eed4db76f77f7ec9a0dc635887e3b7c89a8a153160fd91ab2a8cdec2dbe9
diff --git a/dev-lang/polyml/files/polyml-5.4.1-asm.patch b/dev-lang/polyml/files/polyml-5.4.1-asm.patch
new file mode 100644
index 000000000000..af8bd8d49149
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.4.1-asm.patch
@@ -0,0 +1,28 @@
+--- polyml.5.4.1-orig/libpolyml/x86asm.asm 2011-07-13 00:06:49.000000000 +1000
++++ polyml.5.4.1/libpolyml/x86asm.asm 2012-01-08 16:00:09.740684843 +1100
+@@ -2714,4 +2714,7 @@
+
+
+ ENDIF
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+ END
+--- polyml.5.4.1-orig/libpolyml/power_assembly.S 2010-04-09 01:49:20.000000000 +1000
++++ polyml.5.4.1/libpolyml/power_assembly.S 2012-01-08 15:46:35.006200143 +1100
+@@ -1735,3 +1735,6 @@
+ dd Mask_assign_byte /* 254 */
+ dd Mask_assign_word /* 255 */
+
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+--- polyml.5.4.1-orig/libpolyml/sparc_assembly.S 2010-08-13 01:01:36.000000000 +1000
++++ polyml.5.4.1/libpolyml/sparc_assembly.S 2012-01-08 15:46:12.516642791 +1100
+@@ -1498,3 +1498,6 @@
+ .long Mask_assign_byte /* 254 */
+ .long Mask_assign_word /* 255 */
+
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
diff --git a/dev-lang/polyml/files/polyml-5.4.1-configure.patch b/dev-lang/polyml/files/polyml-5.4.1-configure.patch
new file mode 100644
index 000000000000..aaaed02f8e16
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.4.1-configure.patch
@@ -0,0 +1,11 @@
+--- polyml.5.4.1-orig/configure.ac 2010-09-03 21:22:40.000000000 +1000
++++ polyml.5.4.1/configure.ac 2012-01-09 22:44:04.153668402 +1100
+@@ -321,7 +321,7 @@
+ AC_ARG_WITH([portable],
+ [AS_HELP_STRING([--with-portable],
+ [Build the portable interpreter version of Poly/ML instead of native @<:@default=no@:>@])], [
+- ac_cv_with_portable=yes], [
++ ac_cv_with_portable="$withval"], [
+ ac_cv_with_portable=no])
+
+ case "${host_cpu}" in
diff --git a/dev-lang/polyml/files/polyml-5.5.0-asm.patch b/dev-lang/polyml/files/polyml-5.5.0-asm.patch
new file mode 100644
index 000000000000..cffa627b9f32
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.0-asm.patch
@@ -0,0 +1,10 @@
+--- polyml.5.5-orig/libpolyml/x86asm.asm 2012-05-03 21:07:59.000000000 +1000
++++ polyml.5.5/libpolyml/x86asm.asm 2012-09-19 17:41:51.767737295 +1000
+@@ -3003,4 +3003,7 @@
+ dd Mask_assign_byte ;# 254
+ dd Mask_assign_word ;# 255
+
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+ END
diff --git a/dev-lang/polyml/files/polyml-5.5.0-configure.patch b/dev-lang/polyml/files/polyml-5.5.0-configure.patch
new file mode 100644
index 000000000000..1a2e114e6503
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.0-configure.patch
@@ -0,0 +1,138 @@
+Index: polyml/configure
+===================================================================
+--- polyml/configure (revision 1599)
++++ polyml/configure (revision 1600)
+@@ -20870,10 +20870,8 @@
+ # Check whether --with-portable was given.
+ if test "${with_portable+set}" = set; then :
+ withval=$with_portable;
+- ac_cv_with_portable=yes
+ else
+-
+- ac_cv_with_portable=no
++ with_portable=check
+ fi
+
+
+@@ -20894,36 +20892,46 @@
+
+ $as_echo "#define HOSTARCHITECTURE_SPARC 1" >>confdefs.h
+
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ power* | ppc*)
+
+ $as_echo "#define HOSTARCHITECTURE_PPC 1" >>confdefs.h
+
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ arm*)
+
+ $as_echo "#define HOSTARCHITECTURE_ARM 1" >>confdefs.h
+
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ ia64*)
+
+ $as_echo "#define HOSTARCHITECTURE_IA64 1" >>confdefs.h
+
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ *) as_fn_error $? "Poly/ML is not supported for this architecture" "$LINENO" 5 ;;
+ esac
+
+-# If we have explicitly set --with-portable or we are on a machine without
+-# a code-generator set to use the interpreter.
+-if test "$ac_cv_with_portable" = "yes"; then
++# If we explicitly asked to use the interpreter set the architecture to interpreted.
++if test "x$with_portable" = "xyes" ; then
++ polyarch=interpret
++fi
+
++# If we asked not to use the interpreter check we have native code support.
++if test "x$with_portable" = "xno" ; then
++ if test "x$polyarch" = "xinterpret" ; then
++ as_fn_error $? "--without-portable was given but native code is not supported on this platform" "$LINENO" 5
++ fi
++fi
++
++# Set the define if this is the interpreter. This is no longer actually used.
++if test "x$polyarch" = "xinterpret" ; then
++
+ $as_echo "#define INTERPRETED 1" >>confdefs.h
+
+- polyarch=interpret
+ fi
+
+ # Put this test at the end where it's less likely to be missed.
+Index: polyml/configure.ac
+===================================================================
+--- polyml/configure.ac (revision 1599)
++++ polyml/configure.ac (revision 1600)
+@@ -368,10 +368,10 @@
+ # Test the --with-portable option to build the interpreter even if
+ # we have a code-generator.
+ AC_ARG_WITH([portable],
+- [AS_HELP_STRING([--with-portable],
+- [Build the portable interpreter version of Poly/ML instead of native @<:@default=no@:>@])], [
+- ac_cv_with_portable=yes], [
+- ac_cv_with_portable=no])
++ [AS_HELP_STRING([--with-portable],
++ [Build the portable interpreter version of Poly/ML instead of native @<:@default=no@:>@])],
++ [],
++ [with_portable=check])
+
+ case "${host_cpu}" in
+ i[[3456]]86*)
+@@ -384,28 +384,39 @@
+ ;;
+ sparc*)
+ AC_DEFINE([HOSTARCHITECTURE_SPARC], [1], [Define if the host is a Sparc (32 bit)])
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ power* | ppc*)
+ AC_DEFINE([HOSTARCHITECTURE_PPC], [1], [Define if the host is a Power PC (32 bit)])
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ arm*)
+ AC_DEFINE([HOSTARCHITECTURE_ARM], [1], [Define if the host is an ARM (32 bit)])
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ ia64*)
+ AC_DEFINE([HOSTARCHITECTURE_IA64], [1], [Define if the host is Itanium])
+- ac_cv_with_portable=yes
++ polyarch=interpret
+ ;;
+ *) AC_MSG_ERROR([Poly/ML is not supported for this architecture]) ;;
+ esac
+
+-# If we have explicitly set --with-portable or we are on a machine without
+-# a code-generator set to use the interpreter.
+-if test "$ac_cv_with_portable" = "yes"; then
++# If we explicitly asked to use the interpreter set the architecture to interpreted.
++if test "x$with_portable" = "xyes" ; then
++ polyarch=interpret
++fi
++
++# If we asked not to use the interpreter check we have native code support.
++if test "x$with_portable" = "xno" ; then
++ if test "x$polyarch" = "xinterpret" ; then
++ AC_MSG_ERROR(
++ [--without-portable was given but native code is not supported on this platform])
++ fi
++fi
++
++# Set the define if this is the interpreter. This is no longer actually used.
++if test "x$polyarch" = "xinterpret" ; then
+ AC_DEFINE([INTERPRETED], [1], [Define if using the interpreter] )
+- polyarch=interpret
+ fi
+
+ # Put this test at the end where it's less likely to be missed.
diff --git a/dev-lang/polyml/files/polyml-5.5.0-x-it-basis.patch b/dev-lang/polyml/files/polyml-5.5.0-x-it-basis.patch
new file mode 100644
index 000000000000..2f6ce7b864bd
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.0-x-it-basis.patch
@@ -0,0 +1,21 @@
+Index: polyml/mlsource/extra/XWindows/ml_bind.ML
+===================================================================
+--- polyml/mlsource/extra/XWindows/ml_bind.ML (revision 1600)
++++ polyml/mlsource/extra/XWindows/ml_bind.ML (revision 1601)
+@@ -2437,7 +2437,7 @@
+
+ exception XWindows = XWindows.XWindows;
+
+-let
++local
+ open XWindows;
+
+ fun printRect _ _ (r:XRectangle) =
+@@ -2447,6 +2447,6 @@
+ PolyML.PrettyString ("Rect " ^ PolyML.makestring R)
+ end;
+ in
+- PolyML.addPrettyPrinter printRect
++ val () = PolyML.addPrettyPrinter printRect
+ end;
+
diff --git a/dev-lang/polyml/files/polyml-5.5.1-inputN-return-for-zero-chars.patch b/dev-lang/polyml/files/polyml-5.5.1-inputN-return-for-zero-chars.patch
new file mode 100644
index 000000000000..8f5b02ee9084
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.1-inputN-return-for-zero-chars.patch
@@ -0,0 +1,33 @@
+https://sourceforge.net/p/polyml/code/1875/
+Required for sci-mathematics/isabelle-2013.2
+
+------------------------------------------------------------------------
+r1875 | dcjm | 2013-10-30 10:49:05 -0600 (Wed, 30 Oct 2013) | 1 line
+
+Backport commit 1874 from trunk. This fixes TextIO.inputN and StreamIO.inputN so they return immediately if the request is for zero characters.
+Index: polyml/basis/BasicStreamIO.sml
+===================================================================
+--- polyml/basis/BasicStreamIO.sml (revision 1851)
++++ polyml/basis/BasicStreamIO.sml (working copy)
+@@ -213,6 +213,8 @@
+ fun inputN (f, n) =
+ if n < 0
+ then raise Size
++ else if n = 0 (* Defined to return the empty vector and f *)
++ then (emptyVec, f)
+ else
+ let
+ val (vecs, f') = inputNList (f, n)
+Index: polyml/basis/TextIO.sml
+===================================================================
+--- polyml/basis/TextIO.sml (revision 1851)
++++ polyml/basis/TextIO.sml (working copy)
+@@ -597,6 +597,8 @@
+ | inputN' n (ref(Direct(strm as {buffer, bufp, buflimit, ...}))) =
+ if n < 0 orelse n > CharVector.maxLen
+ then raise Size
++ else if n = 0
++ then "" (* Return the empty string without blocking *)
+ else if !buflimit = 0
+ then (* Last read returned end-of-file. Clear the EOF state once
+ we return this empty string. *)
diff --git a/dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch b/dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch
new file mode 100644
index 000000000000..5b33203d69e1
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.1-optimize-closure.patch
@@ -0,0 +1,141 @@
+https://sourceforge.net/p/polyml/code/1869/
+Required for sci-mathematics/isabelle-2013.2
+
+------------------------------------------------------------------------
+r1869 | dcjm | 2013-10-11 05:59:58 -0600 (Fri, 11 Oct 2013) | 1 line
+
+Back-port commits 1855 and 1867 from trunk. These fix two optimiser bugs. Includes the regression tests.
+
+Index: polyml/mlsource/MLCompiler/CodeTree/CODETREE_OPTIMISER.sml
+===================================================================
+--- polyml/mlsource/MLCompiler/CodeTree/CODETREE_OPTIMISER.sml (revision 1851)
++++ polyml/mlsource/MLCompiler/CodeTree/CODETREE_OPTIMISER.sml (working copy)
+@@ -645,8 +645,9 @@
+ (thisDec :: decs, thisArg @ args, LoadLocal newAddr :: mapList)
+ end
+
+- | mapPattern(ArgPattCurry(currying, ArgPattTuple{allConst=false, filter, ...}) :: patts, n, m) =
+- (* It's a function that returns a tuple. *)
++ | mapPattern(ArgPattCurry(currying as [_], ArgPattTuple{allConst=false, filter, ...}) :: patts, n, m) =
++ (* It's a function that returns a tuple. The function must not be curried because
++ otherwise it returns a function not a tuple. *)
+ let
+ val (thisDec, thisArg, thisMap) =
+ transformFunctionArgument(currying, [LoadArgument m], [LoadArgument n], SOME filter)
+@@ -657,7 +658,7 @@
+
+ | mapPattern(ArgPattCurry(currying as firstArgSet :: _, _) :: patts, n, m) =
+ (* Transform it if it's curried or if there is a tuple in the first arg. *)
+- if List.length currying >= 2 orelse
++ if (*List.length currying >= 2 orelse *) (* This transformation is unsafe. *)
+ List.exists(fn ArgPattTuple{allConst=false, ...} => true | _ => false) firstArgSet
+ then
+ let
+@@ -685,6 +686,13 @@
+
+ and transformFunctionArgument(argumentArgs, loadPack, loadThisArg, filterOpt) =
+ let
++ (* Disable the transformation of curried arguments for the moment.
++ This is unsafe. See Test146. The problem is that this transformation
++ is only safe if the function is applied immediately to all the arguments.
++ However the usage information is propagated so that if the result of
++ the first application is bound to a variable and then that variable is
++ applied it still appears as curried. *)
++ val argumentArgs = [hd argumentArgs]
+ (* We have a function that takes a series of curried argument.
+ Change that so that the function takes a list of arguments. *)
+ val newAddr = ! localCounter before localCounter := ! localCounter + 1
+@@ -1214,9 +1222,11 @@
+ let
+ fun checkArg (ArgPattTuple{allConst=false, ...}) = true
+ (* Function has at least one tupled arg. *)
+- | checkArg (ArgPattCurry(_, ArgPattTuple{allConst=false, ...})) = true
+- (* Function has an arg that is a function that returns a tuple. *)
+- | checkArg (ArgPattCurry(_ :: _ :: _, _)) = true
++ | checkArg (ArgPattCurry([_], ArgPattTuple{allConst=false, ...})) = true
++ (* Function has an arg that is a function that returns a tuple.
++ It must not be curried otherwise it returns a function not a tuple. *)
++ (* This transformation is unsafe. See comment in transformFunctionArgument above. *)
++ (*| checkArg (ArgPattCurry(_ :: _ :: _, _)) = true *)
+ (* Function has an arg that is a curried function. *)
+ | checkArg (ArgPattCurry(firstArgSet :: _, _)) =
+ (* Function has an arg that is a function that
+Index: polyml/Tests/Succeed/Test146.ML
+===================================================================
+--- polyml/Tests/Succeed/Test146.ML (revision 0)
++++ polyml/Tests/Succeed/Test146.ML (revision 1875)
+@@ -0,0 +1,24 @@
++(* Bug in transformation of arguments which are curried functions. It is not
++ safe to transform "f" in the argument to "bar". Although it is curried
++ the application to the first argument "()" is not immediately followed
++ by the application to the second. *)
++
++local
++ val r = ref 0
++in
++ (* Foo should be called exactly once *)
++ fun foo () = (r:= !r+1; fn i => i)
++
++ fun checkOnce () = if !r = 1 then () else raise Fail "bad"
++end;
++
++fun bar f = let val r = f() in (r 1; r 2; List.map r [1, 2, 3]) end;
++
++bar foo;
++
++checkOnce();
++
++exception A and B and C;
++fun rA () = raise A and rB () = raise B;
++fun h (f, g) = let val a = f() in g(); a () end;
++h(rA, rB) handle A => ();
+
+Property changes on: polyml/Tests/Succeed/Test146.ML
+___________________________________________________________________
+Added: svn:eol-style
+## -0,0 +1 ##
++native
+\ No newline at end of property
+Index: polyml/Tests/Succeed/Test147.ML
+===================================================================
+--- polyml/Tests/Succeed/Test147.ML (revision 0)
++++ polyml/Tests/Succeed/Test147.ML (revision 1875)
+@@ -0,0 +1,31 @@
++(* Bug in optimiser transformation. A function argument that returns a tuple
++ can be transformed to take a container but only if it is not curried. *)
++
++(* Cut down example from Isabelle that caused an internal error exception. *)
++
++fun one _ [] = raise Fail "bad"
++ | one pred (x :: xs) =
++ if pred x then (x, xs) else raise Fail "bad";
++
++fun foo (scan, f) xs = let val (x, y) = scan xs in (f x, y) end;
++
++fun bar (scan1, scan2) xs =
++ let
++ val (x, ys) = scan1 xs;
++ val (y, zs) = scan2 x ys;
++ in ((x, y), zs) end;
++
++fun bub (scan1, scan2) = foo(bar(scan1, (fn _ => scan2)), op ^);
++
++val qqq: string list -> string * int = bub(one (fn _ => raise Match), (foo((fn _ => raise Match), String.concat)));
++
++(* Further example - This caused a segfault. *)
++
++PolyML.Compiler.maxInlineSize := 1;
++fun f g = let val (x,y) = g 1 2 in x+y end;
++
++fun r (x, y, z) = fn _ => (x, y+z);
++
++val h: int-> int*int = r (4,5,6);
++
++f (fn _ => h);
+
+Property changes on: polyml/Tests/Succeed/Test147.ML
+___________________________________________________________________
+Added: svn:eol-style
+## -0,0 +1 ##
++native
+\ No newline at end of property
diff --git a/dev-lang/polyml/files/polyml-5.5.2-r1952-check_for_negative_sized_array.patch b/dev-lang/polyml/files/polyml-5.5.2-r1952-check_for_negative_sized_array.patch
new file mode 100644
index 000000000000..1451d2df8d84
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.2-r1952-check_for_negative_sized_array.patch
@@ -0,0 +1,13 @@
+Index: polyml/basis/Array.sml
+===================================================================
+--- polyml/basis/Array.sml (revision 1951)
++++ polyml/basis/Array.sml (revision 1952)
+@@ -129,7 +129,7 @@
+
+ fun array(len, a) =
+ let
+- val () = if len >= maxLen then raise General.Size else ()
++ val () = if len < 0 orelse len >= maxLen then raise General.Size else ()
+ val vec = System_alloc(len+1, 0wx40, RunCall.unsafeCast a)
+ in
+ System_setw(vec, 0, RunCall.unsafeCast len);
diff --git a/dev-lang/polyml/files/polyml-5.5.2-r1954_Fix_segfault_in_FFI_when_malloc_runs_out_of_memory.patch b/dev-lang/polyml/files/polyml-5.5.2-r1954_Fix_segfault_in_FFI_when_malloc_runs_out_of_memory.patch
new file mode 100644
index 000000000000..783577026f67
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.2-r1954_Fix_segfault_in_FFI_when_malloc_runs_out_of_memory.patch
@@ -0,0 +1,112 @@
+Index: polyml/libpolyml/foreign.cpp
+===================================================================
+--- polyml/libpolyml/foreign.cpp (revision 1953)
++++ polyml/libpolyml/foreign.cpp (revision 1954)
+@@ -4,7 +4,7 @@
+
+ Copyright (c) 2000-7
+ Cambridge University Technical Services Limited
+- Further development Copyright David C.J. Matthews 2008-2011.
++ Further development Copyright David C.J. Matthews 2008-2014.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+@@ -251,6 +251,10 @@
+
+ static Volatile *vols;
+ static PLock volLock; // Mutex to protect vols.
++// TODO: There is a theoretical risk of deadlock if any ML allocation is made while this
++// lock is held. An allocation can result in a GC which requires all threads to release
++// ML memory but another thread could block waiting for the mutex.
++// N.B. raising an exception involves an allocation.
+
+ #define FIRST_VOL 0
+
+@@ -268,24 +272,8 @@
+ static unsigned callBackEntries = 0;
+ static PLock callbackTableLock; // Mutex to protect table.
+
+-
+ /**********************************************************************
+ *
+- * Malloc / Free Wrappers
+- *
+- **********************************************************************/
+-
+-static POLYUNSIGNED malloc_count = 0;
+-#if 0
+-#define Vmalloc(where,size) {where = malloc(size); printf("malloc: %p,%d\n",where,size); fflush(stdout); malloc_count++;}
+-#else
+-#define Vmalloc(where,size) {where = malloc(size); malloc_count++;}
+-#endif
+-#define Vfree(p) { free(p); malloc_count--;}
+-
+-
+-/**********************************************************************
+- *
+ * Volatile Allocation
+ *
+ **********************************************************************/
+@@ -349,8 +337,12 @@
+ PLocker plocker(&volLock);
+ Handle res = vol_alloc(taskData);
+ trace(("size= %" POLYUFMT "\n",size));
+- Vmalloc( C_POINTER(UNVOLHANDLE(res)), size );
++ void *p = malloc(size);
++ if (p == 0)
++ RAISE_EXN("Insufficient memory");
++ C_POINTER(UNVOLHANDLE(res)) = p;
+ OWN_C_SPACE(UNVOLHANDLE(res)) = true;
++
+ return res;
+ }
+
+@@ -685,7 +677,7 @@
+ {
+ // Can now free this.
+ trace(("Freeing malloc space of <%" POLYUFMT ">\n",from));
+- Vfree(vols[from].C_pointer);
++ free(vols[from].C_pointer);
+ vols[from].C_pointer = 0;
+ vols[from].Own_C_space = false;
+ }
+@@ -702,7 +694,6 @@
+ }
+ }
+ next_vol = to;
+- info(("unfreed mallocs=<%" POLYUFMT "> next_vol=<%" POLYUFMT ">\n", malloc_count, next_vol));
+
+ /* Callback table. Added DCJM 12/4/04. We always process these as strong references.
+ For the time being at any rate we treat these as permanent entries so that once a
+@@ -910,8 +901,9 @@
+ RAISE_EXN("libffi error: ffi_prep_cif failed");
+
+ // malloc memory for the result
+- void *result;
+- Vmalloc(result, result_type->size);
++ void *result = malloc(result_type->size);
++ if (result == 0)
++ RAISE_EXN("Insufficient memory to allocate space for result");
+
+ processes->ThreadReleaseMLMemory(taskData);
+ ffi_call(&cif, sym, result, arg_values);
+@@ -1580,6 +1572,9 @@
+
+ unsigned num_args = length_list(argTypeList->Word());
+ ffi_type **arg_types = (ffi_type**)malloc(num_args * sizeof(ffi_type*));
++ if (arg_types == 0)
++ RAISE_EXN("Insufficient memory to allocate space for arguments");
++
+ PolyWord p = argTypeList->Word();
+ for (POLYUNSIGNED i=0; i<num_args; i++,p=Tail(p))
+ arg_types[i] = ctypeToFfiType(taskData, Head(p));
+@@ -1587,6 +1582,9 @@
+
+ // The cif needs to be on the heap so that it is available in the callback.
+ ffi_cif *cif = (ffi_cif *)malloc(sizeof(ffi_cif));
++ if (cif == 0)
++ RAISE_EXN("Insufficient memory to allocate space for cif");
++
+ if (ffi_prep_cif(cif, abi, num_args, result_type, arg_types) != FFI_OK)
+ RAISE_EXN("libffi error: ffi_prep_cif failed");
+
diff --git a/dev-lang/polyml/files/polyml-5.5.2-r2007_Ensure_the_large_object_cache_pointer_is_cleared.patch b/dev-lang/polyml/files/polyml-5.5.2-r2007_Ensure_the_large_object_cache_pointer_is_cleared.patch
new file mode 100644
index 000000000000..36c82947f37b
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.2-r2007_Ensure_the_large_object_cache_pointer_is_cleared.patch
@@ -0,0 +1,27 @@
+Index: polyml/libpolyml/gc_mark_phase.cpp
+===================================================================
+--- polyml/libpolyml/gc_mark_phase.cpp (revision 2006)
++++ polyml/libpolyml/gc_mark_phase.cpp (revision 2007)
+@@ -130,13 +130,6 @@
+ if (locPtr == LARGECACHE_SIZE) locPtr = 0;
+ largeObjectCache[locPtr].base = obj;
+ largeObjectCache[locPtr].current = currentPtr;
+- // To try to narrow down a bug that results in the ASSERT failing,
+- // add these extra checks.
+- POLYUNSIGNED lengthWord = obj->LengthWord();
+- ASSERT (OBJ_IS_LENGTH(lengthWord));
+- POLYUNSIGNED length = OBJ_OBJECT_LENGTH(lengthWord);
+- ASSERT(length == originalLength);
+- ASSERT(currentPtr > (PolyWord*)obj && currentPtr < ((PolyWord*)obj)+length);
+ }
+ }
+ else StackOverflow(obj);
+@@ -579,6 +572,8 @@
+ ASSERT(nInUse == 0);
+ MTGCProcessMarkPointers *marker = &markStacks[0];
+ marker->active = true;
++ marker->locPtr = 0;
++ marker->largeObjectCache[0].base = 0;
+ nInUse = 1;
+
+ // Scan the permanent mutable areas.
diff --git a/dev-lang/polyml/files/polyml-5.5.2-r2009_Initialise_the_largeObjectCache_fully_in_the_constructor.patch b/dev-lang/polyml/files/polyml-5.5.2-r2009_Initialise_the_largeObjectCache_fully_in_the_constructor.patch
new file mode 100644
index 000000000000..0629f12f72ca
--- /dev/null
+++ b/dev-lang/polyml/files/polyml-5.5.2-r2009_Initialise_the_largeObjectCache_fully_in_the_constructor.patch
@@ -0,0 +1,21 @@
+Index: polyml/libpolyml/gc_mark_phase.cpp
+===================================================================
+--- polyml/libpolyml/gc_mark_phase.cpp (revision 2008)
++++ polyml/libpolyml/gc_mark_phase.cpp (revision 2009)
+@@ -176,6 +176,16 @@
+ // Clear the mark stack
+ for (unsigned i = 0; i < MARK_STACK_SIZE; i++)
+ markStack[i] = 0;
++ // Clear the large object cache. Actually only largeObjectCache[0].base
++ // needs to be set to zero and for the objects allocated on the heap it is
++ // cleared before each GC in either MarkRoots or MarkPointersTask.
++ // The remianing case is the RescanMarked sub-class which is allocated on the stack
++ // but it doesn't hurt to clear it in all cases.
++ for (unsigned j = 0; j < LARGECACHE_SIZE; j++)
++ {
++ largeObjectCache[locPtr].base = 0;
++ largeObjectCache[locPtr].current = 0;
++ }
+ }
+
+ // Called when the stack has overflowed. We need to include this
diff --git a/dev-lang/polyml/metadata.xml b/dev-lang/polyml/metadata.xml
new file mode 100644
index 000000000000..bdeea6761bc4
--- /dev/null
+++ b/dev-lang/polyml/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>ml@gentoo.org</email>
+ <name>Gentoo ML Project</name>
+ </maintainer>
+ <longdescription lang="en">
+ Poly/ML is a full implementation of Standard ML available as open-source.
+ </longdescription>
+ <use>
+ <flag name="portable">Build the portable interpreter version of Poly/ML instead of native</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">polyml</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-lang/polyml/polyml-5.4.1.ebuild b/dev-lang/polyml/polyml-5.4.1.ebuild
new file mode 100644
index 000000000000..34eabcdb7de5
--- /dev/null
+++ b/dev-lang/polyml/polyml-5.4.1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit base autotools
+
+MY_P=${PN}.${PV}
+
+DESCRIPTION="Poly/ML is a full implementation of Standard ML"
+HOMEPAGE="https://www.polyml.org"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="X elibc_glibc +gmp portable test +threads"
+
+RDEPEND="X? ( x11-libs/motif:0 )
+ gmp? ( >=dev-libs/gmp-5 )
+ elibc_glibc? ( threads? ( >=sys-libs/glibc-2.13 ) )"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+PATCHES=("${FILESDIR}/${PN}-5.4.1-configure.patch"
+ "${FILESDIR}/${PN}-5.4.1-asm.patch")
+
+src_prepare() {
+ base_src_prepare
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ $(use_with X x) \
+ $(use_with gmp) \
+ $(use_with portable) \
+ $(use_with threads)
+}
+
+src_test() {
+ emake tests || die "tests failed"
+}
diff --git a/dev-lang/polyml/polyml-5.5.0.ebuild b/dev-lang/polyml/polyml-5.5.0.ebuild
new file mode 100644
index 000000000000..44b3faff1569
--- /dev/null
+++ b/dev-lang/polyml/polyml-5.5.0.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit base autotools versionator
+
+# Although the download is called 5.5, after building it poly -v says
+# it is 5.5.0.
+MY_PV=$(get_version_component_range "1-2" "${PV}")
+MY_P="${PN}.${MY_PV}"
+
+DESCRIPTION="Poly/ML is a full implementation of Standard ML"
+HOMEPAGE="https://www.polyml.org"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="X elibc_glibc +gmp portable test +threads"
+
+RDEPEND="X? ( x11-libs/motif:0 )
+ gmp? ( >=dev-libs/gmp-5 )
+ elibc_glibc? ( threads? ( >=sys-libs/glibc-2.13 ) )
+ virtual/libffi"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+PATCHES=("${FILESDIR}/${PN}-5.5.0-configure.patch"
+ "${FILESDIR}/${PN}-5.5.0-x-it-basis.patch"
+ "${FILESDIR}/${PN}-5.5.0-asm.patch")
+
+src_prepare() {
+ base_src_prepare
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --with-system-libffi \
+ $(use_with X x) \
+ $(use_with gmp) \
+ $(use_with portable) \
+ $(use_with threads)
+}
+
+src_test() {
+ emake tests || die "tests failed"
+}
diff --git a/dev-lang/polyml/polyml-5.5.1.ebuild b/dev-lang/polyml/polyml-5.5.1.ebuild
new file mode 100644
index 000000000000..ce4a090ed6cc
--- /dev/null
+++ b/dev-lang/polyml/polyml-5.5.1.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit base autotools pax-utils
+
+MY_P="${PN}.${PV}"
+
+DESCRIPTION="Poly/ML is a full implementation of Standard ML"
+HOMEPAGE="https://www.polyml.org"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="X elibc_glibc +gmp portable test +threads"
+
+RDEPEND="X? ( x11-libs/motif:0 )
+ gmp? ( >=dev-libs/gmp-5 )
+ elibc_glibc? ( threads? ( >=sys-libs/glibc-2.13 ) )
+ virtual/libffi"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+PATCHES=(
+ # Bug 256679 - patch the assembler code. The remaining executable stacks in ./.libs/poly
+ # comes from the polyml generated ./polyexport.o file.
+ "${FILESDIR}/${PN}-5.5.0-asm.patch"
+ # https://sourceforge.net/p/polyml/code/1875/ for isabelle-2013.2
+ "${FILESDIR}/${PN}-5.5.1-inputN-return-for-zero-chars.patch"
+ # https://sourceforge.net/p/polyml/code/1869/
+ # Adds Test146.ML that fails, applying it anyway as it is required by
+ # sci-mathematics/isabelle-2013.2
+ "${FILESDIR}/${PN}-5.5.1-optimize-closure.patch"
+)
+
+src_prepare() {
+ base_src_prepare
+ eautoreconf
+ if [ -f "${S}/Tests/Succeed/Test146.ML" ]; then
+ mv "${S}/Tests/Succeed/Test146.ML" "${S}/Tests/Succeed/Test146.ML.disable-test-as-it-fails"
+ fi
+}
+
+src_configure() {
+ econf \
+ --enable-shared \
+ --disable-static \
+ --with-system-libffi \
+ $(use_with X x) \
+ $(use_with gmp) \
+ $(use_with portable) \
+ $(use_with threads)
+}
+
+src_compile() {
+ # Bug 453146 - dev-lang/polyml-5.5.0: fails to build (pax kernel?)
+ pushd libpolyml || die "Could not cd to libpolyml"
+ emake
+ popd
+ emake polyimport
+ pax-mark m "${S}/.libs/polyimport"
+ emake
+ pax-mark m "${S}/.libs/poly"
+}
+
+src_test() {
+ emake tests || die "tests failed"
+}
diff --git a/dev-lang/polyml/polyml-5.5.2.ebuild b/dev-lang/polyml/polyml-5.5.2.ebuild
new file mode 100644
index 000000000000..f54f6675ccf8
--- /dev/null
+++ b/dev-lang/polyml/polyml-5.5.2.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit base autotools pax-utils
+
+MY_P="${PN}.${PV}"
+
+DESCRIPTION="Poly/ML is a full implementation of Standard ML"
+HOMEPAGE="https://www.polyml.org"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="X elibc_glibc +gmp portable test +threads"
+
+RDEPEND="X? ( x11-libs/motif:0 )
+ gmp? ( >=dev-libs/gmp-5 )
+ elibc_glibc? ( threads? ( >=sys-libs/glibc-2.13 ) )
+ virtual/libffi"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+PATCHES=(
+ # Bug 256679 - patch the assembler code. The remaining executable stacks in ./.libs/poly
+ # comes from the polyml generated ./polyexport.o file.
+ "${FILESDIR}/${PN}-5.5.0-asm.patch"
+ # Patches from https://sourceforge.net/p/polyml/code/HEAD/tree/fixes-5.5.2
+ # which are required to build and run sci-mathematics/isabelle-2015
+ "${FILESDIR}/${PN}-5.5.2-r1952-check_for_negative_sized_array.patch"
+ "${FILESDIR}/${PN}-5.5.2-r1954_Fix_segfault_in_FFI_when_malloc_runs_out_of_memory.patch"
+ "${FILESDIR}/${PN}-5.5.2-r2007_Ensure_the_large_object_cache_pointer_is_cleared.patch"
+ "${FILESDIR}/${PN}-5.5.2-r2009_Initialise_the_largeObjectCache_fully_in_the_constructor.patch"
+)
+
+src_prepare() {
+ base_src_prepare
+ eautoreconf
+ if [ -f "${S}/Tests/Succeed/Test146.ML" ]; then
+ mv "${S}/Tests/Succeed/Test146.ML" "${S}/Tests/Succeed/Test146.ML.disable-test-as-it-fails"
+ fi
+}
+
+src_configure() {
+ econf \
+ --enable-shared \
+ --disable-static \
+ --with-system-libffi \
+ $(use_with X x) \
+ $(use_with gmp) \
+ $(use_with portable) \
+ $(use_with threads)
+}
+
+src_compile() {
+ # Bug 453146 - dev-lang/polyml-5.5.0: fails to build (pax kernel?)
+ pushd libpolyml || die "Could not cd to libpolyml"
+ emake
+ popd
+ emake polyimport
+ pax-mark m "${S}/.libs/polyimport"
+ emake
+ pax-mark m "${S}/.libs/poly"
+}
+
+src_test() {
+ emake tests || die "tests failed"
+}
diff --git a/dev-lang/polyml/polyml-5.6.ebuild b/dev-lang/polyml/polyml-5.6.ebuild
new file mode 100644
index 000000000000..6cdf4fdd6fb5
--- /dev/null
+++ b/dev-lang/polyml/polyml-5.6.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit autotools pax-utils
+
+DESCRIPTION="Poly/ML is a full implementation of Standard ML"
+HOMEPAGE="https://www.polyml.org"
+SRC_URI="https://codeload.github.com/polyml/polyml/tar.gz/v${PV} -> ${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="X elibc_glibc +gmp portable test +threads"
+
+RDEPEND="X? ( x11-libs/motif:0 )
+ gmp? ( >=dev-libs/gmp-5 )
+ elibc_glibc? ( threads? ( >=sys-libs/glibc-2.13 ) )
+ virtual/libffi"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ default
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --enable-shared \
+ --disable-static \
+ --with-system-libffi \
+ $(use_with X x) \
+ $(use_with gmp) \
+ $(use_with portable) \
+ $(use_with threads)
+}
+
+src_compile() {
+ # Bug 453146 - dev-lang/polyml-5.5.0: fails to build (pax kernel?)
+ pushd libpolyml || die "Could not cd to libpolyml"
+ emake
+ popd
+ emake polyimport
+ pax-mark m "${S}/.libs/polyimport"
+ emake
+ pax-mark m "${S}/.libs/poly"
+}
+
+src_test() {
+ emake tests || die "tests failed"
+}