summaryrefslogtreecommitdiffstats
path: root/contrib/build-scripts/build-arabica-macosx.sh
blob: c5a4bb9121b98b08a2b0dd2efc880559202b0693 (plain)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash

#
# build arabica for MacOSX
#
# ./configure --with-boost=/opt/local/include/ --with-libxml2=`xcrun --show-sdk-path`/usr --with-parser=libxml2

# exit on error
set -e

ME=`basename $0`
DIR="$( cd "$( dirname "$0" )" && pwd )" 
MACOSX_VER=`/usr/bin/sw_vers -productVersion`
MACOSX_COMP=(`echo $MACOSX_VER | tr '.' ' '`)
DEST_DIR="${DIR}/../prebuilt/darwin-i386/${MACOSX_COMP[0]}.${MACOSX_COMP[1]}/gnu"
SYSROOT=`xcrun --show-sdk-path`

if [ ! -f src/arabica.cpp ]; then
	echo
	echo "Cannot find src/arabica.cpp"
	echo "Run script from within arabica directory:"
	echo "arabica $ ../../${ME}"
	echo
	exit
fi

if [ -f Makefile ]; then
  make clean
fi

if [ ${MACOSX_COMP[1]} -lt 9 ]; then
  MACOSX_VERSION_MIN="-mmacosx-version-min=10.6"
fi

./configure \
CFLAGS="-g ${MACOSX_VERSION_MIN} -arch x86_64" \
CXXFLAGS="-g ${MACOSX_VERSION_MIN} -arch x86_64" \
LDFLAGS="-g ${MACOSX_VERSION_MIN} -arch x86_64" \
--with-libxml2=${SYSROOT}/usr \
--with-parser=libxml2 \
--with-tests=no \
--with-boost=/opt/local/include \
--disable-shared \
--disable-dependency-tracking \
--with-pic \
--prefix=${DEST_DIR}


make
cp ./src/.libs/libarabica.a ./libarabica_d.x86_64.a
make install # once for headers
rm ${DEST_DIR}/lib/libarabica*
make clean


./configure \
CFLAGS="${MACOSX_VERSION_MIN} -arch x86_64" \
CXXFLAGS="${MACOSX_VERSION_MIN} -arch x86_64" \
LDFLAGS="${MACOSX_VERSION_MIN} -arch x86_64" \
--with-libxml2=${SYSROOT}/usr \
--with-parser=libxml2 \
--with-tests=no \
--with-boost=/opt/local/include \
--disable-shared \
--disable-dependency-tracking \
--with-pic


make
cp ./src/.libs/libarabica.a ./libarabica.x86_64.a
make clean


./configure \
CFLAGS="-g ${MACOSX_VERSION_MIN} -arch i386" \
CXXFLAGS="-g ${MACOSX_VERSION_MIN} -arch i386" \
LDFLAGS="-g ${MACOSX_VERSION_MIN} -arch i386" \
--with-libxml2=${SYSROOT}/usr \
--with-parser=libxml2 \
--with-tests=no \
--with-boost=/opt/local/include \
--disable-shared \
--disable-dependency-tracking \
--with-pic

make
cp ./src/.libs/libarabica.a ./libarabica_d.i386.a
make clean

./configure \
CFLAGS="${MACOSX_VERSION_MIN} -arch i386" \
CXXFLAGS="${MACOSX_VERSION_MIN} -arch i386" \
LDFLAGS="${MACOSX_VERSION_MIN} -arch i386" \
--with-libxml2=${SYSROOT}/usr \
--with-parser=libxml2 \
--with-tests=no \
--with-boost=/opt/local/include \
--disable-shared \
--disable-dependency-tracking \
--with-pic

make
cp ./src/.libs/libarabica.a ./libarabica.i386.a
make clean

lipo -create ./libarabica.i386.a ./libarabica.x86_64.a -output ${DEST_DIR}/lib/libarabica.a
lipo -create ./libarabica_d.i386.a ./libarabica_d.x86_64.a -output ${DEST_DIR}/lib/libarabica_d.a