diff options
Diffstat (limited to 'src/equivs.mk')
-rw-r--r-- | src/equivs.mk | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/equivs.mk b/src/equivs.mk new file mode 100644 index 0000000..d7f989a --- /dev/null +++ b/src/equivs.mk | |||
@@ -0,0 +1,27 @@ | |||
1 | ARCH := $(shell dpkg-architecture -q DEB_BUILD_ARCH) | ||
2 | ifndef VERSION | ||
3 | VERSION := $(shell TZ=UTC date -Is | tr -d :- | tr T . | sed 's/+.*//') | ||
4 | endif | ||
5 | export VERSION | ||
6 | PKG ?= $(notdir $(PWD)) | ||
7 | |||
8 | PKG_FILE ?= $(PKG)_$(VERSION)_$(ARCH).deb | ||
9 | export PKG_FILE | ||
10 | |||
11 | $(PKG_FILE): control | ||
12 | equivs-build control | ||
13 | |||
14 | equivs-stamp: control | ||
15 | $(MAKE) $(PKG_FILE) | ||
16 | $(MAKE) install-remove-equivs | ||
17 | rm $(PKG_FILE) | ||
18 | touch $@ | ||
19 | |||
20 | .PHONY: install-remove-equivs | ||
21 | install-remove-equivs: | ||
22 | ifneq (0,$(shell id -u)) | ||
23 | sudo $(MAKE) PKG_FILE=$(PKG_FILE) MAKEFLAGS=$(MAKEFLAGS) $@ | ||
24 | else | ||
25 | dpkg -i $(PKG_FILE) | ||
26 | f=$(PKG_FILE); dpkg -r $${f%%_*} | ||
27 | endif | ||