File: dist.sh

package info (click to toggle)
libcoap3 4.3.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,368 kB
  • sloc: ansic: 60,037; makefile: 1,280; sh: 938; python: 6
file content (72 lines) | stat: -rwxr-xr-x 1,953 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /bin/sh

# This script creates a libcoap archive, unpacks it and does an
# out-of-tree build and installation afterwards. The environment
# variables PLATFORM, TESTS, TLS and DOCS control the build
# configuration. Suggested invocation from travis CI is:
#
# PLATFORM=posix TESTS=yes TLS=no DOCS=yes scripts/dist.sh
#
# Copyright (C) 2018 Olaf Bergmann <bergmann@tzi.org>
#
# This file is part of the CoAP C library libcoap. Please see README
# and COPYING for terms of use.
#

if test "x${PLATFORM}" != "xposix"; then
    exit 0
fi

# where to install the library
WORK=`pwd`/libcoap-build
mkdir -p $WORK || exit 1
PREFIX="--prefix=`pwd`/libcoap-installation"
SILENT="--enable-silent-rules"

WITH_TESTS="`scripts/fix-cunit.sh` --enable-tests"
test -f `pwd`/cunit.pc && echo cat `pwd`/cunit.pc

case "x${TLS}" in
    xno)       WITH_TLS="--disable-dtls"
               ;;
    xopenssl)  WITH_TLS="--with-openssl"
               ;;
    xgnutls)   WITH_TLS="--with-gnutls"
               ;;
    xmbedtls)  WITH_TLS="--with-mbedtls"
               ;;
    xwolfssl)  WITH_TLS="--with-wolfssl"
               ;;
    xtinydtls) WITH_TLS="--with-tinydtls --disable-shared"
               ;;
    *)         WITH_TLS="--with-gnutls"
               ;;
esac

case "x${DOCS}" in
    xyes)      WITH_DOCS="--enable-documentation"
               ;;
    *)         WITH_DOCS="--disable-documentation"
               ;;
esac

config() {
    echo "./configure $*"
    ./configure $* || cat config.log
}

work_dir=$PWD
config "$WITH_TESTS $SILENT --enable-documentation --enable-examples --disable-dtls" && make dist

err=$?
ARCHIVE=`ls -1t libcoap-*.tar.bz2 |head -1`
echo $ARCHIVE
if test $err = 0 -a "x$ARCHIVE" != "x"; then
    DIR=`pwd`/`tar taf $ARCHIVE |cut -d/ -f1|head -1`
    tar xaf $ARCHIVE && cd $WORK && \
        $DIR/configure $PREFIX $WITH_TESTS $SILENT $WITH_DOCS --enable-examples $WITH_TLS && \
        make && make install
    err=$?
fi

exit $err