2011-05-13 16:40:28 +02:00
|
|
|
#
|
2013-03-21 22:11:30 +01:00
|
|
|
# Linux-specific packaging script
|
2011-05-13 16:40:28 +02:00
|
|
|
#
|
|
|
|
|
2015-07-13 17:12:10 +02:00
|
|
|
ifndef TOP_LEVEL_MAKEFILE
|
2013-03-21 22:11:30 +01:00
|
|
|
$(error Top level Makefile must be used to build this target)
|
|
|
|
endif
|
|
|
|
|
2015-02-19 01:51:58 +01:00
|
|
|
# Are we using a debian based distro?
|
2015-03-03 06:19:42 +01:00
|
|
|
ifneq ($(shell which dpkg 2> /dev/null),)
|
2015-02-19 01:51:58 +01:00
|
|
|
|
2015-02-16 07:00:24 +01:00
|
|
|
DEB_DIST := unstable
|
2015-02-11 05:51:53 +01:00
|
|
|
# Instead of RELEASE-15.01-RC1 debian wants 15.01~RC1
|
|
|
|
UPSTREAM_VER := $(subst -,~,$(subst RELEASE-,,$(PACKAGE_LBL)))
|
|
|
|
DEB_REV := 1
|
2015-02-19 03:26:39 +01:00
|
|
|
ifeq ($(DEB_DIST), trusty)
|
|
|
|
DEB_REV := $(DEB_REV)$(DEB_DIST)1
|
|
|
|
endif
|
2015-07-12 18:15:53 +02:00
|
|
|
DEB_NAME := $(ORG_SMALL_NAME)
|
2015-02-11 05:51:53 +01:00
|
|
|
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
|
2011-12-19 01:58:42 +01:00
|
|
|
|
2015-02-11 05:51:53 +01:00
|
|
|
SED_DATE_STRG = $(shell date -R)
|
2015-05-21 16:20:44 +02:00
|
|
|
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; \
|
|
|
|
'
|
2011-12-19 01:58:42 +01:00
|
|
|
|
2015-02-19 00:40:20 +01:00
|
|
|
# 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;
|
2011-12-19 01:58:42 +01:00
|
|
|
|
2015-02-19 01:46:29 +01: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}/;
|
|
|
|
|
2013-03-21 22:11:30 +01:00
|
|
|
.PHONY: package
|
2015-01-31 04:15:53 +01:00
|
|
|
package: debian
|
2015-01-31 20:51:55 +01:00
|
|
|
@$(ECHO) "Building Linux package, please wait..."
|
2015-02-19 01:46:29 +01:00
|
|
|
$(V1) sed -i -e "$(PACKAGE_DEPS_SED)" debian/control
|
2015-03-17 09:43:53 +01:00
|
|
|
$(V1) dpkg-buildpackage -b -us -uc -nc
|
2015-03-17 06:14:25 +01:00
|
|
|
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(BUILD_DIR)
|
|
|
|
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(BUILD_DIR)
|
2015-01-31 04:15:53 +01:00
|
|
|
$(V1) rm -r debian
|
|
|
|
|
2015-02-19 03:26:39 +01:00
|
|
|
.PHONY: debian
|
2015-01-31 04:15:53 +01:00
|
|
|
debian: $(DEB_DIR)
|
2015-02-11 05:51:53 +01:00
|
|
|
$(V1) rm -rf debian
|
2015-05-21 16:20:44 +02:00
|
|
|
$(V1) cp -r $(DEB_DIR) debian
|
2015-07-25 18:46:19 +02:00
|
|
|
$(V1) cp -T package/linux/45-uav.rules debian/$(DEB_NAME).udev
|
2015-05-21 16:20:44 +02:00
|
|
|
$(V1) $(SED_SCRIPT) debian/changelog debian/control
|
2015-02-19 00:40:20 +01:00
|
|
|
ifeq ($(DEB_DIST), trusty)
|
|
|
|
$(V1) sed -i -e "$(TRUSTY_DEPS_SED)" debian/control
|
|
|
|
endif
|
2015-01-31 04:15:53 +01:00
|
|
|
|
2015-02-11 05:51:53 +01:00
|
|
|
.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)
|
2015-01-30 23:16:57 +01:00
|
|
|
|
2015-02-19 01:51:58 +01:00
|
|
|
endif # Debian based distro?
|
2015-01-30 23:16:57 +01:00
|
|
|
##############################
|
|
|
|
#
|
2015-07-29 16:08:50 +02:00
|
|
|
# Install Linux Target
|
2015-01-30 23:16:57 +01:00
|
|
|
#
|
|
|
|
##############################
|
2015-07-26 22:30:41 +02:00
|
|
|
enable-udev-rules := no
|
|
|
|
|
2015-07-25 22:49:42 +02:00
|
|
|
prefix := /usr/local
|
|
|
|
bindir := $(prefix)/bin
|
2015-07-26 22:30:41 +02:00
|
|
|
libbasename := lib
|
|
|
|
libdir := $(prefix)/$(libbasename)
|
2015-07-25 22:49:42 +02:00
|
|
|
datadir := $(prefix)/share
|
|
|
|
udevrulesdir := /etc/udev/rules.d
|
2015-01-30 23:16:57 +01:00
|
|
|
|
|
|
|
INSTALL = cp -a --no-preserve=ownership
|
|
|
|
LN = ln
|
|
|
|
LN_S = ln -s
|
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install:
|
|
|
|
@$(ECHO) " INSTALLING GCS TO $(DESTDIR)/)"
|
|
|
|
$(V1) $(MKDIR) -p $(DESTDIR)$(bindir)
|
|
|
|
$(V1) $(MKDIR) -p $(DESTDIR)$(libdir)
|
|
|
|
$(V1) $(MKDIR) -p $(DESTDIR)$(datadir)
|
|
|
|
$(V1) $(MKDIR) -p $(DESTDIR)$(datadir)/applications
|
|
|
|
$(V1) $(MKDIR) -p $(DESTDIR)$(datadir)/pixmaps
|
2015-05-21 16:20:44 +02:00
|
|
|
$(V1) $(INSTALL) $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)/bin/$(GCS_SMALL_NAME) $(DESTDIR)$(bindir)
|
2015-07-26 22:30:41 +02:00
|
|
|
$(V1) $(INSTALL) $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)/$(libbasename)/$(GCS_SMALL_NAME) $(DESTDIR)$(libdir)
|
2015-05-21 16:20:44 +02:00
|
|
|
$(V1) $(INSTALL) $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)/share/$(GCS_SMALL_NAME) $(DESTDIR)$(datadir)
|
2015-07-14 23:14:47 +02:00
|
|
|
$(V1) $(INSTALL) -T $(ROOT_DIR)/package/linux/gcs.desktop $(DESTDIR)$(datadir)/applications/$(ORG_SMALL_NAME).desktop
|
2015-07-29 16:08:50 +02:00
|
|
|
$(V1) $(INSTALL) -T $(ROOT_DIR)/ground/openpilotgcs/src/plugins/coreplugin/images/$(ORG_SMALL_NAME)_logo_128.png \
|
|
|
|
$(DESTDIR)$(datadir)/pixmaps/$(ORG_SMALL_NAME).png
|
2015-07-14 23:14:47 +02:00
|
|
|
|
2015-07-29 16:08:50 +02:00
|
|
|
$(V1) sed -i -e 's/gcs/$(GCS_SMALL_NAME)/g;s/GCS/$(GCS_BIG_NAME)/g;s/org/$(ORG_SMALL_NAME)/g;s/ORG/$(ORG_BIG_NAME)/g' \
|
|
|
|
$(DESTDIR)$(datadir)/applications/$(ORG_SMALL_NAME).desktop
|
2015-01-30 23:16:57 +01:00
|
|
|
|
2015-07-25 20:56:55 +02:00
|
|
|
ifneq ($(enable-udev-rules), no)
|
2015-07-25 22:49:42 +02:00
|
|
|
$(V1) $(MKDIR) -p $(DESTDIR)$(udevrulesdir)
|
|
|
|
$(V1) $(INSTALL) -T $(ROOT_DIR)/package/linux/45-uav.rules $(DESTDIR)$(udevrulesdir)/45-$(ORG_SMALL_NAME).rules
|
2015-07-25 20:56:55 +02:00
|
|
|
endif
|