summaryrefslogtreecommitdiff
path: root/www-apps/tt-rss/tt-rss-99999999.ebuild
blob: 8292af62bb9c547fcc4129eabaffc8743310e215 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit webapp

if [[ ${PV} == *9999999* ]]; then
	SLOT="${PV}" # Single live slot.
	EGIT_REPO_URI="https://github.com/tt-rss/${PN}.git"
	inherit git-r3
else
	COMMIT=""
	SRC_URI="https://github.com/tt-rss/${PN}/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
	S="${WORKDIR}/${PN}-${COMMIT}"
	KEYWORDS="~amd64 ~arm ~arm64 ~mips ~x86"
fi

DESCRIPTION="Tiny Tiny RSS - A web-based news feed (RSS/Atom) aggregator using AJAX"
HOMEPAGE="https://github.com/tt-rss/"
LICENSE="GPL-3"
IUSE="+acl daemon gd"

PHP_SLOTS="8.4 8.3 8.2" # Check with: grep PHP_VERSION classes/Config.php
PHP_USE="gd?,postgres,ctype,curl,fileinfo,filter,intl,pdo,tokenizer,unicode,xml"

php_rdepend() {
	local slot
	echo "|| ("
	for slot in ${PHP_SLOTS}; do
		echo "(
			virtual/httpd-php:${slot}
			dev-lang/php:${slot}[$1]
		)"
	done
	echo ")"
}

DEPEND="
	daemon? ( acl? ( sys-apps/acl ) )
"

RDEPEND="
	${DEPEND}
	daemon? (
		acct-user/ttrssd
		acct-group/ttrssd
		$(php_rdepend "${PHP_USE},cli,pcntl")
	)
	!daemon? (
		$(php_rdepend "${PHP_USE}")
	)
"

DEPEND="
	!vhosts? ( ${DEPEND} )
"

need_httpd_cgi # From webapp.eclass

pkg_pretend() {
	if has_version www-apps/tt-rss[mysqli]; then
		ewarn
		ewarn "You are currently using tt-rss with the mysql backend."
		ewarn
		ewarn "THIS IS NOT SUPPORTED ANYMORE."
		ewarn
		ewarn "Since 2025-04-17, tt-rss has dropped support for MySQL."
		ewarn
		ewarn "To upgrade, you need to migrate to PostgreSQL first."
		ewarn
		ewarn "Migrating between different tt-rss versions might work but is not recommended."
		ewarn "It's recommended to switch to =www-apps/tt-rss-20250417 for migration."
		ewarn
		ewarn "Export/Import articles could be done with an official plugin:"
		ewarn "ttrss-data-migration"
		ewarn "For plugin installation and export/import, see:"
		ewarn "https://github.com/tt-rss/tt-rss-plugin-data-migration"
		ewarn
		ewarn "Example of migration steps:"
		ewarn "0. Setup PostgreSQL (dev-db/postgresql)"
		ewarn "1. Backup !"
		ewarn "2. Export settings/feeds (OPML)"
		ewarn "3. Export articles (JSON) via ttrss-data-migration"
		ewarn "4. Migrate to PostgreSQL backend changing USE flag mysqli to postgres"
		ewarn "5. Emerge www-apps/tt-rss with new USE flag"
		ewarn "6. Setup fresh install of tt-rss with PostgreSQL backend"
		ewarn "7. Import settings/feeds (OPML)"
		ewarn "8. Import articles"
		ewarn
		die "MySQL backend not supported anymore"
	fi
}

src_install() {
	webapp_src_preinst

	insinto "${MY_HTDOCSDIR}"
	doins -r *

	# When updating, grep the code for new DiskCache::instance occurrences as
	# these directories cannot be created later due to permissions. Some
	# of these directories are already present in the source tree.
	keepdir "${MY_HTDOCSDIR}"/cache/{feed-icons,starred-images}

	local dir
	for dir in "${ED}${MY_HTDOCSDIR}"/{cache/*,feed-icons,lock}/; do
		webapp_serverowned "${dir#${ED}}"
	done

	if use daemon; then
		webapp_hook_script "${FILESDIR}"/permissions-r1
		webapp_postinst_txt en "${FILESDIR}"/postinstall-en-with-daemon-r1.txt

		newinitd "${FILESDIR}"/ttrssd.initd-r4 ttrssd
		newconfd "${FILESDIR}"/ttrssd.confd-r2 ttrssd

		insinto /etc/logrotate.d
		newins "${FILESDIR}"/ttrssd.logrotated-r1 ttrssd

		elog "After upgrading, please restart ttrssd."
	else
		webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt
	fi

	webapp_src_install
}

pkg_postinst() {
	if ! use vhosts && [[ -n ${REPLACING_VERSIONS} && ${PV} == *9999999* ]]; then
		elog
		elog "The live ebuild does not automatically upgrade your installations so"
		elog "don't forget to do so manually."
	fi

	webapp_pkg_postinst
}