Handle overlay filesystem lifecycle.

It is reasonable to expect that the overlay filesystem will be managed.
This commit is contained in:
Matt T. Proud 2012-12-01 12:47:12 +01:00
parent c0ce859c76
commit 096b8d62ea

View file

@ -11,16 +11,20 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
GO_VERSION := 1.0.3
LEVELDB_VERSION := 1.7.0
PROTOCOL_BUFFERS_VERSION := 2.4.1
OVERLAY_ROOT := ${HOME}/overlay_root OVERLAY_ROOT := ${HOME}/overlay_root
export PATH := $(PATH):$(OVERLAY_ROOT)/bin export PATH := $(PATH):$(OVERLAY_ROOT)/bin
export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(OVERLAY_ROOT)/lib export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(OVERLAY_ROOT)/lib
export CFLAGS := $(CFLAGS) -I$(OVERLAY_ROOT)/include export CFLAGS := $(CFLAGS) -I$(OVERLAY_ROOT)/include
export CXXFLAGS := $(CXXFLAGS) -I$(OVERLAY_ROOT)/include export CXXFLAGS := $(CXXFLAGS) -I$(OVERLAY_ROOT)/include
export CPPFLAGS := $(CPPFLAGS) -I$(OVERLAY_ROOT)/include export CPPFLAGS := $(CPPFLAGS) -I$(OVERLAY_ROOT)/include
export LDFLAGS := $(LDFLAGS) -L$(OVERLAY_ROOT)/lib export LDFLAGS := $(LDFLAGS) -L$(OVERLAY_ROOT)/lib
export CGO_CFLAGS := $(CFLAGS) export CGO_CFLAGS := $(CFLAGS)
export CGO_LDFLAGS := $(LDFLAGS)
GO_GET := go get -v -x GO_GET := go get -v -x
APT_GET_INSTALL := sudo apt-get install -y APT_GET_INSTALL := sudo apt-get install -y
@ -38,6 +42,12 @@ build-dependencies: build-dependencies-stamp
build-dependencies-stamp: bison cc mercurial protoc goprotobuf go leveldb levigo gorest build-dependencies-stamp: bison cc mercurial protoc goprotobuf go leveldb levigo gorest
touch $@ touch $@
overlay: overlay-stamp
overlay-stamp:
[ -d "$(OVERLAY_ROOT)" ] || mkdir -vp $(OVERLAY_ROOT)
touch $@
bison: bison-stamp bison: bison-stamp
bison-stamp: bison-stamp:
@ -52,8 +62,8 @@ cc-stamp:
go: go-stamp go: go-stamp
go-stamp: bison go-stamp: bison
gvm install go1.0.3 || true gvm install go$(GO_VERSION) || true
gvm use go1.0.3 || true gvm use go$(GO_VERSION) || true
[ -x "$$(which go)" ] [ -x "$$(which go)" ]
touch $@ touch $@
@ -69,16 +79,16 @@ wget-stamp:
[ -x "$$(which wget)" ] || $(APT_GET_INSTALL) wget [ -x "$$(which wget)" ] || $(APT_GET_INSTALL) wget
touch $@ touch $@
protobuf-2.4.1.tar.bz2: wget protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2: wget
$(WGET) http://protobuf.googlecode.com/files/$@ $(WGET) http://protobuf.googlecode.com/files/$@
protoc: protoc-stamp protoc: protoc-stamp
protoc-stamp: cc protobuf-2.4.1.tar.bz2 protoc-stamp: cc protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2 overlay
([ ! -x "$$(which protoc)" ] && tar xjvf protobuf-2.4.1.tar.bz2) || true ([ ! -x "$$(which protoc)" ] && tar xjvf protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2) || true
([ ! -x "$$(which protoc)" ] && cd protobuf-2.4.1 && ./configure --prefix="$(OVERLAY_ROOT)") || true ([ ! -x "$$(which protoc)" ] && cd protobuf-$(PROTOCOL_BUFFERS_VERSION) && ./configure --prefix="$(OVERLAY_ROOT)") || true
([ ! -x "$$(which protoc)" ] && $(MAKE) -C protobuf-2.4.1) || true ([ ! -x "$$(which protoc)" ] && $(MAKE) -C protobuf-$(PROTOCOL_BUFFERS_VERSION)) || true
([ ! -x "$$(which protoc)" ] && $(MAKE) -C protobuf-2.4.1 install) || true ([ ! -x "$$(which protoc)" ] && $(MAKE) -C protobuf-$(PROTOCOL_BUFFERS_VERSION) install) || true
[ -x "$$(which protoc)" ] [ -x "$$(which protoc)" ]
touch $@ touch $@
@ -91,15 +101,15 @@ goprotobuf-stamp: go protoc source
leveldb: leveldb-stamp leveldb: leveldb-stamp
leveldb-stamp: cc rsync leveldb-1.7.0.tar.gz leveldb-stamp: cc rsync leveldb-$(LEVELDB_VERSION).tar.gz overlay
tar xzvf leveldb-1.7.0.tar.gz tar xzvf leveldb-$(LEVELDB_VERSION).tar.gz
$(MAKE) -C leveldb-1.7.0 $(MAKE) -C leveldb-$(LEVELDB_VERSION)
rsync -av "leveldb-1.7.0/include/" "$(OVERLAY_ROOT)/include/" rsync -av "leveldb-$(LEVELDB_VERSION)/include/" "$(OVERLAY_ROOT)/include/"
rsync -av "leveldb-1.7.0/"*.so* "$(OVERLAY_ROOT)/lib/" rsync -av "leveldb-$(LEVELDB_VERSION)/"*.so* "$(OVERLAY_ROOT)/lib/"
touch $@ touch $@
leveldb-1.7.0.tar.gz: wget leveldb-$(LEVELDB_VERSION).tar.gz: wget
$(WGET) http://leveldb.googlecode.com/files/leveldb-1.7.0.tar.gz $(WGET) http://leveldb.googlecode.com/files/leveldb-$(LEVELDB_VERSION).tar.gz
levigo: levigo-stamp levigo: levigo-stamp
@ -135,10 +145,11 @@ gorest-stamp: go source
clean: clean:
-rm *-stamp -rm *-stamp
-rm protobuf-2.4.1.tar.bz2
-rm -rf "$(OVERLAY_ROOT)" -rm -rf "$(OVERLAY_ROOT)"
-rm -rf leveldb-1.7.0 -rm -rf leveldb-$(LEVELDB_VERSION)
-rm -rf protobuf-2.4.1 -rm -rf protobuf-$(PROTOCOL_BUFFERS_VERSION)
-rm leveldb-$(LEVELDB_VERSION).tar.gz
-rm protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2
.PHONY: all preparation build-dependencies mercurial clean cc wget protoc goprotobuf bison go leveldb rsync levigo test gorest source .PHONY: all bison build-dependencies cc clean go goprotobuf gorest leveldb levigo mercurial overlay preparation protoc rsync source test wget