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-10-08 23:33:16 +02:00
|
|
|
SED_SCRIPT := sed -i -e ' \
|
|
|
|
s/<ARCHIVE_PREFIX>/$(PACKAGE_NAME)/g; \
|
|
|
|
s/<EMAIL>/$(PACKAGING_EMAIL_ADDRESS)/g; \
|
|
|
|
s,<URL>,$(WEBSITE_URL),g; \
|
|
|
|
s,<GIT_URL>,$(GIT_URL),g; \
|
|
|
|
s,<GITWEB_URL>,$(GITWEB_URL),g; \
|
|
|
|
'
|
|
|
|
|
2015-02-19 01:51:58 +01:00
|
|
|
# Are we using a debian based distro?
|
2015-08-01 10:30:28 +02:00
|
|
|
ifneq ($(wildcard /etc/apt/sources.list),)
|
2015-07-31 19:20:19 +02:00
|
|
|
include $(ROOT_DIR)/package/linux/deb.mk
|
2015-07-31 20:17:31 +02:00
|
|
|
# Are we using a rpm based distro?
|
2015-08-01 10:30:28 +02:00
|
|
|
else ifneq ($(wildcard /etc/yum.repos.d/*),)
|
2015-07-31 20:17:31 +02:00
|
|
|
include $(ROOT_DIR)/package/linux/rpm.mk
|
|
|
|
# Are we using an Arch based distro?
|
2015-08-01 10:30:28 +02:00
|
|
|
else ifneq ($(wildcard /etc/pacman.conf),)
|
2015-07-31 20:17:31 +02:00
|
|
|
$(info TODO: built in arch package)
|
|
|
|
endif
|
2015-07-31 19:20:19 +02:00
|
|
|
|
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
|
2015-09-11 23:48:32 +02:00
|
|
|
RM_RF = rm -rf
|
|
|
|
RM_F = rm -f
|
2015-01-30 23:16:57 +01:00
|
|
|
.PHONY: install
|
2015-09-11 23:48:32 +02:00
|
|
|
install: uninstall
|
2015-01-30 23:16:57 +01:00
|
|
|
@$(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-08-04 22:44:29 +02:00
|
|
|
$(V1) $(INSTALL) -T $(ROOT_DIR)/ground/gcs/src/plugins/coreplugin/images/$(ORG_SMALL_NAME)_logo_128.png \
|
2015-07-29 16:08:50 +02:00
|
|
|
$(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
|
2015-09-11 23:48:32 +02:00
|
|
|
|
|
|
|
# uninstall target to ensure no side effects from previous installations
|
|
|
|
.PHONY: uninstall
|
|
|
|
uninstall:
|
|
|
|
@$(ECHO) " UNINSTALLING GCS FROM $(DESTDIR)/)"
|
|
|
|
# Protect against inadvertant 'rm -rf /'
|
|
|
|
ifeq ($(GCS_SMALL_NAME),)
|
|
|
|
@$(ECHO) "Error in build configuration - GCS_SMALL_NAME not defined"
|
|
|
|
exit 1
|
|
|
|
endif
|
|
|
|
ifeq ($(ORG_SMALL_NAME),)
|
|
|
|
@$(ECHO) "Error in build configuration - ORG_SMALL_NAME not defined"
|
|
|
|
exit 1
|
|
|
|
endif
|
|
|
|
# ...safe to Proceed
|
|
|
|
$(V1) $(RM_RF) $(DESTDIR)$(bindir)/$(GCS_SMALL_NAME) # Remove application
|
|
|
|
$(V1) $(RM_RF) $(DESTDIR)$(libdir)/$(GCS_SMALL_NAME) # Remove libraries
|
2015-09-16 21:42:03 +02:00
|
|
|
$(V1) $(RM_RF) $(DESTDIR)$(datadir)/$(GCS_SMALL_NAME) # Remove other data
|
2015-09-11 23:48:32 +02:00
|
|
|
$(V1) $(RM_F) $(DESTDIR)$(datadir)/applications/$(ORG_SMALL_NAME).desktop
|
|
|
|
$(V1) $(RM_F) $(DESTDIR)$(datadir)/pixmaps/$(ORG_SMALL_NAME).png
|
|
|
|
$(V1) $(RM_F) $(DESTDIR)$(udevrulesdir)/45-$(ORG_SMALL_NAME).rules
|
|
|
|
|