Commit eda4b75b authored by Vasudev Kamath's avatar Vasudev Kamath

New upstream version 3.0

parents 716c40e4 0f14fe83
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Gcov files
*.gcno
*.gcov
*.gcda
# Python files
*.pyc
*.pyo
# Build directories
build/
# Clion directory
.idea/
\ No newline at end of file
before_script:
- uname -a
- whoami
- echo $LANG
- g++ --version
- clang++ --version
- rm -rf build/
- mkdir build/
- cd build
variables:
COMPILER: "g++"
BUILD_TYPE: "Debug"
BOTAN: "-DWITH_BOTAN=1"
CARES: "-DWITH_CARES=1"
SYSTEMD: "-DWITH_SYSTEMD=1"
LIBIDN: "-DWITH_LIBIDN=1"
LITESQL: "-DWITH_LITESQL=1"
.template:basic_build: &basic_build
stage: build
script:
- "echo Running cmake with the following parameters: -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}"
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}
- make biboumi -j$(nproc)
- make check -j$(nproc)
image: biboumi-test-fedora:latest
build:1:
variables:
BOTAN: "-DWITHOUT_BOTAN=1"
<<: *basic_build
build:2:
variables:
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:3:
variables:
LITESQL: "-DWITHOUT_LITESQL=1"
<<: *basic_build
build:4:
variables:
LITESQL: "-DWITHOUT_LITESQL=1"
BOTAN: "-DWITHOUT_BOTAN=1"
<<: *basic_build
build:5:
variables:
LITESQL: "-DWITHOUT_LITESQL=1"
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:6:
variables:
BOTAN: "-DWITHOUT_BOTAN=1"
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:6:
variables:
LIBIDN: "-DWITHOUT_LIBIDN=1"
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:rpm:
stage: build
script:
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}
- make rpm -j$(nproc)
artifacts:
paths:
- build/rpmbuild/RPMS
- build/rpmbuild/SRPMS
when: always
.template:basic_test: &basic_test
stage: test
script:
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}
- make biboumi -j$(nproc)
- make check
- make coverage
- mkdir tests_outputs && pushd tests_outputs && make e2e -j$(nproc) -C .. && popd
artifacts:
paths:
- build/coverage/
- build/tests_outputs/
when: always
test:debian:
stage: test
image: biboumi-test-debian:latest
<<: *basic_test
test:fedora:
stage: test
image: biboumi-test-fedora:latest
<<: *basic_test
\ No newline at end of file
Version 3.0 - 2016-08-03
========================
- Support multiple-nick sessions: a user can join an IRC channel behind
one single nick, using multiple different clients, at the same time (as
long as each client is using the same bare JID).
- Database support for persistant per-user per-server configuration. Add
`LiteSQL <https://dev.louiz.org/projects/litesql>` as an optional
dependency.
- Add ad-hoc commands that lets each user configure various things
- Support an after-connect command that will be sent to the server
just after the user gets connected to it.
- Support the sending of a PASS command.
- Lets the users configure their username and realname, if the
realname_customization is set to true.
- The remote TLS certificates are checked against the system’s trusted
CAs, unless the user used the configuration option that ignores these
checks.
- Lets the user set a sha-1 hash to identify a server certificate that
should always be trusted.
- Add an outgoing_bind option.
- Add an ad-hoc command to forcefully disconnect a user from one or
more servers.
- Let the user configure the incoming encoding of an IRC server (the
default behaviour remains unchanged: check if it’s valid utf-8 and if
not, decode as latin-1).
- Support `multi-prefix <http://ircv3.net/specs/extensions/multi-prefix-3.1.html>`.
- And of course, many bufixes.
- Run unit tests and a test suite, build the RPM and check many things
automatically using gitlab-ci.
Version 2.0 - 2015-05-29
========================
- List channels on an IRC server through an XMPP disco items request
- Let the user send any arbitrary raw IRC command by sending a
message to the IRC server’s JID.
- By default, look for the configuration file as per the XDG
basedir spec.
- Support PING requests in all directions.
- Improve the way we forward received NOTICEs by remembering to
which users we previously sent a private message. This improves the
user experience when talking to NickServ.
- Support joining key-protected channels
- Setting a participant's role/affiliation now results in a change of IRC
mode, instead of being ignored. Setting Toto's affiliation to admin is
now equivalent to “/mode +o Toto”
- Fix the reconnection to the XMPP server to try every 2 seconds
instead of immediately. This avoid hogging resources for nothing
- Asynchronously resolve domain names by optionally using the DNS
library c-ares.
- Add a reload add-hoc command, to reload biboumi's configuration
- Add a fixed_irc_server option. With this option enabled,
biboumi can only connect to the one single IRC server configured
Version 1.1 - 2014-07-16
========================
- Fix a segmentation fault when connecting to an IRC server using IPv6
Version 1.0 - 2014-07-12
========================
- First stable release.
- Mostly complete MUC to IRC, and IRC to MUC support
- Complete handling of private messages
- Full IRC modes support: setting any IRC mode, and receiving notifications
for every mode change
- Verbose connection status notifications
- Conversion from IRC formatting to XHTML-im
- Ad-hoc commands support
- Basic TLS support: auto-accepts all certificates, no cipher
configuration, no way to force usage of TLS (it is used only if
available, clear connection is automatically used as a fallback)
- IPv6 support
cmake_minimum_required(VERSION 3.0)
project(biboumi)
set(${PROJECT_NAME}_VERSION_MAJOR 3)
set(${PROJECT_NAME}_VERSION_MINOR 0)
set(${PROJECT_NAME}_VERSION_SUFFIX "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -pedantic -Wall -Wextra")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage --coverage")
endif()
# Define a __FILENAME__ macro to get the filename of each file, instead of
# the full path as in __FILE__
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
#
## Look for external libraries
#
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
#
## Get the software version
#
set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR})
set(RPM_VERSION ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR})
if(${PROJECT_NAME}_VERSION_SUFFIX MATCHES ".+")
set(ARCHIVE_NAME ${ARCHIVE_NAME}${${PROJECT_NAME}_VERSION_SUFFIX})
set(RPM_VERSION ${RPM_VERSION}${${PROJECT_NAME}_VERSION_SUFFIX})
endif()
if(${PROJECT_NAME}_VERSION_SUFFIX MATCHES "^~dev$")
# If we are on a dev version, append the hash of the current git HEAD to
# the version
include(FindGit)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(COMMAND git --git-dir=${CMAKE_SOURCE_DIR}/.git rev-parse --short HEAD
OUTPUT_VARIABLE GIT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(GIT_REVISION)
set(${PROJECT_NAME}_VERSION_SUFFIX "${${PROJECT_NAME}_VERSION_SUFFIX} (${GIT_REVISION})")
set(ARCHIVE_NAME ${ARCHIVE_NAME}${GIT_REVISION})
set(RPM_VERSION ${RPM_VERSION}${GIT_REVISION})
endif()
endif()
endif()
set(SOFTWARE_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}${${PROJECT_NAME}_VERSION_SUFFIX})
include(CheckFunctionExists)
check_function_exists(ppoll HAVE_PPOLL_FUNCTION)
# To be able to include the config.h and other files generated by cmake
include_directories("${CMAKE_CURRENT_BINARY_DIR}/src/")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/")
#
## Documentation
#
execute_process(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE DOC_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(MAN_PAGE ${CMAKE_CURRENT_BINARY_DIR}/doc/${PROJECT_NAME}.1)
set(DOC_PAGE ${CMAKE_CURRENT_SOURCE_DIR}/doc/${PROJECT_NAME}.1.rst)
if (NOT PANDOC_EXECUTABLE)
find_program(PANDOC_EXECUTABLE NAMES pandoc
DOC "The pandoc software, to build the man page from the rst documentation")
if(PANDOC_EXECUTABLE)
message(STATUS "Found Pandoc: ${PANDOC_EXECUTABLE}")
set(WITH_DOC true)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/)
add_custom_command(OUTPUT ${MAN_PAGE}
COMMAND ${PANDOC_EXECUTABLE} -M date="${DOC_DATE}" -s -t man ${DOC_PAGE} -o ${MAN_PAGE}
DEPENDS ${DOC_PAGE})
add_custom_target(doc ALL DEPENDS ${MAN_PAGE})
else()
message(STATUS "Pandoc not found, documentation cannot be built")
endif()
endif()
mark_as_advanced(PANDOC_EXECUTABLE)
# Look for litesql and enable the database if found
if(WITH_LITESQL)
find_package(LITESQL REQUIRED)
elseif(NOT WITHOUT_LITESQL)
find_package(LITESQL)
endif()
if(LITESQL_FOUND)
LITESQL_GENERATE_CPP("database/database.xml"
"biboudb"
LITESQL_GENERATED_SOURCES)
add_library(database STATIC src/database/database.cpp
${LITESQL_GENERATED_SOURCES})
target_link_libraries(database ${LITESQL_LIBRARIES})
if(BOTAN_FOUND)
target_link_libraries(database ${BOTAN_LIBRARIES})
endif()
set(USE_DATABASE TRUE)
endif()
add_subdirectory("louloulibs")
include_directories("louloulibs")
include_directories(${EXPAT_INCLUDE_DIRS})
include_directories(${ICONV_INCLUDE_DIRS})
include_directories(${LIBUUID_INCLUDE_DIRS})
# If they are found in louloulibs CMakeLists.txt, we inherite these values
if(SYSTEMD_FOUND)
include_directories(${SYSTEMD_INCLUDE_DIRS})
endif()
if(BOTAN_FOUND)
include_directories(SYSTEM ${BOTAN_INCLUDE_DIRS})
endif()
if(CARES_FOUND)
include_directories(${CARES_INCLUDE_DIRS})
endif()
#
## utils
#
file(GLOB source_src_utils
src/utils/*.[hc]pp)
# Todo, switch to target_sources(utils) when we go cmake >=3.1 only
add_library(src_utils STATIC ${source_src_utils})
target_link_libraries(src_utils logger config)
if(USE_DATABASE)
target_link_libraries(src_utils database)
endif()
#
## irclib
#
file(GLOB source_irc
src/irc/*.[hc]pp)
add_library(irc STATIC ${source_irc})
target_link_libraries(irc network utils logger)
#
## xmpp
#
file(GLOB source_xmpp
src/xmpp/*.[hc]pp)
add_library(xmpp STATIC ${source_xmpp})
target_link_libraries(xmpp xmpplib bridge network utils src_utils logger)
if(USE_DATABASE)
target_link_libraries(xmpp database)
target_link_libraries(irc database)
endif()
#
## bridge
#
file(GLOB source_bridge
src/bridge/*.[hc]pp)
add_library(bridge STATIC ${source_bridge})
target_link_libraries(bridge xmpp irc utils logger)
#
## Main executable
#
add_executable(${PROJECT_NAME} src/main.cpp)
target_link_libraries(${PROJECT_NAME}
xmpp
irc
bridge
utils
src_utils
config)
if(SYSTEMD_FOUND)
target_link_libraries(xmpp ${SYSTEMD_LIBRARIES})
endif()
#
## Tests
#
file(GLOB source_tests
tests/*.cpp)
add_executable(test_suite EXCLUDE_FROM_ALL
${source_tests})
target_link_libraries(test_suite
xmpplib
xmpp
irc
bridge
utils
config
logger
network)
if(USE_DATABASE)
target_link_libraries(test_suite
database)
endif()
include(ExternalProject)
ExternalProject_Add(catch
GIT_REPOSITORY "https://lab.louiz.org/louiz/Catch.git"
PREFIX "external"
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
set_target_properties(catch PROPERTIES EXCLUDE_FROM_ALL TRUE)
ExternalProject_Get_Property(catch SOURCE_DIR)
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/tests/catch.hpp)
target_include_directories(test_suite
PUBLIC "${SOURCE_DIR}/include/"
)
add_dependencies(test_suite catch)
endif()
add_custom_target(check COMMAND "test_suite" "-s"
DEPENDS test_suite biboumi)
add_custom_target(e2e COMMAND "python3" "${CMAKE_CURRENT_SOURCE_DIR}/tests/end_to_end/"
DEPENDS biboumi)
add_custom_target(e2e_valgrind COMMAND "E2E_BIBOUMI_SUPP_DIR=${CMAKE_CURRENT_SOURCE_DIR}/tests/end_to_end/" "E2E_BIBOUMI_VALGRIND=1" "python3" "${CMAKE_CURRENT_SOURCE_DIR}/tests/end_to_end/"
DEPENDS biboumi)
#
## Code coverage
#
if(CMAKE_BUILD_TYPE MATCHES Debug)
include(CodeCoverage)
SETUP_TARGET_FOR_COVERAGE(coverage
test_suite
coverage
)
endif()
#
## Install target
#
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
install(FILES ${MAN_PAGE} DESTINATION share/man/man1 OPTIONAL COMPONENT documentation)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/biboumi.service DESTINATION lib/systemd/system COMPONENT init)
install(FILES conf/biboumi.cfg DESTINATION /etc/biboumi COMPONENT configuration)
#
## Dist target
## Generate a release tarball from the git sources
#
add_custom_target(dist
COMMAND git archive --prefix=${ARCHIVE_NAME}/ --format=tar HEAD
> ${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_NAME}.tar
# Append this specific file that is not part of the git repo
COMMAND tar -rf ${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_NAME}.tar -P ${SOURCE_DIR}/single_include/catch.hpp --xform 's|/.*/|${ARCHIVE_NAME}/tests/|g'
# Remove a potential existing archive
COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_NAME}.tar.xz
# Compress the archive
COMMAND xz ${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_NAME}.tar
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "${ARCHIVE_NAME}.tar.xz created."
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_dependencies(dist catch)
add_custom_target(rpm
COMMAND mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
COMMAND rpmbuild --define "_topdir `pwd`/rpmbuild/" --define "_sourcedir `pwd`" -ba biboumi.spec
)
add_dependencies(rpm dist)
if(BOTAN_FOUND)
set(STR_WITH_BOTAN "Botan: yes")
else()
set(STR_WITH_BOTAN "Botan: no")
endif()
if(CARES_FOUND)
set(STR_WITH_CARES "c-ares: yes")
else()
set(STR_WITH_CARES "c-ares: no")
endif()
add_custom_target(PrintBuildParameters ALL
${CMAKE_COMMAND} -E cmake_echo_color --cyan "Compiling ${PROJECT_NAME} with ${STR_WITH_BOTAN}, ${STR_WITH_CARES}")
configure_file(biboumi.h.cmake src/biboumi.h)
set(SYSTEMD_SERVICE_TYPE_DOCSTRING "The value used as the Type= in the systemd unit file.")
set(WATCHDOG_SEC_DOCSTRING "The value used as WatchdogSec= in the systemd unit file.")
if(SYSTEMD_FOUND)
set(SYSTEMD_SERVICE_TYPE "notify" CACHE STRING ${SYSTEMD_SERVICE_TYPE_DOCSTRING})
set(WATCHDOG_SEC "20" CACHE STRING ${WATCHDOG_SEC_DOCSTRING})
else()
set(SYSTEMD_SERVICE_TYPE "simple" CACHE STRING ${SYSTEMD_SERVICE_TYPE_DOCSTRING})
set(WATCHDOG_SEC "" CACHE STRING ${WATCHDOG_SEC_DOCSTRING})
endif()
set(SERVICE_USER_DOCSTRING "The value used as the User= in the systemd unit file.")
if(NOT DEFINED SERVICE_USER)
set(SERVICE_USER "nobody" CACHE STRING ${SERVICE_USER_DOCSTRING})
endif()
set(SERVICE_GROUP_DOCSTRING "The value used as the Group= in the systemd unit file.")
if(NOT DEFINED SERVICE_GROUP)
set(SERVICE_GROUP "nobody" CACHE STRING ${SERVICE_GROUP_DOCSTRING})
endif()
configure_file(unit/biboumi.service.cmake biboumi.service)
# The date MUST be in english format
set(ENV{LANG} "en_US.utf-8")
execute_process(COMMAND "date" "+%a %b %d %Y" OUTPUT_VARIABLE RPM_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
unset(ENV{LANG})
configure_file(packaging/biboumi.spec.cmake biboumi.spec)
Copyright (c) 2015 Florent Le Coz
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
INSTALL
=======
tl;dr
-----
cmake . && make && ./biboumi
If that didn’t work, read on.
Dependencies
------------
Build and runtime dependencies:
Tools:
~~~~~~
- A C++14 compiler (clang >= 3.4 or gcc >= 4.9 for example)
- CMake
- pandoc (optional) to build the man page
Libraries:
~~~~~~~~~~
expat_
Used to parse XML from the XMPP server.
libiconv_
Encoding from anything into UTF-8
libuuid_
Generate unique IDs
libidn_ (optional, but recommended)
Provides the stringprep functionality. Without it, JIDs for IRC users are
not provided.
c-ares_ (optional, but recommended)
Asynchronously resolve domain names. This offers better reactivity and
performances when connecting to a big number of IRC servers at the same
time.
libbotan_ 1.11 (optional)
Provides TLS support. Without it, IRC connections are all made in
plain-text mode.
Other branches than the 1.11 are not supported.
litesql_ (optional)
Provides a way to store various options in a (sqlite3) database. Each user
of the gateway can store their own values (for example their prefered port,
or their IRC password).
systemd_ (optional)
Provides the support for a systemd service of Type=notify. This is useful only
if you are packaging biboumi in a distribution with Systemd.
Configure
---------
Configure the build system using cmake, there are many solutions to do that,
the simplest is to just run
cmake .
in the current directory.
The default build type is "Debug", if you want to build a release version,
set the CMAKE_BUILD_TYPE variable to "release", by running this command
instead:
cmake . -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr
You can also configure many parameters of the build (like customize CFLAGS,
the install path, choose the compiler, or enabling some options like the
POLLER to use), using the ncurses interface of ccmake:
ccmake .
In ccmake, first use 'c' to configure the build system, edit the values you
need and finaly use 'g' to generate the Makefiles to build the system and
quit ccmake.
You can also configure these options using a -D command line flag.
The list of available options:
- POLLER: lets you select the poller used by biboumi, at
compile-time. Possible values are:
- EPOLL: use the Linux-specific epoll(7). This is the default on Linux.
- POLL: use the standard poll(2). This is the default value on all non-Linux
platforms.
- WITH_BOTAN and WITHOUT_BOTAN: The first force the usage of the Botan library,
if it is not found, the configuration process will fail. The second will
make the build process ignore the Botan library, it will not be used even
if it's available on the system. If none of these option is specified, the
library will be used if available and will be ignored otherwise.
- WITH_LIBIDN and WITHOUT_LIBIDN: Just like the WITH(OUT)_BOTAN options, but
for the IDN library
- WITH_SYSTEMD and WITHOUT_SYSTEMD: Just like the other WITH(OUT)_* options,
but for the Systemd library
Example:
cmake . -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr
-DWITH_BOTAN=1 -DWITHOUT_SYSTEMD=1
This command will configure the project to build a release, with TLS enabled
(using Botan) but without using Systemd (even if available on the system).
Build
-----
Once you’ve configured everything using cmake, build the project
make
Install
-------
And then, optionaly, Install the software system-wide
make install
Testing
-------
You can run the test suite with
make check
This project uses the Catch unit test framework, it will be automatically
fetched with cmake, by cloning the github repository.
You can also check the overall code coverage of this test suite by running
make coverage
This requires gcov and lcov to be installed.
Run
---
Run the software using the `biboumi` binary. Read the documentation (the
man page biboumi(1) or the `biboumi.1.rst`_ file) for more information on how
to use biboumi.