summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Kostecki <conrad@kostecki.com>2018-11-17 21:30:38 +0100
committerAndrey Utkin <andrey_utkin@gentoo.org>2018-11-24 02:45:20 +0000
commit051f912c4915ce603ccba7bc15c34ae708c2b851 (patch)
tree5a2b7d6caccdba5ddb93b4b0f68bc73debed2ab6 /net-im/spectrum2
parentnet-im/swift: add myself as comaintainer (diff)
downloadgentoo-051f912c4915ce603ccba7bc15c34ae708c2b851.tar.gz
gentoo-051f912c4915ce603ccba7bc15c34ae708c2b851.tar.bz2
gentoo-051f912c4915ce603ccba7bc15c34ae708c2b851.zip
net-im/spectrum2: New package
Spectrum2 is an open source instant messaging jabber transport daemon. Closes: https://bugs.gentoo.org/291437 Package-Manager: Portage-2.3.51, Repoman-2.3.12 RepoMan-Options: --force Signed-off-by: Conrad Kostecki <conrad@kostecki.com> Signed-off-by: Andrey Utkin <andrey_utkin@gentoo.org>
Diffstat (limited to 'net-im/spectrum2')
-rw-r--r--net-im/spectrum2/Manifest1
-rw-r--r--net-im/spectrum2/files/spectrum2-2.0.9-remove_debug_cflags.patch13
-rw-r--r--net-im/spectrum2/files/spectrum2-2.0.9-use_qt5_libcommuni.patch54
-rw-r--r--net-im/spectrum2/files/spectrum2.initd47
-rw-r--r--net-im/spectrum2/files/spectrum2.service12
-rw-r--r--net-im/spectrum2/files/spectrum2.tmpfiles1
-rw-r--r--net-im/spectrum2/metadata.xml26
-rw-r--r--net-im/spectrum2/spectrum2-2.0.9.ebuild125
8 files changed, 279 insertions, 0 deletions
diff --git a/net-im/spectrum2/Manifest b/net-im/spectrum2/Manifest
new file mode 100644
index 000000000000..f17b84864021
--- /dev/null
+++ b/net-im/spectrum2/Manifest
@@ -0,0 +1 @@
+DIST spectrum2-2.0.9.tar.gz 842688 BLAKE2B 32cdb95c161aa97338895fb144200ac94d200aefb58300a8f55b03457b3aae1a0ef4a60311f0e2be8e3f3e331625d04ecd61a9583d07794c4398762e1348b939 SHA512 f111133d3d327619ebbeeaa8c329b09dbdbef9c66ec7bc06eb6eac8c54e144cbf2d81d2751699bf97ae1d1bf0a94581f3971394a7f06b9a4d69f6248f1497982
diff --git a/net-im/spectrum2/files/spectrum2-2.0.9-remove_debug_cflags.patch b/net-im/spectrum2/files/spectrum2-2.0.9-remove_debug_cflags.patch
new file mode 100644
index 000000000000..19e3b83d2300
--- /dev/null
+++ b/net-im/spectrum2/files/spectrum2-2.0.9-remove_debug_cflags.patch
@@ -0,0 +1,13 @@
+--- a/CMakeLists.txt 2018-09-17 09:46:40.000000000 +0200
++++ b/CMakeLists.txt 2018-09-20 21:04:29.000000000 +0200
+@@ -384,10 +384,6 @@
+ endif()
+
+ if(CMAKE_BUILD_TYPE MATCHES Debug)
+- if (CMAKE_COMPILER_IS_GNUCXX)
+- ADD_DEFINITIONS(-O0)
+- ADD_DEFINITIONS(-ggdb)
+- endif()
+ ADD_DEFINITIONS(-DDEBUG)
+ message("Debug : yes")
+ else(CMAKE_BUILD_TYPE MATCHES Debug)
diff --git a/net-im/spectrum2/files/spectrum2-2.0.9-use_qt5_libcommuni.patch b/net-im/spectrum2/files/spectrum2-2.0.9-use_qt5_libcommuni.patch
new file mode 100644
index 000000000000..27e23db44848
--- /dev/null
+++ b/net-im/spectrum2/files/spectrum2-2.0.9-use_qt5_libcommuni.patch
@@ -0,0 +1,54 @@
+--- a/CMakeLists.txt 2018-09-17 09:46:40.000000000 +0200
++++ b/CMakeLists.txt 2018-09-20 20:57:35.000000000 +0200
+@@ -182,8 +182,7 @@
+ if(ENABLE_IRC)
+ find_package(Communi)
+
+- INCLUDE(FindQt4)
+- FIND_PACKAGE(Qt4 COMPONENTS QtCore QtNetwork)
++ FIND_PACKAGE(Qt5 COMPONENTS Core Network)
+ # ADD_DEFINITIONS(${SWIFTEN_CFLAGS})
+ ADD_DEFINITIONS(-DSUPPORT_LEGACY_CAPS)
+ # ADD_DEFINITIONS(-DBOOST_FILESYSTEM_VERSION=2)
+@@ -321,7 +320,6 @@
+ message("IRC plugin : yes")
+ include_directories(${QT_QTNETWORK_INCLUDE_DIR})
+ include_directories(${IRC_INCLUDE_DIR})
+- include(${QT_USE_FILE})
+ else()
+ if(ENABLE_IRC)
+ message("IRC plugin : no (install libCommuni and libprotobuf-dev)")
+--- a/backends/libcommuni/CMakeLists.txt 2018-09-17 09:46:40.000000000 +0200
++++ b/backends/libcommuni/CMakeLists.txt 2018-09-20 20:59:31.000000000 +0200
+@@ -1,14 +1,14 @@
+ cmake_minimum_required(VERSION 2.6)
+ FILE(GLOB SRC *.cpp)
+ FILE(GLOB HEADERS *.h)
+-QT4_WRAP_CPP(SRC ${HEADERS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
+-add_definitions(-DQT_NO_KEYWORDS)
++QT5_WRAP_CPP(SRC ${HEADERS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
+ ADD_EXECUTABLE(spectrum2_libcommuni_backend ${SRC})
++include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS})
+
+ if (NOT WIN32)
+- target_link_libraries(spectrum2_libcommuni_backend ${IRC_LIBRARY} Qt4::QtNetwork Qt4::QtCore transport pthread)
++ target_link_libraries(spectrum2_libcommuni_backend ${IRC_LIBRARY} Qt5::Network Qt5::Core transport pthread)
+ else ()
+- target_link_libraries(spectrum2_libcommuni_backend ${IRC_LIBRARY} Qt4::QtNetwork Qt4::QtCore transport)
++ target_link_libraries(spectrum2_libcommuni_backend ${IRC_LIBRARY} Qt5::Network Qt5::Core transport)
+ endif()
+ INSTALL(TARGETS spectrum2_libcommuni_backend RUNTIME DESTINATION bin)
+
+--- a/cmake_modules/FindCommuni.cmake 2018-09-17 09:46:40.000000000 +0200
++++ b/cmake_modules/FindCommuni.cmake 2018-09-20 21:00:04.000000000 +0200
+@@ -1,8 +1,7 @@
+-find_package(Qt4)
+-include( ${QT_USE_FILE} )
++find_package(Qt5Network)
+
+ FIND_LIBRARY(IRC_LIBRARY NAMES IrcCore PATHS ${QT_LIBRARY_DIR})
+-FIND_PATH(IRC_INCLUDE_DIR NAMES "IrcCore/ircglobal.h" PATHS ${QT_INCLUDE_DIR} PATH_SUFFIXES Communi)
++FIND_PATH(IRC_INCLUDE_DIR NAMES "IrcCore/ircglobal.h" PATHS ${Qt5Core_INCLUDE_DIRS} ${Qt5Core_INCLUDE_DIRS}"/.." PATH_SUFFIXES Communi)
+
+ # message( STATUS ${IRC_LIBRARY})
+ if( IRC_LIBRARY AND IRC_INCLUDE_DIR )
diff --git a/net-im/spectrum2/files/spectrum2.initd b/net-im/spectrum2/files/spectrum2.initd
new file mode 100644
index 000000000000..8a35dbe75bc9
--- /dev/null
+++ b/net-im/spectrum2/files/spectrum2.initd
@@ -0,0 +1,47 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+command="/usr/bin/spectrum2_manager"
+command_group="spectrum"
+command_user="spectrum"
+name="Spectrum2 Transport"
+shell="/bin/sh"
+su="/bin/su"
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting ${name}"
+ "${su}" "${command_user}" -c "${command} start" -s "${shell}"
+ eend $?
+}
+
+start_pre() {
+ # Ensure /run/spectrum2 dir is owned by spectrum user.
+ # spectrum2_manager stores pidfiles of individual services here.
+ # See security related comment at the bottom.
+ checkpath -d -o "${command_user}:${command_group}" -q "/run/spectrum2"
+}
+
+status() {
+ ebegin "Status ${name}"
+ "${su}" "${command_user}" -c "${command} status" -s "${shell}"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${name}"
+ "${su}" "${command_user}" -c "${command} stop" -s "${shell}"
+ eend $?
+}
+
+# Andrey Utkin <andrey_utkin@gentoo.org> (24 Nov 2018)
+# Conrad Kostecki <conrad@kostecki.com> (24 Nov 2018)
+# We are aware of many security issues caused by careless chowning, see
+# http://michael.orlitzky.com/articles/end_root_chowning_now_(make_etc-init.d_great_again).xhtml
+# We believe none of these issues apply.
+# These pidfiles are not read by any privileged process.
+# checkpath here chowns only the dir itself and doesn't act recursively.
diff --git a/net-im/spectrum2/files/spectrum2.service b/net-im/spectrum2/files/spectrum2.service
new file mode 100644
index 000000000000..9d5b72315ef5
--- /dev/null
+++ b/net-im/spectrum2/files/spectrum2.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Spectrum2 Transport
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/spectrum2_manager start
+ExecStop=/usr/bin/spectrum2_manager stop
+User=spectrum
+Group=spectrum
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-im/spectrum2/files/spectrum2.tmpfiles b/net-im/spectrum2/files/spectrum2.tmpfiles
new file mode 100644
index 000000000000..4ce6f1c3ca75
--- /dev/null
+++ b/net-im/spectrum2/files/spectrum2.tmpfiles
@@ -0,0 +1 @@
+d /run/spectrum2 0700 specturm spectrum - -
diff --git a/net-im/spectrum2/metadata.xml b/net-im/spectrum2/metadata.xml
new file mode 100644
index 000000000000..d6eaa6f54e2e
--- /dev/null
+++ b/net-im/spectrum2/metadata.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>ck+gentoo@bl4ckb0x.de</email>
+ <name>Conrad Kostecki</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <longdescription>
+ Spectrum is an open source instant messaging transport.
+ It allows users to chat together even when they are using
+ different IM networks. It acts as a transport layer between
+ the users as showed in the animation above.
+ </longdescription>
+ <use>
+ <flag name="frotz">Enables the Z-Engine backend.</flag>
+ <flag name="irc">Enables the IRC backend, based on <pkg>net-im/libcommuni</pkg>.</flag>
+ <flag name="purple">Enables the libpurple backend, based on <pkg>net-im/pidgin</pkg>.</flag>
+ <flag name="sms">Enables the SMS backend, based on <pkg>app-mobilephone/smstools</pkg>.</flag>
+ <flag name="whatsapp">Enables the WhatsApp backend, based on <pkg>net-im/transwhat</pkg>.</flag>
+ <flag name="twitter">Enables the Twitter backend.</flag>
+ </use>
+</pkgmetadata>
diff --git a/net-im/spectrum2/spectrum2-2.0.9.ebuild b/net-im/spectrum2/spectrum2-2.0.9.ebuild
new file mode 100644
index 000000000000..42cec5837e6b
--- /dev/null
+++ b/net-im/spectrum2/spectrum2-2.0.9.ebuild
@@ -0,0 +1,125 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit cmake-utils python-single-r1 systemd user
+
+DESCRIPTION="An open source instant messaging transport"
+HOMEPAGE="https://www.spectrum.im"
+SRC_URI="https://github.com/SpectrumIM/spectrum2/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="debug doc frotz irc mysql postgres purple sms +sqlite test twitter whatsapp xmpp"
+REQUIRED_USE="|| ( mysql postgres sqlite )"
+
+RDEPEND="
+ dev-libs/boost:=
+ dev-libs/expat
+ dev-libs/log4cxx
+ dev-libs/jsoncpp:=
+ dev-libs/openssl:0=
+ dev-libs/popt
+ dev-libs/protobuf:=
+ net-dns/libidn:0=
+ net-misc/curl
+ sys-libs/zlib:=
+ frotz? ( !games-engines/frotz )
+ irc? ( net-im/libcommuni )
+ mysql? (
+ || (
+ dev-db/mariadb-connector-c
+ dev-db/mysql-connector-c
+ )
+ )
+ postgres? ( dev-libs/libpqxx:= )
+ purple? (
+ dev-libs/glib
+ dev-libs/libev:=
+ net-im/pidgin:=
+ )
+ sms? ( app-mobilephone/smstools )
+ sqlite? ( dev-db/sqlite:3 )
+ twitter? ( net-misc/curl )
+ whatsapp? ( net-im/transwhat )
+ xmpp? ( net-im/swift:= )"
+
+DEPEND="
+ ${PYTHON_DEPS}
+ ${RDEPEND}
+ doc? ( app-doc/doxygen )
+ test? (
+ dev-python/sleekxmpp[${PYTHON_USEDEP}]
+ dev-util/cppunit
+ net-irc/ngircd
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-remove_debug_cflags.patch"
+ "${FILESDIR}/${P}-use_qt5_libcommuni.patch"
+)
+
+# Tests are currently restricted, as they do completly fail
+RESTRICT="test"
+
+pkg_setup() {
+ enewgroup spectrum
+ enewuser spectrum -1 -1 /var/lib/spectrum2 spectrum
+
+ use test && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ # Respect users LDFLAGS
+ sed -i -e "s/-Wl,-export-dynamic/& ${LDFLAGS}/" spectrum/src/CMakeLists.txt || die
+
+ # Respect users CFLAGS, when compiling for debug mode
+ # Since Spectrum2 searches for a qt4 compiled libcommuni,
+ # it must be patched, to find the qt5 compiled libcommuni,
+ # See: https://github.com/SpectrumIM/spectrum2/pull/253
+ cmake-utils_src_prepare
+}
+
+src_configure() {
+ use debug && CMAKE_BUILD_TYPE="Debug"
+
+ local mycmakeargs=(
+ -DENABLE_DOCS="$(usex doc)"
+ -DENABLE_FROTZ="$(usex frotz)"
+ -DENABLE_IRC="$(usex irc)"
+ -DENABLE_MYSQL="$(usex mysql)"
+ -DENABLE_PQXX="$(usex postgres)"
+ -DENABLE_PURPLE="$(usex purple)"
+ -DENABLE_SMSTOOLS3="$(usex sms)"
+ -DENABLE_SQLITE3="$(usex sqlite)"
+ -DENABLE_TESTS="$(usex test)"
+ -DENABLE_TWITTER="$(usex twitter)"
+ -DENABLE_XMPP="$(usex xmpp)"
+ -DLIB_INSTALL_DIR="$(get_libdir)"
+ )
+
+ cmake-utils_src_configure
+}
+
+src_test() {
+ cd tests/libtransport && "${EPYTHON}" ../start.py || die
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ diropts -o spectrum -g spectrum
+ keepdir /var/log/spectrum2 /var/lib/spectrum2
+ diropts
+
+ newinitd "${FILESDIR}"/spectrum2.initd spectrum2
+ systemd_newunit "${FILESDIR}"/spectrum2.service spectrum2.service
+ systemd_newtmpfilesd "${FILESDIR}"/spectrum2.tmpfiles spectrum2.conf
+
+ einstalldocs
+}