From 1e2e6dd83da470dd6018af15f92ba868df3e801a Mon Sep 17 00:00:00 2001 From: murray Date: Sat, 28 Oct 2023 19:27:11 +0100 Subject: [PATCH] New package: mlton-20210117 --- srcpkgs/mlton/patches/20-polyml.patch | 48 +++++++++++++++++ srcpkgs/mlton/patches/30-mlbdeps.patch | 60 +++++++++++++++++++++ srcpkgs/mlton/patches/40-mlton.patch | 20 +++++++ srcpkgs/mlton/patches/50-mlton-stubs.patch | 19 +++++++ srcpkgs/mlton/patches/60-clean-polyml.patch | 10 ++++ srcpkgs/mlton/template | 31 +++++++++++ 6 files changed, 188 insertions(+) create mode 100644 srcpkgs/mlton/patches/20-polyml.patch create mode 100644 srcpkgs/mlton/patches/30-mlbdeps.patch create mode 100644 srcpkgs/mlton/patches/40-mlton.patch create mode 100644 srcpkgs/mlton/patches/50-mlton-stubs.patch create mode 100644 srcpkgs/mlton/patches/60-clean-polyml.patch create mode 100644 srcpkgs/mlton/template diff --git a/srcpkgs/mlton/patches/20-polyml.patch b/srcpkgs/mlton/patches/20-polyml.patch new file mode 100644 index 00000000000000..62ad34c3428755 --- /dev/null +++ b/srcpkgs/mlton/patches/20-polyml.patch @@ -0,0 +1,48 @@ +--- a/mlton/Makefile ++++ b/mlton/Makefile +@@ -187,31 +208,31 @@ smlnj-mlton: mlton-smlnj.cm control/version.sml $(FRONT_END_SOURCES) + # MLton. + # + POLYML := poly ++CAT := cat + + .PHONY: polyml-mlton +-polyml-mlton: mlton-polyml.use $(shell [ -e mlton-polyml.use ] && cat mlton-polyml.use | $(SED) 's/use "\(.*\)";/\1/') control/version.sml $(FRONT_END_SOURCES) +- ( \ +- echo 'use "mlton-polyml.use";'; \ +- echo 'PolyML.export("$(MLTON_OUTPUT)-polyml", Main.mainWrapped);'; \ +- ) | "$(POLYML)" +- $(CC) -o $(MLTON_OUTPUT)-polyml $(MLTON_OUTPUT)-polyml.o -lpolymain -lpolyml +- $(RM) $(MLTON_OUTPUT)-polyml.o ++polyml-mlton: $(MLTON_OUTPUT)-polyml ++ ++$(MLTON_OUTPUT)-polyml: mlton-polyml.sml $(shell [ -e mlton-polyml.sml ] && $(CAT) mlton-polyml.sml | $(GREP) 'use ".*";' | $(SED) 's/use "\(.*\)";/\1/') control/version.sml $(FRONT_END_SOURCES) ++ polyc -o $@ mlton-polyml.sml + +-mlton-polyml.use: ../lib/stubs/basis-stubs-for-polyml/sources.use ../lib/stubs/mlton-stubs-for-polyml/sources.use $(shell "$(RUN_MLTON_DEPS)" -stop f ../lib/stubs/mlton-stubs/sources.mlb | $(GREP) 'mlb$$') $(shell "$(RUN_MLTON_DEPS)" -stop f mlton.mlb | $(GREP) 'mlb$$') ++mlton-polyml.sml: ../lib/stubs/basis-stubs-for-polyml/sources.use ../lib/stubs/mlton-stubs-for-polyml/sources.use $(shell "$(RUN_MLTON_DEPS)" -stop f ../lib/stubs/mlton-stubs/sources.mlb | $(GREP) 'mlb$$') $(shell "$(RUN_MLTON_DEPS)" -stop f mlton.mlb | $(GREP) 'mlb$$') ++ chmod +x $(SRC)/bin/mlbdeps + ( \ +- cat ../lib/stubs/basis-stubs-for-polyml/sources.use | \ ++ $(CAT) ../lib/stubs/basis-stubs-for-polyml/sources.use | \ + $(SED) 's|use "\(.*\)";|../lib/stubs/basis-stubs-for-polyml/\1|'; \ +- "$(RUN_MLTON)" -stop f mlton.mlb | $(GREP) -v 'mlb$$' | $(GREP) 'mlyacc'; \ +- cat ../lib/stubs/mlton-stubs-for-polyml/sources.use | \ ++ $(SRC)/bin/mlbdeps mlton.mlb | $(GREP) -v 'mlb$$' | $(GREP) 'mlyacc'; \ ++ $(CAT) ../lib/stubs/mlton-stubs-for-polyml/sources.use | \ + $(SED) 's|use "\(.*\)";|../lib/stubs/mlton-stubs-for-polyml/\1|'; \ +- "$(RUN_MLTON)" -stop f ../lib/stubs/mlton-stubs/sources.mlb | \ ++ $(SRC)/bin/mlbdeps ../lib/stubs/mlton-stubs/sources.mlb | \ + $(GREP) -v 'mlb$$' | \ + $(GREP) 'mlton-stubs'; \ +- "$(RUN_MLTON)" -stop f mlton.mlb | \ ++ $(SRC)/bin/mlbdeps mlton.mlb | \ + $(GREP) -v 'mlb$$' | \ + $(GREP) -v 'sml/basis' | \ + $(GREP) -v 'targets' | \ + $(GREP) -v 'mlton-stubs' | \ + $(GREP) -v 'mlyacc' | \ + $(GREP) -v 'call-main.sml'; \ +- ) | $(SED) 's|\(.*\)|use "\1";|' > mlton-polyml.use ++ ) | $(SED) 's|\(.*\)|use "\1";|' > $@ ++ echo "val main = Main.mainWrapped;" >> $@ diff --git a/srcpkgs/mlton/patches/30-mlbdeps.patch b/srcpkgs/mlton/patches/30-mlbdeps.patch new file mode 100644 index 00000000000000..03a6ad7188d30f --- /dev/null +++ b/srcpkgs/mlton/patches/30-mlbdeps.patch @@ -0,0 +1,60 @@ +--- /dev/null ++++ b/bin/mlbdeps +@@ -0,0 +1,57 @@ ++#!/usr/bin/env bash ++ ++set -e ++ ++SED=${SED:-sed} ++ ++name=$(basename "$0") ++ ++function normalize_path () { ++ local path="$1" ++ local opath="" ++ while [ "$opath" != "$path" ]; do ++ opath="$path" ++ path="$(echo "$path" | ${SED} -e 's;^\./;;')" ++ done ++ local opath="" ++ while [ "$opath" != "$path" ]; do ++ opath="$path" ++ path="$(echo "$path" | ${SED} -e 's;/\./;/;')" ++ done ++ opath="" ++ while [ "$opath" != "$path" ]; do ++ opath="$path" ++ path="$(echo "$path" | ${SED} -e 's;[^/][^/]*/\.\./;;')" ++ done ++ path="$(echo "$path" | ${SED} -e 's;^\./;;')" ++ echo "$path" ++} ++ ++declare -a seen ++ ++function doit() { ++ local mlb="$1" ++ for s in "${seen[@]}"; do ++ if [ "$mlb" == "$s" ]; then ++ return 0 ++ fi ++ done ++ seen+=("$mlb"); ++ echo "$mlb" ++ if [ -e "$mlb" ]; then ++ local dir="$(dirname $mlb)" ++ for f in $(cat "$mlb" | ${SED} -n -e 's/^[ ]*\([^ ]*\.\(sml\|sig\|fun\|mlb\)\).*/\1/p'); do ++ case "$f" in ++ /*) ;; ++ \$\(*\)*) ;; ++ *) f="$(normalize_path "$dir"/"$f")" ;; ++ esac ++ case "$f" in ++ *.mlb) doit "$f";; ++ *) echo "$f";; ++ esac ++ done ++ fi ++} ++ ++doit "$(normalize_path "$1")" diff --git a/srcpkgs/mlton/patches/40-mlton.patch b/srcpkgs/mlton/patches/40-mlton.patch new file mode 100644 index 00000000000000..0056419b293595 --- /dev/null +++ b/srcpkgs/mlton/patches/40-mlton.patch @@ -0,0 +1,20 @@ +--- a/Makefile ++++ b/Makefile +@@ -308,7 +308,7 @@ smlnj-mlton-x16: + bootstrap-polyml: + $(MAKE) polyml-mlton + $(RM) "$(BIN)/$(MLTON)" +- $(MAKE) BOOTSTRAP_MLTON=$(MLTON).polyml all ++ $(MAKE) OLD_MLTON="$(BIN)/$(MLTON).polyml" all + $(RM) "$(LIB)/$(MLTON)-polyml$(EXE)" + $(RM) "$(BIN)/$(MLTON).polyml" + +@@ -317,7 +317,7 @@ polyml-mlton: + $(MAKE) dirs + $(MAKE) runtime + $(MAKE) -C "$(SRC)/mlton" polyml-mlton +- $(CP) "$(SRC)/mlton/mlton-polyml$(EXE)" "$(LIB)/" ++ $(CP) "$(SRC)/mlton/$(MLTON_OUTPUT)-polyml$(EXE)" "$(LIB)/" + $(MAKE) script + $(MAKE) basis-no-check + $(MAKE) libraries-no-check diff --git a/srcpkgs/mlton/patches/50-mlton-stubs.patch b/srcpkgs/mlton/patches/50-mlton-stubs.patch new file mode 100644 index 00000000000000..21001953982823 --- /dev/null +++ b/srcpkgs/mlton/patches/50-mlton-stubs.patch @@ -0,0 +1,19 @@ +--- a/mlton/Makefile ++++ b/mlton/Makefile +@@ -136,13 +136,13 @@ mlton-stubs.mlb: $(shell "$(RUN_MLTON_DEPS)" -stop f ../lib/stubs/mlton-stubs/so + echo '$$(SML_LIB)/basis/sml-nj.mlb'; \ + echo '$$(SML_LIB)/basis/mlton.mlb'; \ + echo '$$(SML_LIB)/basis/basis.mlb'; \ +- $(RUN_MLTON) -stop f mlton.mlb | \ ++ $(SRC)/bin/mlbdeps mlton.mlb | \ + $(GREP) -v 'mlb$$' | \ + $(GREP) 'mlyacc'; \ +- $(RUN_MLTON) -stop f ../lib/stubs/mlton-stubs/sources.mlb | \ ++ $(SRC)/bin/mlbdeps ../lib/stubs/mlton-stubs/sources.mlb | \ + $(GREP) -v 'mlb$$' | \ + $(GREP) 'mlton-stubs'; \ +- $(RUN_MLTON) -stop f mlton.mlb | \ ++ $(SRC)/bin/mlbdeps mlton.mlb | \ + $(GREP) -v 'mlb$$' | \ + $(GREP) -v 'sml/basis' | \ + $(GREP) -v 'targets' | \ diff --git a/srcpkgs/mlton/patches/60-clean-polyml.patch b/srcpkgs/mlton/patches/60-clean-polyml.patch new file mode 100644 index 00000000000000..8cd33967efa311 --- /dev/null +++ b/srcpkgs/mlton/patches/60-clean-polyml.patch @@ -0,0 +1,10 @@ +--- a/Makefile ++++ b/Makefile +@@ -310,6 +310,7 @@ bootstrap-polyml: + $(RM) "$(BIN)/$(MLTON)" + $(MAKE) OLD_MLTON="$(BIN)/$(MLTON).polyml" all + $(RM) "$(LIB)/$(MLTON)-polyml$(EXE)" ++ $(RM) "$(LIB)/$(MLTON_OUTPUT)-polyml$(EXE)" + $(RM) "$(BIN)/$(MLTON).polyml" + + .PHONY: polyml-mlton diff --git a/srcpkgs/mlton/template b/srcpkgs/mlton/template new file mode 100644 index 00000000000000..ac86588d05ae3b --- /dev/null +++ b/srcpkgs/mlton/template @@ -0,0 +1,31 @@ +# Template file for 'mlton' +pkgname=mlton +version=20210117 +revision=1 +build_style=gnu-makefile +make_build_target=bootstrap-polyml +hostmakedepends="polyml tar" +makedepends="gmp-devel" +depends="bash gcc gmp-devel" +short_desc="MLton Standard ML (SML) compiler" +maintainer="ii8 " +license="HPND" +homepage="http://mlton.org/" +distfiles="https://github.com/MLton/mlton/releases/download/on-${version}-release/mlton-${version}.src.tgz + https://github.com/MLton/mlton/commit/f074a9a41b5338303271cd50f17078595fef35ff.patch>mllex.patch" +checksum="ec7a5a54deb39c7c0fa746d17767752154e9cb94dbcf3d15b795083b3f0f154b + da73a393384ac8e1094dc59b1a19cf73f506d0481354ced814cd894a83216272" +skip_extraction="mllex.patch" +nocross=yes + +post_extract() { + cp "${XBPS_SRCDISTDIR}/${pkgname}-${version}/mllex.patch" . +} + +pre_patch() { + patch -Np1 -i mllex.patch +} + +case "$XBPS_TARGET_MACHINE" in + i686*) broken="The 2nd bootstrap mlton(built by the polyml-mlton) segfaults in parseAndElaborate" ;; +esac