From 0ed5f068d75d02743ae4e41223b0c85c99108c3d Mon Sep 17 00:00:00 2001 From: Ossama Othman Date: Thu, 23 Oct 2014 14:30:44 -0700 Subject: [PATCH] Package SmartDeviceLink 3.5. Change-Id: Ib0222d652d3c1b559680d84f0d51a0826713c7fa Signed-off-by: Ossama Othman --- .gbs.conf | 3 + .gitignore | 10 +++ CMakeLists.txt | 5 ++ LICENSE | 29 +++++++ packaging/config.xml.in | 23 +++++ packaging/manifest.json.in | 12 +++ packaging/smartdevicelink.changes | 24 ++++++ packaging/smartdevicelink.manifest | 5 ++ packaging/smartdevicelink.spec | 170 +++++++++++++++++++++++++++++++++++++ src/appMain/main.cc | 48 ++++++++--- src/thirdPartyLibs/CMakeLists.txt | 15 ++-- 11 files changed, 328 insertions(+), 16 deletions(-) create mode 100644 .gbs.conf create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 packaging/config.xml.in create mode 100644 packaging/manifest.json.in create mode 100644 packaging/smartdevicelink.changes create mode 100644 packaging/smartdevicelink.manifest create mode 100644 packaging/smartdevicelink.spec diff --git a/.gbs.conf b/.gbs.conf new file mode 100644 index 0000000..fa9fdc5 --- /dev/null +++ b/.gbs.conf @@ -0,0 +1,3 @@ +[general] +upstream_branch = upstream +upstream_tag = ${upstreamversion} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1f40119 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# OS Generated Files # +.DS_Store +Thumbs.db +*.o +*.so* +*.a +*~ +*#*# +Makefile +core* diff --git a/CMakeLists.txt b/CMakeLists.txt index 76f3f91..ef00f7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,6 +135,11 @@ if (ENABLE_GCOV) endif() set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -s -O2") #It will be appended to CMAKE_CXX_FLAGS in release +add_definitions(-DSDL_LOG4CXX_PROPERTIES_FILE="/etc/smartdevicelink/log4cxx.properties") +add_definitions(-DSDL_HMI_LINK_FILE="/etc/smartdevicelink/hmi_link") +add_definitions(-DSDL_CONFIG_FILE="/etc/smartdevicelink/smartDeviceLink.ini") +add_definitions(-DSDL_HMI_BROWSER_PATH="/usr/bin/xwalk-launcher" -DSDL_HMI_BROWSER_ARG0="xwalk-launcher") + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") add_definitions(-DOS_LINUX) elseif(CMAKE_SYSTEM_NAME STREQUAL "QNX") diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ca1e2a2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2013, Ford Motor Company +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name of the Ford Motor Company nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packaging/config.xml.in b/packaging/config.xml.in new file mode 100644 index 0000000..13009dc --- /dev/null +++ b/packaging/config.xml.in @@ -0,0 +1,23 @@ + + + + + + + SmartDeviceLink + + + + + + + + + + + + diff --git a/packaging/manifest.json.in b/packaging/manifest.json.in new file mode 100644 index 0000000..b1e4575 --- /dev/null +++ b/packaging/manifest.json.in @@ -0,0 +1,12 @@ +{ + "name": "SmartDeviceLink HMI", + "xwalk_version": "%SDL_VERSION%", + "app": { + "launch":{ + "local_path": "index.html" + } + }, + "icons": { + "128": "images/sdl/devices.png" + } +} diff --git a/packaging/smartdevicelink.changes b/packaging/smartdevicelink.changes new file mode 100644 index 0000000..78e41b1 --- /dev/null +++ b/packaging/smartdevicelink.changes @@ -0,0 +1,24 @@ +* Thu Nov 06 2014 Ossama Othman b01151e +- Package SmartDeviceLink 3.5. + +* Thu Aug 07 2014 Ossama Othman accepted/tizen/ivi/panda/20140403.015744-2-g2948856 +- Remove dependency to MiniBrowser +- Make SmartDeviceLink work with Crosswalk. + +* Thu Mar 06 2014 Ossama Othman 66d2006 +- Added missing dependencies. +- Remove executable bit from JavaScript and CSS files. +- Update to 2.0 release. +- Removed editor backup files shipped upstream SDL code. + +* Tue Dec 17 2013 Ossama Othman ivi_oct_m2@f3d53b2 +- [TIVI-2269] Support launching SDL from ICO homescreen. + +* Thu Aug 15 2013 Ossama Othman 14ffb07 +- Override hardcoded paths and filenames. +- Added missing shared libraries to package. +- Corrected packaging errors, and created new sample-hmi sub-package. +- Removed executable bits from non-executable files. +- Initial packaging of SmartDeviceLink. +- Address build errors when using g++ 4.7 or better. + diff --git a/packaging/smartdevicelink.manifest b/packaging/smartdevicelink.manifest new file mode 100644 index 0000000..c976359 --- /dev/null +++ b/packaging/smartdevicelink.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/smartdevicelink.spec b/packaging/smartdevicelink.spec new file mode 100644 index 0000000..3335d3c --- /dev/null +++ b/packaging/smartdevicelink.spec @@ -0,0 +1,170 @@ +%define SDL_PKGID SDL0000001 +%define SDL_APPID %{SDL_PKGID}.SmartDeviceLink + +Name: smartdevicelink +Summary: GENIVI mobile device and HMI integration +Version: 3.5 +Release: 1 +Group: Automotive/GENIVI +License: BSD-3-Clause +URL: http://projects.genivi.org/smartdevicelink/ +Source: %{name}-%{version}.tar.gz +Source1001: %{name}.manifest +Source2001: config.xml.in +Source2002: manifest.json.in +BuildRequires: cmake +BuildRequires: pkgconfig(bluez) +BuildRequires: pkgconfig(gstreamer-1.0) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(liblog4cxx) +BuildRequires: pkgconfig(avahi-client) +BuildRequires: pkgconfig(libpulse-simple) +BuildRequires: pkgconfig(libtzplatform-config) +BuildRequires: pkgconfig(expat) +BuildRequires: pkgconfig(libcrypto) +BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(sqlite3) +BuildRequires: doxygen +BuildRequires: zip +Requires: crosswalk + +# Custom SDL-enabled HMIs should "Provide" this virtual package. +Requires: smartdevicelink-hmi + +%description +SmartDeviceLink is a project which intends to standardize and wrap the +many in-vehicle interfaces which may exist in the automotive +context. The end goal is to provide an expandable software framework +to both mobile application developers and automotive head unit +creators for the creation of brought-in applications that appear +integrated onto a head unit. + +Many in-vehicle HMIs use different colors, templates, icons, fonts, +voice systems and input methods for their infotainment systems. With +SmartDeviceLink, a template-based approach is provided by the +automotive head unit and allows for different HMI frameworks to follow +a specific set of guidelines ensuring a consistent experience to a +developer. By leveraging this common API and a brought-in device, +automotive head units leverage the complete power of the brought-in +device using the APIs being executed on the mobile device. + +%package sample-hmi +Summary: Sample HMI +Provides: smartdevicelink-hmi + +%description sample-hmi +This package contains a sample/reference HMI. + +%prep +%setup -q -n %{name}-%{version} +cp %{SOURCE1001} . + +%build +mkdir html5_build +pushd html5_build +# For the Qt based HMI add -DHMI2=ON to the cmake command line flags. +%cmake .. -DEXTENDED_MEDIA_MODE=ON +make %{?_smp_mflags} +popd + +%install + +mkdir -p %{buildroot}%{_bindir} %{buildroot}%{_libdir} +mkdir -p %{buildroot}%{_datadir}/%{name} +mkdir -p %{buildroot}%{_sysconfdir}/%{name} + +pushd html5_build/src/appMain +install -m 0755 smartDeviceLinkCore %{buildroot}%{_bindir} +install -m 0755 libPolicy.so %{buildroot}%{_libdir} +popd + +pushd src/appMain +install -m 0644 audio.8bit.wav %{buildroot}%{_datadir}/%{name} +install -m 0644 \ + log4cxx.properties \ + hmi_capabilities.json \ + policy_table.json \ + sdl_preloaded_pt.json \ + sdl_update_pt.json \ + %{buildroot}%{_sysconfdir}/%{name} +sed -e 's,= \(.*\)\.json,= %{_sysconfdir}/%{name}/\1\.json,g' \ + -e 's,= \(audio.8bit.wav\),= %{_datadir}/%{name}/\1,' \ + smartDeviceLink.ini > \ + %{buildroot}%{_sysconfdir}/%{name}/smartDeviceLink.ini +popd + +pushd html5_build/src/components +install -m 0755 rpc_base/librpc_base.so %{buildroot}%{_libdir} +install -m 0755 utils/libUtils.so %{buildroot}%{_libdir} +install -m 0755 connection_handler/libconnectionHandler.so %{buildroot}%{_libdir} +install -m 0755 request_watchdog/libRequestWatchdog.so %{buildroot}%{_libdir} +install -m 0755 resumption/libResumption.so %{buildroot}%{_libdir} +install -m 0755 smart_objects/libSmartObjects.so %{buildroot}%{_libdir} +install -m 0755 policy/src/policy/sqlite_wrapper/libdbms.so %{buildroot}%{_libdir} +install -m 0755 policy/src/policy/policy_table/table_struct/libpolicy_struct.so %{buildroot}%{_libdir} +install -m 0755 policy/src/policy/usage_statistics/libUsageStatistics.so %{buildroot}%{_libdir} +install -m 0755 policy/src/policy/libPolicy.so %{buildroot}%{_libdir} +install -m 0755 transport_manager/libTransportManager.so %{buildroot}%{_libdir} +install -m 0755 protocol_handler/libProtocolHandler.so %{buildroot}%{_libdir} +install -m 0755 hmi_message_handler/libHMIMessageHandler.so %{buildroot}%{_libdir} +install -m 0755 config_profile/libConfigProfile.so %{buildroot}%{_libdir} +install -m 0755 interfaces/libMOBILE_API.so %{buildroot}%{_libdir} +install -m 0755 interfaces/libv4_protocol_v1_2_no_extra.so %{buildroot}%{_libdir} +install -m 0755 interfaces/libHMI_API.so %{buildroot}%{_libdir} +install -m 0755 application_manager/libApplicationManager.so %{buildroot}%{_libdir} +install -m 0755 time_tester/libTimeTester.so %{buildroot}%{_libdir} +install -m 0755 media_manager/libMediaManager.so %{buildroot}%{_libdir} +install -m 0755 formatters/libformatters.so %{buildroot}%{_libdir} +popd + +pushd html5_build/src/thirdPartyLibs +install -m 0755 encryption/libencryption.so %{buildroot}%{_libdir} +install -m 0755 MessageBroker/libMessageBrokerClient.so %{buildroot}%{_libdir} +install -m 0755 MessageBroker/libMessageBrokerServer.so %{buildroot}%{_libdir} +install -m 0755 MessageBroker/libMessageBroker.so %{buildroot}%{_libdir} +install -m 0755 libusbx-1.0.16/libLibusb-1.0.16.so %{buildroot}%{_libdir} +install -m 0755 jsoncpp/libjsoncpp.so %{buildroot}%{_libdir} +popd + +# Sample HMI +# The SDL HMI will be launched with xwalk-launcher so package it as a +# Crosswalk widget. +mkdir -p %{buildroot}%{TZ_SYS_APP_PREINSTALL} +pushd %{dirname:%SOURCE2001} +sed -e 's/%%SDL_PKGID%%/%{SDL_PKGID}/' \ + -e 's/%%SDL_APPID%%/%{SDL_APPID}/' \ + -e 's/%%SDL_VERSION%%/%{version}/' %{SOURCE2001} > config.xml +sed -e 's/%%SDL_VERSION%%/%{version}/' %{SOURCE2002} > manifest.json +zip %{buildroot}%{TZ_SYS_APP_PREINSTALL}/%{name}.wgt config.xml manifest.json +rm config.xml manifest.json +popd +pushd src/components/HMI +zip -r %{buildroot}%{TZ_SYS_APP_PREINSTALL}/%{name}.wgt . +popd + +# Create the 'hmi_link' file with the location of the sample HMI. +# Normally this would be the path to the top-level index.html file for +# the SDL HMI, e.g. %%{_datadir}/%%{name}/HMI/index.html. However, +# since we are using xwalk-laucher to launch the HMI we must instead +# provide the SDL Crosswalk application ID, i.s. SmartDeviceLink, +# instead. +echo %{SDL_APPID} > %{buildroot}%{_sysconfdir}/%{name}/hmi_link + +%clean + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%manifest %{name}.manifest +%license LICENSE +%{_bindir}/smartDeviceLinkCore +%{_libdir}/*.so* +%config %{_sysconfdir}/%{name}/log4cxx.properties + +%files sample-hmi +%manifest %{name}.manifest +%config %{_sysconfdir}/%{name}/* +%exclude %{_sysconfdir}/%{name}/log4cxx.properties +%{_datadir}/%{name}/* +%{TZ_SYS_APP_PREINSTALL}/%{name}.wgt diff --git a/src/appMain/main.cc b/src/appMain/main.cc index 6d98216..b8a527d 100644 --- a/src/appMain/main.cc +++ b/src/appMain/main.cc @@ -60,12 +60,30 @@ // ---------------------------------------------------------------------------- +#ifndef SDL_LOG4CXX_PROPERTIES_FILE +#define SDL_LOG4CXX_PROPERTIES_FILE "log4cxx.properties" +#endif + +#ifndef SDL_HMI_LINK_FILE +#define SDL_HMI_LINK_FILE "hmi_link" +#endif + +#ifndef SDL_HMI_BROWSER_PATH +#define SDL_HMI_BROWSER_PATH "/usr/bin/chromium-browser" +#define SDL_HMI_BROWSER_ARG0 "chromium-browser" +#define SDL_HMI_BROWSER_ARG1 "--auth-schemes=basic,digest,ntlm" +#endif + CREATE_LOGGERPTR_GLOBAL(logger, "appMain") namespace { -const std::string kBrowser = "/usr/bin/chromium-browser"; -const std::string kBrowserName = "chromium-browser"; -const std::string kBrowserParams = "--auth-schemes=basic,digest,ntlm"; +const std::string kBrowser = SDL_HMI_BROWSER_PATH; +const std::string kBrowserName = SDL_HMI_BROWSER_ARG0; + +#ifdef SDL_HMI_BROWSER_ARG1 +const std::string kBrowserParams = SDL_HMI_BROWSER_ARG1; +#endif + const std::string kLocalHostAddress = "127.0.0.1"; const std::string kApplicationVersion = "SDL_RB_B3.5"; @@ -77,13 +95,13 @@ const std::string kApplicationVersion = "SDL_RB_B3.5"; bool InitHmi() { struct stat sb; -if (stat("hmi_link", &sb) == -1) { +if (stat(SDL_HMI_LINK_FILE, &sb) == -1) { LOG4CXX_FATAL(logger, "File with HMI link doesn't exist!"); return false; } std::ifstream file_str; -file_str.open("hmi_link"); +file_str.open(SDL_HMI_LINK_FILE); if (!file_str.is_open()) { LOG4CXX_FATAL(logger, "File with HMI link was not opened!"); @@ -103,11 +121,19 @@ LOG4CXX_INFO(logger, file_str.close(); if (stat(hmi_link.c_str(), &sb) == -1) { - LOG4CXX_FATAL(logger, "HMI index.html doesn't exist!"); - return false; + LOG4CXX_INFO(logger, "HMI index.html doesn't exist!"); + // The hmi_link file in Tizen contains the Crosswalk application ID, + // not a top-level HMI web page such as index.html, since we're + // launching the HMI through xwalk-launcher. Ignore the fact that + // such a file doesn't exist. + // + // return false; } - return utils::System(kBrowser, kBrowserName).Add(kBrowserParams).Add(hmi_link) - .Execute(); + return utils::System(kBrowser, kBrowserName) +#ifdef SDL_HMI_BROWSER_ARG1 + .Add(kBrowserParams) +#endif + .Add(hmi_link).Execute(); } #endif // WEB_HMI @@ -140,7 +166,7 @@ int32_t main(int32_t argc, char** argv) { // -------------------------------------------------------------------------- // Logger initialization - INIT_LOGGER("log4cxx.properties"); + INIT_LOGGER(SDL_LOG4CXX_PROPERTIES_FILE); threads::Thread::SetNameForId(threads::Thread::CurrentId(), "MainThread"); @@ -157,7 +183,7 @@ int32_t main(int32_t argc, char** argv) { if ((argc > 1)&&(0 != argv)) { profile::Profile::instance()->config_file_name(argv[1]); } else { - profile::Profile::instance()->config_file_name("smartDeviceLink.ini"); + profile::Profile::instance()->config_file_name(SDL_CONFIG_FILE); } #ifdef __QNX__ diff --git a/src/thirdPartyLibs/CMakeLists.txt b/src/thirdPartyLibs/CMakeLists.txt index 40e0c08..efe2d2e 100644 --- a/src/thirdPartyLibs/CMakeLists.txt +++ b/src/thirdPartyLibs/CMakeLists.txt @@ -47,22 +47,27 @@ set(3RD_PARTY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/3rd_party") if(ENABLE_LOG OR HMI_DBUS_API) +# Tizen: Use the expat package already provided by Tizen IVI. + # --- libexpat - add_subdirectory(expat-2.1.0) +# add_subdirectory(expat-2.1.0) endif() if(ENABLE_LOG) +# Tizen: Use the log4cxx related packages already provided by Tizen IVI. + # --- libapr-1 - add_subdirectory(apr-cmake) +# add_subdirectory(apr-cmake) # --- apr-util - add_subdirectory(apr-util-cmake) +# add_subdirectory(apr-util-cmake) # --- log4cxx - add_subdirectory(apache-log4cxx-cmake) - set(LOG4CXX_LIBS_DIRECTORY ${LOG4CXX_LIBS_DIRECTORY} PARENT_SCOPE) +# add_subdirectory(apache-log4cxx-cmake) +#set(LOG4CXX_LIBS_DIRECTORY ${LOG4CXX_LIBS_DIRECTORY} PARENT_SCOPE) +set(LOG4CXX_LIBS_DIRECTORY /usr/lib PARENT_SCOPE) endif() -- 2.7.4