[5.0] Add plugin-parser which makes symbolic link of csharp-binder, fix build error 74/196174/1 accepted/tizen/5.0/unified/20181226.063534 submit/tizen_5.0/20181224.124841
authordongsug.song <dongsug.song@samsung.com>
Mon, 24 Dec 2018 10:58:30 +0000 (19:58 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Mon, 24 Dec 2018 11:01:07 +0000 (20:01 +0900)
This reverts commit 424092804c7d1210576c3f7c10666d27722f6cd4.

Change-Id: I76ff814cdeac2a31b4bce4532995368e1d9fadfc

build/tizen/configure.ac
build/tizen/plugin-parser/Makefile.am [new file with mode: 0755]
build/tizen/plugin-parser/configure.ac [new file with mode: 0644]
build/tizen/plugin-parser/nui_vulkan_backend.txt [new file with mode: 0644]
dali-extension/plugin-parser/file.list [new file with mode: 0644]
dali-extension/plugin-parser/plugin-parser.cpp [new file with mode: 0755]
dali-extension/plugin-parser/plugin-parser.h [new file with mode: 0755]
packaging/dali-extension.spec

index 54344b9..429b3ea 100755 (executable)
@@ -21,6 +21,7 @@ AC_CONFIG_SUBDIRS(video-player)
 AC_CONFIG_SUBDIRS(web-engine-chromium)
 AC_CONFIG_SUBDIRS(image-loader)
 AC_CONFIG_SUBDIRS(web-engine-lite)
+AC_CONFIG_SUBDIRS(plugin-parser)
 
 AC_CONFIG_FILES([
 Makefile
diff --git a/build/tizen/plugin-parser/Makefile.am b/build/tizen/plugin-parser/Makefile.am
new file mode 100755 (executable)
index 0000000..b789706
--- /dev/null
@@ -0,0 +1,29 @@
+extension_src_dir = ../../../dali-extension
+
+include ../../../dali-extension/plugin-parser/file.list
+
+lib_LTLIBRARIES =
+
+lib_LTLIBRARIES += libdali-plugin-parser.la
+
+libdali_plugin_parser_la_SOURCES = $(plugin_parser_src_files)
+
+libdali_plugin_parser_la_DEPENDENCIES =
+
+libdali_plugin_parser_la_CXXFLAGS = \
+                       -I../../../dali-extension/ \
+                       $(DLOG_CFLAGS) \
+                       $(DALI_CFLAGS) \
+                       -I${includedir}/glib-2.0 \
+                       -I${libdir}/glib-2.0/include \
+                       -I${includedir}/boost \
+                       -I${includedir}/pkgmgr \
+                       -Wall -Werror
+
+libdali_plugin_parser_la_LIBADD = \
+                       $(DLOG_LIBS)
+
+
+libdali_plugin_parser_la_LDFLAGS = \
+                      -rdynamic
+
diff --git a/build/tizen/plugin-parser/configure.ac b/build/tizen/plugin-parser/configure.ac
new file mode 100644 (file)
index 0000000..71ffcb4
--- /dev/null
@@ -0,0 +1,31 @@
+4_define([dali_version],[0.1.0])
+AC_INIT([dali], [dali_version])
+AM_INIT_AUTOMAKE([-Wall foreign])
+
+AC_CONFIG_MACRO_DIR([m4])
+
+AC_PROG_CXX
+AC_PROG_LIBTOOL
+
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+LT_INIT
+
+DALI_EXTENSION_VERSION=dali_version
+AC_SUBST(DALI_EXTENSION_VERSION)
+
+PKG_CHECK_MODULES([DALI], [dali-core dali-adaptor dali-toolkit])
+PKG_CHECK_MODULES(PKGMGR_INFO, pkgmgr-info)
+PKG_CHECK_MODULES(PKGMGR_INSTALLER, pkgmgr-installer)
+PKG_CHECK_MODULES(DLOG, dlog)
+PKG_CHECK_MODULES(GLIB20, glib-2.0)
+PKG_CHECK_MODULES(BOOST, boost)
+
+#devincludepath=${includedir}
+#AC_SUBST(devincludepath)
+
+AC_CONFIG_FILES([
+Makefile
+])
+
+AC_OUTPUT
diff --git a/build/tizen/plugin-parser/nui_vulkan_backend.txt b/build/tizen/plugin-parser/nui_vulkan_backend.txt
new file mode 100644 (file)
index 0000000..d539d7f
--- /dev/null
@@ -0,0 +1 @@
+type="metadata";name="http://tizen.org/metadata/nui_vulkan_backend";path="/etc/package-manager/parserlib/metadata/libnui_vulkan_backend_plugin.so"
\ No newline at end of file
diff --git a/dali-extension/plugin-parser/file.list b/dali-extension/plugin-parser/file.list
new file mode 100644 (file)
index 0000000..ebc0b64
--- /dev/null
@@ -0,0 +1,4 @@
+plugin_parser_src_files = $(extension_src_dir)/plugin-parser/plugin-parser.cpp
+
+
+plugin_parser_header_files = $(extension_src_dir)/plugin-parser/plugin-parser.h
\ No newline at end of file
diff --git a/dali-extension/plugin-parser/plugin-parser.cpp b/dali-extension/plugin-parser/plugin-parser.cpp
new file mode 100755 (executable)
index 0000000..0c789e2
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef  LOG_TAG
+#undef  LOG_TAG
+#endif
+#define LOG_TAG "DALI_PLUGIN_PARSER"
+
+#include <cstring>
+#include <vector>
+#include <sstream>
+#include <glib.h>
+#include <pkgmgr-info.h>
+#include <pkgmgr_installer_info.h>
+#include <boost/filesystem.hpp>
+#include <boost/system/error_code.hpp>
+#include "plugin-parser.h"
+
+typedef struct Metadata
+{
+  const char *key;
+  const char *value;
+} Metadata;
+
+const std::string valueType = "true";
+const std::string mdKey = "http://tizen.org/metadata/nui_vulkan_backend";
+extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgId, const char *appId, GList *list)
+{
+  GList *tag = NULL;
+  bool mdValue = false;
+  Metadata *mdInfo = NULL;
+  tag = g_list_first(list);
+  while (tag)
+  {
+    mdInfo = (Metadata*)tag->data;
+    if (mdInfo->key == mdKey && mdInfo->value == valueType)
+    {
+      _INFO("NUI VulkanBackend set TRUE");
+      mdValue = true;
+    }
+    tag = g_list_next(tag);
+  }
+
+  if (mdValue)
+  {
+    int ret = makeNuiVulkanBackendSymbolicLink(pkgId, mdValue);
+    _INFO("makeNuiVulkanBackendSymbolicLink()=%d", ret );
+  }
+  else
+  {
+    _INFO("No symbolic link for nui vulkan backend!");
+  }
+  return 0;
+}
+
+extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *appId, GList *list)
+{
+  return PKGMGR_MDPARSER_PLUGIN_INSTALL(pkgId, appId, list);
+}
+
+extern "C" int getRootPath(std::string pkgId, std::string& rootPath)
+{
+  int ret = 0;
+  char *path = 0;
+
+  uid_t uid = 0;
+
+  if (pkgmgr_installer_info_get_target_uid(&uid) < 0)
+  {
+    _ERR("Failed to get UID");
+    return -1;
+  }
+
+  pkgmgrinfo_pkginfo_h handle;
+  if (uid == 0)
+  {
+    ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgId.c_str(), &handle);
+    if (ret != PMINFO_R_OK)
+      return -1;
+  } else
+  {
+    ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgId.c_str(), uid, &handle);
+    if (ret != PMINFO_R_OK)
+      return -1;
+  }
+
+  ret = pkgmgrinfo_pkginfo_get_root_path(handle, &path);
+  if (ret != PMINFO_R_OK)
+  {
+    pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+    return -1;
+  }
+  rootPath = path;
+  pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+
+  return 0;
+}
+
+namespace bf = boost::filesystem;
+extern "C" int makeNuiVulkanBackendSymbolicLink(const std::string& pkgId, bool vkOn)
+{
+  std::string pkgRoot;
+  if (getRootPath(pkgId, pkgRoot) < 0)
+  {
+    _ERR("makeNuiVulkanBackendSymbolicLink() ERROR : fail to get pkgRoot!");
+    return -1;
+  }
+  _INFO("makeNuiVulkanBackendSymbolicLink() TP1 : pkgRoot=%s, vkOn=%d", static_cast<const char*>(pkgRoot.c_str()), vkOn);
+
+  const char* nuiVkBinderPath = "/usr/lib/libdali-csharp-binder-vk.so";
+
+  // if(!vkOn) {
+  //  nuiVkBinderPath = "/usr/lib/libdali-csharp-binder.so";
+  // }
+
+  bf::path symbol_path = bf::path(pkgRoot) / bf::path("lib/libdali-csharp-binder.so");
+  boost::system::error_code error;
+
+  bf::create_symlink(bf::path(nuiVkBinderPath), symbol_path, error);
+  if (error)
+  {
+    _ERR("makeNuiVulkanBackendSymbolicLink() ERROR : create_symlink() error!");
+    return -1;
+  }
+  return 0;
+}
diff --git a/dali-extension/plugin-parser/plugin-parser.h b/dali-extension/plugin-parser/plugin-parser.h
new file mode 100755 (executable)
index 0000000..54ca57c
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __DALI_PLUGIN_PARSER_INTERFACE__
+#define __DALI_PLUGIN_PARSER_INTERFACE__
+
+#ifndef NO_TIZEN
+#include <dlog.h>
+#define LOGX(fmt, arg...) \
+    ({ do { \
+        dlog_print(DLOG_INFO, LOG_TAG, fmt, ##arg); \
+    } while (0); })
+
+#else
+#include <stdio.h>
+#define LOGE(fmt, args...) printf(fmt, ##args)
+#define LOGD(fmt, args...) printf(fmt, ##args)
+#define LOGI(fmt, args...) printf(fmt, ##args)
+#define LOGX(fmt, args...) printf(fmt, ##args)
+#endif
+
+#ifndef _ERR
+#define _ERR(fmt, args...) LOGE(fmt "\n", ##args)
+#endif
+
+#ifndef _DBG
+#define _DBG(fmt, args...) LOGD(fmt "\n", ##args)
+#endif
+
+#ifndef _INFO
+#define _INFO(fmt, args...) LOGI(fmt "\n", ##args)
+#endif
+
+#ifndef _LOGX
+#define _LOGX(fmt, args...) LOGX(fmt "\n", ##args)
+#endif
+
+extern "C"
+{
+    typedef struct _xmlDoc xmlDoc;
+    typedef xmlDoc* xmlDocPtr;
+    int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *pkgId);
+    int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *pkgId);
+    int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *pkgId);
+
+    int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr doc, const char* pkgId);
+    int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr doc, const char* pkgId);
+    int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr doc, const char* pkgId);
+
+    int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *pkgId);
+    int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *pkgId);
+    int PKGMGR_PARSER_PLUGIN_POST_UNINSTALL(const char *pkgId);
+
+    int makeNuiVulkanBackendSymbolicLink(const std::string& pkgId, bool vkOn);
+    int getRootPath(std::string pkgId, std::string& rootPath);
+}
+
+#endif /* __DALI_PLUGIN_PARSER_INTERFACE__ */
index ae82426..68002cf 100755 (executable)
@@ -106,6 +106,25 @@ BuildRequires: pkgconfig(lightweight-web-engine)
 Web Engine Lite plugin to support WebView for Dali
 
 ##############################
