1c87c5fbaSopenharmony_ci#! /bin/sh
2c87c5fbaSopenharmony_ci
3c87c5fbaSopenharmony_ci# This script creates a libcoap archive, unpacks it and does an
4c87c5fbaSopenharmony_ci# out-of-tree build and installation afterwards.
5c87c5fbaSopenharmony_ci#
6c87c5fbaSopenharmony_ci# Copyright (C) 2021-2023 Olaf Bergmann <bergmann@tzi.org>
7c87c5fbaSopenharmony_ci#
8c87c5fbaSopenharmony_ci# This file is part of the CoAP C library libcoap. Please see README
9c87c5fbaSopenharmony_ci# and COPYING for terms of use.
10c87c5fbaSopenharmony_ci#
11c87c5fbaSopenharmony_ci
12c87c5fbaSopenharmony_ciPREFIX=--prefix=`pwd`/libcoap-install
13c87c5fbaSopenharmony_ciARCHIVE=`ls -1t libcoap-*.tar.bz2 |head -1`
14c87c5fbaSopenharmony_cierr=$?
15c87c5fbaSopenharmony_ciecho $ARCHIVE
16c87c5fbaSopenharmony_ciif test $err = 0 -a "x$ARCHIVE" != "x"; then
17c87c5fbaSopenharmony_ci    DIR=`pwd`/`tar taf $ARCHIVE |cut -d/ -f1|head -1`
18c87c5fbaSopenharmony_ci    tar xaf $ARCHIVE && cd $DIR && \
19c87c5fbaSopenharmony_ci        $DIR/configure $PREFIX --enable-tests  --enable-silent-rules --enable-documentation --enable-examples --disable-dtls && \
20c87c5fbaSopenharmony_ci        make EXTRA_CFLAGS=-Werror && make install EXTRA_CFLAGS=-Werror
21c87c5fbaSopenharmony_ci    err=$?
22c87c5fbaSopenharmony_ci    if [ $err = 0 ] ; then
23c87c5fbaSopenharmony_ci        make -C $DIR/examples/lwip EXTRA_CFLAGS=-Werror
24c87c5fbaSopenharmony_ci        err=$?
25c87c5fbaSopenharmony_ci    fi
26c87c5fbaSopenharmony_ci    if [ $err = 0 ] ; then
27c87c5fbaSopenharmony_ci        make -C $DIR/examples/contiki
28c87c5fbaSopenharmony_ci        err=$?
29c87c5fbaSopenharmony_ci    fi
30c87c5fbaSopenharmony_ci    if [ $err = 0 ] ; then
31c87c5fbaSopenharmony_ci        make -C $DIR/examples/riot
32c87c5fbaSopenharmony_ci        err=$?
33c87c5fbaSopenharmony_ci    fi
34c87c5fbaSopenharmony_cifi
35c87c5fbaSopenharmony_ci
36c87c5fbaSopenharmony_ciexit $err
37