Makefile 19.3 KB
Newer Older
1
MAKEFILENAME := $(lastword $(MAKEFILE_LIST))
2
include config.mk
Michael Ott's avatar
Michael Ott committed
3

4
LIBRARIES = DCDBLib
Axel Auweter's avatar
Axel Auweter committed
5
PROJECTS = FilePusher SysFsPusher CollectAgent ParastationProvider IPMIPusher MontBlancPusher SNMPPusher DCDBTools DCDBBenchmark scripts webgui
6

7
CASSANDRA_VERSION = 2.2.6
8
9
MOSQUITTO_VERSION = 1.3.5
BOOST_VERSION     = 1.57.0
Axel Auweter's avatar
Axel Auweter committed
10
SNMP_VERSION      = 5.7.3
Axel Auweter's avatar
Axel Auweter committed
11
OPENSSL_VERSION   = 1.0.1t
Axel Auweter's avatar
Axel Auweter committed
12
CPPDRV_VERSION    = 2.0.1
13
LIBUV_VERSION     = 0.10.36
14
HTTPD_VERSION     = 2.4.18
Axel Auweter's avatar
Axel Auweter committed
15
16
APR_VERSION       = 1.5.2
APR_UTIL_VERSION  = 1.5.4
17
SOURCEFORGE_MROR  = netcologne
18

19
BOOST_VERSION_U   = $(subst .,_,$(BOOST_VERSION))
20
DISTFILES =	apache-cassandra-$(CASSANDRA_VERSION).tar.gz;http://archive.apache.org/dist/cassandra/$(CASSANDRA_VERSION)/apache-cassandra-$(CASSANDRA_VERSION)-bin.tar.gz \
21
		mosquitto-$(MOSQUITTO_VERSION).tar.gz;http://mosquitto.org/files/source/mosquitto-$(MOSQUITTO_VERSION).tar.gz \
22
23
24
		OpenIPMI-2.0.21.tar.gz;http://$(SOURCEFORGE_MROR).dl.sourceforge.net/project/openipmi/OpenIPMI%202.0%20Library/OpenIPMI-2.0.21.tar.gz \
		boost_$(BOOST_VERSION_U).tar.gz;http://$(SOURCEFORGE_MROR).dl.sourceforge.net/project/boost/boost/$(BOOST_VERSION)/boost_$(BOOST_VERSION_U).tar.gz \
		net-snmp-$(SNMP_VERSION).zip;http://$(SOURCEFORGE_MROR).dl.sourceforge.net/project/net-snmp/net-snmp/$(SNMP_VERSION)/net-snmp-$(SNMP_VERSION).zip \
Axel Auweter's avatar
Axel Auweter committed
25
		openssl-$(OPENSSL_VERSION).tar.gz;ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/openssl-$(OPENSSL_VERSION).tar.gz \
26
		cpp-driver-$(CPPDRV_VERSION).tar.gz;https://github.com/datastax/cpp-driver/archive/$(CPPDRV_VERSION).tar.gz \
27
		libuv-v$(LIBUV_VERSION).tar.gz;http://dist.libuv.org/dist/v$(LIBUV_VERSION)/libuv-v$(LIBUV_VERSION).tar.gz \
Axel Auweter's avatar
Axel Auweter committed
28
29
30
		httpd-$(HTTPD_VERSION).tar.gz;http://mirror.softaculous.com/apache//httpd/httpd-$(HTTPD_VERSION).tar.gz \
		apr-util-$(APR_UTIL_VERSION).tar.gz;http://www-us.apache.org/dist//apr/apr-util-$(APR_UTIL_VERSION).tar.gz \
		apr-$(APR_VERSION).tar.gz;http://www-us.apache.org/dist//apr/apr-$(APR_VERSION).tar.gz 
31

