mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-26 15:54:15 +01:00
Merged in james-duley/librepilot/LP-80_extend_linux_packaging (pull request #16)
LP 80_extend_linux_packaging
This commit is contained in:
commit
503dff40bc
56
Makefile
56
Makefile
@ -729,10 +729,40 @@ PACKAGE_SEP := -
|
||||
PACKAGE_FULL_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL)
|
||||
|
||||
# Source distribution is never dirty because it uses git archive
|
||||
DIST_NAME := $(DIST_DIR)/$(subst dirty-,,$(PACKAGE_FULL_NAME)).tar
|
||||
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
|
||||
|
||||
include $(ROOT_DIR)/package/$(UNAME).mk
|
||||
|
||||
##############################
|
||||
#
|
||||
# Source for distribution
|
||||
#
|
||||
##############################
|
||||
$(DIST_VER_INFO): .git/index | $(DIST_DIR)
|
||||
$(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
|
||||
|
||||
$(DIST_TAR): $(DIST_VER_INFO) .git/index | $(DIST_DIR)
|
||||
@$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_TAR))"
|
||||
$(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_TAR)" HEAD
|
||||
$(V1) tar --append --file="$(DIST_TAR)" \
|
||||
--transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \
|
||||
$(call toprel, "$(DIST_VER_INFO)")
|
||||
|
||||
$(DIST_TAR_GZ): $(DIST_TAR)
|
||||
@$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_TAR_GZ))"
|
||||
$(V1) gzip -kf "$(DIST_TAR)"
|
||||
|
||||
.PHONY: dist_tar_gz
|
||||
dist_tar_gz: $(DIST_TAR_GZ)
|
||||
|
||||
.PHONY: dist
|
||||
dist: dist_tar_gz
|
||||
|
||||
|
||||
##############################
|
||||
#
|
||||
# Source code formatting
|
||||
@ -807,30 +837,6 @@ build-info: | $(BUILD_DIR)
|
||||
--template="make/templates/$@.txt" \
|
||||
--outfile="$(BUILD_DIR)/$@.txt"
|
||||
|
||||
##############################
|
||||
#
|
||||
# Source for distribution
|
||||
#
|
||||
##############################
|
||||
|
||||
DIST_VER_INFO := $(DIST_DIR)/version-info.json
|
||||
|
||||
$(DIST_VER_INFO): .git/index | $(DIST_DIR)
|
||||
$(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
|
||||
|
||||
|
||||
$(DIST_NAME).gz: $(DIST_VER_INFO) .git/index | $(DIST_DIR)
|
||||
@$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)"
|
||||
$(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_NAME)" HEAD
|
||||
$(V1) tar --append --file="$(DIST_NAME)" \
|
||||
--transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \
|
||||
$(call toprel, "$(DIST_VER_INFO)")
|
||||
$(V1) gzip -f "$(DIST_NAME)"
|
||||
|
||||
.PHONY: dist
|
||||
dist: $(DIST_NAME).gz
|
||||
|
||||
|
||||
##############################
|
||||
#
|
||||
# Config
|
||||
|
@ -7,75 +7,16 @@ ifndef TOP_LEVEL_MAKEFILE
|
||||
endif
|
||||
|
||||
# Are we using a debian based distro?
|
||||
ifneq ($(shell which dpkg 2> /dev/null),)
|
||||
|
||||
DEB_DIST := unstable
|
||||
# Instead of RELEASE-15.01-RC1 debian wants 15.01~RC1
|
||||
UPSTREAM_VER := $(subst -,~,$(subst RELEASE-,,$(PACKAGE_LBL)))
|
||||
DEB_REV := 1
|
||||
ifeq ($(DEB_DIST), trusty)
|
||||
DEB_REV := $(DEB_REV)$(DEB_DIST)1
|
||||
endif
|
||||
DEB_NAME := $(ORG_SMALL_NAME)
|
||||
DEB_ORIG_SRC := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER).orig.tar.gz
|
||||
DEB_PACKAGE_DIR := $(PACKAGE_DIR)/$(DEB_NAME)-$(UPSTREAM_VER)
|
||||
DEB_ARCH := $(shell dpkg --print-architecture)
|
||||
DEB_PACKAGE_NAME := $(DEB_NAME)_$(UPSTREAM_VER)-$(DEB_REV)_$(DEB_ARCH)
|
||||
DEB_DIR := package/linux/debian
|
||||
|
||||
SED_DATE_STRG = $(shell date -R)
|
||||
SED_SCRIPT = sed -i -e ' \
|
||||
s/<VERSION>/$(UPSTREAM_VER)-$(DEB_REV)/g; \
|
||||
s/<DATE>/$(SED_DATE_STRG)/g; \
|
||||
s/<DIST>/$(DEB_DIST)/g; \
|
||||
s/<NAME>/$(DEB_NAME)/g; \
|
||||
'
|
||||
|
||||
# Ubuntu 14.04 (Trusty Tahr) has different names for the qml-modules
|
||||
TRUSTY_DEPS_SED := s/qml-module-qtquick-controls/qtdeclarative5-controls-plugin/g; \
|
||||
s/qml-module-qtquick-dialogs/qtdeclarative5-dialogs-plugin/g; \
|
||||
s/qml-module-qtquick-localstorage/qtdeclarative5-localstorage-plugin/g; \
|
||||
s/qml-module-qtquick-particles2/qtdeclarative5-particles-plugin/g; \
|
||||
s/qml-module-qtquick2/qtdeclarative5-qtquick2-plugin/g; \
|
||||
s/qml-module-qtquick-window2/qtdeclarative5-window-plugin/g; \
|
||||
s/qml-module-qtquick-xmllistmodel/qtdeclarative5-xmllistmodel-plugin/g;
|
||||
|
||||
# Leave off Qt and ARM compiler dependencies if calling package target under the assumption that
|
||||
# OP is providing them or the user already has them installed because OP is already built.
|
||||
PACKAGE_DEPS_SED := s/python.*/python/;s/{misc:Depends}.*/{misc:Depends}/;
|
||||
|
||||
.PHONY: package
|
||||
package: debian
|
||||
@$(ECHO) "Building Linux package, please wait..."
|
||||
$(V1) sed -i -e "$(PACKAGE_DEPS_SED)" debian/control
|
||||
$(V1) dpkg-buildpackage -b -us -uc -nc
|
||||
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(BUILD_DIR)
|
||||
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(BUILD_DIR)
|
||||
$(V1) rm -r debian
|
||||
|
||||
.PHONY: debian
|
||||
debian: $(DEB_DIR)
|
||||
$(V1) rm -rf debian
|
||||
$(V1) cp -r $(DEB_DIR) debian
|
||||
$(V1) cp -T package/linux/45-uav.rules debian/$(DEB_NAME).udev
|
||||
$(V1) $(SED_SCRIPT) debian/changelog debian/control
|
||||
ifeq ($(DEB_DIST), trusty)
|
||||
$(V1) sed -i -e "$(TRUSTY_DEPS_SED)" debian/control
|
||||
ifneq ($(wildcard /etc/apt/sources.list),)
|
||||
include $(ROOT_DIR)/package/linux/deb.mk
|
||||
# Are we using a rpm based distro?
|
||||
else ifneq ($(wildcard /etc/yum.repos.d/*),)
|
||||
include $(ROOT_DIR)/package/linux/rpm.mk
|
||||
# Are we using an Arch based distro?
|
||||
else ifneq ($(wildcard /etc/pacman.conf),)
|
||||
$(info TODO: built in arch package)
|
||||
endif
|
||||
|
||||
.PHONY: package_src
|
||||
package_src: $(DEB_ORIG_SRC_NAME) $(DEB_PACKAGE_DIR)
|
||||
$(V1) cd $(DEB_PACKAGE_DIR) && dpkg-buildpackage -S -us -uc
|
||||
|
||||
$(DEB_ORIG_SRC): $(DIST_NAME).gz | $(PACKAGE_DIR)
|
||||
$(V1) cp $(DIST_NAME).gz $(DEB_ORIG_SRC)
|
||||
|
||||
$(DEB_PACKAGE_DIR): $(DEB_ORIG_SRC) debian | $(PACKAGE_DIR)
|
||||
$(V1) tar -xf $(DEB_ORIG_SRC) -C $(PACKAGE_DIR)
|
||||
$(V1) mv debian $(PACKAGE_DIR)/$(PACKAGE_NAME)
|
||||
$(V1) rm -rf $(DEB_PACKAGE_DIR) && mv $(PACKAGE_DIR)/$(PACKAGE_NAME) $(DEB_PACKAGE_DIR)
|
||||
|
||||
endif # Debian based distro?
|
||||
##############################
|
||||
#
|
||||
# Install Linux Target
|
||||
|
67
package/linux/deb.mk
Normal file
67
package/linux/deb.mk
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
DEB_DIST := unstable
|
||||
# Instead of RELEASE-15.01-RC1 debian wants 15.01~RC1
|
||||
UPSTREAM_VER := $(subst -,~,$(subst RELEASE-,,$(PACKAGE_LBL)))
|
||||
DEB_REV := 1
|
||||
ifeq ($(DEB_DIST), trusty)
|
||||
DEB_REV := $(DEB_REV)$(DEB_DIST)1
|
||||
endif
|
||||
DEB_NAME := $(ORG_SMALL_NAME)
|
||||
DEB_ORIG_SRC := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER).orig.tar.gz
|
||||
DEB_PACKAGE_DIR := $(PACKAGE_DIR)/$(DEB_NAME)-$(UPSTREAM_VER)
|
||||
DEB_ARCH := $(shell dpkg --print-architecture)
|
||||
DEB_PACKAGE_NAME := $(DEB_NAME)_$(UPSTREAM_VER)-$(DEB_REV)_$(DEB_ARCH)
|
||||
DEB_DIR := package/linux/debian
|
||||
|
||||
SED_DATE_STRG := $(shell date -R)
|
||||
SED_SCRIPT := sed -i -e ' \
|
||||
s/<VERSION>/$(UPSTREAM_VER)-$(DEB_REV)/g; \
|
||||
s/<DATE>/$(SED_DATE_STRG)/g; \
|
||||
s/<DIST>/$(DEB_DIST)/g; \
|
||||
s/<NAME>/$(DEB_NAME)/g; \
|
||||
'
|
||||
|
||||
# Ubuntu 14.04 (Trusty Tahr) has different names for the qml-modules
|
||||
TRUSTY_DEPS_SED := s/qml-module-qtquick-controls/qtdeclarative5-controls-plugin/g; \
|
||||
s/qml-module-qtquick-dialogs/qtdeclarative5-dialogs-plugin/g; \
|
||||
s/qml-module-qtquick-localstorage/qtdeclarative5-localstorage-plugin/g; \
|
||||
s/qml-module-qtquick-particles2/qtdeclarative5-particles-plugin/g; \
|
||||
s/qml-module-qtquick2/qtdeclarative5-qtquick2-plugin/g; \
|
||||
s/qml-module-qtquick-window2/qtdeclarative5-window-plugin/g; \
|
||||
s/qml-module-qtquick-xmllistmodel/qtdeclarative5-xmllistmodel-plugin/g;
|
||||
|
||||
# Leave off Qt and ARM compiler dependencies if calling package target under the assumption that
|
||||
# OP is providing them or the user already has them installed because OP is already built.
|
||||
PACKAGE_DEPS_SED := s/python.*/python/;s/{misc:Depends}.*/{misc:Depends}/;
|
||||
|
||||
.PHONY: package
|
||||
package: debian
|
||||
@$(ECHO) "Building Linux package, please wait..."
|
||||
$(V1) sed -i -e "$(PACKAGE_DEPS_SED)" debian/control
|
||||
$(V1) dpkg-buildpackage -b -us -uc -nc
|
||||
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(BUILD_DIR)
|
||||
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(BUILD_DIR)
|
||||
$(V1) rm -r debian
|
||||
|
||||
.PHONY: debian
|
||||
debian: $(DEB_DIR)
|
||||
$(V1) rm -rf debian
|
||||
$(V1) cp -r $(DEB_DIR) debian
|
||||
$(V1) cp -T package/linux/45-uav.rules debian/$(DEB_NAME).udev
|
||||
$(V1) $(SED_SCRIPT) debian/changelog debian/control
|
||||
ifeq ($(DEB_DIST), trusty)
|
||||
$(V1) sed -i -e "$(TRUSTY_DEPS_SED)" debian/control
|
||||
endif
|
||||
|
||||
.PHONY: package_src
|
||||
package_src: $(DEB_ORIG_SRC_NAME) $(DEB_PACKAGE_DIR)
|
||||
$(V1) cd $(DEB_PACKAGE_DIR) && dpkg-buildpackage -S -us -uc
|
||||
|
||||
$(DEB_ORIG_SRC): $(DIST_TAR_GZ) | $(PACKAGE_DIR)
|
||||
$(V1) cp $(DIST_TAR_GZ) $(DEB_ORIG_SRC)
|
||||
|
||||
$(DEB_PACKAGE_DIR): $(DEB_ORIG_SRC) debian | $(PACKAGE_DIR)
|
||||
$(V1) tar -xf $(DEB_ORIG_SRC) -C $(PACKAGE_DIR)
|
||||
$(V1) mv debian $(PACKAGE_DIR)/$(PACKAGE_NAME)
|
||||
$(V1) rm -rf $(DEB_PACKAGE_DIR) && mv $(PACKAGE_DIR)/$(PACKAGE_NAME) $(DEB_PACKAGE_DIR)
|
||||
|
43
package/linux/rpm.mk
Normal file
43
package/linux/rpm.mk
Normal file
@ -0,0 +1,43 @@
|
||||
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)
|
||||
RPM_PACKAGE_SRC := $(PACKAGE_DIR)/SRPMS/$(RPM_PACKAGE_NAME).src.rpm
|
||||
|
||||
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): RPMBUILD_OPTS := -bb
|
||||
|
||||
.PHONY: package_src
|
||||
package_src: $(RPM_PACKAGE_SRC)
|
||||
$(RPM_PACKAGE_SRC): RPMBUILD_OPTS := -bs
|
||||
|
||||
$(RPM_PACKAGE_FILE) $(RPM_PACKAGE_SRC): $(SPEC_FILE) $(DIST_TAR_GZ) | $(RPM_DIRS)
|
||||
@$(ECHO) "Building $(call toprel,$@), please wait..."
|
||||
$(V1) ln -sf $(DIST_TAR_GZ) $(PACKAGE_DIR)/SOURCES
|
||||
$(V1) rpmbuild $(RPMBUILD_OPTS) --define "_topdir $(PACKAGE_DIR)" $(SPEC_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>%{?dist}
|
||||
|
||||
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,12 +49,11 @@ and ease of use.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}-%{gitrev}
|
||||
%setup -q -n <ARCHIVE_PREFIX>
|
||||
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} gcs QMAKE=qmake-qt5 CC=%{__cc} CXX=%{__cxx} libbasename=%{_lib}
|
||||
#make -j1 opfw_resource
|
||||
|
||||
|
||||
%install
|
||||
@ -76,11 +74,12 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%files
|
||||
%doc README.txt GPLv3.txt
|
||||
%doc README.md CREDITS.txt WHATSNEW.txt
|
||||
%doc GPLv3.txt
|
||||
%{_bindir}/librepilot-gcs
|
||||
%{_udevrulesdir}/45-librepilot.rules
|
||||
%{_datadir}/applications/librepilot.desktop
|
||||
%{_datadir}/librepilot-gcs//*
|
||||
%{_datadir}/librepilot-gcs/*
|
||||
%{_datadir}/pixmaps/librepilot.png
|
||||
%{_libdir}/librepilot-gcs/plugins/OpenPilot/*.pluginspec
|
||||
%{_libdir}/librepilot-gcs/plugins/OpenPilot/*.so
|
Loading…
x
Reference in New Issue
Block a user