-
Notifications
You must be signed in to change notification settings - Fork 3
/
mk-npapi
executable file
·70 lines (59 loc) · 1.38 KB
/
mk-npapi
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
log() {
echo $* 1>&2
}
builddir() {
echo "b"
}
pkgdir() {
echo `builddir`/$1.plugin
}
condir() {
echo `pkgdir $1`/Contents
}
resdir() {
echo `condir $1`/Resources
}
bindir() {
echo `condir $1`/MacOS
}
obj() {
log "compiling $*"
dst=`builddir`/$1.o
shift
cc -DNPAPI -m32 -fvisibility=hidden -fPIC -Wall -O2 -c -I src -o $dst $*
echo $dst
}
plg() {
log "linking $*"
dst=`builddir`/$1
shift
obj=$1
shift
cc -m32 -fvisibility=hidden -fPIC -bundle -flat_namespace -framework OpenGL -framework AppKit -framework WebKit -framework QuartzCore -o $dst $obj -L `builddir` $*
echo $dst
}
pkg() {
log "packaging $*"
install -d `resdir $1`
install -d `bindir $1`
sed s/NAME/$1/g templates/npapi/webtemplate.r > `builddir`/$1.r
xcrun Rez -isysroot `xcrun --show-sdk-path` -o `resdir $1`/$1.rsrc -useDF `builddir`/$1.r
sed s/NAME/$1/g templates/npapi/webtemplate.plist > `condir $1`/Info.plist
cp $2 `bindir $1`
echo `pkgdir $1`
}
ins() {
log "installing $*"
dst="$HOME/Library/Internet Plug-Ins"
cp -R $1 "$dst/"
echo "$dst/`basename $1`"
}
rm -fR `builddir`
install -d `builddir`
cvobj="`obj npapicocoa src/npapicocoa.m`"
testobj=`obj test test/test.c`
testplg=`plg testplugin $testobj $cvobj`
testpkg=`pkg testplugin $testplg`
itestpkg=`ins $testpkg`
echo "installed $itestpkg"