-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·87 lines (65 loc) · 2.12 KB
/
build.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
DSTNAME=TWAIN-SANE-Interface
DSTVERSION=3.6
MACOSX_DEPLOYMENT_TARGET=10.9
NEXT_ROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
if [ ! -d "$NEXT_ROOT" ]; then
echo "Error: SDK not found."
exit 1
fi
if [ ! -f /usr/local/lib/libintl.a ]; then
echo "Error: You should install the gettext package before building $DSTNAME."
exit 1
fi
if [ ! -f /usr/local/lib/libusb.dylib ]; then
echo "Error: You should install the libusb package before building $DSTNAME."
exit 1
fi
if [ ! -f /usr/local/lib/libsane.dylib ]; then
echo "Error: You should install the sane-backends package before building $DSTNAME."
exit 1
fi
SRCDIR=`pwd`/src
BUILD=/tmp/$DSTNAME.build
DSTROOT=/tmp/$DSTNAME.dst
[ -e $BUILD ] && ( rm -rf $BUILD || exit 1 )
[ -e $DSTROOT ] && ( sudo rm -rf $DSTROOT || exit 1 )
cp -pr $SRCDIR $BUILD
(
cd $BUILD
./Info.sh > Info.plist
xcodebuild -project SANE.ds.xcodeproj -configuration Release \
install DSTROOT=$DSTROOT
)
rm -rf $BUILD
sudo chown -Rh root:admin $DSTROOT
sudo chmod -R 775 $DSTROOT
sudo chmod 1775 $DSTROOT
PKG=`pwd`/../PKGS/$DSTNAME.pkg
[ -e $PKG ] && ( rm -rf $PKG || exit 1 )
[ -e $PKG.tar.gz ] && ( rm -rf $PKG.tar.gz || exit 1 )
mkdir -p ../PKGS
RESOURCEDIR=/tmp/$DSTNAME.resources
[ -e $RESOURCEDIR ] && ( rm -rf $RESOURCEDIR || exit 1 )
mkdir -p $RESOURCEDIR
(
cd pkg/Resources
for d in `find . -type d` ; do
mkdir -p $RESOURCEDIR/$d
done
for f in `find . -type f -a ! -name .DS_Store -a ! -name '*.gif'` ; do
sed -e s/@MACOSX_DEPLOYMENT_TARGET@/$MACOSX_DEPLOYMENT_TARGET/g \
-e s/@DSTVERSION@/$DSTVERSION/g \
< $f > $RESOURCEDIR/$f
done
cp -p *.gif $RESOURCEDIR
)
pkgbuild --root $DSTROOT --ownership recommended \
--identifier se.ellert.twain-sane --version $DSTVERSION \
/tmp/TWAIN-SANE-Interface.pkg
productbuild --distribution $RESOURCEDIR/distribution.xml \
--identifier se.ellert.twain-sane --version $DSTVERSION \
--resources $RESOURCEDIR --package-path /tmp $PKG
rm /tmp/TWAIN-SANE-Interface.pkg
rm -rf $RESOURCEDIR
sudo rm -rf $DSTROOT