Add scripts for building GMP.framework and GNUreadline.framework (OS X).
authorjudah.jacobson@gmail.com <unknown>
Tue, 27 Nov 2007 07:29:51 +0000 (07:29 +0000)
committerjudah.jacobson@gmail.com <unknown>
Tue, 27 Nov 2007 07:29:51 +0000 (07:29 +0000)
MacFrameworks/Makefile [new file with mode: 0644]
MacFrameworks/README [new file with mode: 0644]
MacFrameworks/build-framework-gmp.sh [new file with mode: 0644]
MacFrameworks/build-framework-readline.sh [new file with mode: 0644]

diff --git a/MacFrameworks/Makefile b/MacFrameworks/Makefile
new file mode 100644 (file)
index 0000000..8189e23
--- /dev/null
@@ -0,0 +1,31 @@
+READLINE_DIR = readline-5.2
+GMP_DIR = gmp-4.2.1
+
+all: GMP.framework GNUreadline.framework
+
+$(GMP_DIR).tar.gz:
+       cp ../gmp/$(GMP_DIR).tar.gz .
+
+$(READLINE_DIR).tar.gz:
+       curl -O ftp://ftp.cwru.edu/pub/bash/$(READLINE_DIR).tar.gz
+
+$(GMP_DIR): $(GMP_DIR).tar.gz
+       tar -xzvf $(GMP_DIR).tar.gz
+
+$(READLINE_DIR): $(READLINE_DIR).tar.gz
+       tar -xzvf $(READLINE_DIR).tar.gz
+
+GMP.framework: $(GMP_DIR)
+       sh build-framework-gmp.sh
+
+GNUreadline.framework: $(READLINE_DIR)
+       sh build-framework-readline.sh
+
+clean: 
+       rm -rf $(GMP_DIR) $(READLINE_DIR)
+       rm -rf  GMP.framework GNUreadline.framework
+       rm -rf  GMP-framework.zip GNUreadline-framework.zip
+
+cleanall: clean
+       rm $(GMP_DIR).tar.gz
+       rm $(READLINE_DIR).tar.gz
diff --git a/MacFrameworks/README b/MacFrameworks/README
new file mode 100644 (file)
index 0000000..565b5da
--- /dev/null
@@ -0,0 +1,13 @@
+This directory is concerned with generating the following frameworks for use
+on OS X:
+
+GMP.framework
+GNUreadline.framework
+
+To make them, run 'make all' in this directory.  (The first time that you
+run that command, the readline source file readline-5.2.tar.gz will be 
+downloaded from the bash site ftp.cwru.edu into this directory.)
+
+Once you've built the frameworks, you should copy them into
+/Library/Frameworks.  All subsequent builds of ghc will automatically use 
+them as dependencies.  
diff --git a/MacFrameworks/build-framework-gmp.sh b/MacFrameworks/build-framework-gmp.sh
new file mode 100644 (file)
index 0000000..e3d7beb
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+# This is the shell script used to create this framework
+# from the sources available from the GMP web page at
+# http://www.swox.com/gmp/
+# To build your own, copy this file next to a GMP source tree,
+# update the SrcDir variable if necessary and execute
+# sh build-framework.sh
+
+SrcDir=gmp-4.2.1
+FrameworkName=GMP
+FrameworkVersion=A
+LibraryName=libgmp.dylib
+ExtraThings="$SrcDir/StagingAreaPPC/info $SrcDir/README $SrcDir/COPYING.LIB $SrcDir/ChangeLog build-framework.sh"
+
+pushd $SrcDir || exit 1
+
+make distclean
+CFLAGS='-arch ppc' ./configure --enable-cxx --host=powerpc-apple-darwin --disable-static --enable-shared --prefix=`pwd`/StagingAreaPPC || exit 1
+make CCLD='gcc -Wc,-arch -Wc,ppc' || exit 1
+make install || exit 1
+
+make distclean
+CFLAGS='-arch i386' ./configure --enable-cxx --host=none-apple-darwin --disable-static --enable-shared --prefix=`pwd`/StagingAreaIntel || exit 1
+make CCLD='gcc -Wc,-arch -Wc,i386' || exit 1
+make install || exit 1
+
+popd
+
+
+rm -rf $FrameworkName.framework
+
+FWVDir=$FrameworkName.framework/Versions/$FrameworkVersion
+mkdir -p $FWVDir
+
+cp -R $SrcDir/StagingAreaPPC/include $FWVDir/Headers
+# cp $SrcDir/StagingArea/lib/$LibraryName $FWVDir/$FrameworkName
+lipo -arch ppc $SrcDir/StagingAreaPPC/lib/$LibraryName -arch i386 $SrcDir/StagingAreaIntel/lib/$LibraryName -create -output $FWVDir/$FrameworkName
+
+install_name_tool -id $FWVDir/$FrameworkName $FWVDir/$FrameworkName
+
+ln -sf Versions/$FrameworkVersion/$FrameworkName $FrameworkName.framework/$FrameworkName
+ln -sf Versions/$FrameworkVersion/Headers $FrameworkName.framework/Headers
+
+for i in $ExtraThings; do
+    cp -R $i $FrameworkName.framework/
+done
+
+echo "Framework $FrameworkName.framework created."
diff --git a/MacFrameworks/build-framework-readline.sh b/MacFrameworks/build-framework-readline.sh
new file mode 100644 (file)
index 0000000..ef227ca
--- /dev/null
@@ -0,0 +1,63 @@
+
+#!/bin/sh
+# This is the shell script used to create this framework
+# from the sources available from the bash site at
+# ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz
+# To build your own, copy this script and the above gzip file 
+# into an empty directory, and run the following commands:
+# 
+# tar -xzf readline-5.2.tar.gz
+# sh build-framework.sh
+
+ONLY_COPY=0
+
+SrcDir=readline-5.2
+FrameworkName=GNUreadline
+FrameworkVersion=A
+LibraryName=libreadline.dylib
+ExtraThings="$SrcDir/StagingArea/info $SrcDir/README $SrcDir/COPYING $SrcDir/CHANGELOG build-framework-readline.sh readline-5.2.tar.gz"
+
+pushd $SrcDir || exit 1
+
+# for getting cross compiled universal binaries running on ppc and i386
+CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
+LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
+export CFLAGS LDFLAGS
+
+./configure --disable-dependency-tracking --disable-static --enable-shared --prefix=`pwd`/StagingArea || exit 1
+make || exit 1
+make doc || exit 1
+make install || exit 1
+
+popd
+
+rm -rf $FrameworkName.framework
+
+FWVDir=$FrameworkName.framework/Versions/$FrameworkVersion
+mkdir -p $FWVDir
+
+# Copy the header files into our new framework.
+# Change declarations of #include <readline/*.h> to <GNUreadline/readline/*.h>, so that they reference the 
+# header files inside of this framework.
+OLDINCLUDEDIR=$SrcDir/StagingArea/include/readline
+NEWINCLUDEDIR=$FWVDir/Headers/readline
+mkdir -p $NEWINCLUDEDIR
+for i in `ls $OLDINCLUDEDIR`; do
+    sed 's/include <readline/include <GNUreadline\/readline/' $OLDINCLUDEDIR/$i > $NEWINCLUDEDIR/$i
+done
+cp $SrcDir/StagingArea/lib/$LibraryName $FWVDir/$FrameworkName
+
+chmod u+w $FWVDir/$FrameworkName
+
+install_name_tool -id $FWVDir/$FrameworkName $FWVDir/$FrameworkName
+
+ln -sf Versions/$FrameworkVersion/$FrameworkName $FrameworkName.framework/$FrameworkName
+ln -sf Versions/$FrameworkVersion/Headers $FrameworkName.framework/Headers
+
+for i in $ExtraThings; do
+    cp -R $i $FrameworkName.framework/
+done
+
+echo "Framework $FrameworkName.framework created."
+zip -qyr "$FrameworkName-framework.zip" "$FrameworkName.framework"
+echo "... and zipped as $FrameworkName-framework.zip"