Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions ci/build_container/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# The individual build recipe scripts must contain sufficient information (e.g. SHA, URL, repo,
# version number, etc.) to uniquely identify the revision of the upstream dependency. This allows
# make to pick up changes with a simple direct dependency on the build recipe.
# TODO(htuch): These dependencies should be installed into distinct --prefix directories, so we can
# easily blow away the lib/ and include/ install directories when we upgrade version.

all: $(THIRDPARTY_DEPS)/libevent.dep \
$(THIRDPARTY_DEPS)/boringssl.dep \
Expand All @@ -21,24 +19,40 @@ all: $(THIRDPARTY_DEPS)/libevent.dep \

RECIPES := build_recipes

# If $(BUILD_DISTINCT) is set in the make environment, the artifacts are built and installed in
# distinct directories under $(THIRDPARTY_BUILD) and $(THIRDPARTY_SRC). They end up looking like
# $(THIRDPARTY_BUILD)/protobuf.dep/include, $(THIRDPARTY_BUILD)/cotire.dep/include etc. instead of
# all being under $(THIRDPARTY_BUILD)/include.
DISTINCT_PATH = $(if $(BUILD_DISTINCT),$(@F),)

build-setup = rm -rf $@.build && \
$(if $(BUILD_DISTINCT),rm -rf $(THIRDPARTY_BUILD)/$(DISTINCT_PATH) &&,) \
$(if $(BUILD_DISTINCT),rm -rf $(THIRDPARTY_SRC)/$(DISTINCT_PATH) &&,) \
mkdir -p $@.build && \
mkdir -p $(THIRDPARTY_BUILD)/lib && \
mkdir -p $(THIRDPARTY_BUILD)/include && \
mkdir -p $(THIRDPARTY_BUILD)/$(DISTINCT_PATH)/lib && \
mkdir -p $(THIRDPARTY_BUILD)/$(DISTINCT_PATH)/include && \
cd $@.build && \
echo "Building in $@.build, logs at $@.log"

build-complete = rm -rf $@.build && \
echo "Successful build of $@" && \
touch $@

# This needs to be invoked with $(call build-recipe,DEFS) where DEFS are additional environment
# definitions that are to be injected into the build recipe execution environment.
build-recipe = cd $(THIRDPARTY_SRC) && \
$(build-setup) && \
(((bash $(realpath $<) 2>&1) > $@.log) || (cat $@.log; exit 1)) && \
$(build-setup) && \
(((THIRDPARTY_SRC=$(THIRDPARTY_SRC)/$(DISTINCT_PATH) \
THIRDPARTY_BUILD=$(THIRDPARTY_BUILD)/$(DISTINCT_PATH) \
$(1) \
bash $(realpath $<) 2>&1) > $@.log) || (cat $@.log; exit 1)) && \
$(build-complete)

$(THIRDPARTY_DEPS)/%.dep: $(RECIPES)/%.sh
@+$(build-recipe)
@+$(call build-recipe,)

# Special support for targets that need protobuf, and hence take a dependency on protobuf.dep.
PROTOBUF_BUILD ?= $(THIRDPARTY_BUILD)/$(if $(BUILD_DISTINCT),protobuf.dep,)

$(THIRDPARTY_DEPS)/lightstep.dep: $(RECIPES)/lightstep.sh $(THIRDPARTY_DEPS)/protobuf.dep
@+$(build-recipe)
@+$(call build-recipe,PROTOBUF_BUILD=$(PROTOBUF_BUILD))
4 changes: 3 additions & 1 deletion ci/build_container/build_recipes/lightstep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ set -e
wget https://github.com/lightstep/lightstep-tracer-cpp/releases/download/v0_36/lightstep-tracer-cpp-0.36.tar.gz
tar xf lightstep-tracer-cpp-0.36.tar.gz
cd lightstep-tracer-cpp-0.36
# Added for legacy compatibility, should not be needed in new build recipes.
[ -z "$PROTOBUF_BUILD" ] && PROTOBUF_BUILD="$THIRDPARTY_BUILD"
./configure --disable-grpc --prefix=$THIRDPARTY_BUILD --enable-shared=no \
protobuf_CFLAGS="-I$THIRDPARTY_BUILD/include" protobuf_LIBS="-L$THIRDPARTY_BUILD/lib -lprotobuf" PROTOC=$THIRDPARTY_BUILD/bin/protoc
protobuf_CFLAGS="-I$PROTOBUF_BUILD/include" protobuf_LIBS="-L$PROTOBUF_BUILD/lib -lprotobuf" PROTOC=$PROTOBUF_BUILD/bin/protoc
make install