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
i f n d e f T O P _ L E V E L _ M A K E F I L E
2013-03-21 22:11:30 +01:00
$( error Top level Makefile must be used to build this target)
e n d i f
2015-02-19 01:51:58 +01:00
# Are we using a debian based distro?
2015-03-03 06:19:42 +01:00
i f n e q ( $( 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
i f e q ( $( DEB_DIST ) , t r u s t y )
DEB_REV := $( DEB_REV) $( DEB_DIST) 1
e n d i f
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
$( V1) cp -T package/linux/45-openpilot-permissions.rules debian/$( DEB_NAME) .udev
$( V1) $( SED_SCRIPT) debian/changelog debian/control
2015-02-19 00:40:20 +01:00
i f e q ( $( DEB_DIST ) , t r u s t y )
$( V1) sed -i -e " $( TRUSTY_DEPS_SED) " debian/control
e n d i f
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
e n d i f # Debian based distro?
2015-01-30 23:16:57 +01:00
##############################
#
# Install OpenPilot
#
##############################
prefix := /usr/local
bindir := $( prefix) /bin
libdir := $( prefix) /lib
datadir := $( prefix) /share
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)
$( V1) $( INSTALL) $( BUILD_DIR) /$( GCS_SMALL_NAME) _$( GCS_BUILD_CONF) /lib/$( GCS_SMALL_NAME) $( DESTDIR) $( libdir)
$( 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
$( 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-07-12 18:15:53 +02:00
$( V1) $( INSTALL) -T $( ROOT_DIR) /package/linux/openpilot.png $( DESTDIR) $( datadir) /pixmaps/$( ORG_SMALL_NAME) .png
2015-01-30 23:16:57 +01:00