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