util: add script for correcting PC's prefix
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 17 Dec 2015 07:26:21 +0000 (16:26 +0900)
committerSooyoung Ha <yoosah.ha@samsung.com>
Fri, 18 Dec 2015 03:29:18 +0000 (12:29 +0900)
Also modify the install scripts to the same as new script's style.
Remove the redundant windows install script.

Change-Id: I9833050c942c9ab1183180a94e9d1fd126164de4
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
correct_pc_prefix.sh [new file with mode: 0755]
package/3.0-emulator-lib-dev.install.linux
package/3.0-emulator-lib-dev.install.macos
package/3.0-emulator-lib-dev.install.windows [deleted file]
package/build.common

diff --git a/correct_pc_prefix.sh b/correct_pc_prefix.sh
new file mode 100755 (executable)
index 0000000..225dc01
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+uname=$(uname)
+
+PCs=$(find . -name '*.pc')
+for pc in ${PCs}; do
+    echo "${pc}"
+
+    case "$uname" in
+    Darwin*)
+        LIBDIR=$(cd $(dirname "${pc}")/../..; pwd -P)
+        sed -i "" '/^prefix=/c\
+prefix='"${LIBDIR}"'
+' ${pc}
+    ;;
+    *)
+        LIBDIR=$(readlink -f $(dirname "${pc}")/../..)
+        sed -i "/^prefix=/!b;c\prefix=${LIBDIR}" ${pc}
+    ;;
+    esac
+done
index a98e609..9fa2543 100755 (executable)
@@ -14,11 +14,6 @@ PCs=`find "${PKG_INSTALL_PATH}" -name '*.pc'`
 for pc in ${PCs}; do
     echo "$pc"
 
-    for line in `grep -n '^prefix=' ${pc} | cut -f 1 -d :`; do
-        echo "$line"
-    done
-
-    sed -i '/LIBDIR=/d' "$pc"
-    sed -i '/^prefix=/!b;c\prefix=${LIBDIR}' "$pc"
-    sed -i "${line}s|^|LIBDIR="${PKG_INSTALL_PATH}"\n|" "$pc"
+    LIBDIR=$(readlink -f $(dirname "${pc}")/../..)
+    sed -i "/^prefix=/!b;c\prefix=${LIBDIR}" "${pc}"
 done
index 4a9e86d..652a86f 100755 (executable)
@@ -14,10 +14,8 @@ PCs=`find "${PKG_INSTALL_PATH}" -name '*.pc'`
 for pc in ${PCs}; do
     echo "$pc"
 
-    for line in `grep -n '^prefix=' "${pc}" | cut -f 1 -d :`; do
-        echo "$line"
-    done
-
-    sed -i ".bak"  -e '/^prefix/c\' -e "${line}s|^|prefix="${PKG_INSTALL_PATH}"|" "$pc"
-    rm "${pc}".bak
+    LIBDIR=$(cd $(dirname "${pc}")/../..; pwd -P)
+    sed -i "" '/^prefix=/c\
+prefix='"${LIBDIR}"'
+' ${pc}
 done
diff --git a/package/3.0-emulator-lib-dev.install.windows b/package/3.0-emulator-lib-dev.install.windows
deleted file mode 100755 (executable)
index 7c3450e..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-@echo off
-
-setlocal enabledelayedexpansion
-set PC_PATH=%INSTALLED_PATH:"=%\*.pc
-
-@echo !PC_PATH!
-
-FOR /F "delims=" %%i in ('dir /s /b %PC_PATH%') DO (
-@echo %%i
-@echo prefix=!PC_PATH! >> "%%i.bak"
-findstr /B /V ^prefix "%%i" >> "%%i.bak"
-move /Y "%%i.bak" "%%i"
-)
index a3a0623..a7dfb03 100644 (file)
@@ -118,6 +118,8 @@ traverse_directory()
         ;;
         esac
     done
+
+    cp "$SRCDIR"/correct_pc_prefix.sh "$DEV_PACKAGE_DIR"
 }
 
 clean_common()