Skip to content

Commit

Permalink
Install libzauth in ~/.wire-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Artyom Kazak committed May 5, 2018
1 parent f0699fe commit 1407f5a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Makefile
Expand Up @@ -71,3 +71,9 @@ docker-exe-%:
.PHONY: docker-service-%
docker-service-%:
$(MAKE) -C services/"$*" docker

#################################
## dependencies

libzauth:
$(MAKE) -C libs/libzauth install
3 changes: 2 additions & 1 deletion deploy/services-demo/demo.sh
Expand Up @@ -88,7 +88,8 @@ function run_haskell_service() {

function run_nginz() {
colour=$1
(cd ${SCRIPT_DIR} && ${DIR}/../dist/nginx -p ${SCRIPT_DIR} -c ${SCRIPT_DIR}/conf/nginz/nginx.conf -g 'daemon off;' || kill_all) \
prefix=$([ -w /usr/local ] && echo /usr/local || echo "${HOME}/.wire-dev")
(cd ${SCRIPT_DIR} && LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${prefix}/lib/ ${DIR}/../dist/nginx -p ${SCRIPT_DIR} -c ${SCRIPT_DIR}/conf/nginz/nginx.conf -g 'daemon off;' || kill_all) \
| sed -e "s/^/$(tput setaf ${colour})[nginz] /" -e "s/$/$(tput sgr0)/" &
}

Expand Down
5 changes: 4 additions & 1 deletion libs/libzauth/libzauth-c/Makefile
Expand Up @@ -3,7 +3,9 @@ VERSION := "3.0.0"
ARCH := amd64
BUILD ?= 1
OS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
PREFIX ?= /usr/local
# If we can install libzauth globally, we'll install it there, otherwise
# it'll go into ~/.wire-dev
PREFIX := $(shell [ -w /usr/local ] && echo /usr/local || echo "$(HOME)/.wire-dev")

ifeq ($(OS), darwin)
LIB_TYPE := dylib
Expand All @@ -25,6 +27,7 @@ build-release:
cargo build --release

install: build-release
mkdir -p $(PREFIX)/include
mkdir -p $(PREFIX)/lib/pkgconfig
cp src/zauth.h $(PREFIX)/include/
sed -e "s~<<VERSION>>~$(VERSION)~" \
Expand Down
11 changes: 9 additions & 2 deletions services/nginz/Makefile
Expand Up @@ -22,6 +22,9 @@ PID_PATH ?= /var/run
EXTRA_CC_INC ?=
EXTRA_CC_LIB ?=

# Where should we look for packages, locally or globally?
EXTRA_PKG_PATH := $(shell [ -w /usr/local ] && echo /usr/local || echo "$(HOME)/.wire-dev")/lib/pkgconfig

CONFIG_OPTIONS = \
--prefix=$(DEST_PATH) \
$(WITH_DEBUG) \
Expand Down Expand Up @@ -53,15 +56,19 @@ default: compile
clean:
-rm -rf src $(DIST) .metadata zwagger-ui/swagger-ui

.PHONY: check-deps
check-deps:
PKG_CONFIG_PATH=$(EXTRA_PKG_PATH) pkg-config --exists libzauth || { echo -e "\n\033[0;31m The 'libzauth' library was not found\033[0m\n pkg-config path = $(EXTRA_PKG_PATH)\n\n Suggestion: run 'make libzauth' on the top level\n"; exit 1; }

compile: $(BIN)
mkdir -p dist ../../dist
cp src/objs/nginx ../../dist/

dist: guard-NGINZ_VERSION $(DIST)/$(DEB)

$(BIN): src zwagger-ui/swagger-ui
$(BIN): check-deps src zwagger-ui/swagger-ui
git submodule update --init
(cd src; ./configure $(CONFIG_OPTIONS) $(ADDITIONAL_MODULES))
(cd src; PKG_CONFIG_PATH=$(EXTRA_PKG_PATH) ./configure $(CONFIG_OPTIONS) $(ADDITIONAL_MODULES))
make -C src

%.deb: $(BIN) $(DIST)
Expand Down

0 comments on commit 1407f5a

Please sign in to comment.