2014-07-20 22:31:33 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2021-01-02 21:34:16 +01:00
|
|
|
# Copyright (C) 2014-2021 Sébastien Helleu <flashcode@flashtux.org>
|
2014-07-20 22:31:33 +02:00
|
|
|
#
|
|
|
|
# This file is part of WeeChat, the extensible chat client.
|
|
|
|
#
|
|
|
|
# WeeChat is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# WeeChat is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2018-11-29 23:16:07 +01:00
|
|
|
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
2014-07-20 22:31:33 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
#
|
2019-03-29 22:36:25 +01:00
|
|
|
# Build WeeChat according to environment variables:
|
|
|
|
# - BUILDTOOL: cmake or autotools
|
|
|
|
# - BUILDARGS: arguments for cmake or configure commands
|
2014-11-08 14:02:30 +01:00
|
|
|
#
|
|
|
|
# Syntax to run the script with environment variables:
|
2015-10-22 20:54:12 +02:00
|
|
|
# BUILDTOOL=cmake ./build-test.sh
|
|
|
|
# BUILDTOOL=autotools ./build-test.sh
|
|
|
|
# BUILDTOOL=cmake BUILDARGS="arguments" ./build-test.sh
|
|
|
|
# BUILDTOOL=autotools BUILDARGS="arguments" ./build-test.sh
|
2014-11-08 14:02:30 +01:00
|
|
|
#
|
|
|
|
# Syntax to run the script with arguments on command line:
|
2015-10-22 20:54:12 +02:00
|
|
|
# ./build-test.sh cmake [arguments]
|
|
|
|
# ./build-test.sh autotools [arguments]
|
2014-07-20 22:31:33 +02:00
|
|
|
#
|
2020-05-22 19:04:12 +02:00
|
|
|
# This script is used to build WeeChat in CI environment.
|
2014-07-20 22:31:33 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
run ()
|
|
|
|
{
|
2019-11-28 21:23:59 +01:00
|
|
|
echo "Running \"$*\"..."
|
|
|
|
if ! eval "$@"; then
|
2014-07-20 22:31:33 +02:00
|
|
|
echo "ERROR"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
BUILDDIR="build-tmp-$$"
|
|
|
|
|
|
|
|
if [ $# -ge 1 ]; then
|
2014-11-08 14:02:30 +01:00
|
|
|
BUILDTOOL="$1"
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $# -ge 1 ]; then
|
|
|
|
BUILDARGS="$*"
|
2014-07-20 22:31:33 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$BUILDTOOL" ]; then
|
|
|
|
echo "Syntax: $0 cmake|autotools"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# create build directory
|
2014-07-20 22:35:48 +02:00
|
|
|
run "mkdir $BUILDDIR"
|
|
|
|
run "cd $BUILDDIR"
|
2014-07-20 22:31:33 +02:00
|
|
|
|
|
|
|
if [ "$BUILDTOOL" = "cmake" ]; then
|
|
|
|
# build with CMake
|
2021-03-16 20:57:22 +01:00
|
|
|
run "cmake .. -DENABLE_MAN=ON -DENABLE_DOC=ON -DENABLE_TESTS=ON ${BUILDARGS}"
|
2014-08-02 18:44:01 +03:00
|
|
|
run "make VERBOSE=1 -j$(nproc)"
|
2014-07-20 22:31:33 +02:00
|
|
|
run "sudo make install"
|
2020-05-22 19:04:12 +02:00
|
|
|
run "ctest -V"
|
2014-07-20 22:31:33 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$BUILDTOOL" = "autotools" ]; then
|
|
|
|
# build with autotools
|
|
|
|
run "../autogen.sh"
|
2021-03-16 20:57:22 +01:00
|
|
|
run "../configure --enable-man --enable-doc --enable-tests ${BUILDARGS}"
|
2014-08-02 18:44:01 +03:00
|
|
|
run "make -j$(nproc)"
|
2014-07-20 22:31:33 +02:00
|
|
|
run "sudo make install"
|
2014-07-22 21:05:53 +02:00
|
|
|
run "./tests/tests -v"
|
2014-07-20 22:31:33 +02:00
|
|
|
fi
|