]> Pileus Git - ~andy/sunrise/blob - net-irc/iroffer-dinoex/iroffer-dinoex-3.28.ebuild
sys-apps/aeuio: Move Creative Commons licenses to shorter names.
[~andy/sunrise] / net-irc / iroffer-dinoex / iroffer-dinoex-3.28.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="5"
6 inherit eutils toolchain-funcs user
7
8 DESCRIPTION="IRC bot to share files via DCC"
9 HOMEPAGE="http://iroffer.dinoex.de/projects/iroffer"
10 SRC_URI="http://iroffer.dinoex.net/${P}.tar.gz
11         http://iroffer.dinoex.net/HISTORY/${P}.tar.gz"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="~amd64"
16
17 # Generate IUSE
18 DINOEX_DEFAULT_MODULES="+admin +blowfish +chroot +http +memsave +ssl +telnet"
19 DINOEX_OPTIONAL_MODULES="curl debug geoip gnutls ruby static upnp"
20 DINOEX_LANGUAGES="de en fr it"
21
22 IUSE="${DINOEX_DEFAULT_MODULES} ${DINOEX_OPTIONAL_MODULES} daemon"
23 for lang in ${DINOEX_LANGUAGES}
24 do
25         IUSE="${IUSE} linguas_${lang}"
26 done
27
28 REQUIRED_USE="
29         admin? ( http )
30 "
31 # Handle in src_configure: gnutls? ( !ssl )
32
33 DEPEND="
34         chroot? ( dev-libs/nss )
35         curl? ( net-misc/curl )
36         geoip? ( dev-libs/geoip )
37         gnutls? ( net-libs/gnutls )
38         ruby? ( dev-lang/ruby )
39         ssl? ( dev-libs/openssl )
40 "
41
42 RDEPEND="
43         ${DEPEND}
44         !net-irc/iroffer
45 "
46
47 pkg_setup(){
48         # Create user if USE="+daemon"
49         if use daemon ; then
50                 enewgroup ${PN}
51                 enewuser ${PN} -1 -1 -1 ${PN}
52         fi
53 }
54
55 src_prepare(){
56         epatch "${FILESDIR}/${P}-Makefile.patch"
57         epatch "${FILESDIR}/${PN}-config.patch"
58 }
59
60 src_configure(){
61         local my_conf opts
62
63         # Remove unselected default modules
64         for opts in ${DINOEX_DEFAULT_MODULES}
65         do
66                 opts=${opts:1} # Remove "+"
67
68                 if ! use $opts ; then
69                         if [[ $opts != "ssl" ]] ; then
70                                 my_conf="${my_conf} -no-$opts"
71                         else
72                                 my_conf="${my_conf} -no-openssl"
73                         fi
74                 fi
75         done
76
77         # Add selected optional modules
78         for opts in ${DINOEX_OPTIONAL_MODULES}
79         do
80                 if use $opts ; then
81                         case $opts in
82                                 "gnutls")
83                                         # Conflicting USE ssl and gnutls, priority to gnutls
84                                         my_conf="${my_conf} -no-openssl -tls";;
85                                 "static")
86                                         my_conf="${my_conf} -no-libs";;
87                                 *)
88                                         my_conf="${my_conf} -$opts";;
89                         esac
90                 fi
91         done
92
93         # Iroffer uses an unusual configuration file. Need PREFIX (install by default in /usr/local, forbidden in portage)
94         ./Configure CC=$(tc-getCC) PREFIX="/usr" ${my_conf} || die "Error during ./Configure"
95 }
96
97 src_compile(){
98         # Iroffer need the language as first argument of Makefile
99         # Compile each available languages or just English
100         strip-linguas "${DINOEX_LANGUAGES}"
101
102         emake ${LINGUAS:-en}
103 }
104
105 src_install(){
106         local lang
107
108         for lang in ${LINGUAS:-en}
109         do
110                 emake DESTDIR="${D}" install-${lang}
111
112                 # i18n docs
113                 dodoc help-admin-${lang}.txt
114                 case $lang in
115                         "de")
116                                 dodoc beispiel.config LIESMICH.modDinoex;;
117                         "fr")
118                                 dodoc exemple.config;;
119                         *)
120                                 dodoc sample.config;;
121                 esac
122         done
123
124         # Common docs
125         dodoc README README.modDinoex dynip.sh iroffer.cron
126         newdoc "${FILESDIR}/${PN}-HOWTO" HOWTO
127         doman iroffer.1
128
129         # Specific stuff for "+daemon"
130         if use daemon ; then
131                 insinto /etc/${PN}
132                 insopts -m0660 -o root -g ${PN}
133
134                 for lang in ${LINGUAS:-en}
135                 do
136                         case $lang in
137                                 "de")
138                                         doins beispiel.config;;
139                                 "fr")
140                                         doins exemple.config;;
141                                 *)
142                                         doins sample.config;;
143                         esac
144                 done
145
146                 insinto /etc/logrotate.d
147                 insopts -m0644 -o root -g root
148                 newins "${FILESDIR}/${PN}.logrotate" ${PN}
149
150                 newinitd "${FILESDIR}/${PN}.init" ${PN}
151                 newconfd "${FILESDIR}/${PN}.conf" ${PN}
152         fi
153 }
154
155 pkg_postinst(){
156         elog "Quick start: \"HOWTO\" in \"/usr/share/doc/${PF}\""
157
158         if use daemon ; then
159                 elog
160                 ewarn "If you upgrade ${PN}, you can restart all ${PN}'s daemons with:"
161                 ewarn " find /etc/init.d/ -name ${PN}.* -execdir {} restart \;"
162                 ewarn "This command will disconnect all users!"
163         fi
164 }