LP-559 Update Revo HW tab with vector picture
[librepilot.git] / package / linux / rpm.mk
blob4528bcdd7572fb479c8cf765817e6c9ce501a716
1 RPM_NAME := $(PACKAGE_NAME)
2 UPSTREAM_VER := $(subst -,~,$(subst RELEASE-,,$(DIST_LBL)))
3 RPM_REL := 1
4 RPM_ARCH := $(shell rpm --eval '%{_arch}')
5 RPM_PACKAGE_NAME := $(RPM_NAME)-$(UPSTREAM_VER)-$(RPM_REL)
6 RPM_PACKAGE_FILE := $(PACKAGE_DIR)/RPMS/$(RPM_ARCH)/$(RPM_PACKAGE_NAME)$(shell rpm --eval '%{?dist}').$(RPM_ARCH).rpm
7 RPM_PACKAGE_SRC := $(PACKAGE_DIR)/SRPMS/$(RPM_PACKAGE_NAME).src.rpm
9 SED_SCRIPT := $(SED_SCRIPT)' \
10 s/<VERSION>/$(UPSTREAM_VER)/g; \
11 s/<NAME>/$(RPM_NAME)/g; \
12 s/<RELEASE>/$(RPM_REL)/g; \
13 s/<SOURCE0>/$(notdir $(DIST_TAR_GZ))/g; \
14 s/<SOURCE1>/$(notdir $(FW_DIST_TAR_GZ))/g; \
15 s/<SUMMARY>/$(DESCRIPTION_SHORT)/g; \
16 s/<DESCRIPTION>/$(subst ','"'"',$(subst $(NEWLINE),\n,$(DESCRIPTION_LONG)))/g; \
19 RPM_DIRS := $(addprefix $(PACKAGE_DIR)/,BUILD RPMS SOURCES SPECS SRPMS)
20 DIRS += $(RPM_DIRS)
22 SPEC_FILE := $(PACKAGE_DIR)/SPECS/$(RPM_NAME).spec
23 SPEC_FILE_IN := $(ROOT_DIR)/package/linux/rpmspec.in
25 .PHONY: rpmspec
26 rpmspec: $(SPEC_FILE)
28 $(SPEC_FILE): $(SPEC_FILE_IN) $(DIST_VER_INFO) | $(RPM_DIRS)
29 $(V1) cp -f $(SPEC_FILE_IN) $(SPEC_FILE)
30 $(V1) $(SED_SCRIPT) $(SPEC_FILE)
33 .PHONY: package
34 package: $(RPM_PACKAGE_FILE)
35 $(RPM_PACKAGE_FILE): RPMBUILD_OPTS := -bb
37 .PHONY: package_src
38 package_src: $(RPM_PACKAGE_SRC)
39 $(RPM_PACKAGE_SRC): RPMBUILD_OPTS := -bs
41 .PHONY: package_src_upload
42 package_src_upload: $(RPM_PACKAGE_SRC)
43 copr-cli build --nowait $(COPR_PROJECT) $(RPM_PACKAGE_SRC)
45 $(RPM_PACKAGE_FILE) $(RPM_PACKAGE_SRC): $(SPEC_FILE) $(DIST_TAR_GZ) $(FW_DIST_TAR_GZ) | $(RPM_DIRS)
46 @$(ECHO) "Building $(call toprel,$@), please wait..."
47 $(V1) ln -sf $(DIST_TAR_GZ) $(PACKAGE_DIR)/SOURCES
48 $(V1) ln -sf $(FW_DIST_TAR_GZ) $(PACKAGE_DIR)/SOURCES
49 $(V1) rpmbuild $(RPMBUILD_OPTS) --define "_topdir $(PACKAGE_DIR)" $(SPEC_FILE)