forked from apache/mesos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.am
304 lines (251 loc) · 8.68 KB
/
Makefile.am
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
# This Makefile is for building third-party packages from
# tarballs. For autotools-based packages, we configure each of the
# packages to build static PIC binaries which we can safely link into
# a shared libmesos, and build it in-place without installing it (even
# if one runs 'make install' in this directory). Non-autotools based
# packages may be special cases; this Makefile is responsible for
# passing any special make or configure flags that might be required.
BUILT_SOURCES = # Initialized to enable using +=.
SUBDIRS = . stout libprocess
# We need to add '--srcdir=.' needed because 'make distcheck' adds
# '--srcdir=...' when configuring.
CONFIGURE_ARGS = @CONFIGURE_ARGS@ --enable-shared=no --with-pic --srcdir=.
if INSTALL_MODULE_DEPENDENCIES
# The reason we use '/' prefix is to allow ourselves to install these packages
# in build/3rdparty directory as well. To do that, we can simply call
# `make install DESTDIR=/path/to/builddir/ install`
# Similarly, when doing system-wide installation, we can do:
# `make install DESTDIR=${MESOS-PREFIX}/lib/mesos/3rdparty install`
CONFIGURE_ARGS += --prefix=/
endif
# Directory where bundled 3rdparty module dependencies are installed.
pkg3rdpartydir = $(pkglibdir)/3rdparty
include versions.am
BOOST = boost-$(BOOST_VERSION)
GLOG = glog-$(GLOG_VERSION)
GMOCK = gmock-$(GMOCK_VERSION)
GPERFTOOLS = gperftools-$(GPERFTOOLS_VERSION)
GTEST = $(GMOCK)/gtest
HTTP_PARSER = http-parser-$(HTTP_PARSER_VERSION)
LEVELDB = leveldb-$(LEVELDB_VERSION)
LIBEV = libev-$(LIBEV_VERSION)
PIP = pip-$(PIP_VERSION)
PROTOBUF = protobuf-$(PROTOBUF_VERSION)
PICOJSON = picojson-$(PICOJSON_VERSION)
SETUPTOOLS = setuptools-$(SETUPTOOLS_VERSION)
WHEEL = wheel-$(WHEEL_VERSION)
ZOOKEEPER = zookeeper-$(ZOOKEEPER_VERSION)
EXTRA_DIST = \
$(BOOST).tar.gz \
$(GLOG).tar.gz \
$(GMOCK).tar.gz \
$(GPERFTOOLS).tar.gz \
$(HTTP_PARSER).tar.gz \
$(LEVELDB).tar.gz \
$(LIBEV).tar.gz \
$(PIP).tar.gz \
$(PROTOBUF).tar.gz \
$(PICOJSON).tar.gz \
$(SETUPTOOLS).tar.gz \
$(WHEEL).tar.gz \
$(ZOOKEEPER).tar.gz
# We need to patch glog in order to deal with a compilation issue when
# compiling with clang (and C++11); see MESOS-860, MESOS-966.
EXTRA_DIST += \
$(GLOG).patch
# We patch http-parser to avoid a name collision with our `flags` namespace.
EXTRA_DIST += \
$(HTTP_PARSER).patch
# We need to patch leveldb to prevent it from linking to snappy and
# tcmalloc; see MESOS-1054, MESOS-1624.
EXTRA_DIST += \
$(LEVELDB).patch
# We patch libev to keep it from reaping child processes.
EXTRA_DIST += \
$(LIBEV).patch
# We include an upstream patch for protobuf in order to avoid
# signed/unsigned comparisons.
EXTRA_DIST += \
$(PROTOBUF).patch
# We need to patch ZooKeeper in order to get 3.4.8 to compile on PPC LE.
EXTRA_DIST += \
$(ZOOKEEPER).patch
CLEAN_EXTRACTED = \
$(BOOST) \
$(GLOG) \
$(GMOCK) \
$(GPERFTOOLS) \
$(HTTP_PARSER) \
$(LEVELDB) \
$(LIBEV) \
$(PIP) \
$(PICOJSON) \
$(PROTOBUF) \
$(SETUPTOOLS) \
$(WHEEL) \
$(ZOOKEEPER)
# This is where the magic happens: we use stamp files as dependencies
# which cause the packages to get extracted as necessary. We also
# apply any patches as appropriate.
%-stamp: %.tar.gz
gzip -d -c $^ | tar xf -
test ! -e $(srcdir)/$*.patch || patch -d $* -p1 <$(srcdir)/$*.patch
touch $@
# Dependencies for all-local.
ALL_LOCAL = # Initialize ALL_LOCAL so we can add to it.
if HAS_PYTHON
if WITH_BUNDLED_PIP
ALL_LOCAL += $(PIP)-stamp
endif
if WITH_BUNDLED_SETUPTOOLS
ALL_LOCAL += $(SETUPTOOLS)-stamp
endif
if WITH_BUNDLED_WHEEL
ALL_LOCAL += $(WHEEL)-stamp
endif
endif
if WITH_BUNDLED_BOOST
ALL_LOCAL += $(BOOST)-stamp
endif
if WITH_BUNDLED_GLOG
LIB_GLOG = $(GLOG)/libglog.la
GLOG_LDFLAGS = # Initialize to empty
if OS_FREEBSD
GLOG_LDFLAGS += "LDFLAGS='-L/usr/local/lib -lexecinfo'"
endif
# NOTE: We explicitly set GTEST_CONFIG=no so that we don't attempt to
# build glog against a system installed gtest (there's no reason to
# "test" glog and it's highly likely it will cause a compilation bug
# when building with clang).
$(LIB_GLOG): $(GLOG)-stamp
cd $(GLOG) && ./configure GTEST_CONFIG=no $(CONFIGURE_ARGS) && \
$(MAKE) $(AM_MAKEFLAGS) $(GLOG_LDFLAGS)
ALL_LOCAL += $(LIB_GLOG)
endif
if HAS_GPERFTOOLS
LIB_GPERFTOOLS = $(GPERFTOOLS)/libprofiler.la
$(LIB_GPERFTOOLS): $(GPERFTOOLS)-build-stamp
$(GPERFTOOLS)-build-stamp: $(GPERFTOOLS)-stamp
cd $(GPERFTOOLS) && ./configure $(CONFIGURE_ARGS) && \
$(MAKE) $(AM_MAKEFLAGS)
touch $@
ALL_LOCAL += $(LIB_GPERFTOOLS)
endif
if WITH_BUNDLED_HTTP_PARSER
# Convenience library for nodejs/http-parser.
noinst_LTLIBRARIES = libry_http_parser.la
nodist_libry_http_parser_la_SOURCES = $(HTTP_PARSER)/http_parser.c
libry_http_parser_la_CPPFLAGS = -I$(HTTP_PARSER) -DHTTP_PARSER_STRICT=0
BUILT_SOURCES += $(nodist_libry_http_parser_la_SOURCES)
$(HTTP_PARSER)/http_parser.c: $(HTTP_PARSER)-stamp
endif
if WITH_BUNDLED_LIBEV
$(LIBEV)/libev.la: $(LIBEV)-stamp
cd $(LIBEV) && ./configure $(CONFIGURE_ARGS) && \
$(MAKE) $(AM_MAKEFLAGS)
ALL_LOCAL += $(LIBEV)/libev.la
endif
if WITH_BUNDLED_PICOJSON
# Stout depends on <picojson.h>. Install picojson.h into $PREFIX/include
# but don't add it to the source tarball.
nodist_include_HEADERS = $(PICOJSON)/picojson.h
$(PICOJSON)/picojson.h: $(PICOJSON)-stamp
ALL_LOCAL += $(PICOJSON)-stamp
endif
if WITH_BUNDLED_PROTOBUF
$(PROTOBUF)/src/protoc $(PROTOBUF)/src/libprotobuf.la: $(PROTOBUF)-build-stamp
$(PROTOBUF)-build-stamp: $(PROTOBUF)-stamp
cd $(PROTOBUF) && ./configure $(CONFIGURE_ARGS) && \
$(MAKE) $(AM_MAKEFLAGS)
touch $@
ALL_LOCAL += $(PROTOBUF)/src/libprotobuf.la
ALL_LOCAL += $(PROTOBUF)/src/protoc
endif
# Convenience library for gmock/gtest.
check_LTLIBRARIES = libgmock.la
nodist_libgmock_la_SOURCES = gmock_sources.cc
if WITH_BUNDLED_GMOCK
libgmock_la_CPPFLAGS = \
-I$(GTEST)/include -I$(GTEST) -I$(GTEST)/src \
-I$(GMOCK)/include -I$(GMOCK) -I$(GMOCK)/src
gmock_sources.cc: $(GMOCK)-stamp
endif
if LINKGTEST
libgmock_la_LIBADD = -lgtest
endif
# We list the sources in BUILT_SOURCES to make sure that the package
# gets unarchived first.
BUILT_SOURCES += $(nodist_libgmock_la_SOURCES)
if WITH_BUNDLED_LEVELDB
# TODO(charles): Figure out PIC options in our configure.ac or create
# a configure.ac for leveldb.
$(LEVELDB)/libleveldb.a: $(LEVELDB)-stamp
cd $(LEVELDB) && \
$(MAKE) $(AM_MAKEFLAGS) CC="$(CC)" CXX="$(CXX)" OPT="$(CXXFLAGS) -fPIC"
ALL_LOCAL += $(LEVELDB)/libleveldb.a
endif
if WITH_BUNDLED_ZOOKEEPER
$(ZOOKEEPER)/src/c/libzookeeper_mt.la: $(ZOOKEEPER)-stamp
cd $(ZOOKEEPER)/src/c && ./configure $(CONFIGURE_ARGS) && \
$(MAKE) $(AM_MAKEFLAGS)
ALL_LOCAL += $(ZOOKEEPER)/src/c/libzookeeper_mt.la
else
# No matter what, we need to extract ZooKeeper so that we can run
# 'make check' (some of our tests need the ZooKeeper JAR).
ALL_LOCAL += $(ZOOKEEPER)-stamp
endif
all-local: $(ALL_LOCAL)
if INSTALL_MODULE_DEPENDENCIES
$(MAKE) $(AM_MAKEFLAGS) \
INSTALLDIR=$(abs_top_builddir)/3rdparty install-module-dependencies
endif
clean-local:
rm -r -f $(CLEAN_EXTRACTED)
rm -f *-stamp
if INSTALL_MODULE_DEPENDENCIES
rm -rf bin include lib64 lib share
endif
tests: all $(check_LTLIBRARIES)
@cd stout && $(MAKE) $(AM_MAKEFLAGS) tests
@cd libprocess && $(MAKE) $(AM_MAKEFLAGS) tests
# Install 3rdparty module dependencies.
if INSTALL_MODULE_DEPENDENCIES
install-exec-local:
$(MAKE) $(AM_MAKEFLAGS) \
INSTALLDIR=$(DESTDIR)$(pkg3rdpartydir) install-module-dependencies
endif
install-module-dependencies:
$(install_sh) -d $(INSTALLDIR)/include
if WITH_BUNDLED_BOOST
@test -d $(INSTALLDIR)/include/boost || \
rm -rf $(INSTALLDIR)/include/boost
cp -fpR $(BOOST)/boost $(INSTALLDIR)/include/
endif
if WITH_BUNDLED_GLOG
cd $(GLOG) && \
$(MAKE) $(AM_MAKEFLAGS) DESTDIR=$(INSTALLDIR) install
endif
if WITH_BUNDLED_PICOJSON
cd $(PICOJSON) && \
$(MAKE) $(AM_MAKEFLAGS) \
DESTDIR= includedir=$(INSTALLDIR)/include install
endif
if WITH_BUNDLED_PROTOBUF
cd $(PROTOBUF) && \
$(MAKE) $(AM_MAKEFLAGS) DESTDIR=$(INSTALLDIR) install
endif