aboutsummaryrefslogtreecommitdiff
blob: 94250ce0da726a90cbefa9578a701c789c98d9f8 (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
138
139
140
141
142
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

CRATES="
	arc-swap-0.4.6
	atty-0.2.14
	autocfg-1.0.0
	bitflags-1.2.1
	bytes-0.5.4
	cc-1.0.54
	cfg-if-0.1.10
	chrono-0.4.11
	colored-1.9.3
	foreign-types-0.3.2
	foreign-types-shared-0.1.1
	fuchsia-zircon-0.3.3
	fuchsia-zircon-sys-0.3.3
	futures-core-0.3.5
	futures-macro-0.3.5
	futures-task-0.3.5
	futures-util-0.3.5
	hermit-abi-0.1.13
	idna-0.2.0
	iovec-0.1.4
	kernel32-sys-0.2.2
	lazy_static-1.4.0
	libc-0.2.71
	log-0.4.8
	matches-0.1.8
	memchr-2.3.3
	mime-0.3.16
	mime_guess-2.0.3
	mio-0.6.22
	mio-named-pipes-0.1.6
	mio-uds-0.6.8
	miow-0.2.1
	miow-0.3.4
	net2-0.2.34
	num-integer-0.1.42
	num-traits-0.2.11
	num_cpus-1.13.0
	once_cell-1.4.0
	openssl-0.10.29
	openssl-sys-0.9.57
	percent-encoding-2.1.0
	pin-project-0.4.17
	pin-project-internal-0.4.17
	pin-project-lite-0.1.5
	pin-utils-0.1.0
	pkg-config-0.3.17
	proc-macro-hack-0.5.16
	proc-macro-nested-0.1.4
	proc-macro2-1.0.17
	quote-1.0.6
	redox_syscall-0.1.56
	serde-1.0.110
	serde_derive-1.0.110
	signal-hook-registry-1.2.0
	simple_logger-1.6.0
	slab-0.4.2
	smallvec-1.4.0
	socket2-0.3.12
	syn-1.0.27
	time-0.1.43
	tokio-0.2.21
	tokio-openssl-0.4.0
	toml-0.5.6
	unicase-2.6.0
	unicode-bidi-0.3.4
	unicode-normalization-0.1.12
	unicode-xid-0.2.0
	url-2.1.1
	vcpkg-0.2.8
	version_check-0.9.2
	winapi-0.2.8
	winapi-0.3.8
	winapi-build-0.1.1
	winapi-i686-pc-windows-gnu-0.4.0
	winapi-x86_64-pc-windows-gnu-0.4.0
	ws2_32-sys-0.2.1
"

inherit cargo git-r3 systemd

EGIT_REPO_URI="https://git.sr.ht/~int80h/gemserv"
EGIT_COMMIT="8ebe1becf124cf6143e3410d10cfb0fb760911e6"

DESCRIPTION="A gemini Server written in rust"
HOMEPAGE="
	gemini://80h.dev/projects/gemserv/
	https://git.sr.ht/~int80h/gemserv
"
SRC_URI="$(cargo_crate_uris ${CRATES})"

LICENSE="Apache-2.0 BSD MIT MPL-2.0"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="
	>=dev-libs/openssl-1.1.0g
	acct-user/gemini
"
DEPEND="${RDEPEND}"

src_prepare() {
	# Fix paths in systemd unit.
	sed -i "s@/path/to/bin /path/to/config@${EPREFIX}/usr/bin/gemserv ${EPREFIX}/etc/gemserv/config.toml@" \
		init-scripts/gemserv.service || die

	# Fix paths in config.
	sed -Ei 's@/path/to/(key|cert)@/etc/gemserv/\1.pem@' config.toml || die
	# Fix typo in config.
	sed -Ei 's@^proxy@proxy =@' config.toml || die

	default
}

src_unpack() {
	git-r3_src_unpack
	cargo_src_unpack
}

src_install() {
	cargo_src_install

	einstalldocs

	insinto etc/gemserv
	insopts --group=gemini --mode=640
	newins config.toml config.toml.example

	systemd_dounit init-scripts/gemserv.service
	newinitd "${FILESDIR}/${PN}.initd" "${PN}"
}

pkg_postinst() {
	einfo "You can generate yourself a TLS certificate and key with:"
	einfo "openssl req -x509 -newkey rsa:4096 -sha256 -days 3660 -nodes \\"
	einfo "    -keyout /etc/gemserv/key.pem -out /etc/gemserv/cert.pem"
}