-
Notifications
You must be signed in to change notification settings - Fork 36
/
Makefile.in
170 lines (130 loc) · 5 KB
/
Makefile.in
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
164
165
166
167
168
169
170
PROJECT := umu-launcher
# Define the interpreters to use to prevent shebang complaints
PYTHON_INTERPRETER = /usr/bin/env python3
# If this is changed to umu (uppercase), `uninstall` target will also remove the SLR directory
INSTALLDIR ?= umu
OBJDIR := builddir
PREFIX ?= /usr
BINDIR := $(PREFIX)/bin
LIBDIR := $(PREFIX)/lib
DATADIR := $(PREFIX)/share
MANDIR := $(DATADIR)/man
PYTHONDIR := $(shell $(PYTHON_INTERPRETER) -c "import site; print(site.getsitepackages()[0])")
DESTDIR ?=
USERINSTALL ?= xfalse
FLATPAK ?= xfalse
.PHONY: all
ifeq ($(FLATPAK), xtrue)
all: umu-dist umu-launcher umu-vendored
endif
.PHONY: install
ifeq ($(USERINSTALL), xtrue)
SOURCE_DATE_EPOCH = $(shell LC_ALL=C date --date='@1580601600')
all: zipapp
install: zipapp-install
else
all: umu-dist umu-docs umu-launcher umu-vendored
install: umu-install umu-launcher-install umu-vendored-install
endif
$(OBJDIR)/.build-umu-docs: | $(OBJDIR)
$(info :: Building umu man pages )
scdoc < docs/umu.1.scd > $(OBJDIR)/umu.1
scdoc < docs/umu.5.scd > $(OBJDIR)/umu.5
touch $(@)
.PHONY: umu-docs
umu-docs: $(OBJDIR)/.build-umu-docs
umu-docs-install: umu-docs
$(info :: Installing umu man pages )
install -d $(DESTDIR)$(MANDIR)/man1
install -d $(DESTDIR)$(MANDIR)/man5
install -m644 $(OBJDIR)/umu.1 $(DESTDIR)$(MANDIR)/man1/umu.1
install -m644 $(OBJDIR)/umu.5 $(DESTDIR)$(MANDIR)/man5/umu.5
$(OBJDIR)/.build-umu-dist: | $(OBJDIR)
$(info :: Building umu )
$(PYTHON_INTERPRETER) -m build --wheel --skip-dependency-check --no-isolation --outdir=$(OBJDIR)
touch $(@)
.PHONY: umu-dist
umu-dist: $(OBJDIR)/.build-umu-dist
umu-dist-install: umu-dist
$(info :: Installing umu )
install -d $(DESTDIR)$(PYTHONDIR)/$(INSTALLDIR)
$(PYTHON_INTERPRETER) -m installer --destdir=$(DESTDIR) $(OBJDIR)/*.whl
ifeq ($(FLATPAK), xtrue)
umu-install: umu-dist-install
else
umu-install: umu-dist-install umu-docs-install
endif
ifeq ($(FLATPAK), xtrue)
UMU_LAUNCHER_COMMAND = org.openwinecomponents.umu.umu-launcher
else
UMU_LAUNCHER_COMMAND = $(BINDIR)/umu-run
endif
# umu-launcher is separate to allow control over installing the bin target
$(OBJDIR)/.build-umu-launcher: | $(OBJDIR)
$(info :: Building umu-launcher )
sed 's|##INSTALL_PATH##|$(UMU_LAUNCHER_COMMAND)|g' umu/umu-launcher/umu-run.in > $(OBJDIR)/umu-launcher-run
touch $(@)
.PHONY: umu-launcher
umu-launcher: $(OBJDIR)/.build-umu-launcher
umu-launcher-bin-install: umu-launcher
install -d $(DESTDIR)$(DATADIR)/steam/compatibilitytools.d/umu-launcher
install -Dm 755 $(OBJDIR)/$(<)-run $(DESTDIR)$(DATADIR)/steam/compatibilitytools.d/umu-launcher/umu-run
umu-launcher-dist-install:
$(info :: Installing umu-launcher )
install -d $(DESTDIR)$(DATADIR)/steam/compatibilitytools.d/umu-launcher
install -Dm 644 umu/umu-launcher/compatibilitytool.vdf -t $(DESTDIR)$(DATADIR)/steam/compatibilitytools.d/umu-launcher
install -Dm 644 umu/umu-launcher/toolmanifest.vdf -t $(DESTDIR)$(DATADIR)/steam/compatibilitytools.d/umu-launcher
umu-launcher-install: umu-launcher-dist-install umu-launcher-bin-install
$(OBJDIR)/.build-umu-vendored: | $(OBJDIR)
$(info :: Building vendored dependencies )
python3 -m pip install urllib3 -t $(OBJDIR)
.PHONY: umu-vendored
umu-vendored: $(OBJDIR)/.build-umu-vendored
umu-vendored-install: umu-vendored
$(info :: Installing subprojects )
install -d $(DESTDIR)$(PYTHONDIR)/umu/_vendor
cp -r $(OBJDIR)/urllib3 $(DESTDIR)$(PYTHONDIR)/umu/_vendor
$(OBJDIR):
@mkdir -p $(@)
.PHONY: clean
clean:
$(info :: Cleaning source directory )
@rm -rf -v ./$(RELEASEDIR) $(RELEASEDIR).tar.gz
RELEASEDIR := $(PROJECT)-$(shell git describe --abbrev=0)
$(RELEASEDIR):
mkdir -p $(@)
.PHONY: release
release: $(RELEASEDIR) | zipapp
$(info :: Creating source distribution for release )
mkdir -p $(<)
rm -rf umu/__pycache__
cp -r umu packaging Makefile.in configure.sh README.md LICENSE $(<)
tar -cvzf $(<).tar.gz $(<)
cp -a $(ZIPAPP) .
sha512sum umu-run > umu-run.sha512sum
.PHONY: uninstall
# NEVER use a wildcard here
uninstall:
$(info :: Removing $(INSTALLDIR) files in $(DESTDIR)$(BINDIR) )
@rm -rf -v --preserve-root=all $(DESTDIR)$(BINDIR)/umu-run
ZIPAPP := $(OBJDIR)/umu-run
ZIPAPP_STAGING := $(OBJDIR)/zipapp_staging
ZIPAPP_VENV := $(OBJDIR)/zipapp_venv
$(OBJDIR)/.build-zipapp: | $(OBJDIR)
$(info :: Building umu-launcher as zipapp )
$(PYTHON_INTERPRETER) -m venv $(ZIPAPP_VENV)
. $(ZIPAPP_VENV)/bin/activate && python3 -m pip install -t "$(ZIPAPP_STAGING)" -U --no-compile . truststore
rm -r "$(ZIPAPP_STAGING)"/bin
cp umu/__main__.py "$(ZIPAPP_STAGING)"
find "$(ZIPAPP_STAGING)" -exec touch -h -d "$(SOURCE_DATE_EPOCH)" {} +
. $(ZIPAPP_VENV)/bin/activate && python3 -m zipapp $(ZIPAPP_STAGING) -o $(ZIPAPP) -p "$(PYTHON_INTERPRETER)" -c
touch -d "$(SOURCE_DATE_EPOCH)" $(ZIPAPP)
touch $(@)
.PHONY: zipapp
zipapp: $(OBJDIR)/.build-zipapp
zipapp-install: zipapp
$(info :: Installing umu-launcher as zipapp )
install -d $(DESTDIR)$(PREFIX)/bin
install -Dm755 -p $(ZIPAPP) $(DESTDIR)$(BINDIR)
@echo "Standalone application 'umu-run' created at '$(DESTDIR)$(PREFIX)/bin'"
# vim: ft=make