summaryrefslogtreecommitdiff
path: root/dev-lang/mlton
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /dev-lang/mlton
reinit the tree, so we can have metadata
Diffstat (limited to 'dev-lang/mlton')
-rw-r--r--dev-lang/mlton/Manifest10
-rw-r--r--dev-lang/mlton/files/mlton-20070826-no-execmem.patch29
-rw-r--r--dev-lang/mlton/files/mlton-20130715-no-PIE.patch66
-rw-r--r--dev-lang/mlton/files/mlton-20130715-split-make-for-pax-mark.patch11
-rw-r--r--dev-lang/mlton/metadata.xml14
-rw-r--r--dev-lang/mlton/mlton-20130715.ebuild119
6 files changed, 249 insertions, 0 deletions
diff --git a/dev-lang/mlton/Manifest b/dev-lang/mlton/Manifest
new file mode 100644
index 000000000000..dee51e077f8e
--- /dev/null
+++ b/dev-lang/mlton/Manifest
@@ -0,0 +1,10 @@
+AUX mlton-20070826-no-execmem.patch 1236 SHA256 4ca68021fed935628d22fa17cbaf09b9ccbd2b9306070959afe49989d12e0ecb SHA512 d6f323bc181656fbdfdf25e0472e7e13e93b565f3ba64ea9cc81fbcb6c935580c1811f783035a5b1c45be082a38f157610666276aad9fb36d3fdb009fe7ce1c9 WHIRLPOOL c0b2cc4a40779a80bdf33101a2770ec70941a42c28dfd9334c5058407ba4c376be51124f901bdd81c63446aa3d14394ca9b9a82454c55a94efc8d7da3d268e9c
+AUX mlton-20130715-no-PIE.patch 2399 SHA256 ff642bd7e39925e12f74ba2f119f5019dbab52f0cf7778d5c0784bb74ccd1685 SHA512 ef0d675acfcbe05c1f810da2b9d684b4412a0f283e6025930c13d80912036ffc650972664f5a4fdd955e4c78c3564c751c1ba9bf279f738eca96801eeb57f0b2 WHIRLPOOL 7f635c6460ad5c82128d3511620c851e8d63cfd41090cedfa8fc72127b23efecdfc9bfd58776123686e093fd0aebd64eaddf17e40d340b3c99ed25bc7f1053b2
+AUX mlton-20130715-split-make-for-pax-mark.patch 556 SHA256 76bfe366c53a26b287732d0d5280dda7cd52e6fdb0bf044db44bde1d08e8b389 SHA512 9d334c930abe38f222bdd16c7dbdb0b1e0a70955aa8832fd441c9443c53f9d66c3ec49c06f59de501c014a66c6265a6df64269e0534c0ffdae0115718febb694 WHIRLPOOL 5641dca7b67f000105325644dedfb31cea53e4dd181096ac98b68640863eedff40fc0c091f1ca39f9c488e59bcf78d42b0b6d83a39374fcec54097f0fda3c6f9
+DIST mlton-20130715-1.amd64-linux.tgz 19512324 SHA256 f6f912009b0946b73af88ff5f3e713b6be63b871696e2697ccf1564b56e7d03b SHA512 ac41cf8b2afbba80ed25908b1842348eac1507b2aada103648171db1482358c4176b01d9266dfee053b20fc224653ec58ee9d3265672c02fa3774b7562a319bf WHIRLPOOL 50d265fbfabba1c9ed840a3393bf80f3b86a094a2a4ca5be323fc369bffcc3f5763a7ea3574b0f64be551396d9dea7365d1263629d8b14ef5fefad203544bfbe
+DIST mlton-20130715-1.x86-linux.tgz 18065793 SHA256 92d89627cf760c56d0e9727f328b006341bf5be283fc7d616a6276c26d95b2cf SHA512 13a996952df27420f05f8290920055231156c8982c1cf3c31259d73e0c534258e2aad91596e51809719ffb0b74652aa052d296000f2ab99462714d4ef9a41859 WHIRLPOOL a010aca6ae07c1e824b1fbfabc9c00eca270422783715ed644b864916f604f77115d87130ab5c77f6163d1f24793aee4ca33cf425bde2b680563c03756ba44ec
+DIST mlton-20130715.src.tgz 25606142 SHA256 215857ad11d44f8d94c27f75e74017aa44b2c9703304bcec9e38c20433143d6c SHA512 db273de47dc0059e830332b559918567f5153a0518e067ba71927e3705157f1984d6f6202201cef25aaef29d1a71a637e9a1cb30951e94dbfae4ab1a5e5d40d1 WHIRLPOOL 0c899b0cb17251ca345b73764a86e160ea5bdde5d35f5eb36b1f72202c87dcc251cfb19563744ad7cfe2e10eb76963df79dca023801f858441d5c745046df5be
+EBUILD mlton-20130715.ebuild 3994 SHA256 21bf747f2e3778364da44424972503f1fbf019e7c6185e2dda6485a52f476de2 SHA512 69d008b0d4522f331f071513b6ff67bf26e9fca0b4522d229a9d81ad52740670c64455f3cc1bcbefcd99f1c477cb8b39465ad1bb72e729c96c57d2adbc6d126d WHIRLPOOL 2859fafd63dfa06734e9d680fe7916953e554762667a317b7fddd13e44d3d32d224631a4d374392235188841e2e5c5613768eaba38db763f4eb45903fa3217f5
+MISC ChangeLog 2560 SHA256 46565b17ca88db333fb16695af56ceb32425873d7f3c2c4c4adbe7e8a62a127c SHA512 32078188f131bea32df470d7b0df597813ddc7feeecd11019c908bcf91f68124f41d0075f464d9e2da0875ec62da3da1532067a703646fb0646eaac4c9243cdf WHIRLPOOL 79812221ec595fea18c62c1aa318aa6fb2765a7d0ae501926ee790fadc9a09fd5ba8bf847a0fc638e3a2d151907b395c8cc841cfbffff443079b88815486cc93
+MISC ChangeLog-2015 2913 SHA256 a86d3d9d54f5b3cd43db04aa7d5a418b6eb47405e893331a1df34f4a13378331 SHA512 6eb36363485c97166dbdb36123ee67ca91a504e0e08608eed5d74e4f9c5352db1b910d267c5efdd98227f75bdc4ccdcadf432659ccf88c069caa47393cd0d602 WHIRLPOOL 037517449328cfeec5f1d95aa02ceb8682fdaea7046e94f2df0a946b47cafc0e54737cc2c4f85eda01bbc622273e46b6ce0603fcdd261308cb02865a21542ddf
+MISC metadata.xml 453 SHA256 c6ae217f4bae63f2cbfa252f4877e4dd2c0684be368ff962c6212e648e329d31 SHA512 019258148a954fbe475be30cf130a48fdcae1789dfadf478fc7f9724fcd2e6a1962485f2ccfa30b023af6b04ee69947007a805b66ebdab7b4180fc235197fdd1 WHIRLPOOL 4e014b78f6be192adbaafdf641ced2a5d4380dd16ec643379be58a56fc1cb3c27821bd341a4c652d68af19ffe64ad43d4863e3e2e76eb60689f9a2dde2d5c51b
diff --git a/dev-lang/mlton/files/mlton-20070826-no-execmem.patch b/dev-lang/mlton/files/mlton-20070826-no-execmem.patch
new file mode 100644
index 000000000000..f4d4bdf540bf
--- /dev/null
+++ b/dev-lang/mlton/files/mlton-20070826-no-execmem.patch
@@ -0,0 +1,29 @@
+From 544930de3b1c754fa8803169902a63bce7cc02ba Mon Sep 17 00:00:00 2001
+From: Adam Goode <adam@spicenitz.org>
+Date: Wed, 6 Feb 2008 20:17:51 -0500
+Subject: [PATCH] Remove PROT_EXEC from mprotect
+
+It looks like mprotect is used here as part of signal handling.
+There doesn't seems to be a reason to have the area of memory
+marked as executable. In fact, on Fedora 9, this causes MLton
+compiled binaries (including MLton itself) to fail.
+---
+ runtime/platform/mmap-protect.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/runtime/platform/mmap-protect.c b/runtime/platform/mmap-protect.c
+index f0dea49..df42215 100644
+--- a/runtime/platform/mmap-protect.c
++++ b/runtime/platform/mmap-protect.c
+@@ -7,7 +7,7 @@ void *GC_mmapAnon_safe_protect (void *start, size_t length,
+ if (mprotect (low, dead_low, PROT_NONE))
+ diee ("mprotect failed");
+ result = (void*)((pointer)low + dead_low);
+- if (mprotect (result, length, PROT_READ | PROT_WRITE | PROT_EXEC))
++ if (mprotect (result, length, PROT_READ | PROT_WRITE))
+ diee ("mprotect failed");
+ high = (void*)((pointer)result + length);
+ if (mprotect (high, dead_high, PROT_NONE))
+--
+1.5.4
+
diff --git a/dev-lang/mlton/files/mlton-20130715-no-PIE.patch b/dev-lang/mlton/files/mlton-20130715-no-PIE.patch
new file mode 100644
index 000000000000..a059b1598bec
--- /dev/null
+++ b/dev-lang/mlton/files/mlton-20130715-no-PIE.patch
@@ -0,0 +1,66 @@
+--- mlton-20130715-orig/bin/upgrade-basis 2013-07-16 05:59:09.000000000 +1000
++++ mlton-20130715/bin/upgrade-basis 2013-12-17 18:17:24.165889500 +1100
+@@ -28,7 +28,7 @@
+ tmp="$$.sml"
+
+ echo "val () = print \"I work\"" >"$tmp"
+-if ! mlton "$tmp" 1>&2; then
++if ! mlton -link-opt -fno-PIE "$tmp" 1>&2; then
+ die "Error: cannot upgrade basis because the compiler doesn't work"
+ fi
+
+--- mlton-20130715-orig/mlton/Makefile 2013-07-16 05:59:09.000000000 +1000
++++ mlton-20130715/mlton/Makefile 2013-12-17 23:35:06.137421195 +1100
+@@ -106,7 +106,7 @@
+ rm -f control/version.sml
+ $(MAKE) control/version.sml
+ @echo 'Compiling mlton (takes a while)'
+- mlton $(FLAGS) $(FILE)
++ mlton $(FLAGS) -link-opt -fno-PIE $(FILE)
+
+ .PHONY: def-use
+ def-use: mlton.def-use
+--- mlton-20130715-orig/mllex/Makefile 2013-07-16 05:59:09.000000000 +1000
++++ mlton-20130715/mllex/Makefile 2013-12-18 07:03:29.592171611 +1100
+@@ -21,7 +21,7 @@
+
+ $(NAME): $(NAME).mlb $(shell PATH="$(BIN):$$PATH" && "$(MLTON)" -stop f $(NAME).mlb)
+ @echo 'Compiling $(NAME)'
+- "$(MLTON)" $(FLAGS) $(NAME).mlb
++ "$(MLTON)" $(FLAGS) -link-opt -fno-PIE $(NAME).mlb
+
+ html/index.html: $(TEX_FILES)
+ mkdir -p html
+--- mlton-20130715-orig/mlnlffigen/Makefile 2013-07-16 05:59:09.000000000 +1000
++++ mlton-20130715/mlnlffigen/Makefile 2013-12-18 11:55:33.590660407 +1100
+@@ -22,7 +22,7 @@
+
+ $(NAME): $(NAME).mlb $(shell PATH="$(BIN):$$PATH" && "$(MLTON)" -stop f $(NAME).mlb)
+ @echo 'Compiling $(NAME)'
+- $(MLTON) $(FLAGS) $(NAME).mlb
++ $(MLTON) $(FLAGS) -link-opt -fno-PIE $(NAME).mlb
+
+ .PHONY: clean
+ clean:
+--- mlton-20130715-orig/mlprof/Makefile 2013-07-16 05:59:09.000000000 +1000
++++ mlton-20130715/mlprof/Makefile 2013-12-20 14:02:50.292677796 +1100
+@@ -21,7 +21,7 @@
+
+ $(NAME): $(NAME).mlb $(shell PATH="$(BIN):$$PATH" && "$(MLTON)" -stop f $(NAME).mlb)
+ @echo 'Compiling $(NAME)'
+- $(MLTON) $(FLAGS) $(NAME).mlb
++ $(MLTON) $(FLAGS) -link-opt -fno-PIE $(NAME).mlb
+
+ .PHONY: clean
+ clean:
+--- mlton-20130715-orig/mlyacc/Makefile 2013-07-16 05:59:09.000000000 +1000
++++ mlton-20130715/mlyacc/Makefile 2013-12-20 15:01:26.567775876 +1100
+@@ -41,7 +41,7 @@
+
+ $(NAME): $(NAME).mlb $(shell PATH="$(BIN):$$PATH" && "$(MLTON)" -stop f $(NAME).mlb)
+ @echo 'Compiling $(NAME)'
+- "$(MLTON)" $(FLAGS) $(NAME).mlb
++ "$(MLTON)" $(FLAGS) -link-opt -fno-PIE $(NAME).mlb
+
+ src/yacc.lex.sml: src/yacc.lex
+ rm -f src/yacc.lex.sml && \
diff --git a/dev-lang/mlton/files/mlton-20130715-split-make-for-pax-mark.patch b/dev-lang/mlton/files/mlton-20130715-split-make-for-pax-mark.patch
new file mode 100644
index 000000000000..3286d44e3522
--- /dev/null
+++ b/dev-lang/mlton/files/mlton-20130715-split-make-for-pax-mark.patch
@@ -0,0 +1,11 @@
+--- mlton-20130715-orig/Makefile 2013-07-16 05:59:09.000000000 +1000
++++ mlton-20130715/Makefile 2013-12-27 13:29:35.259563131 +1100
+@@ -58,7 +58,7 @@
+
+ .PHONY: all-no-docs
+ all-no-docs:
+- $(MAKE) dirs runtime compiler basis-no-check script mlbpathmap constants libraries tools
++ $(MAKE) basis-no-check script mlbpathmap constants libraries tools
+ # Remove $(AOUT) so that the $(MAKE) compiler below will remake MLton.
+ # We also want to re-run the just-built tools (mllex and mlyacc)
+ # because they may be better than those that were used for the first
diff --git a/dev-lang/mlton/metadata.xml b/dev-lang/mlton/metadata.xml
new file mode 100644
index 000000000000..6a46dc0bbde8
--- /dev/null
+++ b/dev-lang/mlton/metadata.xml
@@ -0,0 +1,14 @@
+<?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>
+ <use>
+ <flag name="binary">install a binary version (need to do this once to bootstrap, until smlnj is supported)</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">mlton</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-lang/mlton/mlton-20130715.ebuild b/dev-lang/mlton/mlton-20130715.ebuild
new file mode 100644
index 000000000000..8fc9db5dee2a
--- /dev/null
+++ b/dev-lang/mlton/mlton-20130715.ebuild
@@ -0,0 +1,119 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit check-reqs eutils pax-utils
+
+DESCRIPTION="Standard ML optimizing compiler and libraries"
+BASE_URI="mirror://sourceforge/${PN}"
+SRC_URI="!binary? ( ${BASE_URI}/${P}.src.tgz )
+ binary? ( amd64? ( ${BASE_URI}/${P}-1.amd64-linux.tgz )
+ x86? ( ${BASE_URI}/${P}-1.x86-linux.tgz ) )"
+
+HOMEPAGE="http://www.mlton.org"
+
+LICENSE="HPND MIT"
+SLOT="0/${PV}"
+# there is support for ppc64 and ia64, but no
+# binaries are provided and there is no native
+# code generation for these platforms
+KEYWORDS="-* ~amd64 ~x86"
+IUSE="binary doc"
+
+DEPEND="dev-libs/gmp
+ doc? ( virtual/latex-base )"
+RDEPEND="dev-libs/gmp"
+
+QA_PRESTRIPPED="binary? (
+ usr/bin/mlnlffigen
+ usr/bin/mllex
+ usr/bin/mlprof
+ usr/bin/mlyacc
+ usr/lib/mlton/mlton-compile
+)"
+
+# The resident set size of mlton-compile is 10GB on amd64
+CHECKREQS_MEMORY="4G"
+
+pkg_pretend() {
+ if use !binary; then
+ check-reqs_pkg_pretend
+ fi
+}
+
+src_unpack() {
+ if use !binary; then
+ unpack ${A}
+ else
+ mkdir -p "${S}" || die "Could not create ${S} directory"
+ pushd "${S}" || die "Could not cd to ${S}"
+ unpack ${A}
+ popd
+ fi
+}
+
+src_prepare() {
+ if use !binary; then
+ # The patch removing executable permissions from mmap'd memory regions is not upstreamed:
+ # http://pkgs.fedoraproject.org/cgit/mlton.git/tree/mlton-20070826-no-execmem.patch
+ epatch "${FILESDIR}/${PN}-20070826-no-execmem.patch"
+ # PIE in hardened requires executables to be linked with -fPIC. mlton by default tries
+ # to link executables against the non PIC objects in libmlton.a. We may be bootstrapping
+ # with an old mlton install, if we tried to patch it (to link with libmlton-pic.a) we would
+ # need a patched binary.
+ # http://mlton.org/MLtonWorld says Executables that save and load worlds are incompatible
+ # with address space layout randomization (ASLR) of the executable.
+ epatch "${FILESDIR}/${PN}-20130715-no-PIE.patch"
+ # Remove dirs runtime compiler from all-no-docs to avoid repeating these steps.
+ # As we need to pax-mark the mlton-compiler executable.
+ epatch "${FILESDIR}/${PN}-20130715-split-make-for-pax-mark.patch"
+ fi
+}
+
+src_compile() {
+ if use !binary; then
+ has_version dev-lang/mlton || die "emerge with binary use flag first"
+
+ # Fix location in which to install man pages
+ sed -i 's@^MAN_PREFIX_EXTRA :=.*@MAN_PREFIX_EXTRA := /share@' \
+ Makefile || die 'sed Makefile failed'
+
+ emake -j1 dirs runtime compiler CFLAGS="${CFLAGS}" || die
+ pax-mark m "${S}/mlton/mlton-compile"
+ pax-mark m "${S}/build/lib/mlton-compile"
+
+ # Does not support parallel make
+ emake -j1 all-no-docs CFLAGS="${CFLAGS}" || die
+ if use doc; then
+ export VARTEXFONTS="${T}/fonts"
+ emake docs || die "failed to create documentation"
+ fi
+ fi
+}
+
+src_install() {
+ if use binary; then
+ # Fix location in which to install man pages
+ mv "${S}/usr/man" "${S}/usr/share" || die "mv man failed"
+ pax-mark m "${S}/usr/lib/mlton/mlton-compile"
+ pax-mark m "${S}/usr/bin/mllex"
+ pax-mark m "${S}/usr/bin/mlyacc"
+ mv "${S}/usr" "${D}" || die "mv failed"
+ else
+ emake DESTDIR="${D}" install-no-docs || die
+ if use doc; then emake DESTDIR="${D}" TDOC="${D}"/usr/share/doc/${P} install-docs || die; fi
+ fi
+}
+
+pkg_postinst() {
+ # There are PIC objects in libmlton-pic.a. -link-opt -lmlton-pic does not help as mlton
+ # specifies -lmlton before -lmlton-pic. It appears that it would be necessary to patch mlton
+ # to convince mlton to use the lib*-pic.a libraries when linking an executable.
+ ewarn 'PIE in Gentoo hardened requires executables to be linked with -fPIC. mlton by default links'
+ ewarn 'executables against the non PIC objects in libmlton.a. http://mlton.org/MLtonWorld notes:'
+ ewarn 'Executables that save and load worlds are incompatible with address space layout'
+ ewarn 'randomization (ASLR) of the executable.'
+ ewarn 'To suppress the generation of position-independent executables.'
+ ewarn '-link-opt -fno-PIE'
+}