[MLton-commit] r6857
Wesley Terpstra
wesley at mlton.org
Tue Sep 16 05:04:37 PDT 2008
A script for creating Universal binaries with MLton on Mac OS X
----------------------------------------------------------------------
A mlton/trunk/package/macosx/mlton-ub
----------------------------------------------------------------------
Added: mlton/trunk/package/macosx/mlton-ub
===================================================================
--- mlton/trunk/package/macosx/mlton-ub 2008-09-16 10:17:23 UTC (rev 6856)
+++ mlton/trunk/package/macosx/mlton-ub 2008-09-16 12:04:31 UTC (rev 6857)
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+# A script that creates OS X Universal Binaries
+# Simply use mlton-ub instead of mlton.
+
+set -e
+
+declare -a args rargs
+while [ "$#" -gt 0 ]; do
+ case "$1" in
+ @MLton)
+ while [ "$#" -gt 0 -a "$1" != "--" ]; do
+ rargs[${#rargs[@]}]="$1"
+ shift
+ done
+ rargs[${#rargs[@]}]="--"
+ shift
+ ;;
+ -output)
+ shift
+ file="$1"
+ shift
+ ;;
+ -*)
+ args[${#args[@]}]="$1"
+ args[${#args[@]}]="$2"
+ shift
+ shift
+ ;;
+ *)
+ if test -z "$file"; then file="${1%.*}"; fi
+ args[${#args[@]}]="$1"
+ shift
+ ;;
+ esac
+done
+
+if [ -z "$file" ]; then
+ exec mlton "${rargs[@]}" "${args[@]}"
+fi
+
+mlton "${rargs[@]}" -output "$file.i386" -target i386 "${args[@]}"
+mlton "${rargs[@]}" -output "$file.x86_64" -target x86_64 "${args[@]}"
+mlton "${rargs[@]}" -output "$file.ppc" -target ppc "${args[@]}"
+mlton "${rargs[@]}" -output "$file.ppc64" -target ppc64 "${args[@]}"
+
+lipo -create -output "$file" \
+ "$file.i386" "$file.x86_64" "$file.ppc" "$file.ppc64"
+rm -f "$file.i386" "$file.x86_64" "$file.ppc" "$file.ppc64"
Property changes on: mlton/trunk/package/macosx/mlton-ub
___________________________________________________________________
Name: svn:executable
+ *
More information about the MLton-commit
mailing list