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