update submodules for GHC.HetMet.GArrow -> Control.GArrow renaming
[ghc-hetmet.git] / distrib / MacFrameworks / build-framework-readline.sh
1
2 #!/bin/sh
3 # This is the shell script used to create this framework
4 # from the sources available from the bash site at
5 # ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz
6 # To build your own, copy this script and the above gzip file 
7 # into an empty directory, and run the following commands:
8
9 # tar -xzf readline-5.2.tar.gz
10 # sh build-framework.sh
11
12 ONLY_COPY=0
13
14 SrcDir=readline-5.2
15 FrameworkName=GNUreadline
16 FrameworkVersion=A
17 LibraryName=libreadline.dylib
18 ExtraThings="$SrcDir/StagingArea/info $SrcDir/README $SrcDir/COPYING $SrcDir/CHANGELOG build-framework-readline.sh readline-5.2.tar.gz"
19
20 pushd $SrcDir || exit 1
21
22 # for getting cross compiled universal binaries running on ppc and i386
23 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
24 LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
25 export CFLAGS LDFLAGS
26
27 ./configure --disable-dependency-tracking --disable-static --enable-shared --prefix=`pwd`/StagingArea || exit 1
28 make || exit 1
29 make doc || exit 1
30 make install || exit 1
31
32 popd
33
34 rm -rf $FrameworkName.framework
35
36 FWVDir=$FrameworkName.framework/Versions/$FrameworkVersion
37 mkdir -p $FWVDir
38
39 # Copy the header files into our new framework.
40 # Change declarations of #include <readline/*.h> to <GNUreadline/readline/*.h>, so that they reference the 
41 # header files inside of this framework.
42 OLDINCLUDEDIR=$SrcDir/StagingArea/include/readline
43 NEWINCLUDEDIR=$FWVDir/Headers/readline
44 mkdir -p $NEWINCLUDEDIR
45 for i in `ls $OLDINCLUDEDIR`; do
46     sed 's/include <readline/include <GNUreadline\/readline/' $OLDINCLUDEDIR/$i > $NEWINCLUDEDIR/$i
47 done
48 cp $SrcDir/StagingArea/lib/$LibraryName $FWVDir/$FrameworkName
49
50 chmod u+w $FWVDir/$FrameworkName
51
52 install_name_tool -id $FWVDir/$FrameworkName $FWVDir/$FrameworkName
53
54 ln -sf Versions/$FrameworkVersion/$FrameworkName $FrameworkName.framework/$FrameworkName
55 ln -sf Versions/$FrameworkVersion/Headers $FrameworkName.framework/Headers
56
57 for i in $ExtraThings; do
58     cp -R $i $FrameworkName.framework/
59 done
60
61 echo "Framework $FrameworkName.framework created."
62 zip -qyr "$FrameworkName-framework.zip" "$FrameworkName.framework"
63 echo "... and zipped as $FrameworkName-framework.zip"