From 3ac52ad622c83aadd7a02c798e31bbc3d5fae0bb Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Mon, 29 Aug 2016 16:59:34 +0200 Subject: [PATCH] build: Prepare building by installing dependencies libs It is strongly recommended to rely on scons, if not possible, this can be done differently using this script. For more details about building IoTivity please check: https://wiki.iotivity.org/build The main purpose of prep.sh, is for continuous integration experiments for Tizen platform, but could be used for others too. Bug: https://jira.iotivity.org/browse/IOT-1600 Change-Id: I63e713c8531f0eea698277993cf21c3d55c80270 Origin: https://gerrit.iotivity.org/gerrit/#/c/11699/ Signed-off-by: Philippe Coval Reviewed-on: https://gerrit.iotivity.org/gerrit/12477 Tested-by: jenkins-iotivity Reviewed-by: Kevin Kane Reviewed-by: Uze Choi (cherry picked from commit 10c5f532f85a2e97dbbe91c94276fc9bfff5d016) Reviewed-on: https://gerrit.iotivity.org/gerrit/11699 Tested-by: jenkins-iotivity Reviewed-by: Dan Mihai --- extlibs/gtest/prep.sh | 58 ++++++++++++++++++++++++++ extlibs/mbedtls/prep.sh | 103 ++++++++++++++++++++++++++++++---------------- extlibs/tinycbor/prep.sh | 105 ++++++++++++++++++++++++++++++++--------------- prep.sh | 42 +++++++++++++++++++ 4 files changed, 241 insertions(+), 67 deletions(-) create mode 100644 extlibs/gtest/prep.sh create mode 100755 prep.sh diff --git a/extlibs/gtest/prep.sh b/extlibs/gtest/prep.sh new file mode 100644 index 0000000..5fb4209 --- /dev/null +++ b/extlibs/gtest/prep.sh @@ -0,0 +1,58 @@ +#!/bin/bash +#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + +set -e + +[ ! -z ${EXEC_MODE} ] || EXEC_MODE=false + +package="gtest" +packageRevision='1.7.0' +packageUrl='http://pkgs.fedoraproject.org/repo/pkgs/gtest/gtest-1.7.0.zip/2d6ec8ccdf5c46b05ba54a9fd1d130d7/gtest-1.7.0.zip' +packageArchive=$(basename -- "${packageUrl}") +packageDir="extlibs/${package}/${package}-${packageRevision}" +packageSourceFile="${packageDir}/CMakeLists.txt" + + +do_() +{ + set +f + if $EXEC_MODE; then + echo "warning: fetching online resources may not be reproductible" + printf "%s \n" "trying: \"$@\"" + eval "$@" + else + cat</dev/null + which unzip 2>/dev/null + do_ "cd extlibs/${package} && wget -nc -O ${packageArchive} ${packageUrl} && unzip ${packageArchive}" + fi +} + + +main_ "$@" diff --git a/extlibs/mbedtls/prep.sh b/extlibs/mbedtls/prep.sh index acc660a..d32b2c7 100755 --- a/extlibs/mbedtls/prep.sh +++ b/extlibs/mbedtls/prep.sh @@ -1,39 +1,72 @@ -#!/bin/sh +#!/bin/bash +#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= set -e -# Keep mbedtls_revision in sync with extlibs/mbedtls/SConscript's setting. Right now this script -# assumes mbedtls_revision is a tag; comment out the second clause if mbedtls_revision becomes -# a branch or a specific commit. -mbedtls_url="https://github.com/ARMmbed/mbedtls" -mbedtls_dir=`dirname -- "$(readlink -f "$0")"`/mbedtls -mbedtls_reldir="extlibs/mbedtls/mbedtls" - -mbedtls_revision="mbedtls-2.4.0" -if [ ! -d ${mbedtls_dir} ]; then - echo "" - echo "*********************************** Error: ****************************************" - echo "* Please download mbedTLS using the following command: *" - echo "* $ git clone ${mbedtls_url} ${mbedtls_reldir} -b ${mbedtls_revision}" - echo "***********************************************************************************" - echo "" - exit -elif [ ! -z $(git tag -l $mbedtls_revision) ]; then - echo "" - echo "*********************************** Error: ****************************************" - echo "* mbedTLS repo is out of date. Please update mbedtls using the following commands:*" - echo "* $ cd (authoritative mbedTLS source repo location) *" - echo "* $ git fetch *" - echo "***********************************************************************************" - echo "" - exit -elif [ -d ${mbedtls_dir}/.git ]; then - cd ${mbedtls_dir} - git reset --hard ${mbedtls_revision} ; git apply --whitespace=fix ../ocf.patch - cd - - rm -rf ${mbedtls_dir}/.git* -else - echo "tizen: Checking if ocf.patch is applied in ${mbedtls_dir}" - grep -r 'TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256' "${mbedtls_dir}" -fi +[ ! -z ${EXEC_MODE} ] || EXEC_MODE=false + +# Right now this script assumes packageRevision is a tag; +# comment out the second clause if packageRevision becomes a branch or a specific commit. +package="mbedtls" +packageRevision='mbedtls-2.4.0' +packageUrl="https://github.com/ARMmbed/mbedtls" +packageDir="extlibs/${package}/${package}" + + +do_() +{ + set +f + if $EXEC_MODE; then + echo "warning: fetching online resources may not be reproductible" + printf "%s \n" "trying: \"$@\"" + eval "$@" + else + cat< /dev/null + which git > /dev/null + which unzip > /dev/null + which wget > /dev/null + + find ./extlibs/ -maxdepth 2 -a -iname "prep.sh" | xargs -n1 bash +} + + +main_ -- 2.7.4