mirror of
https://github.com/falk-werner/webfuse
synced 2024-10-27 20:34:10 +00:00
feat(webfuse): eclipse cdt project (#17)
adds convenience run and discovery targets (for first build target) allows usage of host container (volume mount/ dind) fixes portable workspace configuration adds makefile targets to CDT configuration fixes localization * adds eclipse-cdt project and necessary discovery for toolchain settings * extends targets and fixes discovery * renames CDT Eclipse project * enables portable workspace docker-build on build server
This commit is contained in:
parent
66a585ecf1
commit
0ac03b6150
117
.cproject
Normal file
117
.cproject
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||||
|
<cconfiguration id="cdt.managedbuild.toolchain.gnu.base.2091678410">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.2091678410" moduleId="org.eclipse.cdt.core.settings" name="amd64-ubuntu">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.base.2091678410" name="amd64-ubuntu" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||||
|
<folderInfo id="cdt.managedbuild.toolchain.gnu.base.2091678410.118484177" name="/" resourcePath="">
|
||||||
|
<toolChain id="cdt.managedbuild.toolchain.gnu.base.1517489953" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.GNU_ELF" id="cdt.managedbuild.target.gnu.platform.base.971240548" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
|
||||||
|
<builder id="cdt.managedbuild.target.gnu.builder.base.232876219" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="false" superClass="cdt.managedbuild.target.gnu.builder.base"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1816617162" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.545065126" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.2051808734" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.c.compiler.base.327402516" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2075154955" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.1022031726" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.437603593" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base">
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1581559480" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||||
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
|
</inputType>
|
||||||
|
</tool>
|
||||||
|
<tool id="cdt.managedbuild.tool.gnu.assembler.base.804063739" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
|
||||||
|
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.707113868" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
</cconfiguration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<project id="webfuse.null.1226539536" name="webfuse"/>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
|
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||||
|
<configuration configurationName="amd64-ubuntu"/>
|
||||||
|
<configuration configurationName="Default">
|
||||||
|
<resource resourceType="PROJECT" workspacePath="/webfuse"/>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="scannerConfiguration">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.2091678410;cdt.managedbuild.toolchain.gnu.base.2091678410.118484177;cdt.managedbuild.tool.gnu.cpp.compiler.base.545065126;cdt.managedbuild.tool.gnu.cpp.compiler.input.2051808734">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.2091678410;cdt.managedbuild.toolchain.gnu.base.2091678410.118484177;cdt.managedbuild.tool.gnu.c.compiler.base.327402516;cdt.managedbuild.tool.gnu.c.compiler.input.2075154955">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||||
|
<buildTargets>
|
||||||
|
<target name="check" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
|
<buildTarget>check</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>true</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="memcheck" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
|
<buildTarget>memcheck</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>true</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="distclean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
|
<buildTarget>distclean</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>true</runAllBuilders>
|
||||||
|
</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>
|
||||||
|
<runAllBuilders>true</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
|
<buildTarget>all</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>true</runAllBuilders>
|
||||||
|
</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>
|
||||||
|
</buildTargets>
|
||||||
|
</storageModule>
|
||||||
|
</cproject>
|
27
.project
Normal file
27
.project
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>webfuse</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
|
<triggers>clean,full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||||
|
<triggers>full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
15
.settings/language.settings.xml
Normal file
15
.settings/language.settings.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<project>
|
||||||
|
<configuration id="cdt.managedbuild.toolchain.gnu.base.2091678410" name="amd64-ubuntu">
|
||||||
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
<provider class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider" name="CDT User Setting Entries" prefer-non-shared="true"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(g?cc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="true" env-hash="1982439746031607768" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="make discover-cc" prefer-non-shared="true" store-entries-with-project="false">
|
||||||
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
|
</provider>
|
||||||
|
</extension>
|
||||||
|
</configuration>
|
||||||
|
</project>
|
12
.settings/org.eclipse.cdt.core.prefs
Normal file
12
.settings/org.eclipse.cdt.core.prefs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
environment/project/cdt.managedbuild.toolchain.gnu.base.2091678410/BUILDTARGET/delimiter=\:
|
||||||
|
environment/project/cdt.managedbuild.toolchain.gnu.base.2091678410/BUILDTARGET/operation=append
|
||||||
|
environment/project/cdt.managedbuild.toolchain.gnu.base.2091678410/BUILDTARGET/value=amd64-ubuntu-builder
|
||||||
|
environment/project/cdt.managedbuild.toolchain.gnu.base.2091678410/BUILDVERBOSE/delimiter=\:
|
||||||
|
environment/project/cdt.managedbuild.toolchain.gnu.base.2091678410/BUILDVERBOSE/operation=append
|
||||||
|
environment/project/cdt.managedbuild.toolchain.gnu.base.2091678410/BUILDVERBOSE/value=1
|
||||||
|
environment/project/cdt.managedbuild.toolchain.gnu.base.2091678410/VERBOSE/delimiter=\:
|
||||||
|
environment/project/cdt.managedbuild.toolchain.gnu.base.2091678410/VERBOSE/operation=replace
|
||||||
|
environment/project/cdt.managedbuild.toolchain.gnu.base.2091678410/VERBOSE/value=
|
||||||
|
environment/project/cdt.managedbuild.toolchain.gnu.base.2091678410/append=true
|
||||||
|
environment/project/cdt.managedbuild.toolchain.gnu.base.2091678410/appendContributed=true
|
@ -11,6 +11,7 @@ before_install:
|
|||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- PARALLELMFLAGS="-j2"
|
- PARALLELMFLAGS="-j2"
|
||||||
|
- PORTABLE_WORSPACE=1
|
||||||
matrix:
|
matrix:
|
||||||
- MARCH=amd64 CHECK_TARGET=memcheck
|
- MARCH=amd64 CHECK_TARGET=memcheck
|
||||||
- MARCH=arm32v7 CHECK_TARGET=check
|
- MARCH=arm32v7 CHECK_TARGET=check
|
||||||
|
163
Makefile
163
Makefile
@ -1,3 +1,6 @@
|
|||||||
|
PARALLELMFLAGS ?= -j$(shell nproc)
|
||||||
|
MAKEFLAGS += $(PARALLELMFLAGS) --no-builtin-rules
|
||||||
|
|
||||||
.PHONY: default
|
.PHONY: default
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
@ -5,24 +8,33 @@ default: all
|
|||||||
|
|
||||||
export SOURCE_DATE_EPOCH ?= $(shell $(PROJECT_ROOT)/build/get_source_date_epoch.sh)
|
export SOURCE_DATE_EPOCH ?= $(shell $(PROJECT_ROOT)/build/get_source_date_epoch.sh)
|
||||||
export BUILDTIME ?= $(shell date -u -d '@$(SOURCE_DATE_EPOCH)' --rfc-3339 ns 2>/dev/null | sed -e 's/ /T/')
|
export BUILDTIME ?= $(shell date -u -d '@$(SOURCE_DATE_EPOCH)' --rfc-3339 ns 2>/dev/null | sed -e 's/ /T/')
|
||||||
|
export DOCKER ?= docker
|
||||||
|
|
||||||
|
DOCKER_BUILDKIT ?=
|
||||||
|
|
||||||
VERBOSE ?=
|
VERBOSE ?=
|
||||||
MARCH ?=
|
BUILDVERBOSE ?=
|
||||||
|
BUILDTARGET ?=
|
||||||
|
MARCH ?= $(call march,$(BUILDTARGET))
|
||||||
|
|
||||||
PROJECT_NAME ?= webfuse
|
PROJECT_NAME ?= webfuse
|
||||||
PROJECT_ROOT ?= .
|
PROJECT_ROOT ?= .
|
||||||
VERSION ?= $(shell cat $(PROJECT_ROOT)/VERSION)
|
VERSION ?= $(shell cat $(PROJECT_ROOT)/VERSION)
|
||||||
OUT ?= $(PROJECT_ROOT)/.build
|
OUT ?= $(PROJECT_ROOT)/.build
|
||||||
|
|
||||||
PARALLELMFLAGS ?= -j$(shell nproc)
|
|
||||||
UID ?= $(shell id -u)
|
UID ?= $(shell id -u)
|
||||||
|
|
||||||
DOCKER ?= docker
|
|
||||||
DOCKER_BUILDKIT ?=
|
|
||||||
|
|
||||||
CONTAINER_USER ?= $(UID)
|
CONTAINER_USER ?= $(UID)
|
||||||
CONTAINER_GROUP ?= $(shell id -g)
|
CONTAINER_GROUP ?= $(shell id -g)
|
||||||
CONTAINER_WORKSPACE ?= /workspace
|
|
||||||
|
HOST_CONTAINER ?= $(shell $(PROJECT_ROOT)/build/get_container_id.sh)
|
||||||
|
HOST_CONTAINER := $(HOST_CONTAINER)
|
||||||
|
|
||||||
|
$(HOST_CONTAINER)PORTABLE_WORSPACE ?=
|
||||||
|
CONTAINER_PROJECT_ROOT ?= /workspace/src
|
||||||
|
CONTAINER_OUT ?= /workspace/out
|
||||||
|
$(PORTABLE_WORSPACE)CONTAINER_PROJECT_ROOT = $(abspath $(PROJECT_ROOT))
|
||||||
|
$(PORTABLE_WORSPACE)CONTAINER_OUT = $(abspath $(OUT))
|
||||||
|
|
||||||
UBUNTU_CODENAME ?= bionic
|
UBUNTU_CODENAME ?= bionic
|
||||||
|
|
||||||
@ -54,6 +66,11 @@ $(OUT)/docker/qemu-arm-static-$(QEMU_VERSION): URL := https://github.com/multiar
|
|||||||
|
|
||||||
# Architecture-specific rule target configuration
|
# Architecture-specific rule target configuration
|
||||||
|
|
||||||
|
march = $(shell echo '$1' | sed -n -e 's@\([^-]*\)-.*@\1@p')
|
||||||
|
|
||||||
|
TARGETS += $(BUILDTARGET)
|
||||||
|
MARCH := $(MARCH)
|
||||||
|
|
||||||
MARCH_AMD64 := $(filter-out amd64,$(MARCH))
|
MARCH_AMD64 := $(filter-out amd64,$(MARCH))
|
||||||
$(MARCH_AMD64)MARCHS += amd64
|
$(MARCH_AMD64)MARCHS += amd64
|
||||||
$(MARCH_AMD64)TARGETS += amd64-ubuntu-builder
|
$(MARCH_AMD64)TARGETS += amd64-ubuntu-builder
|
||||||
@ -74,9 +91,10 @@ $(addprefix $(OUT)/docker/,$(UBUNTU_TARGETS)): CODENAME := $(UBUNTU_CODENAME)
|
|||||||
|
|
||||||
# Common rule target configuration
|
# Common rule target configuration
|
||||||
|
|
||||||
MAKEFLAGS += $(PARALLELMFLAGS) --no-builtin-rules
|
CMAKEFLAGS += '-GNinja'
|
||||||
|
|
||||||
CMAKEFLAGS += -GNinja
|
BUILDSILENT := $(if $(BUILDVERBOSE),,1)
|
||||||
|
$(BUILDSILENT)NINJAFLAGS += -v
|
||||||
|
|
||||||
DOCKER_RUNFLAGS += --interactive
|
DOCKER_RUNFLAGS += --interactive
|
||||||
DOCKER_RUNFLAGS += --rm
|
DOCKER_RUNFLAGS += --rm
|
||||||
@ -85,11 +103,14 @@ DOCKER_RUNFLAGS += --user $(CONTAINER_USER):$(CONTAINER_GROUP)
|
|||||||
DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined
|
DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined
|
||||||
DOCKER_RUNFLAGS += --env SOURCE_DATE_EPOCH
|
DOCKER_RUNFLAGS += --env SOURCE_DATE_EPOCH
|
||||||
DOCKER_RUNFLAGS += --env BUILDTIME
|
DOCKER_RUNFLAGS += --env BUILDTIME
|
||||||
|
DOCKER_RUNFLAGS += --env NINJA_STATUS
|
||||||
|
DOCKER_RUNFLAGS += $(addprefix --volumes-from ,$(HOST_CONTAINER))
|
||||||
|
|
||||||
DOCKER_BUILDARGS += CODENAME=$(CODENAME)
|
DOCKER_BUILDARGS += CODENAME=$(CODENAME)
|
||||||
DOCKER_BUILDARGS += PARALLELMFLAGS=$(PARALLELMFLAGS)
|
DOCKER_BUILDARGS += PARALLELMFLAGS=$(PARALLELMFLAGS)
|
||||||
DOCKER_BUILDARGS += USERID=$(UID)
|
DOCKER_BUILDARGS += USERID=$(UID)
|
||||||
DOCKER_BUILDARGS += WORKSPACE=$(CONTAINER_WORKSPACE)
|
DOCKER_BUILDARGS += PROJECT_ROOT=$(CONTAINER_PROJECT_ROOT)
|
||||||
|
DOCKER_BUILDARGS += OUT=$(CONTAINER_OUT)
|
||||||
|
|
||||||
DOCKER_BUILDFLAGS += --rm
|
DOCKER_BUILDFLAGS += --rm
|
||||||
DOCKER_BUILDFLAGS += $(addprefix --build-arg ,$(DOCKER_BUILDARGS))
|
DOCKER_BUILDFLAGS += $(addprefix --build-arg ,$(DOCKER_BUILDARGS))
|
||||||
@ -101,16 +122,13 @@ OUT_DIRS += $(addprefix $(OUT)/,$(TARGETS))
|
|||||||
|
|
||||||
BUILD_TARGETS += $(addprefix build-,$(TARGETS))
|
BUILD_TARGETS += $(addprefix build-,$(TARGETS))
|
||||||
CHECK_TARGETS += $(addprefix check-,$(TARGETS))
|
CHECK_TARGETS += $(addprefix check-,$(TARGETS))
|
||||||
|
CLEAN_TARGETS += $(addprefix clean-,$(TARGETS))
|
||||||
|
RUN_TARGETS += $(addprefix run-,$(firstword $(TARGETS)))
|
||||||
EXTRACT_TARGETS += $(patsubst $(OUT)/%.tar.gz,$(OUT)/src/%,$(FETCH_TARGETS))
|
EXTRACT_TARGETS += $(patsubst $(OUT)/%.tar.gz,$(OUT)/src/%,$(FETCH_TARGETS))
|
||||||
|
DISCOVER_CC_TARGETS += $(addprefix discover-cc-,$(firstword $(TARGETS)))
|
||||||
RULE_TARGETS = $(addprefix $(OUT)/,$(addsuffix /rules.mk,$(TARGETS)))
|
RULE_TARGETS = $(addprefix $(OUT)/,$(addsuffix /rules.mk,$(TARGETS)))
|
||||||
|
|
||||||
BUILD_TARGETS := $(BUILD_TARGETS)
|
TARGETS := $(sort $(TARGETS))
|
||||||
CHECK_TARGETS := $(CHECK_TARGETS)
|
|
||||||
MEMCHECK_TARGETS := $(MEMCHECK_TARGETS)
|
|
||||||
CONTAINER_GROUP := $(CONTAINER_GROUP)
|
|
||||||
VERSION := $(VERSION)
|
|
||||||
PROJECT_ROOT := $(PROJECT_ROOT)
|
|
||||||
OUT := $(OUT)
|
|
||||||
|
|
||||||
# Macros
|
# Macros
|
||||||
|
|
||||||
@ -118,36 +136,67 @@ echo_if_silent = VERBOSE=1
|
|||||||
$(VERBOSE)echo_if_silent = echo $1
|
$(VERBOSE)echo_if_silent = echo $1
|
||||||
$(VERBOSE)SILENT := @
|
$(VERBOSE)SILENT := @
|
||||||
|
|
||||||
image_rule = $$(OUT)/docker/$1: $$(OUT)/docker/$1.dockerfile $$(EXTRACT_TARGETS) $$(PROJECT_ROOT)/Makefile; $$(call image,$1)
|
$(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_run = $(DOCKER) run $(DOCKER_RUNFLAGS) $3 \
|
||||||
|
$(addprefix --volume ,$(call container_run_volumes,$1)) \
|
||||||
|
--workdir '$(CONTAINER_OUT)/$1' \
|
||||||
|
$(PROJECT_NAME)-$1:$(VERSION) \
|
||||||
|
$2
|
||||||
|
|
||||||
|
image_rule = \
|
||||||
|
$$(OUT)/docker/$1: $$(OUT)/docker/$1.dockerfile $$(EXTRACT_TARGETS) $$(PROJECT_ROOT)/Makefile; \
|
||||||
|
$$(call image,$1)
|
||||||
image = $(SILENT) \
|
image = $(SILENT) \
|
||||||
$(call echo_if_silent,docker build $(PROJECT_NAME)-$1:$(VERSION) $(OUT)) \
|
$(call echo_if_silent,docker build $(PROJECT_NAME)-$1:$(VERSION) $(OUT)) \
|
||||||
&& $(DOCKER) build $(DOCKER_BUILDFLAGS) --iidfile $@ --file $< --tag $(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,$1,/bin/bash,--tty)
|
run_rule = \
|
||||||
run = $(SILENT) \
|
run-$1: $$(OUT)/docker/$1; \
|
||||||
$(call echo_if_silent,TARGET=$1 $2) \
|
$$(call run_recipe,$1,/bin/bash,--tty)
|
||||||
&& $(DOCKER) run $(DOCKER_RUNFLAGS) $3 \
|
run = $(call echo_if_silent,TARGET=$1 $2) && $(call container_run,$1,$2,$3)
|
||||||
--volume '$(realpath $(PROJECT_ROOT)):$(CONTAINER_WORKSPACE)' \
|
run_recipe = $(SILENT)-$(call run,$1,$2,$3)
|
||||||
--volume '$(realpath $(OUT)/$1):$(CONTAINER_WORKSPACE)/$(notdir $(OUT))' \
|
|
||||||
--workdir '$(CONTAINER_WORKSPACE)/$(notdir $(OUT))' \
|
|
||||||
$(PROJECT_NAME)-$1:$(VERSION) \
|
|
||||||
$2
|
|
||||||
|
|
||||||
configure_rule = $$(OUT)/$1/CMakeCache.txt: $$(PROJECT_ROOT)/CMakeLists.txt $$(OUT)/docker/$1; $$(call configure,$1)
|
configure_rule = \
|
||||||
configure = $(call run,$1,cmake $(CMAKEFLAGS) ..) && touch $@
|
$$(OUT)/$1/CMakeCache.txt: $$(PROJECT_ROOT)/CMakeLists.txt $$(OUT)/docker/$1; \
|
||||||
|
$$(call configure,$1)
|
||||||
|
configure = $(SILENT) \
|
||||||
|
$(call run,$1,sh -c 'cmake $(CMAKEFLAGS) $(CONTAINER_PROJECT_ROOT) && $(CONTAINER_PROJECT_ROOT)/build/discover_cc_settings.sh $(notdir $@) $(realpath $(dir $@))') \
|
||||||
|
&& touch $@
|
||||||
|
|
||||||
build_rule = build-$1: $$(OUT)/$1/CMakeCache.txt; $$(call build,$1)
|
build_rule = \
|
||||||
build = $(call run,$1,ninja $(PARALLELMFLAGS) $(GLOAS))
|
build-$1: $$(OUT)/$1/CMakeCache.txt; \
|
||||||
|
$$(call build,$1)
|
||||||
|
build = $(SILENT)$(call run,$1,ninja $(PARALLELMFLAGS) $(NINJAFLAGS) $(GOALS))
|
||||||
|
|
||||||
check_rule = check-$1: build-$1; $$(call check,$1)
|
check_rule = \
|
||||||
check = $(call run,$1,ctest $(CTESTFLAGS))
|
check-$1: build-$1;
|
||||||
|
|
||||||
memcheck_rule = memcheck-$1: build-$1; $$(call memcheck,$1)
|
memcheck_rule = \
|
||||||
memcheck = $(call run,$1,ctest -T memcheck $(CTESTFLAGS))
|
memcheck-$1: build-$1; \
|
||||||
|
$$(call memcheck,$1)
|
||||||
|
memcheck = $(SILENT)$(call run,$1,ctest -T memcheck $(CTESTFLAGS))
|
||||||
|
|
||||||
|
discover_cc_settings_rule = \
|
||||||
|
$$(OUT)/$1/include_dirs.txt: $$(OUT)/$1/CMakeCache.txt; \
|
||||||
|
$$(call discover_cc_settings,$1)
|
||||||
|
discover_cc_settings = $(SILENT) \
|
||||||
|
$(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
|
||||||
|
|
||||||
# Rules
|
# Rules
|
||||||
|
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
ifneq ($(MAKECMDGOALS),distclean)
|
||||||
-include $(RULE_TARGETS)
|
-include $(RULE_TARGETS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -166,28 +215,47 @@ $(RULE_TARGETS): $(PROJECT_ROOT)/Makefile | $(OUT_DIRS)
|
|||||||
echo '$(call memcheck_rule,$(TARGET))'; \
|
echo '$(call memcheck_rule,$(TARGET))'; \
|
||||||
echo; \
|
echo; \
|
||||||
echo '$(call run_rule,$(TARGET))'; \
|
echo '$(call run_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
|
.PHONY: all build-%
|
||||||
all: $(BUILD_TARGETS)
|
all: $(BUILD_TARGETS);
|
||||||
|
|
||||||
.PHONY: check
|
.PHONY: check check-%
|
||||||
check: $(CHECK_TARGETS)
|
check: $(CHECK_TARGETS);
|
||||||
|
|
||||||
.PHONY: memcheck
|
.PHONY: memcheck memcheck-%
|
||||||
memcheck: $(MEMCHECK_TARGETS)
|
memcheck: $(MEMCHECK_TARGETS);
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: lint lint-%
|
||||||
clean: $(CLEAN_TARGETS)
|
lint: $(LINT_TARGETS);
|
||||||
|
|
||||||
|
.PHONY: run run-%
|
||||||
|
run: $(RUN_TARGETS);
|
||||||
|
|
||||||
|
.PHONY: clean clean-%
|
||||||
|
clean: $(CLEAN_TARGETS);
|
||||||
|
|
||||||
|
.PHONY: get-deps get-deps-%
|
||||||
|
get-deps: $(EXTRACT_TARGETS);
|
||||||
|
|
||||||
|
.PHONY: discover-cc discover-cc-%
|
||||||
|
discover-cc: $(DISCOVER_CC_TARGETS);
|
||||||
|
|
||||||
|
.PHONY: distclean
|
||||||
|
distclean:
|
||||||
$(SILENT)-rm -rf $(OUT_DIRS)
|
$(SILENT)-rm -rf $(OUT_DIRS)
|
||||||
|
|
||||||
.PHONY: get-deps
|
|
||||||
get-deps: $(EXTRACT_TARGETS)
|
|
||||||
|
|
||||||
.PHONY: debug-print-%
|
.PHONY: debug-print-%
|
||||||
debug-print-%:
|
debug-print-%:
|
||||||
@printf '%s\n' '$*:' $($*)
|
@printf '%s\n' '$*:' $($*)
|
||||||
|
|
||||||
|
$(CHECK_TARGETS): GOALS := test
|
||||||
$(CHECK_TARGETS) $(MEMCHECK_TARGETS): CONTAINER_USER := user
|
$(CHECK_TARGETS) $(MEMCHECK_TARGETS): CONTAINER_USER := user
|
||||||
|
|
||||||
$(OUT)/docker/qemu-arm-static-$(QEMU_VERSION):
|
$(OUT)/docker/qemu-arm-static-$(QEMU_VERSION):
|
||||||
@ -211,6 +279,3 @@ $(OUT)/src/%: $(OUT)/%.tar.gz | $(OUT_DIRS)
|
|||||||
$(OUT_DIRS):
|
$(OUT_DIRS):
|
||||||
$(SILENT)mkdir -p $@
|
$(SILENT)mkdir -p $@
|
||||||
|
|
||||||
.PRECIOUS: $(OUT)/docker/% $(OUT)/%/CMakeCache.txt
|
|
||||||
.DELETE_ON_ERROR: $(OUT)/%/CMakeCache.txt
|
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ RUN set -x \
|
|||||||
cmake \
|
cmake \
|
||||||
ninja-build \
|
ninja-build \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
|
rsync \
|
||||||
valgrind \
|
valgrind \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
@ -70,12 +71,13 @@ ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
|
|||||||
|
|
||||||
ARG USERID=1000
|
ARG USERID=1000
|
||||||
|
|
||||||
ARG WORKSPACE=/workspace
|
ARG PROJECT_ROOT=/workspace/src
|
||||||
|
ARG OUT=/workspace/out
|
||||||
|
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& useradd -u "$USERID" -ms /bin/bash user \
|
&& useradd -u "$USERID" -ms /bin/bash user \
|
||||||
&& mkdir -p "$WORKSPACE" \
|
&& mkdir -p "$PROJECT_ROOT" "$OUT" \
|
||||||
&& chown user:user "$WORKSPACE"
|
&& chown user:user "$PROJECT_ROOT" "$OUT"
|
||||||
|
|
||||||
WORKDIR "$WORKSPACE"
|
WORKDIR "$OUT"
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ RUN set -x \
|
|||||||
cmake \
|
cmake \
|
||||||
ninja-build \
|
ninja-build \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
|
rsync \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY src /usr/local/src
|
COPY src /usr/local/src
|
||||||
@ -71,12 +72,13 @@ ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
|
|||||||
|
|
||||||
ARG USERID=1000
|
ARG USERID=1000
|
||||||
|
|
||||||
ARG WORKSPACE=/workspace
|
ARG PROJECT_ROOT=/workspace/src
|
||||||
|
ARG OUT=/workspace/out
|
||||||
|
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& useradd -u "$USERID" -ms /bin/bash user \
|
&& useradd -u "$USERID" -ms /bin/bash user \
|
||||||
&& mkdir -p "$WORKSPACE" \
|
&& mkdir -p "$PROJECT_ROOT" "$OUT" \
|
||||||
&& chown user:user "$WORKSPACE"
|
&& chown user:user "$PROJECT_ROOT" "$OUT"
|
||||||
|
|
||||||
WORKDIR "$WORKSPACE"
|
WORKDIR "$OUT"
|
||||||
|
|
||||||
|
56
build/discover_cc_settings.sh
Executable file
56
build/discover_cc_settings.sh
Executable file
@ -0,0 +1,56 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export LANG=C
|
||||||
|
export LC_ALL=C
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
rm -rf "$INCLUDE_DIRS_TMPFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup TERM INT EXIT
|
||||||
|
|
||||||
|
DEST="${DEST:-$PWD}"
|
||||||
|
|
||||||
|
CMAKE_CACHE_FILE="${1:-CMakeCache.txt}"
|
||||||
|
CMAKE_CXX_COMPILER="$(sed -n -e 's/CMAKE_CXX_COMPILER:FILEPATH=\(.*\)$/\1/p' "$CMAKE_CACHE_FILE")"
|
||||||
|
CMAKE_C_COMPILER="$(sed -n -e 's/CMAKE_C_COMPILER:FILEPATH=\(.*\)$/\1/p' "$CMAKE_CACHE_FILE")"
|
||||||
|
|
||||||
|
INCLUDE_DIRS_PREFIX="${2:-$DEST}"
|
||||||
|
INCLUDE_DIRS_TMPFILE="$(mktemp -p "$DEST" include_dirs_XXXXXXXXXX.txt)"
|
||||||
|
INCLUDE_DIRS_FILE="${INCLUDE_DIRS_FILE:-$DEST/include_dirs.txt}"
|
||||||
|
|
||||||
|
C_BUILTIN_FILE="${C_BUILTIN_FILE:-$DEST/builtins.h}"
|
||||||
|
CXX_BUILTIN_FILE="${CXX_BUILTIN_FILE:-$DEST/builtins.hpp}"
|
||||||
|
|
||||||
|
if [ -z "${RSYNC+x}" ]; then
|
||||||
|
RSYNC=rsync
|
||||||
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
|
{
|
||||||
|
echo | "$CMAKE_CXX_COMPILER" -xc++ -E -Wp,-v - 2>&1;
|
||||||
|
echo | "$CMAKE_C_COMPILER" -xc -E -Wp,-v - 2>&1;
|
||||||
|
} \
|
||||||
|
| sed -n -e 's/\s\+\(\/.*$\).*/\1/p';
|
||||||
|
|
||||||
|
sed -n -e 's/.*_INCLUDE_DIRS:INTERNAL=\(.*\)$/\1/p' "$CMAKE_CACHE_FILE";
|
||||||
|
} \
|
||||||
|
| sed 's/;/\n/g' | sed '/^$/d' | sort -u 2>/dev/null 1> "$INCLUDE_DIRS_TMPFILE"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo '#include <...> search starts here:'
|
||||||
|
sed -n -e "s@\(.*\)@$INCLUDE_DIRS_PREFIX\1@p" "$INCLUDE_DIRS_TMPFILE"
|
||||||
|
echo 'End of search list.'
|
||||||
|
} > "$INCLUDE_DIRS_FILE"
|
||||||
|
|
||||||
|
if [ -n "$RSYNC" ]; then
|
||||||
|
"$RSYNC" -arR --files-from="$INCLUDE_DIRS_TMPFILE" / "$DEST"
|
||||||
|
echo "Include folders copied to $DEST" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$CMAKE_C_COMPILER" -xc -dM -E - < /dev/null > "$C_BUILTIN_FILE"
|
||||||
|
echo "C Compiler built-ins written to $C_BUILTIN_FILE" >&2
|
||||||
|
"$CMAKE_CXX_COMPILER" -xc++ -dM -E - < /dev/null > "$CXX_BUILTIN_FILE"
|
||||||
|
echo "C++ Compiler built-ins written to $CXX_BUILTIN_FILE" >&2
|
39
build/get_container_id.sh
Executable file
39
build/get_container_id.sh
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
container_id() {
|
||||||
|
if [ "$#" -le 0 ]; then
|
||||||
|
# shellcheck disable=SC2119
|
||||||
|
container_id_by_cgroup
|
||||||
|
else
|
||||||
|
"$DOCKER" inspect --format='{{.Id}}' "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2120
|
||||||
|
container_id_by_cgroup() {
|
||||||
|
impl_container_id_by_cgroup "$@" || return "$?"
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_container_id_by_cgroup() {
|
||||||
|
file="${1:-/proc/self/cgroup}"
|
||||||
|
|
||||||
|
while IFS= read -r cmd; do
|
||||||
|
id="$(echo "$cmd" | sed -n -e 's/[^:]*:[^:]*:.*\/\([0-9a-fA-F]\+\)$/\1/p')"
|
||||||
|
if container_id "$id" >/dev/null 2>&1; then
|
||||||
|
echo "$id"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done < "$file"
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
DOCKER="${DOCKER:-docker}"
|
||||||
|
|
||||||
|
if [ -z "${CONTAINER+x}" ] && [ -n "$DOCKER" ]; then
|
||||||
|
CONTAINER="$(container_id "$@")" || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$CONTAINER"
|
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
export LANG=C
|
export LANG=C
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user