+# Dali plugin-parser
+##############################
+%package plugin-parser
+Summary:    plugin-parser for Dali
+Group:      System/Libraries
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(pkgmgr-info)
+BuildRequires: pkgconfig(pkgmgr-installer)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(boost)
+
+%description plugin-parser
+plugin-parser for Dali
+
+%define dali_plugin_parser_dir           /etc/package-manager/parserlib/metadata/
+%define dali_plugin_parser_list_dir      /usr/share/parser-plugins/
+
+
+##############################
 # Preparation
 ##############################
 %prep
@@ -161,6 +180,14 @@ install -m 0644 scripts/dali.sh %{buildroot}%{_sysconfdir}/profile.d
 cd build/tizen
 %make_install DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
 
+mkdir -p %{buildroot}%{dali_plugin_parser_dir}
+mkdir -p %{buildroot}%{dali_plugin_parser_list_dir}
+
+rm %{buildroot}/%{_libdir}/libdali-plugin-parser.so
+rm %{buildroot}/%{_libdir}/libdali-plugin-parser.so.0
+mv %{buildroot}/%{_libdir}/libdali-plugin-parser.so.0.0.0 %{buildroot}%{dali_plugin_parser_dir}libnui_vulkan_backend_plugin.so
+cp %{_builddir}/%{name}-%{version}/build/tizen/plugin-parser/nui_vulkan_backend.txt %{buildroot}%{dali_plugin_parser_list_dir}
+
 %pre
 exit 0
 
@@ -194,6 +221,10 @@ popd
 /sbin/ldconfig
 exit 0
 
+%post plugin-parser
+/sbin/ldconfig
+exit 0
+
 ##############################
 #   Pre Uninstall old package
 ##############################
@@ -227,6 +258,10 @@ exit 0
 /sbin/ldconfig
 exit 0
 
+%postun plugin-parser
+/sbin/ldconfig
+exit 0
+
 ##############################
 # Files in Binary Packages
 ##############################
@@ -273,3 +308,11 @@ exit 0
 %defattr(-,root,root,-)
 %{_libdir}/libdali-web-engine-lite-plugin.so*
 %license LICENSE
+
+
+%files plugin-parser
+%manifest dali-extension.manifest
+%defattr(-,root,root,-)
+%{dali_plugin_parser_dir}libnui_vulkan_backend_plugin.so
+%{dali_plugin_parser_list_dir}nui_vulkan_backend.txt
+%license LICENSE