aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-01-03 15:03:39 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2019-01-03 16:48:48 +0100
commit680af25d7b89e734b77ddad0f4e2d2a4d1bc8826 (patch)
tree53a3377e1c681678164e8e276c41ddf7b019d638
parent565e5a7fac5db9a35fd0b2cb8e12f1bdf4772821 (diff)
Adding packaging files
Add necessary files to build native packages for AGL supported linux distributions Bug-AGL: SPEC-2097 Change-Id: Ife6d1ec8a05f40e0bd70e741859133003716b37a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--ctl-lib/CMakeLists.txt45
-rw-r--r--packaging/deb/agl-libappcontroller.dsc21
-rw-r--r--packaging/deb/debian.agl-libappcontroller-dev.install2
-rw-r--r--packaging/deb/debian.changelog5
-rw-r--r--packaging/deb/debian.compat1
-rw-r--r--packaging/deb/debian.control22
-rw-r--r--packaging/deb/debian.rules17
-rw-r--r--packaging/rpm/agl-libappcontroller.spec72
8 files changed, 181 insertions, 4 deletions
diff --git a/ctl-lib/CMakeLists.txt b/ctl-lib/CMakeLists.txt
index e2fd683..4ca83cc 100644
--- a/ctl-lib/CMakeLists.txt
+++ b/ctl-lib/CMakeLists.txt
@@ -24,6 +24,38 @@ set(PROJECT_AUTHOR_MAIL "fulup@iot.bzh")
set(PROJECT_LICENSE "APL2.0")
set(PROJECT_LANGUAGES "C")
+
+if(DEFINED ENV{SDKTARGETSYSROOT})
+file(STRINGS $ENV{SDKTARGETSYSROOT}/usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE")
+set(BUILD_ENV_SYSROOT $ENV{SDKTARGETSYSROOT})
+elseif(DEFINED ENV{PKG_CONFIG_SYSROOT_DIR})
+file(STRINGS $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE")
+set(BUILD_ENV_SYSROOT $ENV{PKG_CONFIG_SYSROOT_DIR})
+else()
+file(STRINGS /usr/include/linux/version.h LINUX_VERSION_CODE_LINE REGEX "LINUX_VERSION_CODE")
+set(BUILD_ENV_SYSROOT "")
+endif()
+
+# Get the os type
+# Used to package .deb
+set(OS_RELEASE_PATH "${BUILD_ENV_SYSROOT}/etc/os-release")
+if(EXISTS ${OS_RELEASE_PATH})
+ execute_process(COMMAND bash "-c" "grep -E '^ID(_LIKE)?=' ${OS_RELEASE_PATH} | tail -n 1"
+ OUTPUT_VARIABLE TMP_OSRELEASE
+ )
+
+ if (NOT TMP_OSRELEASE STREQUAL "")
+ string(REGEX REPLACE ".*=\"?([0-9a-z\._-]*)( .*)?\"?\n" "\\1" OSDETECTED ${TMP_OSRELEASE})
+ else()
+ set(OSDETECTED "NOT COMPATIBLE !")
+ endif()
+elseif("${BUILD_ENV_SYSROOT}" STREQUAL "$ENV{PKG_CONFIG_SYSROOT_DIR}")
+ set(OSDETECTED "yocto-build")
+else()
+ set(OSDETECTED "NOT COMPATIBLE ! Missing ${OS_RELEASE_PATH} file.")
+endif()
+message("Distribution detected ${OSDETECTED}")
+
if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr")
endif()
@@ -31,14 +63,19 @@ add_definitions(-DAFB_BINDING_VERSION=3)
add_definitions(-DLUA_GLOB_PATTERN="/var/?.lua\\\;")
add_definitions(-DSUSE_LUA_INCDIR)
-
INCLUDE(FindPkgConfig)
+
set (PKG_REQUIRED_LIST
- afb-daemon
- afb-helpers
- lua
+ afb-daemon
+ afb-helpers
)
+if(${OSDETECTED} STREQUAL "debian")
+ list(APPEND PKG_REQUIRED_LIST lua53)
+else()
+ list(APPEND PKG_REQUIRED_LIST lua)
+endif()
+
# Loop on required package and add options
foreach (PKG_CONFIG ${PKG_REQUIRED_LIST})
string(REGEX REPLACE "[<>]?=.*$" "" XPREFIX ${PKG_CONFIG})
diff --git a/packaging/deb/agl-libappcontroller.dsc b/packaging/deb/agl-libappcontroller.dsc
new file mode 100644
index 0000000..05fbdbb
--- /dev/null
+++ b/packaging/deb/agl-libappcontroller.dsc
@@ -0,0 +1,21 @@
+Format: 1.0
+Source: agl-libappcontroller
+Binary: agl-libappcontroller-bin, agl-libappcontroller-dev
+Architecture: any
+Version: 2.0-0
+Maintainer: romain.forlot <romain.forlot@iot.bzh>
+Standards-Version: 3.8.2
+Homepage: https://gerrit.automotivelinux.org/gerrit/src/libappcontroller
+Build-Depends: debhelper (>= 5),
+ cmake,
+ dpkg-dev,
+ pkg-config,
+ liblua5.3-dev,
+ libjson-c-dev,
+ libsystemd-dev,
+ agl-libafb-helpers-dev,
+ agl-app-framework-binder-bin,
+ agl-app-framework-binder-dev,
+DEBTRANSFORM-RELEASE: 1
+Files:
+ libappcontroller_2.0.tar.gz
diff --git a/packaging/deb/debian.agl-libappcontroller-dev.install b/packaging/deb/debian.agl-libappcontroller-dev.install
new file mode 100644
index 0000000..c0778a3
--- /dev/null
+++ b/packaging/deb/debian.agl-libappcontroller-dev.install
@@ -0,0 +1,2 @@
+/opt/AGL/lib/*/pkgconfig/*.pc
+/opt/AGL/lib/*/*.a
diff --git a/packaging/deb/debian.changelog b/packaging/deb/debian.changelog
new file mode 100644
index 0000000..9678b52
--- /dev/null
+++ b/packaging/deb/debian.changelog
@@ -0,0 +1,5 @@
+agl-libappcontroller (2.0-0) unstable; urgency=low
+
+ * init build
+
+ -- Romain Forlot <romain.forlot@iot.bzh> Fri, 28 Dec 2018 10:50:38 +0100
diff --git a/packaging/deb/debian.compat b/packaging/deb/debian.compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/packaging/deb/debian.compat
@@ -0,0 +1 @@
+9
diff --git a/packaging/deb/debian.control b/packaging/deb/debian.control
new file mode 100644
index 0000000..377d815
--- /dev/null
+++ b/packaging/deb/debian.control
@@ -0,0 +1,22 @@
+Priority: optional
+Maintainer: romain.forlot <romain.forlot@iot.bzh>
+Source: agl-libappcontroller
+Build-Depends:
+ debhelper (>= 5),
+ pkg-config,
+ cmake,
+ liblua5.3-dev,
+ libjson-c-dev,
+ libsystemd-dev,
+ agl-libafb-helpers-dev,
+ agl-app-framework-binder-bin,
+ agl-app-framework-binder-dev,
+Standards-Version: 3.8.2
+Homepage: https://gerrit.automotivelinux.org/gerrit/#/admin/projects/apps/libappcontroller
+
+Package: agl-libappcontroller-dev
+Section: libs
+Architecture: any
+Depends: agl-libappcontroller-bin
+Description: libappcontroller provides a generic controller library to be use
+ to quickly develop a binding.
diff --git a/packaging/deb/debian.rules b/packaging/deb/debian.rules
new file mode 100644
index 0000000..c4b4d59
--- /dev/null
+++ b/packaging/deb/debian.rules
@@ -0,0 +1,17 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+export VERSION=$(shell grep -E "^Version" ../*dsc | sed -r 's/^.*: (.*)-.*/\1/')
+
+%:
+ bash /etc/profile.d/AGL-app-framework-binder.sh
+ dh $@
+
+override_dh_auto_configure:
+ dh_auto_configure -- -DVERSION=${VERSION} -DAFB_HELPERS_QT=ON -DCMAKE_INSTALL_PREFIX=/opt/AGL -DCMAKE_INSTALL_LIBDIR:PATH=lib/${DEB_HOST_MULTIARCH}
+
+override_dh_auto_install:
+ dh_auto_install --destdir=/usr/src/packages/BUILD/debian/tmp
+
+override_dh_auto_test:
diff --git a/packaging/rpm/agl-libappcontroller.spec b/packaging/rpm/agl-libappcontroller.spec
new file mode 100644
index 0000000..194ebdd
--- /dev/null
+++ b/packaging/rpm/agl-libappcontroller.spec
@@ -0,0 +1,72 @@
+#
+# spec file for package libappcontroller
+#
+
+%define _prefix /opt/AGL
+%define __cmake cmake
+
+%if 0%{?fedora_version}
+%global debug_package %{nil}
+%endif
+
+Name: agl-libappcontroller
+# WARNING {name} is not used for tar file name in source nor for setup
+# Check hard coded values required to match git directory naming
+Version: 2.0
+Release: 0
+License: Apache-2.0
+Summary: AGL libappcontroller
+Group: Development/Libraries/C and C++
+Url: https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/libappcontroller
+Source: libappcontroller-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: curl
+BuildRequires: gcc-c++
+BuildRequires: pkgconfig(json-c)
+BuildRequires: pkgconfig(afb-daemon)
+BuildRequires: pkgconfig(lua) >= 5.3
+BuildRequires: pkgconfig(afb-helpers)
+BuildRequires: pkgconfig(libsystemd) >= 222
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%description
+libappcontroller provides helpful functions to be used in a binding for the
+Application Framework Binder
+
+%package devel
+Group: Development/Libraries/C and C++
+Requires: %{name} = %{version}
+Provides: pkgconfig(%{name}) = %{version}
+Summary: AGL libappcontroller-devel
+%description devel
+libappcontroller provides helpful functions to be used in a binding for the
+Application Framework Binder
+
+%prep
+%setup -q -n libappcontroller-%{version}
+
+%build
+export PKG_CONFIG_PATH=%{_libdir}/pkgconfig
+[ ! -d build ] && mkdir build
+cd build
+cmake -DCMAKE_INSTALL_PREFIX=/opt/AGL -DCMAKE_BUILD_TYPE=DEBUG -DVERSION=%{version} ..
+%__make %{?_smp_mflags}
+
+%install
+[ -d build ] && cd build
+%make_install
+
+%files
+
+%files devel
+%defattr(-,root,root)
+%dir %{_includedir}
+%dir %{_libdir}
+%{_includedir}/*
+%{_libdir}/*.a
+%{_libdir}/pkgconfig/*.pc
+
+%changelog
+* Fri Dec 28 2018 Romain Forlot
+- initial creation