-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon
155 lines (132 loc) · 3.91 KB
/
common
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
is_windows()
{
if [ "$(uname -s | cut -b1-6)" = "CYGWIN" -o "$(uname -s | cut -b1-7)" = "MINGW32" ]
then
return 0
fi
return 1
}
mk_add_options MOZ_CO_PROJECT="all"
mk_add_options MOZ_CO_MODULE="mozilla/tools/trace-malloc mozilla/tools/rb mozilla/tools/jprof mozilla/other-licenses/libart_lgpl mozilla/js/tests mozilla/tools/footprint"
mk_add_options AUTOCLOBBER=1
VCMOZCONFIGEXT=""
if [ "$MOZ_MSVCVERSION" != "" ]
then
VCMOZCONFIGEXT="-vc$MOZ_MSVCVERSION"
fi
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj/$(basename $MOZCONFIG)$VCMOZCONFIGEXT/
# -pedantic-errors -Wno-long-long
# -W -Wno-unused-parameter
# (CFLAGS only) -Wmissing-prototypes -Wmissing-declarations
# export needed for NSPR configure
if ! is_windows
then
export CFLAGS="$CFLAGS -Wshadow -Wwrite-strings -fmessage-length=0 -fdiagnostics-show-option"
export CXXFLAGS="$CXXFLAGS -Wshadow -Wwrite-strings -fmessage-length=0 -fdiagnostics-show-option -Wno-invalid-offsetof"
if [ "$(uname -s)" != "Darwin" ]
then
# On Mac, -fuse-cxa-atexit causes linker errors
# (undefined symbols: ___dso_handle)
export CXXFLAGS="$CXXFLAGS -fuse-cxa-atexit"
fi
fi
# Commercial tree!
#mk_add_options NS_OBJDIR=@TOPSRCDIR@/../obj-ns/$(basename $MOZCONFIG)/
#ac_add_options --with-moz-objs=../obj/$(basename $MOZCONFIG)/
#ac_add_options --disable-libxul
#ac_add_options --disable-ipc
#ac_add_options --enable-chrome-format=jar
ac_add_options --with-debug-label=dbaron
case "$(uname -s)" in
# Linux) NCORES=$(grep "^processor : " /proc/cpuinfo | wc -l);;
# Also see http://stackoverflow.com/questions/150355/programmatically-find-the-number-of-cores-on-a-machine
Linux) NCORES=$(getconf _NPROCESSORS_ONLN);;
Darwin) NCORES=$(sysctl hw.ncpu);;
MINGW*) NCORES=$(wmic cpu get NumberOfLogicalProcessors /Format:List | grep "^NumberOfLogicalProcessors=" | sed 's/^NumberOfLogicalProcessors=//');;
*) NCORES=2;;
esac
MAKE_J_OPTION=$(($NCORES - 0))
# mk_add_options RUN_AUTOCONF_LOCALLY=1
ac_add_options --prefix="$topsrcdir/../obj/$(basename "$MOZCONFIG")/dist-install/"
# no longer needed for i386 Linux with gcc update to 4.1.1
# no longer needed for x86_64 Linux with Fedora Core 6
#if [ "$(uname -sm)" = "Linux x86_64" ]
#then
# ac_cv_visibility_pragma=no
#fi
if [ "$(hostname)" = "pickering" ]
then
CC="distcc x86_64-linux-gnu-gcc-4.4"
CXX="distcc x86_64-linux-gnu-g++-4.4"
export CC
export CXX
MAKE_J_OPTION=$(distcc -j)
fi
# cls says -jN where N is cpus+1
MOZ_MAKE_FLAGS="-j$MAKE_J_OPTION -s"
mk_add_options MOZ_MAKE_FLAGS="$MOZ_MAKE_FLAGS"
if_enable_jprof()
{
if [ "$(uname -sm)" = "Linux i686" -o "$(uname -sm)" = "Linux x86_64" ]
then
ac_add_options --enable-jprof
fi
}
if_enable_callgrind()
{
if [ "$(uname -s)" = "Linux" ]
then
ac_add_options --enable-callgrind
fi
}
if_enable_shark()
{
if [ "$(uname -s)" = "Darwin" ]
then
ac_add_options --enable-shark
fi
}
if_enable_valgrind()
{
if [ "$(uname -s)" = "Linux" ]
then
ac_add_options --enable-valgrind
fi
}
if_enable_trace_malloc()
{
UNAME="$(uname -sm)"
if [ "$UNAME" = "Linux i686" -o "$UNAME" = "Linux x86_64" -o "$UNAME" = "Darwin Power Macintosh" -o "$UNAME" = "Darwin i386" ]
then
ac_add_options --enable-trace-malloc
fi
if is_windows
then
ac_add_options --enable-trace-malloc
fi
}
if [ "$(uname -s)" = "Linux" ]
then
ac_add_options --enable-dbus
fi
if [ "$(uname -s)" = "Darwin" ]
then
ac_add_options --enable-shark
fi
# Stylo options
if ! is_windows
then
mk_add_options CARGOFLAGS="--color always" # if you want colored output from rust compilation
fi
if [ "$(uname -s)" = "Darwin" ]
then
# Necessary on mac with Xcode >= 7 to avoid errors linking libXUL.
export LDFLAGS=-Wl,-no_compact_unwind
fi
if is_windows
then
HOME_WIN=$(echo "$HOME" | sed 's,^/\([a-z]\)/,\1:/,')
ac_add_options --with-libclang-path="$HOME_WIN/.mozbuild/clang/bin"
ac_add_options --with-clang-path="$HOME_WIN/.mozbuild/clang/bin/clang.exe"
export LLVM_CONFIG="$HOME/.mozbuild/clang/bin/llvm-config.exe"
fi