1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00

fix(webfuse): fix macros (#18)

* fixes return code on error

* fixes macro usage

* adds clean target

* fixes file mode

* fixes image name

* adds registry prefix to allow usage of custom registry (on-premise)

* changes syntax in travis file for package installation

* fixes duplicate settings discovery
This commit is contained in:
nosamad 2019-03-29 13:23:17 +01:00 committed by Falk Werner
parent 0ac03b6150
commit 1d413456a2
4 changed files with 48 additions and 41 deletions

View File

@ -66,7 +66,6 @@
<buildTargets>
<target name="check" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>check</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
@ -74,7 +73,6 @@
</target>
<target name="memcheck" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>memcheck</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
@ -82,7 +80,6 @@
</target>
<target name="distclean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>distclean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
@ -90,7 +87,6 @@
</target>
<target name="discover-cc" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>discover-cc</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
@ -98,7 +94,6 @@
</target>
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
@ -106,12 +101,19 @@
</target>
<target name="lint" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>lint</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
</cproject>

View File

@ -4,10 +4,12 @@ services:
addons:
apt:
update: true
before_install:
- sudo apt-get install -y curl openssl ca-certificates
- sudo apt-get install -y make
- sudo apt-get install -y qemu-user-static
packages:
- curl
- openssl
- ca-certificates
- make
- qemu-user-static
env:
global:
- PARALLELMFLAGS="-j2"

View File

@ -26,6 +26,7 @@ UID ?= $(shell id -u)
CONTAINER_USER ?= $(UID)
CONTAINER_GROUP ?= $(shell id -g)
CONTAINER_CGROUP_PARENT ?=
HOST_CONTAINER ?= $(shell $(PROJECT_ROOT)/build/get_container_id.sh)
HOST_CONTAINER := $(HOST_CONTAINER)
@ -96,15 +97,17 @@ CMAKEFLAGS += '-GNinja'
BUILDSILENT := $(if $(BUILDVERBOSE),,1)
$(BUILDSILENT)NINJAFLAGS += -v
DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined
DOCKER_RUNFLAGS += --interactive
DOCKER_RUNFLAGS += --rm
DOCKER_RUNFLAGS += --init
DOCKER_RUNFLAGS += --user $(CONTAINER_USER):$(CONTAINER_GROUP)
DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined
DOCKER_RUNFLAGS += --env SOURCE_DATE_EPOCH
DOCKER_RUNFLAGS += --env BUILDTIME
DOCKER_RUNFLAGS += --env NINJA_STATUS
DOCKER_RUNFLAGS += $(addprefix --volumes-from ,$(HOST_CONTAINER))
DOCKER_RUNFLAGS += $(addprefix --cgroup-parent ,$(CONTAINER_CGROUP_PARENT))
DOCKER_BUILDARGS += CODENAME=$(CODENAME)
DOCKER_BUILDARGS += PARALLELMFLAGS=$(PARALLELMFLAGS)
@ -139,60 +142,60 @@ $(VERBOSE)SILENT := @
$(HOST_CONTAINER)container_run_volumes += '$(realpath $(PROJECT_ROOT)):$(CONTAINER_PROJECT_ROOT):cached'
$(HOST_CONTAINER)container_run_volumes += '$(realpath $(OUT)/$1):$(CONTAINER_OUT)/$1:delegated'
container_name = $(REGISTRY_PREFIX)$(subst -,/,$1)/$(PROJECT_NAME):$(VERSION)
container_run = $(DOCKER) run $(DOCKER_RUNFLAGS) $3 \
$(addprefix --volume ,$(call container_run_volumes,$1)) \
--workdir '$(CONTAINER_OUT)/$1' \
$(PROJECT_NAME)-$1:$(VERSION) \
$(call container_name,$1) \
$2
image_rule = \
$$(OUT)/docker/$1: $$(OUT)/docker/$1.dockerfile $$(EXTRACT_TARGETS) $$(PROJECT_ROOT)/Makefile; \
$$(call image,$1)
image = $(SILENT) \
$(call echo_if_silent,docker build $(PROJECT_NAME)-$1:$(VERSION) $(OUT)) \
&& $(DOCKER) build $(DOCKER_BUILDFLAGS) --iidfile $@ --file $< --tag $(PROJECT_NAME)-$1:$(VERSION) $(OUT)
run_rule = \
run-$1: $$(OUT)/docker/$1; \
$$(call run_recipe,$1,/bin/bash,--tty)
run = $(call echo_if_silent,TARGET=$1 $2) && $(call container_run,$1,$2,$3)
run_recipe = $(SILENT)-$(call run,$1,$2,$3)
$(SILENT)$$(call image,$1)
image = \
$(call echo_if_silent,docker build $(call container_name,$1) $(OUT)) \
&& $(DOCKER) build $(DOCKER_BUILDFLAGS) --iidfile $@ --file $< --tag $(call container_name,$1) $(OUT)
configure_rule = \
$$(OUT)/$1/CMakeCache.txt: $$(PROJECT_ROOT)/CMakeLists.txt $$(OUT)/docker/$1; \
$$(call configure,$1)
configure = $(SILENT) \
$(SILENT)$$(call configure,$1)
configure = \
$(call run,$1,sh -c 'cmake $(CMAKEFLAGS) $(CONTAINER_PROJECT_ROOT) && $(CONTAINER_PROJECT_ROOT)/build/discover_cc_settings.sh $(notdir $@) $(realpath $(dir $@))') \
&& touch $@
&& touch $(addprefix $(dir $@)/,include_dirs.txt) $@
build_rule = \
build-$1: $$(OUT)/$1/CMakeCache.txt; \
$$(call build,$1)
build = $(SILENT)$(call run,$1,ninja $(PARALLELMFLAGS) $(NINJAFLAGS) $(GOALS))
$(SILENT)$$(call build,$1)
build = $(call run,$1,ninja $(PARALLELMFLAGS) $(NINJAFLAGS) $(GOALS))
check_rule = \
check-$1: build-$1;
memcheck_rule = \
memcheck-$1: build-$1; \
$$(call memcheck,$1)
memcheck = $(SILENT)$(call run,$1,ctest -T memcheck $(CTESTFLAGS))
$(SILENT)$$(call memcheck,$1)
memcheck = $(call run,$1,ctest -T memcheck $(CTESTFLAGS))
run_rule = \
run-$1: $$(OUT)/docker/$1; \
$(SILENT)$$(call run,$1,/bin/bash,--tty) || true
run = $(call echo_if_silent,TARGET=$1 $2) && $(call container_run,$1,$2,$3)
clean_rule = \
clean-$1: ; \
$(SILENT)-$$(call clean,$1)
clean = rm -rf $(OUT)/$1
discover_cc_settings_rule = \
$$(OUT)/$1/include_dirs.txt: $$(OUT)/$1/CMakeCache.txt; \
$$(call discover_cc_settings,$1)
discover_cc_settings = $(SILENT) \
$(SILENT)$$(call discover_cc_settings,$1)
discover_cc_settings = \
$(call run,$1,$(CONTAINER_PROJECT_ROOT)/build/discover_cc_settings.sh $(notdir $<) $(realpath $(dir $<)))
discover_cc_rule = \
discover-cc-$1: $$(OUT)/$1/include_dirs.txt; \
$$(call discover_cc,$1)
discover_cc = $(SILENT)cat $<
clean_rule = \
clean-$1: ; \
$$(call clean,$1)
clean = $(SILENT)-rm -rf $(OUT)/$1
$(SILENT)$$(call discover_cc,$1)
discover_cc = cat $<
# Rules
@ -216,11 +219,11 @@ $(RULE_TARGETS): $(PROJECT_ROOT)/Makefile | $(OUT_DIRS)
echo; \
echo '$(call run_rule,$(TARGET))'; \
echo; \
echo '$(call clean_rule,$(TARGET))'; \
echo; \
echo '$(call discover_cc_settings_rule,$(TARGET))'; \
echo; \
echo '$(call discover_cc_rule,$(TARGET))'; \
echo; \
echo '$(call clean_rule,$(TARGET))'; \
} > $@
.PHONY: all build-%

View File

@ -33,7 +33,7 @@ impl_container_id_by_cgroup() {
DOCKER="${DOCKER:-docker}"
if [ -z "${CONTAINER+x}" ] && [ -n "$DOCKER" ]; then
CONTAINER="$(container_id "$@")" || true
CONTAINER="$(container_id "$@")"
fi
echo "$CONTAINER"