From 53d12fe9ff77fd96a8973e8ff459b498ba728f9b Mon Sep 17 00:00:00 2001
From: barracuda156 <vital.had@gmail.com>
Date: Fri, 21 Jul 2023 13:35:34 +0800
Subject: [PATCH 1/4] Amend Makefile.config for Macports

diff --git Makefile.config Makefile.config
index bc2cb5eef..204751d77 100644
--- Makefile.config
+++ Makefile.config
@@ -22,7 +22,7 @@ WITH_GMP_LIB_DIR := $(WITH_GMP_DIR)/lib
 endif
 
 # Specify installation prefix and staged install destination.
-PREFIX := /usr/local
+PREFIX := @PREFIX@
 DESTDIR :=
 
 # Specify runtime and compile arguments given to (the to-be-built) `mlton`
@@ -41,7 +41,7 @@ OLD_MLTON := mlton
 OLD_MLTON_RUNTIME_ARGS :=
 OLD_MLTON_COMPILE_ARGS :=
 
-OLD_MLTON_DIR :=
+OLD_MLTON_DIR := @MLTON@
 ifneq (,$(OLD_MLTON_DIR))
 OLD_MLTON := $(OLD_MLTON_DIR)/$(OLD_MLTON)
 endif
@@ -50,12 +50,12 @@ endif
 # Can be used for alternative tools (e.g., `SED=gsed`).
 DIFF := diff
 FIND := find
-GIT := git
-GREP := grep
+GIT := @PREFIX@/bin/git
+GREP := @PREFIX@/bin/ggrep
 GZIP := gzip
 PATCH := patch
-RSYNC := rsync
-SED := sed
+RSYNC := @PREFIX@/bin/rsync
+SED := @PREFIX@/bin/gsed
 TAR := tar
 
 SHA1SUM := sha1sum


From 106fc161be1c269db996acd207296385dcee1be5 Mon Sep 17 00:00:00 2001
From: barracuda156 <vital.had@gmail.com>
Date: Fri, 21 Jul 2023 13:37:14 +0800
Subject: [PATCH 2/4] mlbdeps: amend for Macports

diff --git bin/mlbdeps bin/mlbdeps
index ef75768d0..abb885507 100755
--- bin/mlbdeps
+++ bin/mlbdeps
@@ -2,7 +2,7 @@
 
 set -e
 
-SED=${SED:-sed}
+SED="@PREFIX@/bin/gsed"
 
 name=$(basename "$0")
 

From 007c3ea9cd8b4e5ac46a333809ebf03abcc36b84 Mon Sep 17 00:00:00 2001
From: barracuda156 <vital.had@gmail.com>
Date: Fri, 21 Jul 2023 22:55:53 +0800
Subject: [PATCH 4/4] Add version

---
 Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git Makefile.config Makefile.config
index 204751d77..b714ebb4a 100644
--- Makefile.config
+++ Makefile.config
@@ -85,7 +85,7 @@ MLTON := mlton-$(MLTON_FORK)
 MLTON_NAME := MLton [$(MLTON_FORK)]
 endif
 MLTON_OUTPUT := $(MLTON)-compile
-MLTON_VERSION := $(shell TZ=UTC $(GIT) log -n1 --date=format-local:"%Y%m%d.%H%M%S" --pretty=format:"%cd-g%h$$([ "$$($(GIT) status --porcelain 2> /dev/null)" ] && echo '-dirty')" 2> /dev/null || echo '????????')
+MLTON_VERSION := "@VERSION@"
 
 ######################################################################
 ######################################################################
-- 
