Commit 1bd046cb authored by Axel Auweter's avatar Axel Auweter
Browse files

Reworked build system: Now, dependencies (cassandra, thrift, etc) are pulled...

Reworked build system: Now, dependencies (cassandra, thrift, etc) are pulled automatically and set up.
Probably needs further testing.
parent 30aa855d
PROJECTS = FileSpewer CollectAgent SysFsAgent
DISTFILES = thrift-0.9.0.tar.gz; \
apache-cassandra-1.2.3.tar.gz; \
mosquitto-1.1.3.tar.gz; \
rudeconfig-5.0.5.tar.gz; \
FETCH = wget -c --no-check-certificate -O -
PWD = $(shell pwd)
DISTFILESNAMES = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/;.*//'))
DISTFILESPATHS = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/.tar.gz;.*//'))
.PHONY : info all clean cleanall distclean
@echo ""
@echo "DCDB - Data Center Database"
@echo "Buildsystem description"
@echo ""
@echo "Use DCDBBUILDPATH environment variable to specify build path."
@echo "Currently, the project will be built to:"
@echo ""
@echo "The prefix for installation is:"
ifeq ($(wildcard $(DCDBBUILDPATH)),)
@echo "Nothing to do."
@echo "Cleaning up... "
@cd $(DCDBBUILDPATH) && rm -rf $(PROJECTS)
cleanall: clean
@cd $(DCDBBUILDPATH) && rm -f .prerequesites .extract-distfiles .download-distfiles
@cd $(DCDBBUILDPATH) && rm -rf mosquitto_build
@$(foreach f,$(DISTFILESPATHS),echo "Cleaning $(f)..."; cd $(DCDBBUILDPATH)/$(f) && make clean 2&> /dev/null; true;)
@echo "Wiping..."
all: $(DCDBBUILDPATH)/.prerequesites
@$(foreach p,$(PROJECTS),echo ""; echo "Building $(p)..."; rsync -a $(p) $(DCDBBUILDPATH)/; \
make -C $(DCDBBUILDPATH)/$(p); echo "Installing $(p)..."; make -C $(DCDBBUILDPATH)/$(p) install; )
$(DCDBBUILDPATH)/.prerequesites: $(DCDBBUILDPATH)/.extract-distfiles
@echo ""
@echo "Building Mosquitto library..."
@mkdir -p $(DCDBBUILDPATH)/mosquitto_build
$(eval M := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*mosquitto/mosquitto/' | sed 's/\ .*//'))
@cd $(DCDBBUILDPATH)/mosquitto_build && cmake -DCMAKE_INSTALL_PREFIX:PATH=$(DCDBDEPLOYPATH) $(DCDBBUILDPATH)/$(M) && make -j $(MAKETHREADS) && make install
@echo ""
@echo "Building Rudeconfig library..."
$(eval R := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*rudeconfig/rudeconfig/' | sed 's/\ .*//'))
@cd $(DCDBBUILDPATH)/$(R) && ./configure --prefix=$(DCDBDEPLOYPATH) && make -j $(MAKETHREADS) && chmod +x install-sh && make install
@echo ""
@echo "Building Boost..."
$(eval B := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*boost/boost/' | sed 's/\ .*//'))
@cd $(DCDBBUILDPATH)/$(B) && ./ --prefix=$(DCDBDEPLOYPATH) && ./b2 install
@echo ""
@echo "Buidling Thrift..."
$(eval T := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*thrift/thrift/' | sed 's/\ .*//'))
@cd $(DCDBBUILDPATH)/$(T) && ./configure --prefix=$(DCDBDEPLOYPATH) --without-qt4 --without-csharp \
--without-java --without-erlang --without-python --without-perl --without-php --without-php_extension \
--without-ruby --without-haskell --without-go --without-d --with-cpp --with-boost=$(DCDBDEPLOYPATH) && make && make install
@touch $(DCDBBUILDPATH)/.prerequesites
$(DCDBBUILDPATH)/.extract-distfiles: $(foreach f,$(DISTFILESPATHS),$(DCDBBUILDPATH)/$(f)/.dirstamp)
@touch $(DCDBBUILDPATH)/.extract-distfiles
$(DCDBBUILDPATH)/.download-distfiles: $(foreach f,$(DISTFILESNAMES),$(DCDBBUILDPATH)/distfiles/$(f))
@touch $(DCDBBUILDPATH)/.download-distfiles
@mkdir -p $(DCDBBUILDPATH)/distfiles
$(eval F := $(shell echo "$@" | sed 's/.*\///'))
$(eval FF := $(shell echo "$(DISTFILES)" | sed 's/.*$(F);//' | sed 's/ .*//'))
@echo "Downloading $(FF) as $(F)..."
@cd $(DCDBBUILDPATH)/distfiles && $(FETCH) $(FF) > $(F)
$(DCDBBUILDPATH)/%/.dirstamp: $(DCDBBUILDPATH)/.download-distfiles
$(eval F := $(shell echo "$@" | sed 's/\/.dirstamp//' | sed 's/.*\///'))
@echo "Extracting $(F)..."
@cd $(DCDBBUILDPATH) && tar xzf distfiles/$(F).tar.gz
@touch $@
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment