-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile.linux
69 lines (52 loc) · 2.5 KB
/
Makefile.linux
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
SPK_VERSION = $(shell grep Version spk.spec | cut -d ' ' -f 2)
SPFS_VERSION = $(shell cat spfs.spec | grep Version | cut -d ' ' -f 2)
CARGO_TARGET_DIR := $(shell \
if test -f .cargo/config.toml; \
then (grep target-dir .cargo/config.toml || echo target) | sed -sE 's|.*"(.*)".*|\1|'; \
else echo target; \
fi)
export PLATFORM ?= unix
ifeq ($(PLATFORM),windows)
spfs_packages := $(spfs_packages),spfs-cli-winfsp
CARGO_ARGS += --target x86_64-pc-windows-gnu
# swap cargo for cross when building for other platforms
CARGO = cross
else
spfs_packages := $(spfs_packages),spfs-cli-fuse,spfs-cli-monitor
endif
prefix ?= /usr/local
bindir ?= $(prefix)/bin
install-debug-spfs: copy-debug-spfs setcap
install-debug-spk: copy-debug-spk
install-debug: install-debug-spfs install-debug-spk
install: copy-release setcap
install-spfs: copy-spfs setcap
install-dirs:
mkdir -p '$(DESTDIR)$(bindir)'
copy-debug: copy-debug-spfs copy-debug-spk
copy-debug-spfs: debug-spfs install-dirs
for bin in $(CARGO_TARGET_DIR)/debug/spfs*; do sudo install -p -m 755 $$bin '$(DESTDIR)$(bindir)'; done
copy-debug-spk: debug install-dirs
sudo install -p -m 755 $(CARGO_TARGET_DIR)/debug/spk '$(DESTDIR)$(bindir)'
copy-release: release copy-spfs install-dirs
sudo install -p -m 755 $(CARGO_TARGET_DIR)/release/spk '$(DESTDIR)$(bindir)'
copy-spfs: release-spfs install-dirs
for bin in $(CARGO_TARGET_DIR)/release/spfs*; do sudo install -p -m 755 $$bin '$(DESTDIR)$(bindir)'; done
setcap:
sudo setcap 'cap_dac_override,cap_fowner+ep' '$(DESTDIR)$(bindir)/spfs-clean'
sudo setcap 'cap_net_admin+ep' '$(DESTDIR)$(bindir)/spfs-monitor'
sudo setcap 'cap_chown,cap_fowner+ep' '$(DESTDIR)$(bindir)/spfs-render'
sudo setcap 'cap_sys_chroot,cap_sys_admin+ep' '$(DESTDIR)$(bindir)/spfs-join'
sudo setcap 'cap_dac_override,cap_setuid,cap_chown,cap_mknod,cap_sys_admin,cap_fowner+ep' '$(DESTDIR)$(bindir)/spfs-enter'
sudo setcap 'cap_sys_admin+ep' '$(DESTDIR)$(bindir)/spfs-fuse'
.PHONY: check-copyrights
check-copyrights: check-copyrights-exist check-copyrights-spacing
.PHONY: check-copyrights-exist
check-copyrights-exist:
# basic check to ensure that the copyright appears in each source file
grep -LR --include="*.rs" "// Copyright (c) Contributors to the SPK project." ./crates/ || exit 1
.PHONY: check-copyrights-spacing
check-copyrights-spacing:
# basic check to ensure that the copyright notice is followed by
# a blank line, as this ensures good automated import management
grep -zLRP --include="*.rs" "// https://github.com/spkenv/spk\s{2}" ./crates/ || exit 1