提交 9a125872 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Improve get_dep.sh and include fctx into it

上级 3d59d861
...@@ -2,68 +2,68 @@ ...@@ -2,68 +2,68 @@
set -e set -e
current_dir=${PWD##*/} WORKER_PWD=${PWD}
dep=$1 DEP=$1
if [ "${current_dir}" != "worker" ] ; then current_dir_name=${WORKER_PWD##*/}
if [ "${current_dir_name}" != "worker" ] ; then
echo ">>> [ERROR] $(basename $0) must be called from mediasoup/worker/ directory" >&2 echo ">>> [ERROR] $(basename $0) must be called from mediasoup/worker/ directory" >&2
exit 1 exit 1
fi fi
function get_gyp() function get_dep()
{ {
GIT_REPO="https://chromium.googlesource.com/external/gyp.git" GIT_REPO="$1"
GIT_TAG="master" GIT_TAG="$2"
DEST="deps/gyp" DEST="$3"
echo ">>> [INFO] getting dep '${DEP}' ..."
if [ -d "${DEST}" ] ; then if [ -d "${DEST}" ] ; then
echo ">>> [INFO] deleting ${DEST} ..." echo ">>> [INFO] deleting ${DEST} ..."
git rm -rf ${DEST} >/dev/null git rm -rf --ignore-unmatch ${DEST} >/dev/null
rm -rf ${DEST} rm -rf ${DEST}
fi fi
echo ">>> [INFO] cloning ${GIT_REPO} ..." echo ">>> [INFO] cloning ${GIT_REPO} ..."
git clone ${GIT_REPO} ${DEST} git clone ${GIT_REPO} ${DEST}
cd ${DEST} cd ${DEST}
echo ">>> [INFO] setting tag ${GIT_TAG} ..." echo ">>> [INFO] setting '${GIT_TAG}' git tag ..."
git checkout ${GIT_TAG} 2>/dev/null git checkout --quiet ${GIT_TAG}
set -e
echo ">>> [INFO] adding ${GIT_REPO} to the repository ..." echo ">>> [INFO] adding dep source code to the repository ..."
rm -rf .git rm -rf .git
git add . git add .
echo ">>> [INFO] got gyp" echo ">>> [INFO] got dep '${DEP}'"
cd ${WORKER_PWD}
}
function get_gyp()
{
GIT_REPO="https://chromium.googlesource.com/external/gyp.git"
GIT_TAG="master"
DEST="deps/gyp"
get_dep "${GIT_REPO}" "${GIT_TAG}" "${DEST}"
} }
function get_jsoncpp() function get_jsoncpp()
{ {
GIT_REPO="https://github.com/open-source-parsers/jsoncpp.git" GIT_REPO="https://github.com/open-source-parsers/jsoncpp.git"
GIT_TAG="1.7.7" GIT_TAG="1.8.0"
DEST="deps/jsoncpp/jsoncpp" DEST="deps/jsoncpp/jsoncpp"
if [ -d "${DEST}" ] ; then get_dep "${GIT_REPO}" "${GIT_TAG}" "${DEST}"
echo ">>> [INFO] deleting ${DEST} ..."
git rm -rf ${DEST} >/dev/null
rm -rf ${DEST}
fi
echo ">>> [INFO] cloning ${GIT_REPO} ..."
git clone ${GIT_REPO} ${DEST}
cd ${DEST}
echo ">>> [INFO] setting tag ${GIT_TAG} ..."
git checkout ${GIT_TAG} 2>/dev/null
echo ">>> [INFO] adding ${GIT_REPO} to the repository ..."
rm -rf .git
git add .
echo ">>> [INFO] running 'python amalgamate.py' ..." echo ">>> [INFO] running 'python amalgamate.py' ..."
# IMPORTANT: avoid default 'dist/' directory since, somehow, it fails cd ${DEST}
# IMPORTANT: avoid default 'dist/' directory since, somehow, it fails.
python amalgamate.py -s bundled/jsoncpp.cpp python amalgamate.py -s bundled/jsoncpp.cpp
echo ">>> [INFO] got jsoncpp"
} }
function get_netstring() function get_netstring()
...@@ -72,24 +72,7 @@ function get_netstring() ...@@ -72,24 +72,7 @@ function get_netstring()
GIT_TAG="master" GIT_TAG="master"
DEST="deps/netstring/netstring-c" DEST="deps/netstring/netstring-c"
if [ -d "${DEST}" ] ; then get_dep "${GIT_REPO}" "${GIT_TAG}" "${DEST}"
echo ">>> [INFO] deleting ${DEST} ..."
git rm -rf ${DEST} >/dev/null
rm -rf ${DEST}
fi
echo ">>> [INFO] cloning ${GIT_REPO} ..."
git clone ${GIT_REPO} ${DEST}
cd ${DEST}
echo ">>> [INFO] setting tag ${GIT_TAG} ..."
git checkout ${GIT_TAG} 2>/dev/null
echo ">>> [INFO] adding ${GIT_REPO} to the repository ..."
rm -rf .git
git add .
echo ">>> [INFO] got netstring"
} }
function get_libuv() function get_libuv()
...@@ -98,24 +81,7 @@ function get_libuv() ...@@ -98,24 +81,7 @@ function get_libuv()
GIT_TAG="v1.10.2" GIT_TAG="v1.10.2"
DEST="deps/libuv" DEST="deps/libuv"
if [ -d "${DEST}" ] ; then get_dep "${GIT_REPO}" "${GIT_TAG}" "${DEST}"
echo ">>> [INFO] deleting ${DEST} ..."
git rm -rf ${DEST} >/dev/null
rm -rf ${DEST}
fi
echo ">>> [INFO] cloning ${GIT_REPO} ..."
git clone ${GIT_REPO} ${DEST}
cd ${DEST}
echo ">>> [INFO] setting tag ${GIT_TAG} ..."
git checkout ${GIT_TAG} 2>/dev/null
echo ">>> [INFO] adding ${GIT_REPO} to the repository ..."
rm -rf .git
git add .
echo ">>> [INFO] got libuv"
} }
function get_openssl() function get_openssl()
...@@ -130,30 +96,26 @@ function get_libsrtp() ...@@ -130,30 +96,26 @@ function get_libsrtp()
GIT_TAG="master" GIT_TAG="master"
DEST="deps/libsrtp/srtp" DEST="deps/libsrtp/srtp"
if [ -d "${DEST}" ] ; then get_dep "${GIT_REPO}" "${GIT_TAG}" "${DEST}"
echo ">>> [INFO] deleting ${DEST} ..." }
git rm -rf ${DEST} >/dev/null
rm -rf ${DEST}
fi
echo ">>> [INFO] cloning ${GIT_REPO} ..."
git clone ${GIT_REPO} ${DEST}
cd ${DEST}
echo ">>> [INFO] setting tag ${GIT_TAG} ..." function get_fctx()
git checkout ${GIT_TAG} 2>/dev/null {
GIT_REPO="https://github.com/imb/fctx.git"
GIT_TAG="master"
DEST="deps/fctx"
echo ">>> [INFO] adding ${GIT_REPO} to the repository ..." get_dep "${GIT_REPO}" "${GIT_TAG}" "${DEST}"
rm -rf .git
git add .
echo ">>> [INFO] got libsrtp" echo ">>> [INFO] copying include file to test/ directory ..."
cd ${WORKER_PWD}
cp ${DEST}/include/fct.h test/
} }
case "${dep}" in case "${DEP}" in
'-h') '-h')
echo "Usage:" echo "Usage:"
echo " ./scripts/$(basename $0) [gyp|jsoncpp|netstring|libuv|openssl|libsrtp]" echo " ./scripts/$(basename $0) [gyp|jsoncpp|netstring|libuv|openssl|libsrtp|fctx]"
echo echo
;; ;;
gyp) gyp)
...@@ -174,7 +136,17 @@ case "${dep}" in ...@@ -174,7 +136,17 @@ case "${dep}" in
libsrtp) libsrtp)
get_libsrtp get_libsrtp
;; ;;
fctx)
get_fctx
;;
*) *)
echo ">>> [ERROR] unknown dep '${dep}'" >&2 echo ">>> [ERROR] unknown dep '${DEP}'" >&2
exit 1 exit 1
esac esac
if [ $? -eq 0 ] ; then
echo ">>> [INFO] done"
else
echo ">>> [ERROR] failed" >&2
exit 1
fi
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论