Fix rpath for 64bits architecture
authorWonYoung Choi <wy80.choi@samsung.com>
Fri, 7 Aug 2015 10:47:45 +0000 (19:47 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Fri, 7 Aug 2015 10:47:45 +0000 (19:47 +0900)
Change-Id: I3b048ce1ff77ce9efd3b62de20237c5b0fb08572

packaging/webapi-plugins.spec
src/common/common.gypi
src/tool/desc_gentool.cc

index c7d9d4f3fcae18f781af57c106d7475b0ce8d99a..d4ec4d54473c3fc0a2fdae30405c27bd355b15c3 100755 (executable)
@@ -7,6 +7,8 @@
 
 %define crosswalk_extensions tizen-extensions-crosswalk
 
+%define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions}
+
 Name:       webapi-plugins
 Version:    0.21
 Release:    0
@@ -450,6 +452,7 @@ webapi-plugins development headers
 export GYP_GENERATORS='ninja'
 GYP_OPTIONS="--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=%{profile} -Dprivilege_engine=%{tizen_privilege_engine}"
 GYP_OPTIONS="$GYP_OPTIONS -Ddisplay_type=%{display_type}"
+GYP_OPTIONS="$GYP_OPTIONS -Dcrosswalk_extensions_path=%{crosswalk_extensions_path}"
 
 # feature flags
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_is_emulator=%{?tizen_is_emulator}"
@@ -492,7 +495,7 @@ GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_sound_support=%{?tizen_feature_sound_s
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_system_info_support=%{?tizen_feature_system_info_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_system_setting_support=%{?tizen_feature_system_setting_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_telephony_support=%{?tizen_feature_telephony_support}"
-GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_time_support=%{tizen_feature_time_support}"
+GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_time_support=%{?tizen_feature_time_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_inputdevice_support=%{?tizen_feature_inputdevice_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_web_setting_support=%{?tizen_feature_web_setting_support}"
 GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_wi_fi_support=%{?tizen_feature_wi_fi_support}"
@@ -507,8 +510,8 @@ cp LICENSE %{buildroot}/usr/share/license/%{name}
 cat LICENSE.BSD-2.0 >> %{buildroot}/usr/share/license/%{name}
 
 # Extensions.
-mkdir -p %{buildroot}%{_libdir}/%{crosswalk_extensions}
-install -p -m 644 out/Default/libtizen*.so %{buildroot}%{_libdir}/%{crosswalk_extensions}
+mkdir -p %{buildroot}%{crosswalk_extensions_path}
+install -p -m 644 out/Default/libtizen*.so %{buildroot}%{crosswalk_extensions_path}
 
 # devel files
 mkdir -p %{buildroot}%{_libdir}/pkgconfig
@@ -525,15 +528,17 @@ cp -a tools/gyp %{buildroot}%{_includedir}/%{name}/tools/gyp
 cp -a tools/slimit %{buildroot}%{_includedir}/%{name}/tools/slimit
 
 # execute desc_gentool
-LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}%{_libdir}/%{crosswalk_extensions} out/Default/desc_gentool %{buildroot}%{_libdir}/%{crosswalk_extensions} > plugins.json
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}%{crosswalk_extensions_path} out/Default/desc_gentool \
+       %{crosswalk_extensions_path} \
+       %{buildroot}%{crosswalk_extensions_path} > plugins.json
 
 # temporary plugins description for lazy loading
-install -p -m 644 plugins.json %{buildroot}%{_libdir}/%{crosswalk_extensions}/plugins.json
+install -p -m 644 plugins.json %{buildroot}%{crosswalk_extensions_path}/plugins.json
 
 
 %files
-%{_libdir}/%{crosswalk_extensions}/libtizen*.so
-%{_libdir}/%{crosswalk_extensions}/plugins.json
+%{crosswalk_extensions_path}/libtizen*.so
+%{crosswalk_extensions_path}/plugins.json
 %{_datadir}/license/%{name}
 %manifest webapi-plugins.manifest
 
index b2fcc60915366bc9327266bd8eeb6e6f36396b76..ae3d6b1f74b64ae0234ed993a0fafe08318c33ec 100644 (file)
@@ -85,7 +85,7 @@
     ],
     'libraries' : [
       '-L .',
-      '-Wl,-rpath=/usr/lib/tizen-extensions-crosswalk',
+      '-Wl,-rpath=<(crosswalk_extensions_path)',
     ],
   },
 }
index 69fc6ceb2fcccf58a95de7212766d44d1ef65212..60d4646aae41499c6a208fa4cefe872e115528fd 100644 (file)
@@ -12,7 +12,6 @@
 
 static std::string prefix_ = "libtizen";
 static std::string postfix_ = ".so";
-static std::string target_path_ = "/usr/lib/tizen-extensions-crosswalk/";
 static std::vector<std::string> apinamespaces = {"tizen", "xwalk"};
 
 typedef common::Extension *(*CreateExtensionFunc)(void);
@@ -148,20 +147,25 @@ const void* get_interface(const char* name) {
 }
 
 int main(int argc, char* argv[]) {
-  if (argc < 2) {
+  if (argc < 3) {
     std::cerr << "Need tizen crosswalk path" << std::endl;
     return -1;
   }
-  std::string tce_path = argv[1];
-  
-  if (tce_path.empty()) {
+  std::string lib_path = argv[1];
+  if (lib_path.empty()) {
+    std::cerr << "Invalid libpath for tec." << std::endl;
+    return -1;
+  }
+
+  std::string tec_path = argv[2];
+  if (tec_path.empty()) {
     std::cerr << "Invalid tizen crosswalk path" << std::endl;
     return -1;
   }
 
   DIR * dir;
   struct dirent *ent;
-  if ((dir = opendir(tce_path.c_str())) != NULL) {
+  if ((dir = opendir(tec_path.c_str())) != NULL) {
     while ((ent = readdir(dir)) != NULL) {
       std::string fname = ent->d_name;
 
@@ -169,7 +173,7 @@ int main(int argc, char* argv[]) {
           !fname.compare(0, prefix_.size(), prefix_) &&
           !fname.compare(fname.size() - postfix_.size(), postfix_.size(),
                         postfix_)) {
-        std::string so_path = tce_path + "/" + fname;
+        std::string so_path = tec_path + "/" + fname;
         char* error;
         void *handle = dlopen(so_path.c_str(), RTLD_LAZY);
         if ((error = dlerror()) != NULL) {
@@ -186,7 +190,7 @@ int main(int argc, char* argv[]) {
         } else {
           ext++;
           descriptions[ext] = module_description();
-          descriptions[ext].lib = target_path_ + fname;
+          descriptions[ext].lib = lib_path + "/" + fname;
           int ret = initialize(ext, get_interface);
           if (ret != XW_OK) {
             std::cerr << "Error loading extension " << fname << std::endl;
@@ -206,7 +210,7 @@ int main(int argc, char* argv[]) {
 
     print_json();
   } else {
-    std::cerr << "path not exist : " << tce_path << std::endl;
+    std::cerr << "path not exist : " << tec_path << std::endl;
     return -1;
   }