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

adds wrapper script to launch gdbserver

This commit is contained in:
nosamad 2019-04-01 23:51:39 +02:00 committed by Falk Werner
parent 57038cdae9
commit 97f2825a20
2 changed files with 12 additions and 33 deletions

View File

@ -168,7 +168,7 @@ image = \
&& $(DOCKER) build $(DOCKER_BUILDFLAGS) --iidfile $@ --file $< --tag $(call image_name,$1) $(OUT) && $(DOCKER) build $(DOCKER_BUILDFLAGS) --iidfile $@ --file $< --tag $(call image_name,$1) $(OUT)
configure_rule = \ configure_rule = \
$$(OUT)/$1/$$(BUILDTYPE)/CMakeCache.txt: $$(PROJECT_ROOT)/CMakeLists.txt $$(OUT)/docker/$1; \ $$(OUT)/$1/$$(BUILDTYPE)/CMakeCache.txt: $$(PROJECT_ROOT)/CMakeLists.txt $$(OUT)/docker/$1 | $$(OUT)/$1/$$(BUILDTYPE)/gdbserver; \
$$(SILENT)$$(call configure,$1) $$(SILENT)$$(call configure,$1)
configure = \ configure = \
$(call run,$1,sh -c 'cmake $(CMAKEFLAGS) $(CONTAINER_PROJECT_ROOT) && $(CONTAINER_PROJECT_ROOT)/build/discover_cc_settings.sh $(notdir $@) $(realpath $(dir $@))') \ $(call run,$1,sh -c 'cmake $(CMAKEFLAGS) $(CONTAINER_PROJECT_ROOT) && $(CONTAINER_PROJECT_ROOT)/build/discover_cc_settings.sh $(notdir $@) $(realpath $(dir $@))') \
@ -214,11 +214,10 @@ wrapper_rule = \
wrapper = \ wrapper = \
$(call echo_if_silent,generating $@) \ $(call echo_if_silent,generating $@) \
&& sed \ && sed \
-e 's@%PROJECT_ROOT%@$(abspath $(PROJECT_ROOT))@g' \
-e 's@%DOCKER%@$(DOCKER)@g' \ -e 's@%DOCKER%@$(DOCKER)@g' \
-e 's@%RUNFLAGS%@$(DOCKER_RUNFLAGS) $(call image_run_volumes,$1)@g' \ -e 's@%DOCKER_RUNFLAGS%@$(DOCKER_RUNFLAGS) $(addprefix --volume ,$(call image_run_volumes,$1))@g' \
-e 's@%IMAGE%@$(call image_name,$1)@g' \ -e 's@%DOCKER_IMAGE%@$(call image_name,$1)@g' \
-e 's@%RUNCMD%@$(notdir $@)@g' \ -e 's@%DOCKER_RUNCMD%@$(notdir $@)@g' \
$< > $@ \ $< > $@ \
&& chmod +x $@ && chmod +x $@

View File

@ -2,35 +2,15 @@
set -e set -e
PROJECT_ROOT="${PROJECT_ROOT:-%PROJECT_ROOT%}" DOCKER="${DOCKER:-'%DOCKER%'}"
DOCKER_IMAGE="{DOCKER_IMAGE:-'%DOCKER_IMAGE%'}"
DOCKER="${DOCKER:-%DOCKER%}" DOCKER_RUNFLAGS+=( %DOCKER_RUNFLAGS% )
IMAGE="${IMAGE:-%IMAGE%}" DOCKER_RUNFLAGS+=( --network host )
NETWORK="${NETWORK:-host}" DOCKER_RUNFLAGS+=( --workdir "$PWD" )
HOST_CONTAINER="${HOST_CONTAINER:-"$("$PROJECT_ROOT/build/get_container_id.sh")"}"
# shellcheck disable=SC2162 DOCKER_RUNCMD=( %DOCKER_RUNCMD% )
read -a ADDITIONAL_RUNFLAGS <<< "$RUNFLAGS"
RUNFLAGS=() set -- "${DOCKER_RUNFLAGS[@]}" "%DOCKER_IMAGE%" "${DOCKER_RUNCMD[@]}" "$@"
# shellcheck disable=SC2191 exec docker run "$@"
RUNFLAGS+=( %RUNFLAGS% )
if [[ -n "$HOST_CONTAINER" ]]; then
RUNFLAGS+=( --volumes-from "$HOST_CONTAINER" )
fi
RUNFLAGS+=( --network "$NETWORK" )
if [[ -n "$CONTAINER_CGROUP_PARENT" ]]; then
RUNFLAGS+=( --cgroup-parent "$CONTAINER_CGROUP_PARENT" )
fi
RUNFLAGS+=( --workdir "$PWD" )
RUNCMD=( %RUNCMD% )
set -- "${RUNFLAGS[@]}" "${ADDITIONAL_RUNFLAGS[@]}" "$IMAGE" "${RUNCMD[@]}" "$@"
exec "$DOCKER" run "$@"