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)
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)
configure = \
$(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 = \
$(call echo_if_silent,generating $@) \
&& sed \
-e 's@%PROJECT_ROOT%@$(abspath $(PROJECT_ROOT))@g' \
-e 's@%DOCKER%@$(DOCKER)@g' \
-e 's@%RUNFLAGS%@$(DOCKER_RUNFLAGS) $(call image_run_volumes,$1)@g' \
-e 's@%IMAGE%@$(call image_name,$1)@g' \
-e 's@%RUNCMD%@$(notdir $@)@g' \
-e 's@%DOCKER_RUNFLAGS%@$(DOCKER_RUNFLAGS) $(addprefix --volume ,$(call image_run_volumes,$1))@g' \
-e 's@%DOCKER_IMAGE%@$(call image_name,$1)@g' \
-e 's@%DOCKER_RUNCMD%@$(notdir $@)@g' \
$< > $@ \
&& chmod +x $@

View File

@ -2,35 +2,15 @@
set -e
PROJECT_ROOT="${PROJECT_ROOT:-%PROJECT_ROOT%}"
DOCKER="${DOCKER:-'%DOCKER%'}"
DOCKER_IMAGE="{DOCKER_IMAGE:-'%DOCKER_IMAGE%'}"
DOCKER="${DOCKER:-%DOCKER%}"
IMAGE="${IMAGE:-%IMAGE%}"
NETWORK="${NETWORK:-host}"
HOST_CONTAINER="${HOST_CONTAINER:-"$("$PROJECT_ROOT/build/get_container_id.sh")"}"
DOCKER_RUNFLAGS+=( %DOCKER_RUNFLAGS% )
DOCKER_RUNFLAGS+=( --network host )
DOCKER_RUNFLAGS+=( --workdir "$PWD" )
# shellcheck disable=SC2162
read -a ADDITIONAL_RUNFLAGS <<< "$RUNFLAGS"
DOCKER_RUNCMD=( %DOCKER_RUNCMD% )
RUNFLAGS=()
set -- "${DOCKER_RUNFLAGS[@]}" "%DOCKER_IMAGE%" "${DOCKER_RUNCMD[@]}" "$@"
# shellcheck disable=SC2191
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 "$@"
exec docker run "$@"