32
DISTFILES_HASHES = apache-cassandra-2.2.6.tar.gz;8e2a8696ced6c4f9db06c40b2f5a7936;mosquitto-1.3.5.tar.gz;55094ad4dc7c7985377f43d4fc3d09da;OpenIPMI-2.0.21.tar.gz;dc0b42ae40b3f1d0db2a94b75b95fae1;boost_1_57_0.tar.gz;25f9a8ac28beeb5ab84aa98510305299;net-snmp-5.7.3.zip;9f682bd70c717efdd9f15b686d07baee;openssl-1.0.1t.tar.gz;9837746fcf8a6727d46d22ca35953da1;cpp-driver-2.0.1.tar.gz;70bf83e1cbd0d35b7e5ed66fc4dccbb1;libuv-v0.10.36.tar.gz;8eb77b4fee4f311c114a9fee06f5a2ab;httpd-2.4.18.tar.gz;2f90ce3426541817e0dfd01cae086b60;apr-util-1.5.4.tar.gz;866825c04da827c6e5f53daff5569f42;apr-1.5.2.tar.gz;98492e965963f852ab29f9e61b2ad700;
33

34
FETCH = wget -c --no-check-certificate -O -
35
MD5 = $(if $(shell which md5),md5,$(if $(shell md5sum --tag Makefile 2&> /dev/null || true),md5sum --tag,openssl md5 <))
36
37
38
39
40
41
42
43
44
45
46

MAKETHREADS ?= $(if $(findstring $(shell uname),Darwin),$(shell sysctl machdep.cpu.thread_count | cut -b 27-),\
		$(if $(findstring $(shell uname),Linux),$(shell cat /proc/cpuinfo | grep processor | wc -l),4))

CASSANDRA_CLUSTER_NAME                 = Datacenter Monitor Database
CASSANDRA_FLUSH_LARGEST_MEMTABLES_AT   = 0.5
CASSANDRA_REDUCE_CACHE_SIZES_AT        = 0.6
CASSANDRA_REDUCE_CACHE_CAPACITY_TO     = 0.4
CASSANDRA_PARTITIONER                  = org.apache.cassandra.dht.ByteOrderedPartitioner
CASSANDRA_COMMITLOG_TOTAL_SPACE_IN_MB  = 256
CASSANDRA_COMMITLOG_SEGMENT_SIZE_IN_MB = 16
Axel Auweter's avatar
Axel Auweter committed
47
48
CASSANDRA_TOMBSTONE_WARN_THRESHOLD     = 100000
CASSANDRA_TOMBSTONE_FAILURE_THRESHOLD  = 10000000
49

50
51
HTTPD_PORT = 8080

52
53
54
DISTFILESNAMES = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/;.*//'))
DISTFILESPATHS = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/.tar.gz;.*//' | sed 's/.zip;.*//' ))

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# If cross-compiling for ARM, adjust the build settings
ifeq ("$(ARCH)", "arm")
ifeq ("$(CROSS_COMPILE)", "")
$(error "If you want to cross compile for ARM, you must set the CROSS_COMPILE variable with your cross compiler prefix")
endif
CROSS_COMPILE_STRP = $(CROSS_COMPILE:-=)
CC = "$(CROSS_COMPILE)gcc"
CXX = "$(CROSS_COMPILE)g++"
CMAKE_CROSS_FLAGS = -DCMAKE_C_COMPILER=$(CC) \
			-DCMAKE_CXX_COMPILER=$(CXX) \
			-DCMAKE_FIND_ROOT_PATH=/usr/$(CROSS_COMPILE_STRP) \
			-DCMAKE_LIBRARY_PATH=$(DCDBDEPLOYPATH)/lib \
			-DCMAKE_INCLUDE_PATH=$(DCDBDEPLOYPATH)/include
AUTOCONF_CROSS_FLAGS = --host=$(CROSS_COMPILE_STRP)
SKIP_PROJECTS = IPMIPusher MontBlancPusher
70
OPENSSL_TARGET = "linux-generic32"
71
else
72
OPENSSL_TARGET = $(if $(findstring $(shell uname),Darwin),"darwin64-x86_64-cc","linux-x86_64")
Axel Auweter's avatar
Axel Auweter committed
73
LRT = $(if $(findstring $(shell uname),Darwin),"","-lrt")
74
75
76
77
78
CMAKE_CROSS_FLAGS = ""
AUTOCONF_CROSS_FLAGS = ""
SKIP_PROJECTS = ""
endif

