buildmedialibrary.sh 3.5 KB
Newer Older
1 2 3 4
#!/bin/bash

SCRIPT=$(readlink -f "$0")
PROJECTPATH=$(dirname "$SCRIPT")
5 6 7 8

if [ "$BUILDCOMMONDONE" != 1 ]; then
    source ${PROJECTPATH}/buildcommon
fi
9 10 11 12 13 14 15

##############################
# FETCH MEDIALIBRARY SOURCES #
##############################

if [ ! -d "${PROJECTPATH}/medialibrary" ]; then
    echo -e "\e[1m\e[32mmedialibrary source not found, cloning\e[0m"
16
    git clone http://code.videolan.org/videolan/medialibrary.git "${PROJECTPATH}/medialibrary"
17
    checkfail "medialibrary source: git clone failed"
18 19
#else
#    ( cd ${PROJECTPATH}/medialibrary && git pull --rebase ) || echo "Failed to update medialibrary"
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
fi

if [ ! -d "${PROJECTPATH}/libvlcpp" ]; then
    echo -e "\e[1m\e[32mlibvlcpp source not found, cloning\e[0m"
    git clone http://code.videolan.org/videolan/libvlcpp.git "${PROJECTPATH}/libvlcpp"
    checkfail "libvlcpp source: git clone failed"
fi

echo -e "\e[1m\e[36mCFLAGS:            ${CFLAGS}\e[0m"
echo -e "\e[1m\e[36mEXTRA_CFLAGS:      ${EXTRA_CFLAGS}\e[0m"

#################
# Setup folders #
#################

35 36 37 38 39 40 41
if [ "$RELEASE" = 1 ]; then
    MEDIALIBRARY_BUILD_DIR=${PROJECTPATH}/medialibrary/build-tizen-${TARGET_TUPLE}-release
else
    MEDIALIBRARY_BUILD_DIR=${PROJECTPATH}/medialibrary/build-tizen-${TARGET_TUPLE}
fi


42 43 44 45 46 47 48 49
mkdir -p ${MEDIALIBRARY_BUILD_DIR}

#############
# CONFIGURE #
#############

cd ${MEDIALIBRARY_BUILD_DIR}

50
CMAKE_OPTS="-DCMAKE_BUILD_TYPE=Debug"
51 52 53 54
if [ "$RELEASE" = 1 ]; then
    CMAKE_OPTS=""
fi

55 56 57 58 59 60
if [ ${TIZEN_SDK_VERSION} = "2.3.1" ];then
    PKG_CONFIG_PATH="${TIZEN_SDK}/tools/efl-tools/lib/pkgconfig/"
else
    PKG_CONFIG_PATH="${TIZEN_SDK}/platforms/tizen-${TIZEN_SDK_SHORT_VERSION}/common/efl-tool/efl-tools/lib/pkgconfig/"
fi

61 62 63
# PKG_CONFIG_PATH is required to have a proper evas detection.
# however, since the .pc the SDK provides are broken, we override with
# our own values
64
if [ ! -e ./Makefile -o "$RELEASE" = 1 -o ../CMakeLists.txt -nt ./Makefile ]; then
65 66
CPPFLAGS="$CPPFLAGS" \
CFLAGS="$CFLAGS ${EXTRA_CFLAGS}" \
67
CXXFLAGS="$CFLAGS ${EXTRA_CXXFLAGS} -pthread" \
68
LDFLAGS="$LDFLAGS -static-libstdc++" \
69
CC="${CROSS_COMPILE}gcc -fPIC --sysroot=${SYSROOT}" \
70
CXX="${CROSS_COMPILE}g++ -fPIC --sysroot=${SYSROOT} -D__cpp_static_assert=200410 -DTIZEN" \
71 72 73
NM="${CROSS_COMPILE}nm" \
STRIP="${CROSS_COMPILE}strip" \
RANLIB="${CROSS_COMPILE}ranlib" \
74
PKG_CONFIG_PATH="${PKG_CONFIG_PATH}" \
75 76
AR="${CROSS_COMPILE}ar" \
cmake \
77
    ${CMAKE_OPTS} \
78
    -DBUILD_TESTS=OFF \
79
    -DLIBVLCPP_DIR="${PROJECTPATH}/libvlcpp" \
80
    -DLIBVLC_INCLUDE_DIR="${PROJECTPATH}/vlc/include;${PROJECTPATH}/vlc/${VLC_BUILD_DIR}/include" \
81 82 83 84
    -DLIBVLC_LIBRARY="${PROJECTPATH}/lib/libvlc.so" \
    -DSQLITE3_INCLUDE_DIR="${TIZEN_INCLUDES}/" \
    -DSQLITE3_LIBRARY_DEBUG="${TIZEN_LIBS}/libsqlite3.so" \
    -DSQLITE3_LIBRARY_RELEASE="${TIZEN_LIBS}/libsqlite3.so" \
85
    -DEXTRA_LIBS="${SYSROOT}/${TARGET_TUPLE}/lib/libatomic.a" \
86 87
    -DEVAS_INCLUDE_DIRS="${TIZEN_INCLUDES}/ecore-evas-1;${TIZEN_INCLUDES}/evas-1;${TIZEN_INCLUDES}/efl-1;${TIZEN_INCLUDES}/eina-1;${TIZEN_INCLUDES}/eina-1/eina;${TIZEN_INCLUDES}/eo-1;${TIZEN_INCLUDES}/emile-1" \
    -DEVAS_LIBRARIES="-L${TIZEN_LIBS} -levas -lecore_evas" \
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
    ..
checkfail "medialibrary: cmake failed"
fi

############
# BUILDING #
############

echo -e "\e[1m\e[32mBuilding medialibrary\e[0m"
make $MAKEFLAGS 

checkfail "medialibrary: make failed"

cp -a ${MEDIALIBRARY_BUILD_DIR}/src/libmedialibrary.so* ${PROJECTPATH}/lib/

cd ../../

if [ "$RELEASE" = 1 ]; then
    echo -e "\e[1m\e[32mStripping\e[0m"
    ${CROSS_COMPILE}strip ${PROJECTPATH}/lib/libmedialibrary.so*
    checkfail "stripping"
fi