diff options
author | Jinhyung Jo <jinhyung.jo@samsung.com> | 2017-11-21 15:23:00 +0900 |
---|---|---|
committer | Jinhyung Jo <jinhyung.jo@samsung.com> | 2017-11-21 15:23:15 +0900 |
commit | 6b47f9b999bdf6d88937da53945e84d9ee1e0385 (patch) | |
tree | 292f9d15fac6611ef449efcd52f99246b48a2aac | |
parent | 1e95afff8b6caa5e98c8249c9e958fdd7647335c (diff) | |
parent | 65c220d5c5d45cf3d612e823360efd3d124afe7c (diff) | |
download | emulator-common-lib-tizen_studio.tar.gz emulator-common-lib-tizen_studio.tar.bz2 emulator-common-lib-tizen_studio.zip |
Merge remote-tracking branch 'upsteam/opensrc' into tizen_studiotizen_studio
Change-Id: I727462d067fc500f84002b03b98b5e96af948793
Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com>
-rwxr-xr-x | correct_pc_prefix.sh | 21 | ||||
-rw-r--r-- | package/build.common | 177 | ||||
-rw-r--r-- | package/build.linux | 143 | ||||
-rw-r--r-- | package/build.macos | 146 | ||||
-rw-r--r-- | package/changelog | 70 | ||||
-rw-r--r-- | package/emulator-common-lib-dev.install.macos | 23 | ||||
-rw-r--r-- | package/emulator-common-lib-dev.install.windows | 13 | ||||
-rw-r--r-- | package/pkginfo.manifest | 63 |
8 files changed, 656 insertions, 0 deletions
diff --git a/correct_pc_prefix.sh b/correct_pc_prefix.sh new file mode 100755 index 0000000..225dc01 --- /dev/null +++ b/correct_pc_prefix.sh @@ -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 diff --git a/package/build.common b/package/build.common new file mode 100644 index 0000000..9f60aa0 --- /dev/null +++ b/package/build.common @@ -0,0 +1,177 @@ +#!/bin/sh + +OS_COMMON_DIR="$ROOTDIR/os-common" +LIB_PACKAGE_DIR="$SRCDIR/package/${BUILD_LIB_PACKAGE}.package.${TARGET_OS}/data/tools/emulator/bin" +DEV_PACKAGE_DIR="$SRCDIR/package/${BUILD_DEV_PACKAGE}.package.${TARGET_OS}/data" +SWT_FILE="swt-4.5.jar" + +RESULT_CONTAINS=contains +RESULT_NOT_CONTAINS=not_contains + +# $1: source strings (e.g. "emulator-lib, emulator-lib-dev, emulator-common-lib-dev") +trim_string() +{ + trimmed=$1 + trimmed=${trimmed%% } + trimmed=${trimmed## } + + echo "$trimmed" +} + +# $1: source string +# $2: string to search for +contains_string() +{ + string="$1" + substring="$2" + if test "${string#*$substring}" != "$string" + then + echo "$RESULT_CONTAINS" + else + echo "$RESULT_NOT_CONTAINS" + fi +} + +# $1: file to set permission +set_file_permission() +{ + string="$(/usr/bin/file "$1")" + substring="executable" + + # if file type has excutable, set 755 permission. + # if not, set 644 permission + if test "${string#*$substring}" != "$string" + then + chmod 755 "$1" + else + chmod 644 "$1" + fi +} + +# $1: directory including files to set permission +find_file_to_set_permission() +{ + for file in $(find "$1" -type f) + do + set_file_permission "$file" + echo "change the pemission of $file" + done +} + +test_symlink() +{ + if [ ! -h "$ROOTDIR/tests/testsymlink" ] + then + echo "'emulator-library-pool' should be zipped with storing symbolic links" + exit 1 + fi +} + +verify_swt() +{ + TMP_SWT_DIR="$SRCDIR/swt" + + if [ -d "$TMP_SWT_DIR" ] ; then + rm -rf "$TMP_SWT_DIR" + fi + mkdir -p "$TMP_SWT_DIR" + + # especially check for swt.jar + unzip -jo "$1" META-INF/MANIFEST.MF -d "$TMP_SWT_DIR" + TEMP_SWT_WS=$(cat "$TMP_SWT_DIR/MANIFEST.MF" | grep "SWT-WS:" | cut -d ':' -f2) + SWT_WS=$(trim_string "$TEMP_SWT_WS") + if [ "$(contains_string "$SWT_WS" $BUILD_WS)" = "$RESULT_NOT_CONTAINS" ];then + echo "$SWT_SW not supported" + exit 1 + fi + + TEMP_SWT_ARCH="$(cat "$TMP_SWT_DIR/MANIFEST.MF" | grep "SWT-Arch:" | cut -d ':' -f2)" + SWT_ARCH=$(trim_string "$TEMP_SWT_ARCH") + if [ "$(contains_string "$SWT_ARCH" $BUILD_ARCH)" = "$RESULT_NOT_CONTAINS" ];then + echo "$SWT_ARCH not supported" + exit 1 + fi + + # if file type has excutable, set 755 permission. if not, set 644 permission + set_file_permission "$1" +} + +# $1: BUILD_LIB_PACKAGE (e.g. 3.0-emulator-lib) +# $2: DIRECTORY_PATH (optional) +traverse_directory() +{ + if [ "$2" = "$OS_COMMON_DIR" ];then + TRAVERSE_DIRECTORY_PATH="$2" + else + TRAVERSE_DIRECTORY_PATH="$ROOTDIR/$TARGET_OS/*/" + fi + + for dirname in $(ls -d $TRAVERSE_DIRECTORY_PATH) + do + case $(basename "$dirname") in + ___*) + echo "skip this directory" + # skip this directory, do nothing. + ;; + *) + echo "include this directory" + cd $dirname + if [ -f "$dirname/common-dev.install" ];then + . common-dev.install + dev_install "$DEV_PACKAGE_DIR" + fi + + if [ -f "$dirname/common-lib.install" ];then + . common-lib.install + lib_install "$LIB_PACKAGE_DIR" + fi + ;; + esac + done + + cp "$SRCDIR"/correct_pc_prefix.sh "$DEV_PACKAGE_DIR" +} + +clean_common() +{ + rm -rf "$SRCDIR"/*.zip +} + +prepare_common() +{ + mkdir -p "$LIB_PACKAGE_DIR" + mkdir -p "$DEV_PACKAGE_DIR" + mkdir -p "$DEV_PACKAGE_DIR/lib" + mkdir -p "$DEV_PACKAGE_DIR/include" + mkdir -p "$DEV_PACKAGE_DIR/bin" + + if [ "${TARGET_OS}" = "windows-32" ];then + BUILD_ARCH=x86 + BUILD_WS=win32 + elif [ "${TARGET_OS}" = "windows-64" ];then + BUILD_ARCH=x86_64 + BUILD_WS=win32 + elif [ "${TARGET_OS}" = "ubuntu-32" ];then + BUILD_ARCH=x86 + BUILD_WS=gtk + elif [ "${TARGET_OS}" = "ubuntu-64" ];then + BUILD_ARCH=x86_64 + BUILD_WS=gtk + elif [ "${TARGET_OS}" = "macos-64" ];then + BUILD_ARCH=x86_64 + BUILD_WS=cocoa + fi +} + +verify_common() +{ + test_symlink + verify_swt "$LIB_PACKAGE_DIR/$SWT_FILE" + verify_swt "$DEV_PACKAGE_DIR/$SWT_FILE" + + # For reverse build dependency with extention plugin. + # (They need "swt_4.4/swt.jar") + # XXX: Should be removed later. + mkdir "$DEV_PACKAGE_DIR/swt_4.4" + cp "$DEV_PACKAGE_DIR/$SWT_FILE" "$DEV_PACKAGE_DIR/swt_4.4/swt.jar" +} diff --git a/package/build.linux b/package/build.linux new file mode 100644 index 0000000..074cd7a --- /dev/null +++ b/package/build.linux @@ -0,0 +1,143 @@ +#!/bin/sh + +BUILD_ARCH= +BUILD_LIB_PACKAGE=emulator-common-lib +BUILD_DEV_PACKAGE=emulator-common-lib-dev +BUILD_WS= + +# check if the architecture supports the file +# $1: file name +check_archi_windows_32() +{ + . $SRCDIR/package/build.common + if [ "$(contains_string "$1" ".dll")" = "$RESULT_CONTAINS" ];then + FILE_RESULT="$(/usr/bin/file $(readlink -f "$1"))" + ARCH_OK=0 + if [ "$(contains_string "$FILE_RESULT" "32-bit")" = "$RESULT_CONTAINS" ];then + echo "$1 has the supported architecture" + ARCH_OK=1 + elif [ "$(contains_string "$FILE_RESULT" "PE32")" = "$RESULT_CONTAINS" ];then + echo "$1 has the supported architecture" + ARCH_OK=1 + fi + fi + if [ $ARCH_OK -eq 0 ];then + echo "$1 has not the supported architecture" + exit 1 + fi +} + +check_archi_windows_64() +{ + . $SRCDIR/package/build.common + if [ "$(contains_string "$1" ".dll")" = "$RESULT_CONTAINS" ];then + FILE_RESULT="$(/usr/bin/file $(readlink -f "$1"))" + ARCH_OK=0 + if [ "$(contains_string "$FILE_RESULT" "32-bit")" = "$RESULT_CONTAINS" ];then + echo "$1 has the supported architecture" + ARCH_OK=1 + elif [ "$(contains_string "$FILE_RESULT" "64-bit")" = "$RESULT_CONTAINS" ];then + echo "$1 has the supported architecture" + ARCH_OK=1 + elif [ "$(contains_string "$FILE_RESULT" "PE32")" = "$RESULT_CONTAINS" ];then + echo "$1 has the supported architecture" + ARCH_OK=1 + elif [ "$(contains_string "$FILE_RESULT" "PE32+")" = "$RESULT_CONTAINS" ];then + echo "$1 has the supported architecture" + ARCH_OK=1 + fi + fi + if [ $ARCH_OK -eq 0 ];then + echo "$1 has not the supported architecture" + exit 1 + fi +} + +check_archi_ubuntu_32() +{ + . $SRCDIR/package/build.common + if [ "$(contains_string "$1" ".so")" = "$RESULT_CONTAINS" ];then + FILE_RESULT="$(/usr/bin/file $(readlink -f "$1"))" + if [ "$(contains_string "$FILE_RESULT" "32-bit")" = "$RESULT_NOT_CONTAINS" ];then + echo "$1 has not the supported architecture" + exit 1 + fi + echo "$1 has the supported architecture" + fi +} + +check_archi_ubuntu_64() +{ + . $SRCDIR/package/build.common + if [ "$(contains_string "$1" ".so")" = "$RESULT_CONTAINS" ];then + FILE_RESULT="$(/usr/bin/file $(readlink -f "$1"))" + if [ "$(contains_string "$FILE_RESULT" "64-bit")" = "$RESULT_NOT_CONTAINS" ];then + echo "$1 has not the supported architecture" + exit 1 + fi + echo "$1 has the supported architecture" + fi +} + +# $1: directory path that library files are in +verify_library() +{ + if [ "${TARGET_OS}" = "windows-32" ] || [ "${TARGET_OS}" = "windows-64" ];then + LIBRARY_EXTENSION=dll + elif [ "${TARGET_OS}" = "ubuntu-32" ] || [ "${TARGET_OS}" = "ubuntu-64" ];then + LIBRARY_EXTENSION=so + fi + + for file in $(find "$1" -iname '*.'$LIBRARY_EXTENSION) + do + echo "$file" + if [ "${TARGET_OS}" = "windows-32" ];then + check_archi_windows_32 "$file" + elif [ "${TARGET_OS}" = "windows-64" ];then + check_archi_windows_64 "$file" + elif [ "${TARGET_OS}" = "ubuntu-32" ];then + check_archi_ubuntu_32 "$file" + elif [ "${TARGET_OS}" = "ubuntu-64" ];then + check_archi_ubuntu_64 "$file" + fi + done +} + +verify() +{ + . $SRCDIR/package/build.common + verify_library "$LIB_PACKAGE_DIR" + verify_library "$DEV_PACKAGE_DIR" + find_file_to_set_permission "$LIB_PACKAGE_DIR" + find_file_to_set_permission "$DEV_PACKAGE_DIR" +} + +clean() +{ + . $SRCDIR/package/build.common + clean_common +} + +prepare() +{ + clean + . $SRCDIR/package/build.common + prepare_common +} + +build() +{ + echo "nothing to do." +} + +install() +{ + prepare + . $SRCDIR/package/build.common + traverse_directory "$BUILD_LIB_PACKAGE" "$ROOTDIR/os-common" + traverse_directory "$BUILD_LIB_PACKAGE" + verify_common + verify +} + +echo "build success" diff --git a/package/build.macos b/package/build.macos new file mode 100644 index 0000000..bb7d709 --- /dev/null +++ b/package/build.macos @@ -0,0 +1,146 @@ +#!/bin/sh -e + +BUILD_ARCH=x86_64 +BUILD_LIB_PACKAGE=emulator-common-lib +BUILD_DEV_PACKAGE=emulator-common-lib-dev +BUILD_WS=cocoa + +patch_loader_path() +{ + . $SRCDIR/package/build.common + + LIBDIR=$1 + + # libs[] is an array. + declare -a libs + declare -i cnt=0 + + cd "$LIBDIR" + + # add library to patch loader_path + for file in $(find . -type f -exec file -F ' ' {} \; | grep "dynamically linked shared library" | awk '{print $1}') + do + libs[$cnt]="$file" + cnt=$cnt+1 + done + + for file in $(find . -type l -exec file -F ' ' {} \; | grep "dynamically linked shared library" | awk '{print $1}') + do + libs[$cnt]="$file" + cnt=$cnt+1 + done + + for lib in "${libs[@]}" + do + if [ -h "$LIBDIR/$lib" ] + then + continue + fi + + libname=$(basename "$lib") + + # set ID + install_name_tool -id "@rpath/$libname" "$lib" + + # read line by line of otool result + otool -L "$lib" | sed 1,2d | \ + while read line + do + linked_libpath=( $(echo "$line" | awk '{print $1}') ) + case "$linked_libpath" in + "/usr/lib/"* | "/System/"*) + # system library, we have nothing to do + ;; + *) + linked_libname=$(basename "$linked_libpath" .dylib) + matched=0 + for other_lib in "${libs[@]}" + do + other_libname=$(basename "$other_lib") + case "$other_libname" in + "$linked_libname"*) + # chnage path + install_name_tool -change "$linked_libpath" "@rpath/$other_libname" "$lib" + matched=1 + ;; + *) + ;; + esac + done + + if [ ${matched} -eq 0 ] + then + echo "$lib has host dependant library: $linked_libpath" + #exit 1 + fi + ;; + esac + done + done +} + +check_archi_macos_64() +{ + . $SRCDIR/package/build.common + FILE_RESULT="$(/usr/bin/file "$1")" + if [ "$(contains_string "$FILE_RESULT" "dynamically linked shared library")" == "$RESULT_CONTAINS" ];then + if [ "$(contains_string "$FILE_RESULT" $BUILD_ARCH)" == "$RESULT_NOT_CONTAINS" ];then + echo "$1 has not the supported architecture" + exit 1 + fi + echo "$1 has the supported architecture" + fi +} + +# $1: directory path that library files are in +verify_library() +{ + LIBRARY_EXTENSION=dylib + + for file in $(find "$1" -iname '*.'$LIBRARY_EXTENSION) + do + echo "$file" + check_archi_macos_64 "$file" + done +} + +verify() +{ + . $SRCDIR/package/build.common + verify_library "$LIB_PACKAGE_DIR" + verify_library "$DEV_PACKAGE_DIR" + find_file_to_set_permission "$LIB_PACKAGE_DIR" + find_file_to_set_permission "$DEV_PACKAGE_DIR" +} + +clean() +{ + . $SRCDIR/package/build.common + clean_common +} + +prepare() +{ + clean + . $SRCDIR/package/build.common + prepare_common +} + +build() +{ + echo "nothing to do." +} + +install() +{ + prepare + . $SRCDIR/package/build.common + traverse_directory "$BUILD_LIB_PACKAGE" "$ROOTDIR/os-common" + traverse_directory "$BUILD_LIB_PACKAGE" + verify_common + verify + patch_loader_path "$LIB_PACKAGE_DIR" + patch_loader_path "$DEV_PACKAGE_DIR/lib" +} + +echo "build success" diff --git a/package/changelog b/package/changelog new file mode 100644 index 0000000..2d1d049 --- /dev/null +++ b/package/changelog @@ -0,0 +1,70 @@ +* 1.2.8 +- (packaging for TizenStudio 2.0) +== Minkee Lee <minkee.lee@samsung.com> 2017-10-12 +* 1.2.7 +- (build machine upgrade) +== Minkee Lee <minkee.lee@samsung.com> 2017-05-12 +* 1.2.6 +- (for sync) +== Minkee Lee <minkee.lee@samsung.com> 2016-11-21 +* 1.2.5 +- include libraries for new ECP +== seokyeon hwang <syeon.hwang@samsung.com> 2016-07-18 +* 1.2.4 +- enhance build script for macosx +== seokyeon hwang <syeon.hwang@samsung.com> 2016-06-08 +* 1.2.3 +- repackaging curl for windows-32 +== SeokYeon Hwang <syeon.hwang@samsung.com> 2016-05-27 +* 1.2.2 +- include libgcc_s_dw2-1.dll for Windows-32 +== SeokYeon Hwang <syeon.hwang@samsung.com> 2016-05-27 +* 1.2.0 +- prepare windows-64 libraries and update windows libraries +- use @rpath for MacOSX libraries +== SeokYeon Hwang <syeon.hwang@samsung.com> 2016-05-25 +* 1.1.12 +- add commons-io library +== Munkyu Im <munkyu.im@samsung.com> 2016-03-24 +* 1.1.11 +- lib-dev: add swt.jar (ver 4.4) for legacy plugin +- lib: remove swt.jar in emulator-common-lib (revert) +== Minkee Lee <minkee.lee@samsung.com> 2016-03-17 +* 1.1.10 +- add swt.jar for reverse build (W/A) +== Minkee Lee <minkee.lee@samsung.com> 2016-03-09 +* 1.1.9 +- change SWT version from 4.4 to 4.5 +- add symbolic link preserving test +- remove hard-coding of SWT version +== Jihye Won <jihye.won1@samsung.com> 2016-01-05 +* 1.1.8 +- support CROSS BUILD +- simplify build script by creating build.common +- make install scripts in emulator-common-library-pool execute +== Jihye Won <jihye.won1@samsung.com> 2015-09-14 +* 1.1.7 +- change build-dependency from 2.4-emulator-library-pool into emulator-common-library-pool +== Jihye Won <jihye.won1@samsung.com> 2015-09-14 +* 1.1.6 +- insert intl.dll into emulator-lib +== Jihye Won <jihye.won1@samsung.com> 2015-09-04 +* 1.1.5 +- set file permission function in emulator-liv-dev +== Jihye Won <jihye.won1@samsung.com> 2015-09-03 +* 1.1.4 +- change directory structure of emulator-common-lib-dev +== Jihye Won <jihye.won1@samsung.com> 2015-09-02 +* 1.1.3 +- add intl.dll in emulator-common-lib +== Jihye Won <jihye.won1@samsung.com> 2015-08-27 +* 1.1.2 +- add jar files for emulator-manager +== Jihye Won <jihye.won1@samsung.com> 2015-08-26 +* 1.1.1 +- rename the install scripts for packaging emulator-common-lib-dev +== Jihye Won <jihye.won1@samsung.com> 2015-08-25 +- add macos-64 build scripts for packaging emulator-common-lib +== Munkyu Im <munkyu.im@samsung.com> 2015-07-15 +- add windows build scripts for packaging emulator-common-lib +== Jihye Won <jihye.won1@samsung.com> 2015-07-16 diff --git a/package/emulator-common-lib-dev.install.macos b/package/emulator-common-lib-dev.install.macos new file mode 100644 index 0000000..2bdb169 --- /dev/null +++ b/package/emulator-common-lib-dev.install.macos @@ -0,0 +1,23 @@ +#!/bin/sh -xe + +PKG_INSTALL_PATH="${INSTALLED_PATH}" +if [ -z "$PKG_INSTALL_PATH" ] +then + exit 2; +fi +echo $PKG_INSTALL_PATH + +## adjust pkgconfig (.pc) file + +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 +done diff --git a/package/emulator-common-lib-dev.install.windows b/package/emulator-common-lib-dev.install.windows new file mode 100644 index 0000000..7c3450e --- /dev/null +++ b/package/emulator-common-lib-dev.install.windows @@ -0,0 +1,13 @@ +@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" +) diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest new file mode 100644 index 0000000..e9f4622 --- /dev/null +++ b/package/pkginfo.manifest @@ -0,0 +1,63 @@ +Version : 1.2.8 +Maintainer: Minkee Lee <minkee.lee@samsung.com>, Munkyu Im <munkyu.im@samsung.com> +Source: emulator + +Package : emulator-common-lib +OS : macos-64 +Build-host-os : macos-64 +Build-dependency: emulator-common-library-pool [ ubuntu-64 ] +Description : common libraries for Tizen Emulator. + +Package : emulator-common-lib +OS : ubuntu-32 +Build-host-os : ubuntu-32 +Build-dependency: emulator-common-library-pool [ ubuntu-64 ] +Description : common libraries for Tizen Emulator. + +Package : emulator-common-lib +OS : ubuntu-64 +Build-host-os : ubuntu-64 +Build-dependency: emulator-common-library-pool [ ubuntu-64 ] +Description : common libraries for Tizen Emulator. + +Package : emulator-common-lib +OS : windows-32 +Build-host-os : ubuntu-64 +Build-dependency: emulator-common-library-pool [ ubuntu-64 ] +Description : common libraries for Tizen Emulator. + +Package : emulator-common-lib +OS : windows-64 +Build-host-os : ubuntu-64 +Build-dependency: emulator-common-library-pool [ ubuntu-64 ] +Description : common libraries for Tizen Emulator. + +Package : emulator-common-lib-dev +OS: macos-64 +Build-host-os: macos-64 +Build-dependency: emulator-common-library-pool [ ubuntu-64 ] +Description : libraries and headers to build tizen emulator source. + +Package : emulator-common-lib-dev +OS : ubuntu-32 +Build-host-os : ubuntu-32 +Build-dependency: emulator-common-library-pool [ ubuntu-64 ] +Description : jar files to build tizen emulator manager source. + +Package : emulator-common-lib-dev +OS : ubuntu-64 +Build-host-os : ubuntu-64 +Build-dependency: emulator-common-library-pool [ ubuntu-64 ] +Description : jar files to build tizen emulator manager source. + +Package : emulator-common-lib-dev +OS: windows-32 +Build-host-os : ubuntu-64 +Build-dependency: emulator-common-library-pool [ ubuntu-64 ] +Description : libraries and headers to build tizen emulator source. + +Package : emulator-common-lib-dev +OS: windows-64 +Build-host-os : ubuntu-64 +Build-dependency: emulator-common-library-pool [ ubuntu-64 ] +Description : libraries and headers to build tizen emulator source. |