2009-08-04 20:30:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# ngIRCd -- The Next Generation IRC Daemon
|
2014-01-04 23:48:31 +00:00
|
|
|
# Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors
|
2009-08-04 20:30:59 +00:00
|
|
|
#
|
|
|
|
# This program 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 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
# Please read the file COPYING, README and AUTHORS for more information.
|
|
|
|
#
|
|
|
|
|
|
|
|
# This script analyzes the build process of ngIRCd and generates output
|
|
|
|
# suitable for inclusion in doc/Platforms.txt -- please send reports
|
|
|
|
# to the ngIRCd mailing list: <ngircd-ml@ngircd.barton.de>.
|
|
|
|
|
|
|
|
NAME=`basename "$0"`
|
|
|
|
VERBOSE=
|
2014-01-11 00:27:12 +00:00
|
|
|
CLEAN=1
|
2009-08-04 20:30:59 +00:00
|
|
|
|
|
|
|
PLATFORM=
|
|
|
|
COMPILER="unknown"
|
|
|
|
VERSION="unknown"
|
|
|
|
DATE=`date "+%y-%m-%d"`
|
|
|
|
COMMENT=
|
|
|
|
|
2012-04-27 22:58:23 +00:00
|
|
|
R_CONFIGURE=
|
|
|
|
R_MAKE=
|
|
|
|
R_CHECK=
|
2014-06-04 10:15:23 +00:00
|
|
|
R_CHECK_Y="?"
|
2012-04-27 22:58:23 +00:00
|
|
|
R_RUN=
|
|
|
|
|
2014-01-11 00:33:24 +00:00
|
|
|
SRC_D=`dirname "$0"`
|
|
|
|
MY_D="$PWD"
|
|
|
|
|
2012-04-27 22:58:23 +00:00
|
|
|
[ -n "$MAKE" ] || MAKE="make"
|
|
|
|
export MAKE CC
|
|
|
|
|
2009-08-04 20:30:59 +00:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
"-v")
|
|
|
|
VERBOSE=1
|
|
|
|
;;
|
2014-01-11 00:27:12 +00:00
|
|
|
"-x")
|
|
|
|
CLEAN=
|
|
|
|
;;
|
2009-08-04 20:30:59 +00:00
|
|
|
*)
|
2014-01-11 00:27:12 +00:00
|
|
|
echo "Usage: $NAME [-v] [-x]"
|
|
|
|
echo
|
|
|
|
echo " -v Verbose output"
|
|
|
|
echo " -x Don't regenerate build system, even when possible"
|
|
|
|
echo
|
2009-08-04 20:30:59 +00:00
|
|
|
exit 2
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2015-12-19 16:27:27 +00:00
|
|
|
for cmd in telnet expect; do
|
|
|
|
command -v "$cmd" >/dev/null 2>&1 \
|
|
|
|
|| echo "$NAME: WARNING: $cmd(1) not found, \"make check\" won't run all tests!"
|
|
|
|
done
|
|
|
|
|
2009-08-04 20:30:59 +00:00
|
|
|
echo "$NAME: Checking ngIRCd base source directory ..."
|
2014-01-11 00:33:24 +00:00
|
|
|
grep "ngIRCd" "$SRC_D/ChangeLog" >/dev/null 2>&1
|
2009-08-04 20:30:59 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2014-01-11 00:33:24 +00:00
|
|
|
grep "ngIRCd" "$SRC_D/../ChangeLog" >/dev/null 2>&1
|
2009-08-04 20:30:59 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "$NAME: ngIRCd base source directory not found!?"
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-01-11 00:33:24 +00:00
|
|
|
SRC_D="$SRC_D/.."
|
2009-08-04 20:30:59 +00:00
|
|
|
fi
|
2014-01-11 00:33:24 +00:00
|
|
|
echo "$NAME: - source directory: $SRC_D"
|
|
|
|
echo "$NAME: - working directory: $MY_D"
|
2009-08-04 20:30:59 +00:00
|
|
|
|
2013-10-14 21:47:07 +00:00
|
|
|
echo "$NAME: Checking for GIT tree ..."
|
2014-01-11 00:33:24 +00:00
|
|
|
if [ -d "$SRC_D/.git" ]; then
|
2013-10-14 21:47:07 +00:00
|
|
|
echo "$NAME: Checking for \"git\" command ..."
|
|
|
|
git version >/dev/null 2>&1
|
2015-12-19 16:27:03 +00:00
|
|
|
if [ $? -eq 0 ] && [ -n "$CLEAN" ]; then
|
2013-10-14 21:47:07 +00:00
|
|
|
echo "$NAME: Running \"git clean\" ..."
|
2014-01-11 00:33:24 +00:00
|
|
|
cd "$SRC_D" || exit 1
|
2013-10-14 21:47:07 +00:00
|
|
|
[ -n "$VERBOSE" ] && git clean -dxf || git clean -dxf >/dev/null
|
2014-01-11 00:33:24 +00:00
|
|
|
cd "$MY_D" || exit 1
|
2013-10-14 21:47:07 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-01-11 00:33:24 +00:00
|
|
|
echo "$NAME: Checking for \"$SRC_D/configure\" script ..."
|
|
|
|
if [ ! -r "$SRC_D/configure" ]; then
|
|
|
|
echo "$NAME: Running \"$SRC_D/autogen.sh\" ..."
|
|
|
|
cd "$SRC_D" || exit 1
|
2009-08-04 20:30:59 +00:00
|
|
|
[ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null
|
2014-01-11 00:33:24 +00:00
|
|
|
cd "$MY_D" || exit 1
|
2009-08-04 20:30:59 +00:00
|
|
|
fi
|
|
|
|
|
2014-01-11 00:33:24 +00:00
|
|
|
if [ -r "$SRC_D/configure" ]; then
|
|
|
|
echo "$NAME: Running \"$SRC_D/configure\" script ..."
|
|
|
|
[ -n "$VERBOSE" ] && "$SRC_D/configure" -C || "$SRC_D/configure" -C >/dev/null
|
2015-12-19 16:27:03 +00:00
|
|
|
if [ $? -eq 0 ] && [ -r ./Makefile ]; then
|
2012-04-27 22:58:23 +00:00
|
|
|
R_CONFIGURE=1
|
|
|
|
echo "$NAME: Running \"$MAKE\" ..."
|
|
|
|
[ -n "$VERBOSE" ] && "$MAKE" || "$MAKE" >/dev/null
|
2015-12-19 16:27:03 +00:00
|
|
|
if [ $? -eq 0 ] && [ -x src/ngircd/ngircd ]; then
|
2012-04-27 22:58:23 +00:00
|
|
|
R_MAKE=1
|
|
|
|
echo "$NAME: Running \"$MAKE check\" ..."
|
|
|
|
[ -n "$VERBOSE" ] && "$MAKE" check || "$MAKE" check >/dev/null
|
2009-08-04 20:30:59 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2012-04-27 22:58:23 +00:00
|
|
|
R_CHECK=1
|
|
|
|
R_RUN=$R_CHECK
|
2014-06-04 10:15:23 +00:00
|
|
|
[ -r ./src/testsuite/tests-skipped.lst ] \
|
|
|
|
&& R_CHECK_Y="y" || R_CHECK_Y="Y"
|
2009-08-04 20:30:59 +00:00
|
|
|
else
|
|
|
|
./src/ngircd/ngircd --help 2>/dev/null \
|
2012-11-13 21:42:49 +00:00
|
|
|
| grep "^ngIRCd" >/dev/null
|
2012-04-27 22:58:23 +00:00
|
|
|
[ $? -eq 0 ] && R_RUN=1
|
2009-08-04 20:30:59 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get target platform information
|
|
|
|
if [ -r "src/config.h" ]; then
|
2012-11-13 21:42:49 +00:00
|
|
|
CPU=`grep "HOST_CPU" "src/config.h" | cut -d'"' -f2`
|
|
|
|
OS=`grep "HOST_OS" "src/config.h" | cut -d'"' -f2`
|
|
|
|
VENDOR=`grep "HOST_VENDOR" "src/config.h" | cut -d'"' -f2`
|
2009-08-04 20:30:59 +00:00
|
|
|
PLATFORM="$CPU/$VENDOR/$OS"
|
|
|
|
fi
|
|
|
|
if [ -z "$PLATFORM" ]; then
|
|
|
|
PLATFORM="`uname 2>/dev/null` `uname -r 2>/dev/null`, `uname -m 2>/dev/null`"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get compiler information
|
|
|
|
if [ -r "Makefile" ]; then
|
2010-10-25 16:49:54 +00:00
|
|
|
CC=$(grep "^CC = " Makefile | cut -d' ' -f3)
|
2009-08-04 20:30:59 +00:00
|
|
|
$CC --version 2>&1 | grep -i "GCC" >/dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
2013-10-16 19:59:23 +00:00
|
|
|
# GCC, or compiler that mimics GCC
|
2012-04-24 10:08:01 +00:00
|
|
|
$CC --version 2>&1 | grep -i "Open64" >/dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
COMPILER="Open64"
|
|
|
|
else
|
|
|
|
COMPILER=$($CC --version | head -1 \
|
|
|
|
| cut -d')' -f2 | cut -d' ' -f2)
|
|
|
|
COMPILER="gcc $COMPILER"
|
|
|
|
fi
|
2010-10-26 20:18:30 +00:00
|
|
|
else
|
2013-10-16 19:59:23 +00:00
|
|
|
# Non-GCC compiler
|
2013-10-20 13:25:19 +00:00
|
|
|
$CC --version 2>&1 | grep -i "clang" >/dev/null
|
2013-10-14 21:45:59 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
COMPILER=$($CC --version 2>/dev/null | head -1 \
|
2013-10-20 13:25:19 +00:00
|
|
|
| cut -d'(' -f1 | cut -d'-' -f1 \
|
|
|
|
| sed -e 's/version //g' | sed -e 's/Apple /A-/g' \
|
|
|
|
| sed -e 's/Debian //g' | sed -e 's/LLVM /clang /g')
|
2013-10-14 21:45:59 +00:00
|
|
|
fi
|
2013-10-16 19:59:23 +00:00
|
|
|
$CC -version 2>&1 | grep -i "tcc" >/dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
COMPILER=$($CC -version 2>/dev/null | head -1 \
|
|
|
|
| cut -d'(' -f1 | sed -e 's/version //g')
|
|
|
|
fi
|
2013-10-14 21:45:59 +00:00
|
|
|
if [ "$COMPILER" = "unknown" ]; then
|
2010-10-26 20:18:30 +00:00
|
|
|
v="`$CC --version 2>/dev/null | head -1`"
|
2013-10-16 19:59:23 +00:00
|
|
|
[ -z "$v" ] && v="`$CC -version 2>/dev/null | head -1`"
|
2013-10-14 21:45:59 +00:00
|
|
|
[ -n "$v" ] && COMPILER="$v"
|
|
|
|
fi
|
2009-08-04 20:30:59 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get ngIRCd version information
|
2015-08-26 22:12:50 +00:00
|
|
|
eval "$(grep "^VERSION = " Makefile | sed -e 's/ //g')"
|
2010-10-25 16:49:54 +00:00
|
|
|
case "$VERSION" in
|
2014-01-11 00:32:12 +00:00
|
|
|
*~*-*)
|
|
|
|
VERSION=`echo "$VERSION" | cut -b1-10`
|
2010-10-25 16:49:54 +00:00
|
|
|
;;
|
|
|
|
esac
|
2009-08-04 20:30:59 +00:00
|
|
|
[ -n "$VERSION" ] || VERSION="unknown"
|
|
|
|
|
|
|
|
# Get IO interface information
|
|
|
|
if [ "$OS" = "linux-gnu" ]; then
|
2013-10-22 12:15:34 +00:00
|
|
|
COMMENT="1"
|
2009-08-04 20:30:59 +00:00
|
|
|
else
|
|
|
|
grep "^#define HAVE_SYS_DEVPOLL_H 1" src/config.h >/dev/null 2>&1
|
2013-10-22 12:15:34 +00:00
|
|
|
[ $? -eq 0 ] && COMMENT="4"
|
2009-08-04 20:30:59 +00:00
|
|
|
grep "^#define HAVE_EPOLL_CREATE 1" src/config.h >/dev/null 2>&1
|
2013-10-22 12:15:34 +00:00
|
|
|
[ $? -eq 0 ] && COMMENT="5"
|
2009-08-04 20:30:59 +00:00
|
|
|
grep "^#define HAVE_KQUEUE 1" src/config.h >/dev/null 2>&1
|
2013-10-22 12:15:34 +00:00
|
|
|
[ $? -eq 0 ] && COMMENT="3"
|
2009-08-04 20:30:59 +00:00
|
|
|
fi
|
|
|
|
|
2012-04-27 22:58:23 +00:00
|
|
|
[ -n "$R_CONFIGURE" ] && C="Y" || C="N"
|
|
|
|
[ -n "$R_MAKE" ] && M="Y" || M="N"
|
2014-06-04 10:15:23 +00:00
|
|
|
[ -n "$R_CHECK" ] && T="$R_CHECK_Y" || T="N"
|
2012-04-27 22:58:23 +00:00
|
|
|
[ -n "$R_RUN" ] && R="Y" || R="N"
|
2009-08-04 20:30:59 +00:00
|
|
|
[ -n "$COMMENT" ] && COMMENT=" $COMMENT"
|
|
|
|
|
|
|
|
echo
|
2013-10-22 12:15:34 +00:00
|
|
|
echo " the executable works (\"runs\") as expected --+"
|
|
|
|
echo " tests run successfully (\"make check\") --+ |"
|
|
|
|
echo " ngIRCd compiles (\"make\") --+ | |"
|
|
|
|
echo " ./configure works --+ | | |"
|
|
|
|
echo " | | | |"
|
|
|
|
echo "Platform Compiler ngIRCd Date Tester C M T R *"
|
|
|
|
echo "--------------------------- ------------ ---------- -------- -------- - - - - -"
|
2015-12-19 16:27:03 +00:00
|
|
|
command -v printf >/dev/null 2>&1
|
2010-10-26 20:18:30 +00:00
|
|
|
if [ $? -eq 0 ]; then
|
2014-06-04 10:15:23 +00:00
|
|
|
printf "%-27s %-12s %-10s %s %-8s %s %s %s %s%s\n" \
|
2010-10-26 20:18:30 +00:00
|
|
|
"$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$USER" \
|
|
|
|
"$C" "$M" "$T" "$R" "$COMMENT"
|
|
|
|
else
|
|
|
|
echo "$PLATFORM $COMPILER $VERSION $DATE $USER" \
|
|
|
|
"$C" "$M" "$T" "$R" "$COMMENT"
|
|
|
|
fi
|
2014-06-04 10:15:23 +00:00
|
|
|
echo
|
|
|
|
if [ "$R_CHECK_Y" = "y" ]; then
|
2015-12-19 16:27:27 +00:00
|
|
|
echo "$NAME: WARNING: Some tests have been skipped!"
|
2014-06-04 10:15:23 +00:00
|
|
|
echo
|
|
|
|
fi
|