Axel Auweter's avatar
Axel Auweter committed
79
CFLAGS += -I$(DCDBDEPLOYPATH)/include -O2 -g
Axel Auweter's avatar
Axel Auweter committed
80
CXX11FLAGS = --std=c++11 -Wno-c99-extensions -Wno-missing-field-initializers -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG -Wno-unused-local-typedef
Axel Auweter's avatar
Axel Auweter committed
81
LDFLAGS += -L$(DCDBDEPLOYPATH)/lib -O2 -g
82

83
.PHONY : info all clean cleanall distclean check-cross-compile $(LIBRARIES) $(PROJECTS)
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

info:
	@echo ""
	@echo "DCDB - Data Center Database"
	@echo "Buildsystem description"
	@echo ""
	@echo "Use the DCDBDEPSPATH environment variable to specify a build path for the"
	@echo "dependencies. Currently, the project dependenceis will be built to:"
	@echo "$(DCDBDEPSPATH)"
	@echo ""
	@echo "Use the DCDBDEPLOYPATH environment variable to specifiy the path for deployment"
	@echo "of all tools. Currently, the directory for deployment/staging is:"
	@echo "$(DCDBDEPLOYPATH)"
	@echo ""
	@echo "There should only be a few requirements to build DCDB."
	@echo "On Ubuntu, these are: build-essential, cmake, libssl-dev"
	@echo "To run Cassandra, you should also have a JAVA runtime installed."
	@echo ""
	@echo "To modify the number of parallel build threads, you may set the MAKETHREADS"
	@echo "environment variable. Currently, your system is configured to execute a"
	@echo "parallel build with $(MAKETHREADS) threads."
	@echo ""
	@echo "To start, please type:"
	@echo "     make all"
108
109
110
111
	@echo ""
	@echo "For ARM cross compilation, please type:"
	@echo "     make ARCH=arm CROSS_COMPILE=<X> all"
	@echo "where <X> is your cross copmlier prefix ( e.g. arm-linux-gnueabihf- )"
112

113
clean:
114
115
116
117
118
119
120
121
122
123
124
	@$(foreach l,$(LIBRARIES),echo "Cleaning $(l)..." && make -C $(l) clean && echo;)
	@$(foreach p,$(PROJECTS),echo "Cleaning $(p)..." && make -C $(p) clean && echo;)

cleanall: clean
	@cd $(DCDBDEPSPATH) && rm -f .prerequesites .extract-distfiles .download-distfiles
	@cd $(DCDBDEPSPATH) && rm -rf mosquitto_build
	@$(foreach f,$(DISTFILESPATHS),echo "Cleaning $(f)..." && rm -rf $(DCDBDEPSPATH)/$(f) && echo;)

distclean: clean
	@echo "Wiping dependencies..."
	@rm -rf $(DCDBDEPSPATH)
125
	@rm -rf .md5sums
126
127
128
129
130
131
132
133

mrproper: distclean
	$(eval U := $(shell whoami))
	@if [ "$(U)" = "root" ]; then echo "Sorry, I won't allow you to use mrproper as root."; exit 1; fi
	@echo ""
	@echo "Wiping installation directory..."
	@rm -rf $(DCDBDEPLOYPATH)

134
135
136
137
138
139
140
141
142
update-distfile-hashes: .md5sums
	$(eval X := $(shell cat .md5sums | tr \\\n \; ))
	@echo "Updating $(MAKEFILENAME)..."
	@sed -i -e 's/^DISTFILES_HASHES\ =.*/DISTFILES_HASHES\ =\ $(X)/' $(MAKEFILENAME) ;
	@rm -f .md5sums

.md5sums: $(DCDBDEPSPATH)/.download-distfiles
	@$(foreach f,$(DISTFILESNAMES),echo "Checksumming $(f)..." && printf "$(f);" >> .md5sums && $(MD5) $(DCDBDEPSPATH)/distfiles/$(f) | sed -e 's/.*\ //' >> .md5sums; )

