summaryrefslogtreecommitdiffstats
path: root/contrib/build-scripts/build-v8-mac.sh
blob: e979c4d99d56e609ebe99e1114a813d47aef9de5 (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
#!/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 '.' ' '`)
DEST_DIR="${DIR}/../prebuilt/darwin-i386/${MACOSX_COMP[0]}.${MACOSX_COMP[1]}/gnu"
PWD=`pwd`

export MACOSX_DEPLOYMENT_TARGET=10.6

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
  CXXFLAGS="-mmacosx-version-min=10.6 -stdlib=libstdc++"
  LDFLAGS="-stdlib=libstdc++"
else
  CXXFLAGS="-mmacosx-version-min=10.7 -stdlib=libc++"
  LDFLAGS="-stdlib=libc++"
fi

make dependencies

make ia32.release
make ia32.debug

make x64.release
make x64.debug

cp include/* ${DEST_DIR}/include

lipo -create \
  ./out/x64.release/libv8_base.x64.a \
  ./out/ia32.release/libv8_base.ia32.a \
  -output ${DEST_DIR}/lib/libv8_base.a
  
lipo -create \
  ./out/x64.release/libv8_snapshot.a \
  ./out/ia32.release/libv8_snapshot.a \
  -output ${DEST_DIR}/lib/libv8_snapshot.a
  
lipo -create \
  ./out/x64.debug/libv8_base.x64.a \
  ./out/ia32.debug/libv8_base.ia32.a \
  -output ${DEST_DIR}/lib/libv8_base_d.a
  
lipo -create \
  ./out/x64.debug/libv8_snapshot.a \
  ./out/ia32.debug/libv8_snapshot.a \
  -output ${DEST_DIR}/lib/libv8_snapshot_d.a