From 7bb70e203a5b178d4b4c6f8e2af508be64cf4dad Mon Sep 17 00:00:00 2001 From: James Duley Date: Fri, 31 Jul 2015 19:17:31 +0100 Subject: [PATCH] LP-80 extend linux packaging: added basis for rpm Change-Id: I3d00fd1801375abadb1ea0057469f5ba710d15dc --- Makefile | 3 +- package/Linux.mk | 12 +++++- package/linux/rpm.mk | 37 +++++++++++++++++++ package/linux/{librepilot.spec => rpmspec.in} | 15 ++++---- 4 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 package/linux/rpm.mk rename package/linux/{librepilot.spec => rpmspec.in} (90%) diff --git a/Makefile b/Makefile index e8f8d5516..66ca9049a 100644 --- a/Makefile +++ b/Makefile @@ -735,7 +735,8 @@ PACKAGE_SEP := - PACKAGE_FULL_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL) # Source distribution is never dirty because it uses git archive -DIST_NAME := $(subst -dirty,,$(PACKAGE_FULL_NAME)) +DIST_LBL := $(subst -dirty,,$(PACKAGE_LBL)) +DIST_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(DIST_LBL) DIST_TAR := $(DIST_DIR)/$(DIST_NAME).tar DIST_TAR_GZ := $(DIST_TAR).gz DIST_VER_INFO := $(DIST_DIR)/version-info.json diff --git a/package/Linux.mk b/package/Linux.mk index 255c23b66..3dc9ad7b4 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -9,7 +9,17 @@ endif # Are we using a debian based distro? ifneq ($(shell which dpkg 2> /dev/null),) include $(ROOT_DIR)/package/linux/deb.mk -endif # Debian based distro? +endif + +# Are we using a rpm based distro? +ifneq ($(shell which rpm 2> /dev/null),) + include $(ROOT_DIR)/package/linux/rpm.mk +endif + +# Are we using an Arch based distro? +ifneq ($(shell which makepkg 2> /dev/null),) + $(info TODO: built in arch package) +endif ############################## # diff --git a/package/linux/rpm.mk b/package/linux/rpm.mk new file mode 100644 index 000000000..789c1ce30 --- /dev/null +++ b/package/linux/rpm.mk @@ -0,0 +1,37 @@ +RPM_NAME := $(PACKAGE_NAME) +UPSTREAM_VER := $(subst -,~,$(subst RELEASE-,,$(DIST_LBL))) +RPM_REL := 1 +RPM_ARCH := $(shell rpm --eval '%{_arch}') +RPM_PACKAGE_NAME := $(RPM_NAME)-$(UPSTREAM_VER)-$(RPM_REL)$(shell rpm --eval '%{?dist}').$(RPM_ARCH).rpm +RPM_PACKAGE_FILE := $(PACKAGE_DIR)/RPMS/$(RPM_ARCH)/$(RPM_PACKAGE_NAME) + +SED_SCRIPT := sed -i -e ' \ + s//$(UPSTREAM_VER)/g; \ + s//$(RPM_NAME)/g; \ + s//$(RPM_REL)/g; \ + s//$(notdir $(DIST_TAR_GZ))/g; \ + s//$(PACKAGE_NAME)/g; \ + ' + +RPM_DIRS := $(addprefix $(PACKAGE_DIR)/,BUILD RPMS SOURCES SPECS SRPMS) +DIRS += $(RPM_DIRS) + +SPEC_FILE := $(PACKAGE_DIR)/SPECS/$(RPM_NAME).spec +SPEC_FILE_IN := $(ROOT_DIR)/package/linux/rpmspec.in + +.PHONY: rpmspec +rpmspec: $(SPEC_FILE) + +$(SPEC_FILE): $(SPEC_FILE_IN) | $(RPM_DIRS) + $(V1) cp -f $(SPEC_FILE_IN) $(SPEC_FILE) + $(V1) $(SED_SCRIPT) $(SPEC_FILE) + + +.PHONY: package +package: $(RPM_PACKAGE_FILE) + +$(RPM_PACKAGE_FILE): $(SPEC_FILE) $(DIST_TAR_GZ) | $(RPM_DIRS) + @$(ECHO) "Building $(RPM_PACKAGE_NAME), please wait..." + $(V1) ln -sf $(DIST_TAR_GZ) $(PACKAGE_DIR)/SOURCES + $(V1) rpmbuild -bb --define "_topdir $(PACKAGE_DIR)" $(SPEC_FILE) + diff --git a/package/linux/librepilot.spec b/package/linux/rpmspec.in similarity index 90% rename from package/linux/librepilot.spec rename to package/linux/rpmspec.in index 5d653644e..e89595840 100644 --- a/package/linux/librepilot.spec +++ b/package/linux/rpmspec.in @@ -1,16 +1,13 @@ - -%global gitrev g07deb66 - -Name: LibrePilot +Name: Summary: Ground Control Station -Version: 0.0 -Release: 1.git%{gitrev}%{?dist} +Version: +Release: Group: Applications/Scientific License: GPLv3+ URL: http://forum.librepilot.org/ -Source0: https://github.com/librepilot/%{name}/archive/%{name}-%{version}-%{gitrev}.tar.gz +Source0: BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -25,6 +22,7 @@ BuildRequires: qt5-qtscript-devel BuildRequires: qt5-qtserialport-devel BuildRequires: qt5-qtsvg-devel BuildRequires: qt5-qttools-devel +BuildRequires: qt5-qttranslations BuildRequires: dwz BuildRequires: pkgconfig BuildRequires: python @@ -33,6 +31,7 @@ BuildRequires: systemd-devel Requires: libusbx Requires: SDL +Requires: qt5-qtquickcontrols Requires: qt5-qtdeclarative Requires: qt5-qtmultimedia Requires: qt5-qtscript @@ -50,7 +49,7 @@ and ease of use. %prep -%setup -q -n %{name}-%{version}-%{gitrev} +%setup -q -n %{name}-%{version} %build