From 57f90038334e31b3644ceadbde09305188596226 Mon Sep 17 00:00:00 2001 From: James Duley Date: Fri, 31 Jul 2015 18:20:19 +0100 Subject: [PATCH] LP-80 extend linux packaging: split out debian package make into own file Change-Id: I5a84c53d2a0727d424053bf0f506c47d4b7b7d78 --- package/Linux.mk | 69 ++------------------------------------------ package/linux/deb.mk | 67 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 67 deletions(-) create mode 100644 package/linux/deb.mk diff --git a/package/Linux.mk b/package/Linux.mk index 7acc0455f..255c23b66 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -8,74 +8,9 @@ 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//$(UPSTREAM_VER)-$(DEB_REV)/g; \ - s//$(SED_DATE_STRG)/g; \ - s//$(DEB_DIST)/g; \ - s//$(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) - + include $(ROOT_DIR)/package/linux/deb.mk endif # Debian based distro? + ############################## # # Install Linux Target diff --git a/package/linux/deb.mk b/package/linux/deb.mk new file mode 100644 index 000000000..ed481aa25 --- /dev/null +++ b/package/linux/deb.mk @@ -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//$(UPSTREAM_VER)-$(DEB_REV)/g; \ + s//$(SED_DATE_STRG)/g; \ + s//$(DEB_DIST)/g; \ + s//$(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) +