1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

LP-80 extend linux packaging: added basis for rpm

Change-Id: I3d00fd1801375abadb1ea0057469f5ba710d15dc
This commit is contained in:
James Duley 2015-07-31 19:17:31 +01:00
parent 57f9003833
commit 7bb70e203a
4 changed files with 57 additions and 10 deletions

View File

@ -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

View File

@ -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
##############################
#

37
package/linux/rpm.mk Normal file
View File

@ -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/<VERSION>/$(UPSTREAM_VER)/g; \
s/<NAME>/$(RPM_NAME)/g; \
s/<RELEASE>/$(RPM_REL)/g; \
s/<SOURCE>/$(notdir $(DIST_TAR_GZ))/g; \
s/<ARCHIVE_PREFIX>/$(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)

View File

@ -1,16 +1,13 @@
%global gitrev g07deb66
Name: LibrePilot
Name: <NAME>
Summary: Ground Control Station
Version: 0.0
Release: 1.git%{gitrev}%{?dist}
Version: <VERSION>
Release: <RELEASE>
Group: Applications/Scientific
License: GPLv3+
URL: http://forum.librepilot.org/
Source0: https://github.com/librepilot/%{name}/archive/%{name}-%{version}-%{gitrev}.tar.gz
Source0: <SOURCE>
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