84 lines
1.6 KiB
Makefile
84 lines
1.6 KiB
Makefile
NAME ?= targeted
|
|
REPO ?= repo
|
|
|
|
RPMBUILDFLAGS = \
|
|
-D "_topdir ${PWD}" \
|
|
-D "_srcrpmdir ${PWD}" \
|
|
-D "_sourcedir ${PWD}" \
|
|
-D "_specdir ${PWD}" \
|
|
-D "_rpmdir ${PWD}"
|
|
|
|
ARCH = noarch
|
|
VERSION = $(shell rpm -q --qf '%{VERSION}' --specfile dch-selinux.spec)
|
|
RELEASE = $(shell rpm -q --qf '%{RELEASE}' --specfile dch-selinux.spec)
|
|
TAR = dch-selinux-$(VERSION).tar.xz
|
|
SPEC = dch-selinux.spec
|
|
RPM = dch-selinux-$(VERSION)-$(RELEASE).$(ARCH).rpm
|
|
SRPM = dch-selinux-$(VERSION)-$(RELEASE).src.rpm
|
|
|
|
define buildpp
|
|
$(MAKE) NAME=$(NAME) -f /usr/share/selinux/devel/Makefile
|
|
endef
|
|
|
|
.PHONY: \
|
|
clean \
|
|
default \
|
|
dist \
|
|
mockbuild \
|
|
pp \
|
|
publish \
|
|
repo \
|
|
rpm \
|
|
srpm
|
|
|
|
default: pp
|
|
|
|
dch-samba.pp: dch-samba.fc dch-samba.if dch-samba.te
|
|
$(call buildpp)
|
|
|
|
$(TAR): \
|
|
$(wildcard *.fc) \
|
|
$(wildcard *.if) \
|
|
$(wildcard *.te)
|
|
tar -cJf $@ --transform 's/^/dch-selinux-$(VERSION)\//' $^
|
|
|
|
$(RPM): $(SPEC) $(TAR)
|
|
rpmbuild $(RPMBUILDFLAGS) -bb -v $<
|
|
mv $(ARCH)/$@ $@
|
|
rmdir $(ARCH)
|
|
|
|
$(SRPM): $(SPEC) $(TAR)
|
|
rpmbuild $(RPMBUILDFLAGS) -bs -v $<
|
|
|
|
dist: $(TAR)
|
|
|
|
clean:
|
|
rm -f *.pp *.rpm *.srpm *.tar.xz
|
|
rm -rf BUILD BUILDROOT
|
|
rm -rf repo
|
|
rm -rf tmp
|
|
|
|
mockbuild: $(SRPM)
|
|
ifeq ($(MOCKTARGET),)
|
|
$(error MOCKTARGET is required, e.g. make MOCKTARGET=fedora-37-x86_64 mockbuild)
|
|
endif
|
|
mock -r '$(MOCKTARGET)' $(SRPM)
|
|
cp -a /var/lib/mock/$(MOCKTARGET)/result/*.noarch.rpm .
|
|
|
|
publish: repo
|
|
ifeq ($(PUBLISH_HOST),)
|
|
$(error PUBLISH_HOST and PUBLISH_PATH are required)
|
|
endif
|
|
rsync -rtiO --delete $(REPO)/ $(PUBLISH_HOST):$(PUBLISH_PATH)
|
|
|
|
repo:
|
|
mkdir -p '$(REPO)'
|
|
cp *.rpm '$(REPO)'/
|
|
createrepo '$(REPO)'
|
|
|
|
rpm: $(RPM)
|
|
|
|
srpm: $(SRPM)
|
|
|
|
pp: dch-samba.pp
|