summaryrefslogtreecommitdiff
blob: ca07782f8477b54d673a7cc96bdd481699759c03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit edos2unix cmake

DESCRIPTION="A spam-resistant message board application for Freenet"
# FMS only has a homepage within freenet, so the closest is a wiki linking to it
HOMEPAGE="https://github.com/freenet/wiki/wiki/FMS"
SRC_URI="https://dev.gentoo.org/~tommy/distfiles/${PN}-src-${PV}.zip"
S="${WORKDIR}"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="frost ssl"

CDEPEND="
	acct-group/freenet
	acct-user/freenet
"

RDEPEND="
	${CDEPEND}
	dev-db/sqlite:3=
	dev-libs/poco
	frost? ( net-libs/mbedtls:0= )
	ssl? ( net-libs/mbedtls:0= )
"
DEPEND="${RDEPEND}"
BDEPEND="
	${CDEPEND}
	app-arch/unzip
	virtual/libiconv
"

PATCHES=( "${FILESDIR}/${PN}-use-system-libs4.patch" )

DOCS=( "readme.txt" )

src_prepare() {
	# Convert encoding due applied patch
	edos2unix src/http/pages/showfilepage.cpp
	edos2unix CMakeLists.txt

	# Remove bundled libs
	rm -fr libs || die

	cmake_src_prepare
}

src_configure() {
	local mycmakeargs=(
		-DDO_CHARSET_CONVERSION="ON"
		-DFCP_SSL_SUPPORT="$(usex ssl 'ON' 'OFF')"
		-DFROST_SUPPORT="$(usex frost 'ON' 'OFF')"
		-DI_HAVE_READ_THE_README="ON"
		-DUSE_BUNDLED_SQLITE="OFF"
	)

	cmake_src_configure
}

src_install() {
	dobin "${BUILD_DIR}"/fms

	insinto /var/freenet/fms
	doins *.htm
	doins -r fonts images styles translations

	fperms -R o-rwx /var/freenet/fms
	fowners -R freenet:freenet /var/freenet/fms

	newinitd "${FILESDIR}/fms.initd" fms

	einstalldocs
}

pkg_postinst() {
	if ! has_version 'net-p2p/freenet' ; then
		ewarn "FMS needs a freenet node to upload and download messages."
		ewarn "Please make sure to have a node you can connect to"
		ewarn "or install net-p2p/freenet to get FMS working."
	fi

	einfo "By default, the FMS NNTP server will listen on port 1119,"
	einfo "and the web configuration interface will be running at"
	einfo "http://localhost:8080."
	einfo "For more information, read the installed readme.txt."

	if use frost; then
		einfo
		einfo "You need to enable frost on the configuration page"
		einfo "and restart FMS for frost support."
	fi
}