| 1 |
#!/bin/sh |
| 2 |
# Install Gauche as a framework on MacOSX |
| 3 |
|
| 4 |
set -e |
| 5 |
|
| 6 |
# This script installs the Gauche stuff under Gauche.framework. |
| 7 |
# It can be just copied into the application bundle as a private |
| 8 |
# framework. The advantage is that the application bundle can |
| 9 |
# just simply copied to the machine that doesn't have Gauche installed. |
| 10 |
# |
| 11 |
# We don't, and probably won't, support a shared framework, though. |
| 12 |
# A shared framework needs installation process anyway, and it embeds |
| 13 |
# its abosolute path in it so that it can't be casually copied |
| 14 |
# afterwards. So it doesn't have the advantage of private frameworks, |
| 15 |
# and we'll get all the disadvantages of the frameworks (e.g. nonstandard |
| 16 |
# header paths, difficulty of using gauche auxiliary scripts, etc). |
| 17 |
|
| 18 |
version=$1 |
| 19 |
framework_dir=`pwd`/Gauche.framework |
| 20 |
prefix=$framework_dir/Versions/$version |
| 21 |
|
| 22 |
# Install stuff under $prefix. |
| 23 |
rm -rf $framework_dir |
| 24 |
(cd lib; make prefix=$prefix install) |
| 25 |
(cd ext; make prefix=$prefix install) |
| 26 |
(cd src; make prefix=$prefix TARGETLIB=@executable_path/../Frameworks/Gauche.framework install) |
| 27 |
mkdir $prefix/Resources |
| 28 |
cp src/Info.plist $prefix/Resources |
| 29 |
|
| 30 |
# Creates appropriate links |
| 31 |
rm -f $framework_dir/Versions/Current |
| 32 |
ln -s ./$version $framework_dir/Versions/Current |
| 33 |
rm -f $framework_dir/Headers |
| 34 |
ln -s ./Versions/Current/lib/gauche/$version/include $framework_dir/Headers |
| 35 |
rm -f $framework_dir/libgauche.dylib |
| 36 |
ln -s ./Versions/Current/lib/libgauche.dylib $framework_dir/libgauche.dylib |
| 37 |
rm -f $framework_dir/Gauche |
| 38 |
ln -s ./libgauche.dylib $framework_dir/Gauche |
| 39 |
rm -f $framework_dir/Resources |
| 40 |
ln -s ./Versions/Current/Resources $framework_dir/Resources |
| 41 |
|
| 42 |
# Modifies header to meet MacOSX convention (duh!) |
| 43 |
for h in $framework_dir/Headers/*.h $framework_dir/Headers/gauche/*.h |
| 44 |
do |
| 45 |
sed -e 's@^#include <gc\.h>@#include <Gauche/gc.h>@' \ |
| 46 |
-e 's@^# *include <\(gauche.*\)\.h>@#include <Gauche/\1.h>@' \ |
| 47 |
-e 's@^# *include "\(gc.*\)\.h"@#include "Gauche/\1.h"@' $h > tmp.h && \ |
| 48 |
mv -f $h $h.bak && \ |
| 49 |
mv tmp.h $h && \ |
| 50 |
chmod 444 $h && \ |
| 51 |
rm -f $h.bak |
| 52 |
done |