--- /dev/null
+From 5ecf7794e6635a331b57740b5d4491bba0a12a42 Mon Sep 17 00:00:00 2001
+From: Jaska Uimonen <jaska.uimonen@helsinki.fi>
+Date: Wed, 6 Jun 2012 17:41:55 +0300
+Subject: [PATCH 1/8] build-sys: fixes to get built, fixes for 64-bit distros.
+
+---
+ CMakeLists.txt | 23 +++++++++++++++++++----
+ PluginCommandInterfaceDbus/CMakeLists.txt | 4 ++--
+ PluginControlInterface/CMakeLists.txt | 2 +-
+ PluginRoutingInterfaceAsync/CMakeLists.txt | 2 +-
+ PluginRoutingInterfaceDbus/CMakeLists.txt | 2 +-
+ audiomanager.pc.cmake | 12 ++++++++++++
+ cmake/FindDBUS.cmake | 6 +++---
+ 7 files changed, 39 insertions(+), 12 deletions(-)
+ create mode 100644 audiomanager.pc.cmake
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7d63451..f06c238 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -29,6 +29,10 @@ ELSE (NOT DAEMONVERSION)
+ STRING(REGEX REPLACE "-" "." DAEMONVERSION ${DAEMONVERSION})
+ ENDIF(NOT DAEMONVERSION)
+
++IF(NOT DEFINED LIBDIR)
++ SET(LIBDIR lib)
++ENDIF(NOT DEFINED LIBDIR)
++
+ message(STATUS "Build Version ${DAEMONVERSION}")
+
+ execute_process(COMMAND git log --pretty=short WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+@@ -99,11 +103,16 @@ if(USE_BUILD_LIBS)
+ SET(DEFAULT_PLUGIN_ROUTING_DIR "${PLUGINS_OUTPUT_PATH}/routing")
+ SET(CONTROLLER_PLUGIN "${PLUGINS_OUTPUT_PATH}/control/libPluginControlInterface.so")
+ else(USE_BUILD_LIBS)
+- SET(DEFAULT_PLUGIN_COMMAND_DIR "${CMAKE_INSTALL_PREFIX}/lib/${LIB_INSTALL_SUFFIX}/command")
+- SET(DEFAULT_PLUGIN_ROUTING_DIR "${CMAKE_INSTALL_PREFIX}/lib/${LIB_INSTALL_SUFFIX}/routing")
+- SET(CONTROLLER_PLUGIN "${CMAKE_INSTALL_PREFIX}/lib/${LIB_INSTALL_SUFFIX}/control/libPluginControlInterface.so")
++ SET(DEFAULT_PLUGIN_COMMAND_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}/${LIB_INSTALL_SUFFIX}/command")
++ SET(DEFAULT_PLUGIN_ROUTING_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}/${LIB_INSTALL_SUFFIX}/routing")
++ SET(CONTROLLER_PLUGIN "${CMAKE_INSTALL_PREFIX}/${LIBDIR}/${LIB_INSTALL_SUFFIX}/control/libPluginControlInterface.so")
+ endif(USE_BUILD_LIBS)
+
++message(STATUS "default directory for command plugin ${DEFAULT_PLUGIN_COMMAND_DIR}")
++message(STATUS " routing plugin ${DEFAULT_PLUGIN_ROUTING_DIR}")
++message(STATUS "default controller plugin ${CONTROLLER_PLUGIN}")
++
++
+ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
+ SET(AUDIO_INCLUDE_FOLDER ${CMAKE_SOURCE_DIR}/include)
+ SET(DOC_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/doc)
+@@ -118,10 +127,12 @@ endif(EXISTS "ProjectSpecific/")
+
+ CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/cmake/config.cmake ${CMAKE_SOURCE_DIR}/include/config.h )
+ CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/AudioManagerDaemon/docx/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/DoxyFile )
+-
++CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/audiomanager.pc.cmake ${CMAKE_SOURCE_DIR}/audiomanager.pc @ONLY)
+
+ IF(WITH_DLT)
+ pkg_check_modules(DLT REQUIRED automotive-dlt>=2.2.0)
++ELSE(WITH_DLT)
++ set(CMAKE_EXE_LINKER_FLAGS "-lrt")
+ ENDIF(WITH_DLT)
+
+
+@@ -159,6 +170,10 @@ IF(EXISTS "ProjectSpecific/")
+ add_subdirectory (ProjectSpecific)
+ endif(EXISTS "ProjectSpecific/")
+
++INSTALL(FILES audiomanager.pc
++ DESTINATION ${LIBDIR}/pkgconfig
++ COMPONENT devel)
++
+ # uninstall target
+ configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+diff --git a/PluginCommandInterfaceDbus/CMakeLists.txt b/PluginCommandInterfaceDbus/CMakeLists.txt
+index 9d7f8a7..90e7574 100644
+--- a/PluginCommandInterfaceDbus/CMakeLists.txt
++++ b/PluginCommandInterfaceDbus/CMakeLists.txt
+@@ -68,12 +68,12 @@ ENDIF(WITH_TESTS)
+ #ENDIF(WITH_DOCUMENTATION)
+
+ INSTALL(TARGETS PluginCommandInterfaceDbus
+- DESTINATION "lib/${LIB_INSTALL_SUFFIX}/command"
++ DESTINATION "${LIBDIR}/${LIB_INSTALL_SUFFIX}/command"
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT sampleplugins
+ )
+
+-execute_process(COMMAND cp "${CMAKE_SOURCE_DIR}/PluginCommandInterfaceDbus/${INCLUDE_FOLDER}/CommandInterface.xml" ${EXECUTABLE_OUTPUT_PATH}/CommandInterface.xml)
++execute_process(COMMAND /bin/sh -c "mkdir -p ${EXECUTABLE_OUTPUT_PATH}; cp ${CMAKE_SOURCE_DIR}/PluginCommandInterfaceDbus/${include_FOLDER}/CommandInterface.xml ${EXECUTABLE_OUTPUT_PATH}/CommandInterface.xml")
+
+ SET(ADD_DEPEND "audiomanager-bin" "dlt" "libdbus-1-3(>=1.2.16)")
+ set_property(GLOBAL APPEND PROPERTY sampleplugins_prop "${ADD_DEPEND}")
+diff --git a/PluginControlInterface/CMakeLists.txt b/PluginControlInterface/CMakeLists.txt
+index b1be2d1..60e2b8b 100644
+--- a/PluginControlInterface/CMakeLists.txt
++++ b/PluginControlInterface/CMakeLists.txt
+@@ -62,7 +62,7 @@ ENDIF(WITH_TESTS)
+ #ENDIF(WITH_DOCUMENTATION)
+
+ INSTALL(TARGETS PluginControlInterface
+- DESTINATION "lib/${LIB_INSTALL_SUFFIX}/control"
++ DESTINATION "${LIBDIR}/${LIB_INSTALL_SUFFIX}/control"
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT sampleplugins
+ )
+diff --git a/PluginRoutingInterfaceAsync/CMakeLists.txt b/PluginRoutingInterfaceAsync/CMakeLists.txt
+index e3e52f7..e68f9ea 100644
+--- a/PluginRoutingInterfaceAsync/CMakeLists.txt
++++ b/PluginRoutingInterfaceAsync/CMakeLists.txt
+@@ -70,7 +70,7 @@ ENDIF(WITH_TESTS)
+
+
+ INSTALL(TARGETS PluginRoutingInterfaceAsync
+- DESTINATION "lib/${LIB_INSTALL_SUFFIX}/routing"
++ DESTINATION "${LIBDIR}/${LIB_INSTALL_SUFFIX}/routing"
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT sampleplugins
+ )
+diff --git a/PluginRoutingInterfaceDbus/CMakeLists.txt b/PluginRoutingInterfaceDbus/CMakeLists.txt
+index 4f8ade9..3050db6 100644
+--- a/PluginRoutingInterfaceDbus/CMakeLists.txt
++++ b/PluginRoutingInterfaceDbus/CMakeLists.txt
+@@ -71,7 +71,7 @@ execute_process(COMMAND cp "${CMAKE_SOURCE_DIR}/PluginRoutingInterfaceDbus/${INC
+ #ENDIF(WITH_DOCUMENTATION)
+
+ INSTALL(TARGETS PluginRoutingInterfaceDbus
+- DESTINATION "lib/${LIB_INSTALL_SUFFIX}/routing"
++ DESTINATION "${LIBDIR}/${LIB_INSTALL_SUFFIX}/routing"
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
+ COMPONENT sampleplugins
+ )
+diff --git a/audiomanager.pc.cmake b/audiomanager.pc.cmake
+new file mode 100644
+index 0000000..d83f00b
+--- /dev/null
++++ b/audiomanager.pc.cmake
+@@ -0,0 +1,12 @@
++prefix=@prefix@
++exec_prefix=@prefix@
++libdir=@libdir@
++includedir=@includedir@
++
++Name: audiomanager
++Description: GENIVI Audio Manager
++Version: @GENIVI_PROJECT_VERSION@
++Requires:
++Libs: -L${libdir} -ldlt -lrt -lpthread
++Cflags: -I${includedir}/dlt -DDLT_@PRINT_MAJOR_VERSION@_@PRINT_MINOR_VERSION@
++
+diff --git a/cmake/FindDBUS.cmake b/cmake/FindDBUS.cmake
+index 0935b2f..2d2cd9e 100644
+--- a/cmake/FindDBUS.cmake
++++ b/cmake/FindDBUS.cmake
+@@ -22,13 +22,13 @@ FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h
+ )
+
+ FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
+-/usr/lib/dbus-1.0/include
+-/usr/lib/*/dbus-1.0/include
++/usr/${LIBDIR}/dbus-1.0/include
++/usr/${LIBDIR}/*/dbus-1.0/include
+ )
+
+ FIND_LIBRARY(DBUS_LIBRARY
+ NAMES dbus-1
+-PATHS /lib
++PATHS /${LIBDIR}
+ )
+
+ SET( DBUS_FOUND "NO" )
+--
+1.7.7.6
+
--- /dev/null
+From 0cf6c971b40bb6b35d839d6c8124103b390950e0 Mon Sep 17 00:00:00 2001
+From: Jaska Uimonen <jaska.uimonen@helsinki.fi>
+Date: Wed, 6 Jun 2012 17:43:58 +0300
+Subject: [PATCH 2/8] DBus sending&routing interface bug fixes.
+
+---
+ PluginRoutingInterfaceDbus/include/CAmDbusSend.h | 2 +-
+ PluginRoutingInterfaceDbus/src/CAmDbusSend.cpp | 2 +-
+ .../src/CAmRoutingSenderDbus.cpp | 37 ++++++++++++++------
+ 3 files changed, 28 insertions(+), 13 deletions(-)
+
+diff --git a/PluginRoutingInterfaceDbus/include/CAmDbusSend.h b/PluginRoutingInterfaceDbus/include/CAmDbusSend.h
+index 3f8f0a5..97e62fb 100644
+--- a/PluginRoutingInterfaceDbus/include/CAmDbusSend.h
++++ b/PluginRoutingInterfaceDbus/include/CAmDbusSend.h
+@@ -32,7 +32,7 @@ namespace am
+ class CAmRoutingDbusSend
+ {
+ public:
+- CAmRoutingDbusSend(DBusConnection* conn, std::string bus_name, std::string path, std::string interface, std::string method);
++ CAmRoutingDbusSend(DBusConnection* conn, std::string& bus_name, std::string& path, std::string& interface, std::string& method);
+ virtual ~CAmRoutingDbusSend();
+ void append(std::string string);
+ void append(uint16_t integer);
+diff --git a/PluginRoutingInterfaceDbus/src/CAmDbusSend.cpp b/PluginRoutingInterfaceDbus/src/CAmDbusSend.cpp
+index 0f02ab3..b393569 100644
+--- a/PluginRoutingInterfaceDbus/src/CAmDbusSend.cpp
++++ b/PluginRoutingInterfaceDbus/src/CAmDbusSend.cpp
+@@ -25,7 +25,7 @@ namespace am
+
+ DLT_IMPORT_CONTEXT(routingDbus)
+
+-CAmRoutingDbusSend::CAmRoutingDbusSend(DBusConnection* conn, std::string bus_name, std::string path, std::string interface, std::string method) :
++CAmRoutingDbusSend::CAmRoutingDbusSend(DBusConnection* conn, std::string& bus_name, std::string& path, std::string& interface, std::string& method) :
+ mpDbusMessage(NULL), //
+ mpDbusConnection(conn), //
+ mDbusMessageIter(), //
+diff --git a/PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp b/PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp
+index 360d61d..f95ec33 100644
+--- a/PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp
++++ b/PluginRoutingInterfaceDbus/src/CAmRoutingSenderDbus.cpp
+@@ -95,7 +95,8 @@ am_Error_e CAmRoutingSenderDbus::asyncAbort(const am_Handle_s handle)
+ iter = mMapHandles.find(handle.handle);
+ if (iter != mMapHandles.end())
+ {
+- CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, "asyncAbort");
++ std::string method("asyncAbort");
++ CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, method);
+ send.append(handle.handle);
+ return (send.send());
+ }
+@@ -111,7 +112,12 @@ am_Error_e CAmRoutingSenderDbus::asyncConnect(const am_Handle_s handle, const am
+ iter = mMapSources.find(sourceID);
+ if (iter != mMapSources.end())
+ {
+- CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, "asyncConnect");
++ std::string busname(iter->second.busname);
++ std::string path(iter->second.path);
++ std::string interface(iter->second.interface);
++ std::string method("asyncConnect");
++
++ CAmRoutingDbusSend send(mpDBusConnection, busname, path, interface, method);
+ send.append(handle.handle);
+ send.append(connectionID);
+ send.append(sourceID);
+@@ -132,7 +138,8 @@ am_Error_e CAmRoutingSenderDbus::asyncDisconnect(const am_Handle_s handle, const
+ iter = mMapConnections.find(connectionID);
+ if (iter != mMapConnections.end())
+ {
+- CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, "asyncDisconnect");
++ std::string method("asyncDisconnect");
++ CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, method);
+ send.append(handle.handle);
+ send.append(connectionID);
+ mMapHandles.insert(std::make_pair(handle.handle, iter->second));
+@@ -149,7 +156,8 @@ am_Error_e CAmRoutingSenderDbus::asyncSetSinkVolume(const am_Handle_s handle, co
+ iter = mMapSinks.find(sinkID);
+ if (iter != mMapSinks.end())
+ {
+- CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, "asyncSetSinkVolume");
++ std::string method("asyncSetSinkVolume");
++ CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, method);
+ send.append(handle.handle);
+ send.append(sinkID);
+ send.append(volume);
+@@ -169,7 +177,8 @@ am_Error_e CAmRoutingSenderDbus::asyncSetSourceVolume(const am_Handle_s handle,
+ iter = mMapSources.find(sourceID);
+ if (iter != mMapSources.end())
+ {
+- CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, "asyncSetSourceVolume");
++ std::string method("asyncSetSourceVolume");
++ CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, method);
+ send.append(handle.handle);
+ send.append(sourceID);
+ send.append(volume);
+@@ -189,7 +198,8 @@ am_Error_e CAmRoutingSenderDbus::asyncSetSourceState(const am_Handle_s handle, c
+ iter = mMapSources.find(sourceID);
+ if (iter != mMapSources.end())
+ {
+- CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, "asyncSetSourceState");
++ std::string method("asyncSetSourceState");
++ CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, method);
+ send.append(handle.handle);
+ send.append(sourceID);
+ send.append(static_cast<int16_t>(state));
+@@ -207,7 +217,8 @@ am_Error_e CAmRoutingSenderDbus::asyncSetSinkSoundProperties(const am_Handle_s h
+ iter = mMapSinks.find(sinkID);
+ if (iter != mMapSinks.end())
+ {
+- CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, "asyncSetSinkSoundProperties");
++ std::string method("asyncSetSinkSoundProperties");
++ CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, method);
+ send.append(handle.handle);
+ send.append(sinkID);
+ send.append(listSoundProperties);
+@@ -225,7 +236,8 @@ am_Error_e CAmRoutingSenderDbus::asyncSetSinkSoundProperty(const am_Handle_s han
+ iter = mMapSinks.find(sinkID);
+ if (iter != mMapSinks.end())
+ {
+- CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, "asyncSetSinkSoundProperty");
++ std::string method("asyncSetSinkSoundProperty");
++ CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, method);
+ send.append(handle.handle);
+ send.append(sinkID);
+ send.append(soundProperty);
+@@ -243,7 +255,8 @@ am_Error_e CAmRoutingSenderDbus::asyncSetSourceSoundProperties(const am_Handle_s
+ iter = mMapSources.find(sourceID);
+ if (iter != mMapSources.end())
+ {
+- CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, "asyncSetSourceSoundProperties");
++ std::string method("asyncSetSourceSoundProperties");
++ CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, method);
+ send.append(handle.handle);
+ send.append(sourceID);
+ send.append(listSoundProperties);
+@@ -261,7 +274,8 @@ am_Error_e CAmRoutingSenderDbus::asyncSetSourceSoundProperty(const am_Handle_s h
+ iter = mMapSources.find(sourceID);
+ if (iter != mMapSources.end())
+ {
+- CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, "asyncSetSourceSoundProperty");
++ std::string method("asyncSetSourceSoundProperty");
++ CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, method);
+ send.append(handle.handle);
+ send.append(sourceID);
+ send.append(soundProperty);
+@@ -290,7 +304,8 @@ am_Error_e CAmRoutingSenderDbus::setDomainState(const am_domainID_t domainID, co
+ iter = mMapDomains.find(domainID);
+ if (iter != mMapDomains.end())
+ {
+- CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, "setDomainState");
++ std::string method("setDomainState");
++ CAmRoutingDbusSend send(mpDBusConnection, iter->second.busname, iter->second.path, iter->second.interface, method);
+ send.append(domainID);
+ send.append(static_cast<int16_t>(domainState));
+ return (send.send());
+--
+1.7.7.6
+
--- /dev/null
+From 560f2181b1cd166e9e1303539b387996ea5bf58e Mon Sep 17 00:00:00 2001
+From: Jaska Uimonen <jaska.uimonen@helsinki.fi>
+Date: Wed, 6 Jun 2012 17:44:20 +0300
+Subject: [PATCH 3/8] Uninitialized member fixes.
+
+---
+ .../src/CAmControlSenderBase.cpp | 2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/PluginControlInterface/src/CAmControlSenderBase.cpp b/PluginControlInterface/src/CAmControlSenderBase.cpp
+index 046a7ac..cdbbcd3 100644
+--- a/PluginControlInterface/src/CAmControlSenderBase.cpp
++++ b/PluginControlInterface/src/CAmControlSenderBase.cpp
+@@ -85,6 +85,8 @@ am_Error_e CAmControlSenderBase::hookUserConnectionRequest(const am_sourceID_t s
+ am_MainConnection_s mainConnectionData;
+ mainConnectionData.mainConnectionID = 0;
+ mainConnectionData.connectionState = CS_CONNECTING;
++ mainConnectionData.sinkID = sinkID;
++ mainConnectionData.sourceID = sourceID;
+ mainConnectionData.delay = 0;
+ mainConnectionData.listConnectionID = listConnectionIDs;
+ mControlReceiveInterface->enterMainConnectionDB(mainConnectionData, mainConnectionID);
+--
+1.7.7.6
+
--- /dev/null
+From 120777b93b69a8e54a30fd24bafab66ef86229ee Mon Sep 17 00:00:00 2001
+From: Jaska Uimonen <jaska.uimonen@helsinki.fi>
+Date: Fri, 8 Jun 2012 12:45:40 +0300
+Subject: [PATCH 4/8] dbus system bus fix
+
+---
+ AudioManagerDaemon/src/CAmDbusWrapper.cpp | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/AudioManagerDaemon/src/CAmDbusWrapper.cpp b/AudioManagerDaemon/src/CAmDbusWrapper.cpp
+index 0f511e2..651337e 100644
+--- a/AudioManagerDaemon/src/CAmDbusWrapper.cpp
++++ b/AudioManagerDaemon/src/CAmDbusWrapper.cpp
+@@ -136,7 +136,7 @@ void CAmDbusWrapper::registerCallback(const DBusObjectPathVTable* vtable, const
+
+ std::string completePath = std::string(DBUS_SERVICE_OBJECT_PATH) + "/" + path;
+ dbus_error_init(&mDBusError);
+- mpDbusConnection = dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
++ //mpDbusConnection = dbus_bus_get(DBUS_BUS_SESSION, &mDBusError);
+ dbus_connection_register_object_path(mpDbusConnection, completePath.c_str(), vtable, userdata);
+ if (dbus_error_is_set(&mDBusError))
+ {
+--
+1.7.7.6
+
--- /dev/null
+From 15d3aef5abd037611dfa8d8cf7449c61579c77aa Mon Sep 17 00:00:00 2001
+From: Jaska Uimonen <jaska.uimonen@helsinki.fi>
+Date: Fri, 8 Jun 2012 22:27:17 +0300
+Subject: [PATCH 5/8] remove async plugin from build
+
+---
+ CMakeLists.txt | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f06c238..2104fec 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -155,7 +155,7 @@ endif(WITH_PLUGIN_COMMAND)
+
+ if(WITH_PLUGIN_ROUTING)
+ add_subdirectory (PluginRoutingInterfaceDbus)
+- add_subdirectory (PluginRoutingInterfaceAsync)
++# add_subdirectory (PluginRoutingInterfaceAsync)
+ endif(WITH_PLUGIN_ROUTING)
+
+ if(WITH_PLUGIN_CONTROL)
+--
+1.7.7.6
+
--- /dev/null
+From 0ad35127c272fe98a85b428d84b33403853b3bfc Mon Sep 17 00:00:00 2001
+From: Jaska Uimonen <jaska.uimonen@helsinki.fi>
+Date: Wed, 6 Jun 2012 17:48:40 +0300
+Subject: [PATCH 6/8] packaging: added spec file template.
+
+---
+ audiomanager.spec.in | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 73 insertions(+), 0 deletions(-)
+ create mode 100644 audiomanager.spec.in
+
+diff --git a/audiomanager.spec.in b/audiomanager.spec.in
+new file mode 100644
+index 0000000..e772f36
+--- /dev/null
++++ b/audiomanager.spec.in
+@@ -0,0 +1,73 @@
++Name: audiomanager
++License: Mozilla Public License 2.0
++Group: System/Daemons
++Summary: AudioManager
++Version: @VERSION@
++Release: 0
++Source: %{name}-@VERSION@.tar.gz
++@DECLARE_PATCHES@
++#BuildRequires: pkgconfig(automotive-dlt)
++BuildRequires: pkgconfig(sqlite3)
++BuildRequires: pkgconfig(dbus-1)
++BuildRequires: cmake
++Requires(post): /sbin/ldconfig
++Requires(postun): /sbin/ldconfig
++
++%description
++Automotive AudioManager
++
++%package devel
++License: Mozilla Public License 2.0
++Summary: Automotive AudioManager Development Package
++Group: System/Development
++Requires: %{name} = %{version}-%{release}
++
++%description devel
++Files needed for developing against the Automotive AudioManager
++
++%prep
++%setup -q -n %{name}-@VERSION@
++@APPLY_PATCHES@
++
++%build
++mkdir build
++cd build
++
++case %{_arch} in
++ *64) libdir=lib64;;
++ *) libdir=lib;;
++esac
++
++cmake -DWITH_TESTS=OFF -DUSE_BUILD_LIBS=OFF -DWITH_DLT=OFF -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=$libdir ..
++make %{?jobs:-j %jobs}
++
++%install
++rm -rf "$RPM_BUILD_ROOT"
++cd build
++make install DESTDIR=$RPM_BUILD_ROOT
++
++%post -p /sbin/ldconfig
++
++%postun -p /sbin/ldconfig
++
++%clean
++rm -rf "$RPM_BUILD_ROOT"
++
++%files
++%defattr(-,root,root,-)
++%{_bindir}/AudioManager
++%{_libdir}/audioManager/command/*.so.*
++%{_libdir}/audioManager/control/*.so.*
++%{_libdir}/audioManager/routing/*.so.*
++%{_libdir}/audioManager/command/*.so
++%{_libdir}/audioManager/control/*.so
++%{_libdir}/audioManager/routing/*.so
++
++%files devel
++%defattr(-,root,root,-)
++%{_includedir}/*.h
++%{_includedir}/command/*.h
++%{_includedir}/control/*.h
++%{_includedir}/routing/*.h
++%{_includedir}/shared/*.h
++%{_libdir}/pkgconfig/*.pc
+--
+1.7.7.6
+
--- /dev/null
+From 23763810ae5ac4196b8f179476dab3f6c591bc67 Mon Sep 17 00:00:00 2001
+From: Jaska Uimonen <jaska.uimonen@helsinki.fi>
+Date: Wed, 6 Jun 2012 17:59:11 +0300
+Subject: [PATCH 7/8] scripts: added obs-export.sh.
+
+---
+ obs-export.sh | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 135 insertions(+), 0 deletions(-)
+ create mode 100755 obs-export.sh
+
+diff --git a/obs-export.sh b/obs-export.sh
+new file mode 100755
+index 0000000..d4c72da
+--- /dev/null
++++ b/obs-export.sh
+@@ -0,0 +1,135 @@
++#!/bin/bash
++
++# This needs a bit more work, mostly on the "discplined engineering" front.
++# IOW, instead of this UPSTREAM_BASE hack it would be better to have 3
++# branches:
++# 1) pristine upstream: for tracking upstream progress/retrogression
++# 2) patched upstream: pristine upstream with outr patches applied
++# 3) working local: patches upstream + a set of scripts (like this) to
++# do everyday stuff like making new releases, exporting stuff to
++# OBS, etc...
++
++PKG="$(basename `pwd` | tr [:upper:] [:lower:])"
++UPSTREAM_BASE="06476e68a42077a0597628dca1c4a53cd20f5236"
++VERSION="`date +'%Y%m%d'`"
++HEAD="HEAD"
++MODE=gerrit
++
++while [ "${1#-}" != "$1" -a -n "$1" ]; do
++ case $1 in
++ --name|-n)
++ PKG="$2"
++ shift 2
++ ;;
++ --version|-v)
++ VERSION="$2"
++ shift 2
++ ;;
++ --base|-B|-b)
++ UPSTREAM_BASE="$2"
++ shift 2
++ ;;
++ --head|-H)
++ HEAD="$2"
++ shift 2
++ ;;
++ --obs|-o)
++ MODE="obs"
++ shift 1
++ ;;
++ --help|-h)
++ echo "usage: $0 [options], where the possible options are"
++ echo " -n <name> name of your package"
++ echo " -v <version> version to in rpm/SPEC file"
++ echo " -B <upstream-base> name or SHA1 of baseline"
++ echo " -H <taget-head> name or SHA1 of release HEAD"
++ echo " --obs include tarball for OBS"
++ echo ""
++ echo "<name> is the name of the package, <version> is the version"
++ echo "you want to export to OBS, and <upstream-base> is the name of"
++ echo "the upstream git branch or the SHA1 you want to generate your"
++ echo "release from and base your patches on top of. On OBS mode the"
++ echo "output will be generated in a directory called obs-$VERSION."
++ echo "Otherwise in gerrit mode, the output will be generated in a"
++ echo "directory called packaging."
++ echo ""
++ echo "E.g.:"
++ echo " $0 -n pulseaudio -v 2.0 -B pulseaudio-2.0 -H tizen"
++ echo ""
++ echo "This will produce a gerrit export with version 2.0 against the"
++ echo "SHA1 pulseaudio-2.0, producing patches up till tizen and"
++ echo "place the result in a directory called packaging."
++ exit 0
++ ;;
++ --debug|-d)
++ set -x
++ ;;
++ *) echo "usage: $0 [-n <name>][-v <version>][--obs]"
++ echo " [-b <upstream-base>] [-H <head>"
++ exit 1
++ ;;
++ esac
++done
++
++case $MODE in
++ gerrit)
++ TARBALL=""
++ DIR=packaging
++ ;;
++ obs)
++ TARBALL=$PKG-$VERSION.tar
++ DIR="obs-$VERSION"
++ ;;
++ *)
++ echo "invalid mode: $MODE"
++ exit 1
++ ;;
++esac
++
++echo "Package name: $PKG"
++echo "Package version: $VERSION"
++echo "Package baseline: $UPSTREAM_BASE"
++echo "Package head: $HEAD"
++echo "Output directory: $DIR"
++
++if [ -n "$TARBALL" ]; then
++ echo "Generating tarball..."
++ rm -fr $DIR
++ mkdir $DIR && \
++ git archive --format=tar --prefix=$PKG-$VERSION/ $UPSTREAM_BASE \
++ > $DIR/$TARBALL && \
++ gzip $DIR/$TARBALL
++fi
++
++echo "Generating patches, creating spec file..."
++cd $DIR && \
++ git format-patch -n $UPSTREAM_BASE..$HEAD && \
++ cat ../$PKG.spec.in | sed "s/@VERSION@/$VERSION/g" > $PKG.spec.in && \
++cd - >& /dev/null
++
++cd $DIR
++patchlist="`ls *.patch`"
++cat $PKG.spec.in | while read line; do
++ case $line in
++ @DECLARE_PATCHES@)
++ i=0
++ for patch in $patchlist; do
++ echo "Patch$i: $patch"
++ let i=$i+1
++ done
++ ;;
++ @APPLY_PATCHES@)
++ i=0
++ for patch in $patchlist; do
++ echo "%patch$i -p1"
++ let i=$i+1
++ done
++ ;;
++ *)
++ echo "$line"
++ ;;
++ esac
++done > $PKG.spec
++cd - >& /dev/null
++
++rm -f $DIR/$PKG.spec.in
+--
+1.7.7.6
+
--- /dev/null
+From 9bd6bf19e53476b0cc284ae7fef44a40fd873d49 Mon Sep 17 00:00:00 2001
+From: Jaska Uimonen <jaska.uimonen@helsinki.fi>
+Date: Thu, 7 Jun 2012 10:55:56 +0300
+Subject: [PATCH 8/8] build-sys: make sure libdbus pulls in -lrt for the
+ linker.
+
+---
+ cmake/FindDBUS.cmake | 1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/cmake/FindDBUS.cmake b/cmake/FindDBUS.cmake
+index 2d2cd9e..99bfe4a 100644
+--- a/cmake/FindDBUS.cmake
++++ b/cmake/FindDBUS.cmake
+@@ -34,6 +34,7 @@ PATHS /${LIBDIR}
+ SET( DBUS_FOUND "NO" )
+ IF(DBUS_LIBRARY)
+ SET( DBUS_FOUND "YES" )
++ SET ( DBUS_LIBRARY ${DBUS_LIBRARY} -lrt)
+ message(STATUS "Found DBUS libs: ${DBUS_LIBRARY}")
+ message(STATUS "Found DBUS include: ${DBUS_INCLUDE_DIR}")
+ message(STATUS "Found DBUS arch dependent include: ${DBUS_ARCH_INCLUDE_DIR}")
+--
+1.7.7.6
+
--- /dev/null
+Name: audiomanager
+License: Mozilla Public License 2.0
+Group: System/Daemons
+Summary: AudioManager
+Version: 0.5
+Release: 0
+Source: %{name}-0.5.tar.gz
+Patch0: 0001-build-sys-fixes-to-get-built-fixes-for-64-bit-distro.patch
+Patch1: 0002-DBus-sending-routing-interface-bug-fixes.patch
+Patch2: 0003-Uninitialized-member-fixes.patch
+Patch3: 0004-dbus-system-bus-fix.patch
+Patch4: 0005-remove-async-plugin-from-build.patch
+Patch5: 0006-packaging-added-spec-file-template.patch
+Patch6: 0007-scripts-added-obs-export.sh.patch
+Patch7: 0008-build-sys-make-sure-libdbus-pulls-in-lrt-for-the-lin.patch
+#BuildRequires: pkgconfig(automotive-dlt)
+BuildRequires: pkgconfig(sqlite3)
+BuildRequires: pkgconfig(dbus-1)
+BuildRequires: cmake
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+Automotive AudioManager
+
+%package devel
+License: Mozilla Public License 2.0
+Summary: Automotive AudioManager Development Package
+Group: System/Development
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Files needed for developing against the Automotive AudioManager
+
+%prep
+%setup -q -n %{name}-0.5
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+
+%build
+mkdir build
+cd build
+
+case %{_arch} in
+*64) libdir=lib64;;
+*) libdir=lib;;
+esac
+
+cmake -DWITH_TESTS=OFF -DUSE_BUILD_LIBS=OFF -DWITH_DLT=OFF -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=$libdir ..
+make %{?jobs:-j %jobs}
+
+%install
+rm -rf "$RPM_BUILD_ROOT"
+cd build
+make install DESTDIR=$RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%clean
+rm -rf "$RPM_BUILD_ROOT"
+
+%files
+%defattr(-,root,root,-)
+%{_bindir}/AudioManager
+%{_libdir}/audioManager/command/*.so.*
+%{_libdir}/audioManager/control/*.so.*
+%{_libdir}/audioManager/routing/*.so.*
+%{_libdir}/audioManager/command/*.so
+%{_libdir}/audioManager/control/*.so
+%{_libdir}/audioManager/routing/*.so
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/*.h
+%{_includedir}/command/*.h
+%{_includedir}/control/*.h
+%{_includedir}/routing/*.h
+%{_includedir}/shared/*.h
+%{_libdir}/pkgconfig/*.pc