143
all: check-cross-compile $(DCDBDEPSPATH)/.prerequesites
144
145
146
	@make $(LIBRARIES)
	@make $(PROJECTS)

147
148
149
150
151
152
check-cross-compile:
	@if [ "$(ARCH)" = "arm" ]; then \
		echo "Info: Cross-compiling for ARM using compiler prefix: $(CROSS_COMPILE_STRP)"; \
		echo; \
	fi;

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
$(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
	@echo ""
	@echo "Preparing patches..."
	@cp -a patches $(DCDBDEPSPATH)/
	
	$(eval S := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*openssl/openssl/' | sed 's/\ .*//'))
	@if [ ! -e $(DCDBDEPSPATH)/$(S)/.installed ]; then \
		echo ""; \
		echo "Building OpenSSL library..."; \
		cd $(DCDBDEPSPATH)/$(S) && ./Configure shared --prefix=$(DCDBDEPLOYPATH) $(OPENSSL_TARGET); \
		cd $(DCDBDEPSPATH)/$(S) && make && make install_sw && touch $(DCDBDEPSPATH)/$(S)/.installed; \
	else \
		echo "Skipping OpenSSL library (already built)..."; \
	fi

	$(eval M := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*mosquitto/mosquitto/' | sed 's/\ .*//'))
	@if [ ! -e $(DCDBDEPSPATH)/$(M)/.installed ]; then \
		echo ""; \
		echo "Building Mosquitto library..."; \
		if [ -e $(DCDBDEPSPATH)/patches/$(M).patch ]; then \
			echo "Patching Mosquitto..."; \
			cd $(DCDBDEPSPATH)/$(M) && (patch -N -p0 < $(DCDBDEPSPATH)/patches/$(M).patch || true); \
		fi; \
		mkdir -p $(DCDBDEPSPATH)/mosquitto_build; \
		cd $(DCDBDEPSPATH)/mosquitto_build && \
178
179
180
181
182
183
184
			cmake $(CMAKE_CROSS_FLAGS) \
				-DOPENSSL_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
				-DWITH_SRV=no \
				-DWITH_TLS=yes \
				-DWITH_TLS_PSK=yes \
				-DCMAKE_INSTALL_PREFIX:PATH=$(DCDBDEPLOYPATH)/ \
				$(DCDBDEPSPATH)/$(M) && \
185
186
187
188
189
190
191
192
			make -j $(MAKETHREADS) && make install && \
			touch $(DCDBDEPSPATH)/$(M)/.installed; \
	else \
		echo "Skipping Mosquitto library (already built)..."; \
	fi
	
	$(eval O := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*OpenIPMI/OpenIPMI/' | sed 's/\ .*//'))
	$(eval X := $(shell uname))
193
194
195
	@if [ "$(ARCH)" = "arm" ]; then \
		echo "Skipping OpenIPMI - does not build on ARM"; \
	elif [ ! -e $(DCDBDEPSPATH)/$(O)/.installed ]; then \
196
197
198
199
200
201
202
203
204
205
		echo ""; \
		echo "Building OpenIPMI library..."; \
		if [ -e $(DCDBDEPSPATH)/patches/$(O).patch ]; then \
			echo "Patching OpenIPMI..."; \
			cd $(DCDBDEPSPATH)/$(O) && (patch -N -p1 < $(DCDBDEPSPATH)/patches/$(O).patch || true); \
		fi; \
		if [ "$(X)" == "Darwin" ]; then \
			echo "Fixing OpenIPMI for Mac OS..."; \
			cd $(DCDBDEPSPATH)/$(O) && find . -name 'Makefile*' | xargs sed -i '' -e 's/Map/map/g'; \
		fi; \
206
207
		cd $(DCDBDEPSPATH)/$(O) && aclocal && automake; \
		cd $(DCDBDEPSPATH)/$(O) && ./configure --prefix=$(DCDBDEPLOYPATH) --with-swig=no --with-perl=no --with-python=no \
Axel Auweter's avatar
Axel Auweter committed
208
			CC="$(CC)" CFLAGS="$(CFLAGS) $(LRT)" \
209
			$(AUTOCONF_CROSS_FLAGS); \
Axel Auweter's avatar
Axel Auweter committed
210
		echo "LRT = $(LRT)" && cd $(DCDBDEPSPATH)/$(O) && make -j $(MAKETHREADS) && make install && touch $(DCDBDEPSPATH)/$(O)/.installed; \
211
212
213
214
215
216
217
218
219
220
221
222
	else \
		echo "Skipping OpenIPMI library (already built)..."; \
	fi
	
	$(eval B := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*boost/boost/' | sed 's/\ .*//'))
	@if [ ! -e $(DCDBDEPSPATH)/$(B)/.installed ]; then \
		echo ""; \
		echo "Building Boost..."; \
		if [ -e $(DCDBDEPSPATH)/patches/$(B).patch ]; then \
			echo "Patching Boost..."; \
			cd $(DCDBDEPSPATH)/$(B) && (patch -N -p2 < $(DCDBDEPSPATH)/patches/$(B).patch || true); \
		fi; \
223
224
225
		if [ "$(ARCH)" = "arm" ]; then \
			echo " using gcc : arm : $(CROSS_COMPILE)g++ ; " > $(DCDBDEPSPATH)/$(B)/tools/build/src/user-config.jam; \
		fi; \
226
		cd $(DCDBDEPSPATH)/$(B) && ./bootstrap.sh --prefix=$(DCDBDEPLOYPATH) \
227
			--with-libraries=atomic,chrono,date_time,exception,filesystem,program_options,random,regex,system,thread,timer; \
228
		cd $(DCDBDEPSPATH)/$(B) && \
229
			./b2 -j $(MAKETHREADS) cxxflags="$(CXX11FLAGS)" install && touch $(DCDBDEPSPATH)/$(B)/.installed; \
230
231
232
233
234
235
236
237
238
239
240
241
	else \
		echo "Skipping Boost (already built)..."; \
	fi

	$(eval S := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*net-snmp/net-snmp/' | sed 's/\ .*//'))
	@if [ ! -e $(DCDBDEPSPATH)/$(S)/.installed ]; then \
		echo ""; \
		echo "Building net-snmp..."; \
		if [ -e $(DCDBDEPSPATH)/patches/$(S).patch ]; then \
			echo "Patching net-snmp..."; \
			cd $(DCDBDEPSPATH)/$(S) && (patch -N -p1 < $(DCDBDEPSPATH)/patches/$(S).patch || true); \
		fi; \
242
		cd $(DCDBDEPSPATH)/$(S) && env CC="$(CC)" CFLAGS="$(CFLAGS)" ./configure --prefix=$(DCDBDEPLOYPATH) --with-default-snmp-version="3" \
243
244
			--with-sys-contact="@@no.where" --with-sys-location="Unknown" --with-logfile="$(DCDBDEPLOYPATH)/var/log/snmpd.log" \
			--with-persistent-directory="$(DCDBDEPLOYPATH)/var/net-snmp" --disable-embedded-perl --without-perl-modules \
245
			--with-openssl=$(DCDBDEPLOYPATH) $(AUTOCONF_CROSS_FLAGS); \
246
247
248
249
250
251
252
253
254
255
		cd $(DCDBDEPSPATH)/$(S) && env CFLAGS="$(CFLAGS)" make -j $(MAKETHREADS) && make install && touch $(DCDBDEPSPATH)/$(S)/.installed; \
	else \
		echo "Skipping net-snmp (already built)..."; \
	fi

	$(eval U := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*libuv/libuv/' | sed 's/\ .*//'))
	@if [ ! -e $(DCDBDEPSPATH)/$(U)/.installed ]; then \
		echo ""; \
		echo "Building libuv..."; \
		cd $(DCDBDEPSPATH)/$(U) && \
256
		env CC="$(CC)" CFLAGS="$(CFLAGS)" make -j $(MAKETHREADS); \
257
258
259
260
261
262
263
264
265
266
267
268
269
270
		echo "Installing libuv..."; \
		mkdir -p $(DCDBDEPLOYPATH)/include/uv-private; \
		cd $(DCDBDEPSPATH)/$(U) && install -c include/uv.h $(DCDBDEPLOYPATH)/include/; \
		cd $(DCDBDEPSPATH)/$(U) && install -c include/uv-private/* $(DCDBDEPLOYPATH)/include/uv-private/; \
		mkdir -p $(DCDBDEPLOYPATH)/lib/; \
		if [ -e $(DCDBDEPSPATH)/$(U)/libuv.a ]; then cd $(DCDBDEPSPATH)/$(U) && install -c libuv.a $(DCDBDEPLOYPATH)/lib/; fi; \
		if [ -e $(DCDBDEPSPATH)/$(U)/libuv.so ]; then cd $(DCDBDEPSPATH)/$(U) && install -c libuv.so $(DCDBDEPLOYPATH)/lib/; ln -s $(DCDBDEPLOYPATH)/lib/libuv.so $(DCDBDEPLOYPATH)/lib/libuv.so.0.10; fi; \
		if [ -e $(DCDBDEPSPATH)/$(U)/libuv.dylib ]; then cd $(DCDBDEPSPATH)/$(U) && install -c libuv.dylib $(DCDBDEPLOYPATH)/lib/; fi; \
		touch $(DCDBDEPSPATH)/$(U)/.installed; \
	else \
		echo "Skipping libuv (already built)..."; \
	fi

	$(eval D := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*cpp-driver/cpp-driver/' | sed 's/\ .*//'))
271
	@if [ ! -e $(DCDBDEPSPATH)/$(D)/.installed ]; then \
272
273
274
275
276
277
278
279
		echo ""; \
		echo "Building cpp-driver..."; \
		if [ -e $(DCDBDEPSPATH)/patches/$(D).patch ]; then \
			echo "Patching cpp-driver..."; \
			cd $(DCDBDEPSPATH)/$(D) && (patch -N -p1 < $(DCDBDEPSPATH)/patches/$(D).patch || true); \
		fi; \
		mkdir -p $(DCDBDEPSPATH)/cpp-driver_build; \
		cd $(DCDBDEPSPATH)/cpp-driver_build && \
Axel Auweter's avatar
Axel Auweter committed
280
			cmake $(CMAKE_CROSS_FLAGS) \
281
				-DCMAKE_CXX_FLAGS="$(CXX11FLAGS) -Wno-unused-command-line-argument -L$(DCDBDEPLOYPATH)/lib " \
282
				-DOPENSSL_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
283
				-DLIBUV_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
284
				-DCASS_BUILD_EXAMPLES=NO \
Axel Auweter's avatar
Axel Auweter committed
285
				-DCMAKE_INSTALL_LIBDIR=lib \
286
287
				-DCMAKE_INSTALL_PREFIX=$(DCDBDEPLOYPATH)/ \
				-DCMAKE_EXE_LINKER_FLAGS="-L$(DCDBDEPLOYPATH)/lib -lboost_random" \
Axel Auweter's avatar
Axel Auweter committed
288
				-DCMAKE_SHARED_LINKER_FLAGS="-L$(DCDBDEPLOYPATH)/lib -lboost_random" \
289
				$(DCDBDEPSPATH)/$(D) && \
290
291
			make -j $(MAKETHREADS) && make install && \
			touch $(DCDBDEPSPATH)/$(D)/.installed; \
292
293
294
295
	else \
		echo "Skipping cpp-driver (already built)..."; \
	fi

296
	$(eval H := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*httpd/httpd/' | sed 's/\ .*//'))
Axel Auweter's avatar
Axel Auweter committed
297
298
	$(eval A := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*apr/apr/' | sed 's/\ .*//'))
	$(eval U := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*apr-util/apr-util/' | sed 's/\ .*//'))
299
300
301
	@if [ ! -e $(DCDBDEPSPATH)/$(H)/.installed ]; then \
		echo ""; \
		echo "Building Apache HTTPD server..."; \
Axel Auweter's avatar
Axel Auweter committed
302
303
304
		cp -a $(DCDBDEPSPATH)/$(A) $(DCDBDEPSPATH)/$(H)/srclib/apr; \
		cp -a $(DCDBDEPSPATH)/$(U) $(DCDBDEPSPATH)/$(H)/srclib/apr-util; \
		cd $(DCDBDEPSPATH)/$(H) && ./configure --with-included-apr --prefix=$(DCDBDEPLOYPATH); \
305
306
307
308
309
310
311
312
		cd $(DCDBDEPSPATH)/$(H) && make -j $(MAKETHREADS) && make install && touch $(DCDBDEPSPATH)/$(H)/.installed; \
		echo "Configuring Apache HTTPD server:"; \
		echo "    Setting listen port: $(HTTPD_PORT)"; \
		sed -i -e 's/Listen\ 80/Listen $(HTTPD_PORT)/' $(DCDBDEPLOYPATH)/conf/httpd.conf; \
		echo "    Enabling mod_cgid..."; \
		sed -i -e 's/#LoadModule\ cgid_module.*/LoadModule\ cgid_module\ modules\/mod_cgid.so/' $(DCDBDEPLOYPATH)/conf/httpd.conf; \
		echo "    Setting symlink for dcdbquery..."; \
		ln -s $(DCDBDEPLOYPATH)/bin/dcdbquery $(DCDBDEPLOYPATH)/cgi-bin/; \
313
314
		echo "    Setting symlink for dcdbconfig..."; \
		ln -s $(DCDBDEPLOYPATH)/bin/dcdbconfig $(DCDBDEPLOYPATH)/cgi-bin/; \
315
316
317
318
319
320
321
		echo "    Adding cgi-bin SymLinksIfOwnerMatch option..."; \
		sed -i -e '/<Directory.*cgi-bin.>/,/<\/Directory>/ s/Options.*/Options\ SymLinksIfOwnerMatch/' $(DCDBDEPLOYPATH)/conf/httpd.conf; \
		touch $(DCDBDEPSPATH)/$(H)/.installed; \
	else \
		echo "Skipping Apache HTTPD server (already built)..."; \
	fi
	
322
323
324
	@echo ""
	@echo "Staging and configuring Cassandra..."
	@$(eval C := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*apache-cassandra/apache-cassandra/' | sed 's/\ .*//'))
325
	@rsync -rlptD $(DCDBDEPSPATH)/$(C)/ $(DCDBDEPLOYPATH)/cassandra
326
327
328
329
330
331
332
333
334
	@$(eval P := $(shell echo "$(DCDBDEPLOYPATH)" | sed 's/\//\\\//g'))
	@sed -i.original -e 's/\/var\/lib\/cassandra/$(P)\/var\/lib\/cassandra/g' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*cluster_name:.*/cluster_name:\ '\''$(CASSANDRA_CLUSTER_NAME)'\''/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*flush_largest_memtables_at:.*/flush_largest_memtables_at:\ $(CASSANDRA_FLUSH_LARGEST_MEMTABLES_AT)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*reduce_cache_sizes_at:.*/reduce_cache_sizes_at:\ $(CASSANDRA_REDUCE_CACHE_SIZES_AT)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*reduce_cache_capacity_to:.*/reduce_cache_capacity_to:\ $(CASSANDRA_REDUCE_CACHE_CAPACITY_TO)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*partitioner:.*/partitioner:\ $(CASSANDRA_PARTITIONER)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*commitlog_total_space_in_mb:.*/commitlog_total_space_in_mb: $(CASSANDRA_COMMITLOG_TOTAL_SPACE_IN_MB)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*commitlog_segment_size_in_mb:.*/commitlog_segment_size_in_mb: $(CASSANDRA_COMMITLOG_SEGMENT_SIZE_IN_MB)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
Axel Auweter's avatar
Axel Auweter committed
335
336
	@sed -i -e 's/.*tombstone_warn_threshold:.*/tombstone_warn_threshold: $(CASSANDRA_TOMBSTONE_WARN_THRESHOLD)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
	@sed -i -e 's/.*tombstone_failure_threshold:.*/tombstone_failure_threshold: $(CASSANDRA_TOMBSTONE_FAILURE_THRESHOLD)/' $(DCDBDEPLOYPATH)/cassandra/conf/cassandra.yaml
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351

	@touch $(DCDBDEPSPATH)/.prerequesites
	
$(DCDBDEPSPATH)/.extract-distfiles: $(foreach f,$(DISTFILESPATHS),$(DCDBDEPSPATH)/$(f)/.dirstamp)
	@touch $(DCDBDEPSPATH)/.extract-distfiles
	
$(DCDBDEPSPATH)/.download-distfiles: $(foreach f,$(DISTFILESNAMES),$(DCDBDEPSPATH)/distfiles/$(f))
	@touch $(DCDBDEPSPATH)/.download-distfiles

$(DCDBDEPSPATH)/distfiles/%: 
	@mkdir -p $(DCDBDEPSPATH)/distfiles
	$(eval F := $(shell echo "$@" | sed 's/.*\///'))
	$(eval FF := $(shell echo "$(DISTFILES)" | sed 's/.*$(F);//' | sed 's/ .*//'))
	@echo "Downloading $(FF) as $(F)..."
	@cd $(DCDBDEPSPATH)/distfiles && $(FETCH) $(FF) > $(F)
352
353
354
355
356
357
358
359
360
361
362
363
	@if [ "$(NOCHECK)" = "" ]; then \
		printf "Verifying checksum... "; \
		if [ "`echo "$(DISTFILES_HASHES)" | sed -e 's/.*$(F);//' | sed -e 's/;.*//';`" = "`$(MD5) $(DCDBDEPSPATH)/distfiles/$(F) | sed -e 's/.*\ //'`" ]; then \
			echo "Checksum OK!"; \
		else \
			echo "Checksum FAIL!"; \
			exit 2; \
		fi \
	else \
		echo "Skipping checksum verification..."; \
	fi
	@echo ""
364
365
366
367
368
369
370
371
372
373
374
375
376
377

$(DCDBDEPSPATH)/%/.dirstamp: $(DCDBDEPSPATH)/.download-distfiles
	$(eval F := $(shell echo "$@" | sed 's/\/.dirstamp//' | sed 's/.*\///'))
	@echo "Extracting $(F)..."
	@if [ "$(suffix $(shell ls $(DCDBDEPSPATH)/distfiles/$(F)*))" = ".gz" ]; then \
		cd $(DCDBDEPSPATH) && tar xzf distfiles/$(F).tar.gz; \
	else \
		cd $(DCDBDEPSPATH) && unzip distfiles/$(F).zip > /dev/null; \
	fi
	@touch $@

$(LIBRARIES): $(DCDBDEPSPATH)/.prerequesites
	@echo ""
	@echo "Building Library $@..."
378
	@$(MAKE) -j $(MAKETHREADS) CC=$(CC) CXX=$(CXX) -C $@
379
	@echo "Installing Library $@..."
380
	@$(MAKE) CC=$(CC) CXX=$(CXX) -C $@ install
381

382
$(PROJECTS):
383
	$(eval X := $(shell echo "$(SKIP_PROJECTS)" | grep "$@"))
384
	@if [ "$(X)" = "" ]; then \
385
386
387
388
389
390
391
392
393
		echo ""; \
		echo "Building $@..."; \
		$(MAKE) -j $(MAKETHREADS) CC=$(CC) CXX=$(CXX) -C $@ ; \
		echo "Installing $@..."; \
		$(MAKE) CC=$(CC) CXX=$(CXX) -C $@ install ; \
	else \
		echo ""; \
		echo "Skipping $@..."; \
	fi