forked from nrgaway/qubes-core-libvirt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
103 lines (79 loc) · 2.23 KB
/
Makefile.common
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
#
# Common Makefile for building RPMs
#
WORKDIR := $(shell pwd)
SPECDIR ?= $(WORKDIR)
SRCRPMDIR ?= $(WORKDIR)/srpm
BUILDDIR ?= $(WORKDIR)
RPMDIR ?= $(WORKDIR)/rpm
SOURCEDIR := $(WORKDIR)
VERSION := $(shell cat version)
EPOCH := $(shell cat epoch)
RPM_DEFINES := --define "_sourcedir $(SOURCEDIR)" \
--define "_specdir $(SPECDIR)" \
--define "_builddir $(BUILDDIR)" \
--define "_srcrpmdir $(SRCRPMDIR)" \
--define "_rpmdir $(RPMDIR)" \
--define "version $(VERSION)" \
--define "epoch $(EPOCH)" \
--define "_default_patch_fuzz 3"
ifndef NAME
$(error "You can not run this Makefile without having NAME defined")
endif
all: help
URL := \
https://libvirt.org/sources/libvirt-$(VERSION).tar.xz \
https://libvirt.org/sources/python/libvirt-python-$(VERSION).tar.gz
ifndef SRC_FILE
ifdef URL
SRC_FILE := $(notdir $(URL))
endif
endif
DISTFILES_MIRROR ?=
ifneq ($(DISTFILES_MIRROR),)
URL := $(addprefix $(DISTFILES_MIRROR)/,$(SRC_FILE))
endif
get-sources: $(SRC_FILE)
$(SRC_FILE):
ifneq ($(SRC_FILE), None)
@wget -q $(URL)
@wget -q $(addsuffix .asc,$(URL))
endif
.PHONY: import-keys
import-keys:
@if [ -n "$$GNUPGHOME" ]; then rm -f "$$GNUPGHOME/core-libvirt-trustedkeys.gpg"; fi
@gpg --no-auto-check-trustdb --no-default-keyring --keyring core-libvirt-trustedkeys.gpg -q --import *-key.asc
.PHONY: verify-sources
verify-sources: import-keys
ifneq ($(SRC_FILE), None)
@for f in $(SRC_FILE); do \
gpgv --keyring core-libvirt-trustedkeys.gpg $$f.asc $$f 2>/dev/null || \
{ echo "Wrong signature on $$f!"; exit 1; }; \
done
endif
.PHONY: clean-sources
clean-sources:
ifneq ($(SRC_FILE), None)
-rm $(SRC_FILE)
endif
#RPM := rpmbuild --buildroot=/dev/shm/buildroot/
RPM := rpmbuild
RPM_WITH_DIRS = $(RPM) $(RPM_DEFINES)
rpms: get-sources $(SPECFILE)
$(RPM_WITH_DIRS) -bb $(SPECFILE)
srpm: get-sources $(SPECFILE)
$(RPM_WITH_DIRS) -bs $(SPECFILE)
verrel:
@echo $(NAME)-$(VERSION)-$(RELEASE)
# mop up, printing out exactly what was mopped.
.PHONY : clean
clean ::
@echo "Running the %clean script of the rpmbuild..."
$(RPM_WITH_DIRS) --clean --nodeps $(SPECFILE)
help:
@echo "Usage: make <target>"
@echo
@echo "prep Just do the prep"
@echo "rpms Build rpms"
@echo "srpm Create an srpm"
@echo