www-client/google-chrome-beta: automated update (84.0.4147.30)
[gentoo.git] / net-misc / sks / sks-1.1.6-r5.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit multilib user readme.gentoo-r1 systemd
7
8 DESCRIPTION="An OpenPGP keyserver which is decentralized with highly reliable synchronization"
9 HOMEPAGE="https://bitbucket.org/skskeyserver/sks-keyserver"
10 SRC_URI="https://bitbucket.org/skskeyserver/sks-keyserver/downloads/${P}.tgz"
11 LICENSE="GPL-2"
12 SLOT="0"
13 KEYWORDS="~amd64 ~x86"
14 IUSE="optimize test"
15 RESTRICT="!test? ( test )"
16 DOC_CONTENTS="To get sks running, first build the database,
17 start the database, import atleast one key, then
18 run a cleandb. See the sks man page for more information
19 Typical DB_CONFIG file and sksconf has been installed
20 in /var/lib/sks and can be used as templates by renaming
21 to remove the .typical extension. The DB_CONFIG file has
22 to be in place before doing the database build, or the BDB
23 environment has to be manually cleared from both KDB and PTree.
24 The same applies if you are upgrading to this version with an existing KDB/Ptree,
25 using another version of BDB than 4.8; you need to clear the environment
26 using e.g. db4.6_recover -h . and db4.6_checkpoint -1h . in both KDB and PTree
27 Additionally a sample web interface has been installed as
28 web.typical in /var/lib/sks that can be used by renaming it to web
29 Important: It is strongly recommended to set up SKS behind a
30 reverse proxy. Instructions on properly configuring SKS can be
31 found at https://bitbucket.org/skskeyserver/sks-keyserver/wiki/Peering"
32
33 RDEPEND=">=dev-lang/ocaml-4.0:=
34         dev-ml/camlp4:=
35         dev-ml/cryptokit:=
36         sys-libs/db:5.3"
37 DEPEND="${RDEPEND}
38         dev-ml/findlib"
39
40 pkg_setup() {
41         ebegin "Creating named group and user"
42         enewgroup sks
43         enewuser sks -1 -1 /var/lib/sks sks
44 }
45
46 src_prepare() {
47         eapply "${FILESDIR}/${P}-unbundle-cryptokit.patch" \
48                         "${FILESDIR}/${P}-use-ocamlfind.patch" \
49                         "${FILESDIR}/${P}-use-ocamlfind2.patch" \
50                         "${FILESDIR}/${P}-use-ocamlfind3.patch"
51
52         cp Makefile.local.unused Makefile.local || die
53         sed -i \
54                 -e "s:^BDBLIB=.*$:BDBLIB=-L/usr/$(get_libdir):g" \
55                 -e "s:^BDBINCLUDE=.*$:BDBINCLUDE=-I/usr/include/db5.3/:g" \
56                 -e "s:^LIBDB=.*$:LIBDB=-ldb-5.3:g" \
57                 -e "s:^PREFIX=.*$:PREFIX=${D}/usr:g" \
58                 -e "s:^MANDIR=.*$:MANDIR=${D}/usr/share/man:g" \
59                 Makefile.local || die
60         sed -i \
61                 -e 's:/usr/sbin/sks:/usr/bin/sks:g' \
62                 sks_build.sh || die
63         dosym /usr/bin/sks_build.sh /usr/bin/sks_build.bc.sh
64         eapply_user
65 }
66
67 src_compile() {
68         emake dep
69         # sks build fails with paralell build in module Bdb
70         emake -j1 all
71         if use optimize; then
72                 emake all.bc
73         fi
74 }
75
76 src_test() {
77         ./sks unit_test || die
78 }
79
80 src_install() {
81         if use optimize; then
82                 emake install.bc
83                 dosym /usr/bin/sks.bc usr/bin/sks
84                 dosym /usr/bin/sks_add_mail.bc usr/bin/sks_add_mail
85         else
86                 emake install
87         fi
88
89         dodoc README.md
90
91         newinitd "${FILESDIR}/sks-db.initd" sks-db
92         newinitd "${FILESDIR}/sks-recon.initd" sks-recon
93         newconfd "${FILESDIR}/sks.confd" sks
94         systemd_dounit "${FILESDIR}"/sks-db.service
95         systemd_dounit "${FILESDIR}"/sks-recon.service
96
97         dodir "/var/lib/sks/web.typical"
98         insinto /var/lib/sks
99         newins sampleConfig/DB_CONFIG DB_CONFIG.typical
100         newins sampleConfig/sksconf.typical sksconf.typical
101         insinto /var/lib/sks/web.typical
102         doins sampleWeb/HTML5/*
103
104         keepdir /var/lib/sks
105         readme.gentoo_create_doc
106 }
107
108 pkg_postinst() {
109         readme.gentoo_print_elog
110
111         if [[ -n ${REPLACING_VERSIONS} ]]; then
112                 einfo "Note when upgrading from versions of SKS earlier than 1.1.4"
113                 einfo "The default values for pagesize settings have changed. To continue"
114                 einfo "using an existing DB without rebuilding, explicit settings have to be"
115                 einfo "added to the sksconf file."
116                 einfo "pagesize:       4"
117                 einfo "ptree_pagesize: 1"
118         fi;
119 }