2015-11-23 22:02:29 +01:00
|
|
|
DEB_DIST := $(shell lsb_release -c -s)
|
2015-07-31 19:20:19 +02:00
|
|
|
# Instead of RELEASE-15.01-RC1 debian wants 15.01~RC1
|
|
|
|
UPSTREAM_VER := $(subst -,~,$(subst RELEASE-,,$(PACKAGE_LBL)))
|
2015-10-18 11:26:15 +02:00
|
|
|
ifeq ($(DEB_DIST), unstable) # This should be set manually for a submission to Debian or similar
|
2015-07-31 19:20:19 +02:00
|
|
|
DEB_REV := 1
|
2015-10-18 11:26:15 +02:00
|
|
|
else
|
|
|
|
DEB_REV := 0$(DEB_DIST)1
|
2015-07-31 19:20:19 +02:00
|
|
|
endif
|
|
|
|
DEB_NAME := $(ORG_SMALL_NAME)
|
|
|
|
DEB_ORIG_SRC := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER).orig.tar.gz
|
2015-11-09 23:25:13 +01:00
|
|
|
DEB_ORIG_FW := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER).orig-firmware.tar.gz
|
2015-07-31 19:20:19 +02:00
|
|
|
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)
|
2015-10-08 23:33:16 +02:00
|
|
|
SED_SCRIPT := $(SED_SCRIPT)' \
|
2015-07-31 19:20:19 +02:00
|
|
|
s/<VERSION>/$(UPSTREAM_VER)-$(DEB_REV)/g; \
|
|
|
|
s/<DATE>/$(SED_DATE_STRG)/g; \
|
|
|
|
s/<DIST>/$(DEB_DIST)/g; \
|
|
|
|
s/<NAME>/$(DEB_NAME)/g; \
|
2016-04-01 23:23:21 +02:00
|
|
|
s/<DESCRIPTION>/$(DESCRIPTION_SHORT)\n $(subst ','"'"',$(subst $(NEWLINE),\n ,$(DESCRIPTION_LONG)))/g; \
|
2015-07-31 19:20:19 +02:00
|
|
|
'
|
|
|
|
|
2016-03-30 22:49:01 +02:00
|
|
|
# Ubuntu 14.04 (Trusty Tahr) use qt in /opt PPA
|
|
|
|
OPT_QT := qt56
|
|
|
|
TRUSTY_DEPS_SED := s/qml-module-.*/$(OPT_QT)quickcontrols/g; \
|
|
|
|
s/qt5-default.*/$(OPT_QT)-meta-minimal, $(OPT_QT)svg, $(OPT_QT)script, $(OPT_QT)serialport, $(OPT_QT)multimedia, $(OPT_QT)translations, $(OPT_QT)tools/g;
|
2015-07-31 19:20:19 +02:00
|
|
|
|
|
|
|
# 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
|
2016-03-30 23:01:29 +02:00
|
|
|
$(V1) sed -i -e 's,config_new.*, --help > /dev/null,' debian/rules
|
2015-07-31 19:20:19 +02:00
|
|
|
$(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)
|
2016-03-30 22:49:01 +02:00
|
|
|
$(V1) sed -i -e '$(TRUSTY_DEPS_SED)' debian/control
|
|
|
|
$(V1) sed -i -e 's,dh ,source /opt/$(OPT_QT)/bin/$(OPT_QT)-env.sh || true; dh ,' debian/rules
|
|
|
|
$(V1) echo "SHELL := /bin/bash" >> debian/rules
|
2015-07-31 19:20:19 +02:00
|
|
|
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)
|
|
|
|
|
2015-11-09 23:25:13 +01:00
|
|
|
$(DEB_ORIG_FW): $(FW_DIST_TAR_GZ) | $(PACKAGE_DIR)
|
|
|
|
$(V1) cp $(FW_DIST_TAR_GZ) $(DEB_ORIG_FW)
|
|
|
|
|
|
|
|
$(DEB_PACKAGE_DIR): $(DEB_ORIG_SRC) $(DEB_ORIG_FW) debian | $(PACKAGE_DIR)
|
2015-07-31 19:20:19 +02:00
|
|
|
$(V1) tar -xf $(DEB_ORIG_SRC) -C $(PACKAGE_DIR)
|
2015-11-09 23:25:13 +01:00
|
|
|
$(V1) tar -xf $(DEB_ORIG_FW) -C $(PACKAGE_DIR)/$(PACKAGE_NAME)
|
2015-07-31 19:20:19 +02:00
|
|
|
$(V1) mv debian $(PACKAGE_DIR)/$(PACKAGE_NAME)
|
|
|
|
$(V1) rm -rf $(DEB_PACKAGE_DIR) && mv $(PACKAGE_DIR)/$(PACKAGE_NAME) $(DEB_PACKAGE_DIR)
|
|
|
|
|