forked from falk-werner/webfuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
123 lines (91 loc) · 4.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
SHELL := /bin/sh
MAKEFILE := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
MAKEFLAGS += --no-builtin-rules
.SUFFIXES:
.PHONY: default
default: all
#######################################################################################################################
# Overridable project defaults
DOBUILD_DOCKERFILE ?= $(PROJECTDIR)/build/%MARCH%-%DISTRIB_ID%-%ID%.dockerfile
DOBUILD_EXTDIR ?= $(PROJECTDIR)/build/dobuild-extensions
DOBUILD_PROJECTDIR ?= $(patsubst %/,%,$(dir $(MAKEFILE)))
DOBUILD_GENERIC_ADAPTER ?= meson
DOBUILDDIR ?= $(PROJECTDIR)/build/dobuild
PROJECTDIR = $(DOBUILD_PROJECTDIR)
include $(DOBUILDDIR)/defaults.mk
#######################################################################################################################
# Project defaults and macros
DEFAULTTARGET = x86_64-ubuntu@bionic+builder@debug
FETCHDIR = $(BUILDDIR)/.deps
dobuild_image_buildargs = \
$(addprefix MARCH=,%MARCH%) \
$(addprefix DISTRIB_VERSION=,%DISTRIB_VERSION%) \
$(addprefix USERID=,$(USERID))
#######################################################################################################################
# Project dependencies
DUMB_INIT_VERSION ?= 1.2.2
IMAGE_BUILDARGS += DUMB_INIT_VERSION=$(DUMB_INIT_VERSION)
FETCH_TARGETS += $(FETCHDIR)/dumb-init-$(DUMB_INIT_VERSION).tar.gz
$(FETCHDIR)/dumb-init-$(DUMB_INIT_VERSION).tar.gz: URL := https://github.com/Yelp/dumb-init/archive/v${DUMB_INIT_VERSION}.tar.gz
$(SKIP_MD5SUM)$(FETCHDIR)/dumb-init-$(DUMB_INIT_VERSION).tar.gz: MD5 := 6166084b05772cdcf615a762c6f3b32e
FUSE_VERSION ?= 3.9.1
IMAGE_BUILDARGS += FUSE_VERSION=$(FUSE_VERSION)
FETCH_TARGETS += $(FETCHDIR)/libfuse-fuse-$(FUSE_VERSION).tar.gz
$(FETCHDIR)/libfuse-fuse-$(FUSE_VERSION).tar.gz: URL := https://github.com/libfuse/libfuse/archive/fuse-$(FUSE_VERSION).tar.gz
$(SKIP_MD5SUM)$(FETCHDIR)/libfuse-fuse-$(FUSE_VERSION).tar.gz: MD5 := 5f7c1062def710d8b60343524a18cc82
QEMU_VERSION ?= v4.1.0-1
IMAGE_BUILDARGS += QEMU_VERSION_=$(QEMU_VERSION)
FETCH_TARGETS += $(FETCHDIR)/qemu-arm-static-$(QEMU_VERSION)
$(FETCHDIR)/qemu-arm-static-$(QEMU_VERSION): URL := https://github.com/multiarch/qemu-user-static/releases/download/$(QEMU_VERSION)/qemu-arm-static
$(SKIP_MD5SUM)$(FETCHDIR)/qemu-arm-static-$(QEMU_VERSION): MD5 := e508e6e4dd7f3a851207aac245a4653f
#######################################################################################################################
# Architecture-specific rule target configuration
GENERIC_TARGETS += $(call target_properties_combine,\
,\
x86_64 arm32v7,\
ubuntu@bionic alpine@3.9,\
,\
,\
builder,\
,\
debug release coverage minsize \
)
DOCKER_TARGETS += $(GENERIC_TARGETS)
#######################################################################################################################
# Common rule target configuration
CURLFLAGS += -s
DOCKER_RUNFLAGS += --device /dev/fuse
DOCKER_RUNFLAGS += --cap-add SYS_ADMIN
DOCKER_RUNFLAGS += --security-opt apparmor:unconfined
DOCKER_RUNFLAGS += --cap-add SYS_PTRACE
DOCKER_RUNFLAGS += --security-opt seccomp=unconfined
OUTDIRS += $(OUTDIR)/src
OUTDIRS += $(OUTDIR)/docker
EXTRACT_TARGETS += $(OUTDIR)/docker/qemu-arm-static-$(QEMU_VERSION)
EXTRACT_TARGETS += $(patsubst $(FETCHDIR)/%.tar.gz,$(OUTDIR)/src/%,$(FETCH_TARGETS))
#######################################################################################################################
# Makefile dependencies
MAKEFILE_DEPS += gzip
MAKEFILE_DEPS += tar
MAKEFILE_DEPS += chmod
MAKEFILE_DEPS += touch
MAKEFILE_DEPS += cp
#######################################################################################################################
# Rules
include $(DOBUILDDIR)/docker.mk
include $(DOBUILDDIR)/standardrules.mk
$(FETCH_TARGETS): | $(FETCHDIR)
$(SILENT)$(call curl,$@,$(URL),$(MD5))
$(OUTDIR)/docker/qemu-arm-static-$(QEMU_VERSION) : $(FETCHDIR)/qemu-arm-static-$(QEMU_VERSION) | $(OUTDIRS)
$(SILENT) \
$(call echo_if_silent_cmd,cp $< $@) \
&& cp $< $@ \
&& chmod +x $@
$(OUTDIR)/src/%: $(FETCHDIR)/%.tar.gz | $(OUTDIRS)
$(SILENT) \
$(call echo_if_silent_cmd,tar -C $(dir $@) -xf $<) \
&& tar -I 'gzip -n' -C $(dir $@) -xf $< \
&& touch $@
$(FETCHDIR):
$(SILENT)mkdir -p $@
.DELETE_ON_ERROR: $(FETCH_TARGETS)