net-misc/sks: fixing ebuild
[portage-overlay.git] / net-misc / sks / sks-1.1.4.ebuild
1 # Copyright 1999-2013 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=5
6
7 inherit eutils multilib user readme.gentoo systemd
8
9 DESCRIPTION="An OpenPGP keyserver whose goal is to provide easy to deploy, decentralized, and highly reliable synchronization"
10 HOMEPAGE="https://bitbucket.org/skskeyserver/sks-keyserver"
11 SRC_URI="http://bitbucket.org/skskeyserver/sks-keyserver/downloads/${P}.tgz"
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~amd64 ~x86"
15 IUSE="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}/${P}-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 || die
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         systemd_dounit "${FILESDIR}/sks-db.service"
75         systemd_dounit "${FILESDIR}/sks-recon.service"
76
77         dodir "${D}/var/lib/sks/web.typical"
78         insinto /var/lib/sks
79         newins sampleConfig/DB_CONFIG DB_CONFIG.typical
80         newins sampleConfig/sksconf sksconf.typical
81         insinto /var/lib/sks/web.typical
82         doins sampleWeb/HTML5/*
83
84         keepdir /var/lib/sks
85 }
86
87 pkg_postinst() {
88         readme.gentoo_print_elog
89         ewarn "Note when upgrading from earlier versions of SKS"
90         ewarn "===================="
91         ewarn "The default values for pagesize settings have changed. To continue"
92         ewarn "using an existing DB without rebuilding, explicit settings have to be"
93         ewarn "added to the sksconf file."
94         ewarn "pagesize:       4"
95         ewarn "ptree_pagesize: 1"
96 }