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;https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz \
apache-cassandra-1.2.3.tar.gz;http://mirror.netcologne.de/apache.org/cassandra/1.2.3/apache-cassandra-1.2.3-bin.tar.gz \
mosquitto-1.1.3.tar.gz;http://mosquitto.org/files/source/mosquitto-1.1.3.tar.gz \
rudeconfig-5.0.5.tar.gz;http://rudeserver.com/config/download/rudeconfig-5.0.5.tar.gz \
boost_1_53_0.tar.gz;http://netcologne.dl.sourceforge.net/project/boost/boost/1.53.0/boost_1_53_0.tar.gz
FETCH = wget -c --no-check-certificate -O -
MAKETHREADS = 2
PWD = $(shell pwd)
DCDBBUILDPATH ?= $(PWD)/build/
DCDBDEPLOYPATH ?= $(DCDBBUILDPATH)/deploy/
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
info:
@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 "$(DCDBBUILDPATH)"
@echo ""
@echo "The prefix for installation is:"
@echo "$(DCDBDEPLOYPATH)"
clean:
ifeq ($(wildcard $(DCDBBUILDPATH)),)
@echo "Nothing to do."
else
@echo "Cleaning up... "
@cd $(DCDBBUILDPATH) && rm -rf $(PROJECTS)
endif
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;)
distclean:
@echo "Wiping..."
@rm -rf $(DCDBBUILDPATH)
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) && ./bootstrap.sh --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
$(DCDBBUILDPATH)/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 $@
Supports Markdown
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