summaryrefslogtreecommitdiffstats
path: root/contrib/build-scripts/build-v8-macosx.sh
blob: 199232432e37eceae39272b07cce6906828d1cb3 (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash

#
# build v8 for MacOSX
# http://code.google.com/p/v8/wiki/BuildingWithGYP
#

# 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 '.' ' '`)
PLATFORM_ID=`${DIR}/platform-id-mac.sh`
DEST_DIR="${DIR}/../prebuilt/${PLATFORM_ID}"
PWD=`pwd`


if [ ! -f src/v8.h ]; then
	echo
	echo "Cannot find src/v8.h"
	echo "Run script from within v8 directory"
	echo
	exit
fi

if [ ! -f ../depot_tools/update_depot_tools ]; then
	echo
	echo "Cannot find ../depot_tools/update_depot_tools"
	echo "Checkout depot_tools as a sibling directory"
	echo "svn co http://src.chromium.org/svn/trunk/tools/depot_tools"
	echo
	exit
fi

DEPOT_PATH="${PWD}/../depot_tools"
export PATH="${DEPOT_PATH}:${PATH}"

if [ ${MACOSX_COMP[1]} -lt 9 ]; then
	export MACOSX_DEPLOYMENT_TARGET=10.6
	export GYP_DEFINES="clang=1 mac_deployment_target=10.6"
	export CXX="`which clang++` -mmacosx-version-min=10.6 -stdlib=libstdc++"
	export LINK="`which clang++` -stdlib=libstdc++"
  # export CXXFLAGS="-mmacosx-version-min=10.6 -stdlib=libstdc++"
  # export LDFLAGS="-stdlib=libstdc++"
else
	export MACOSX_DEPLOYMENT_TARGET=10.7
	export GYP_DEFINES="clang=1 mac_deployment_target=10.7"
	export CXX="`which clang++` -mmacosx-version-min=10.7 -stdlib=libc++"
	export LINK="`which clang++` -stdlib=libc++"
  # export CXXFLAGS="-mmacosx-version-min=10.7 -stdlib=libc++"
  # export LDFLAGS="-stdlib=libc++"
fi

# make dependencies

make snapshot=off ia32.release
make snapshot=off ia32.debug

make snapshot=off x64.release
make snapshot=off x64.debug

cp include/*.h ${DEST_DIR}/include

#release 
lipo -create \
  ./out/x64.release/libv8_base.a \
  ./out/ia32.release/libv8_base.a \
  -output ${DEST_DIR}/lib/libv8_base.a

lipo -create \
  ./out/x64.release/libv8_libbase.a \
  ./out/ia32.release/libv8_libbase.a \
  -output ${DEST_DIR}/lib/libv8_libbase.a

lipo -create \
  ./out/x64.release/libv8_libplatform.a \
  ./out/ia32.release/libv8_libplatform.a \
  -output ${DEST_DIR}/lib/libv8_libplatform.a

lipo -create \
  ./out/x64.release/libv8_external_snapshot.a \
  ./out/ia32.release/libv8_external_snapshot.a \
  -output ${DEST_DIR}/lib/libv8_external_snapshot.a

lipo -create \
  ./out/x64.release/libicuuc.a \
  ./out/ia32.release/libicuuc.a \
  -output ${DEST_DIR}/lib/libicuuc.a

lipo -create \
  ./out/x64.release/libicui18n.a \
  ./out/ia32.release/libicui18n.a \
  -output ${DEST_DIR}/lib/libicui18n.a

lipo -create \
  ./out/x64.release/libicudata.a \
  ./out/ia32.release/libicudata.a \
  -output ${DEST_DIR}/lib/libicudata.a

#debug
lipo -create \
  ./out/x64.debug/libv8_base.a \
  ./out/ia32.debug/libv8_base.a \
  -output ${DEST_DIR}/lib/libv8_base_d.a
  
lipo -create \
  ./out/x64.debug/libv8_libbase.a \
  ./out/ia32.debug/libv8_libbase.a \
  -output ${DEST_DIR}/lib/libv8_libbase_d.a

lipo -create \
  ./out/x64.debug/libv8_libplatform.a \
  ./out/ia32.debug/libv8_libplatform.a \
  -output ${DEST_DIR}/lib/libv8_libplatform_d.a

lipo -create \
  ./out/x64.debug/libv8_external_snapshot.a \
  ./out/ia32.debug/libv8_external_snapshot.a \
  -output ${DEST_DIR}/lib/libv8_external_snapshot_d.a


lipo -create \
  ./out/x64.debug/libicuuc.a \
  ./out/ia32.debug/libicuuc.a \
  -output ${DEST_DIR}/lib/libicuuc_d.a

lipo -create \
  ./out/x64.debug/libicui18n.a \
  ./out/ia32.debug/libicui18n.a \
  -output ${DEST_DIR}/lib/libicui18n_d.a

lipo -create \
  ./out/x64.debug/libicudata.a \
  ./out/ia32.debug/libicudata.a \
  -output ${DEST_DIR}/lib/libicudata_d.a