-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
163 lines (130 loc) · 4.66 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
.PHONY : compile_flags.txt
LIBSYSTEMD_CFLAGS := $(shell pkg-config --cflags libsystemd)
LIBSYSTEMD_LDLIBS := $(shell pkg-config --libs libsystemd)
DBUS_CFLAGS := $(shell pkg-config --cflags dbus-1)
DBUS_LDLIBS := $(shell pkg-config --libs dbus-1)
CXX := g++
CXXFLAGS := \
-DZYPAK_RELEASE="\"$(shell git describe --tags --dirty)\"" \
-fstack-protector-all -fstack-clash-protection -Wall -Werror \
-std=c++20 -g -pthread \
-Inickle -Isrc \
$(LIBSYSTEMD_CFLAGS) $(DBUS_CFLAGS)
BUILD := build
OBJ := $(BUILD)/obj
include rules.mk
all :
# Anything that the preload libs depend on needs to be build with -fPIC, since the preload libs
# are so files can can only have objects built with -fPIC.
pic_NAME := pic
pic_PUBLIC_CXXFLAGS := -fPIC
base_NAME := base
base_DEPS := pic
base_PUBLIC_LIBS := $(LIBSYSTEMD_LDLIBS)
base_SOURCES := \
debug_internal/log_stream.cc \
debug.cc \
env.cc \
evloop.cc \
fd_map.cc \
launcher.cc \
socket.cc \
strace.cc \
$(call build_stlib,base)
dbus_NAME := dbus
dbus_DEPS := pic
dbus_PUBLIC_LIBS := $(DBUS_LDLIBS)
dbus_SOURCES := \
bus.cc \
bus_error.cc \
bus_readable_message.cc \
bus_writable_message.cc \
flatpak_portal_proxy.cc \
internal/bus_thread.cc \
$(call build_stlib,dbus)
preload_PUBLIC_LIBS := -ldl
preload_host_SOURCE_DIR := preload/host
preload_host_NAME := zypak-preload-host
preload_host_DEPS := preload base
preload_host_SOURCES := \
exec_zypak_sandbox.cc \
sandbox_path.cc \
sandbox_suid.cc \
$(call build_shlib,preload_host)
preload_host_mimic_strategy_SOURCE_DIR := preload/host/mimic_strategy
preload_host_mimic_strategy_NAME := zypak-preload-host-mimic-strategy
preload_host_mimic_strategy_DEPS := preload base
preload_host_mimic_strategy_SOURCES := \
initialize.cc \
$(call build_shlib,preload_host_mimic_strategy)
preload_host_spawn_strategy_SOURCE_DIR := preload/host/spawn_strategy
preload_host_spawn_strategy_NAME := zypak-preload-host-spawn-strategy
preload_host_spawn_strategy_DEPS := preload dbus base
preload_host_spawn_strategy_SOURCES := \
bus_safe_fork.cc \
initialize.cc \
process_override.cc \
spawn_launcher_delegate.cc \
supervisor.cc \
$(call build_shlib,preload_host_spawn_strategy)
preload_host_spawn_strategy_close_SOURCE_DIR := preload/host/spawn_strategy/close
preload_host_spawn_strategy_close_NAME := zypak-preload-host-spawn-strategy-close
preload_host_spawn_strategy_close_DEPS := preload base
preload_host_spawn_strategy_close_SOURCES := \
no_close_host_fd.cc \
$(call build_shlib,preload_host_spawn_strategy_close)
preload_child_SOURCE_DIR := preload/child
preload_child_NAME := zypak-preload-child
preload_child_DEPS := preload base
preload_child_SOURCES := \
bwrap_pid.cc \
$(call build_shlib,preload_child)
preload_child_mimic_strategy_SOURCE_DIR := preload/child/mimic_strategy
preload_child_mimic_strategy_NAME := zypak-preload-child-mimic-strategy
preload_child_mimic_strategy_DEPS := preload base
preload_child_mimic_strategy_SOURCES := \
fd_storage.cc \
initialize.cc \
localtime.cc \
open_urandom.cc \
$(call build_shlib,preload_child_mimic_strategy)
preload_child_spawn_strategy_SOURCE_DIR := preload/child/spawn_strategy
preload_child_spawn_strategy_NAME := zypak-preload-child-spawn-strategy
preload_child_spawn_strategy_DEPS := preload dbus base
preload_child_spawn_strategy_SOURCES := \
chroot_fake.cc \
$(call build_shlib,preload_child_spawn_strategy)
sandbox_NAME := zypak-sandbox
sandbox_DEPS := base
sandbox_SOURCES := \
main.cc \
mimic_strategy/fork.cc \
mimic_strategy/mimic_launcher_delegate.cc \
mimic_strategy/reap.cc \
mimic_strategy/status.cc \
mimic_strategy/zygote.cc \
spawn_strategy/run.cc \
$(call build_exe,sandbox)
helper_NAME := zypak-helper
helper_DEPS := dbus base
helper_SOURCES := \
chroot_helper.cc \
main.cc \
spawn_latest.cc \
$(call build_exe,helper)
compile_flags.txt :
echo -xc++ $(CXXFLAGS) | tr ' ' '\n' > compile_flags.txt
clean :
rm -rf $(BUILD)
install : all
install -Dm 755 -t $(FLATPAK_DEST)/bin zypak-wrapper.sh
ln -sf $(FLATPAK_DEST)/bin/zypak-wrapper{.sh,}
install -Dm 755 -t $(FLATPAK_DEST)/bin build/zypak-helper
install -Dm 755 -t $(FLATPAK_DEST)/bin build/zypak-sandbox
install -Dm 755 -t $(FLATPAK_DEST)/lib build/libzypak-preload-host.so
install -Dm 755 -t $(FLATPAK_DEST)/lib build/libzypak-preload-host-mimic-strategy.so
install -Dm 755 -t $(FLATPAK_DEST)/lib build/libzypak-preload-host-spawn-strategy.so
install -Dm 755 -t $(FLATPAK_DEST)/lib build/libzypak-preload-host-spawn-strategy-close.so
install -Dm 755 -t $(FLATPAK_DEST)/lib build/libzypak-preload-child.so
install -Dm 755 -t $(FLATPAK_DEST)/lib build/libzypak-preload-child-mimic-strategy.so
install -Dm 755 -t $(FLATPAK_DEST)/lib build/libzypak-preload-child-spawn-strategy.so