1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils multilib multilib-minimal savedconfig toolchain-funcs user
8 ################################################################################
9 # axtls CONFIG MINI-HOWTO
11 # Note: axtls is highly configurable and uses mconf, like the linux kernel.
12 # You can configure it in a couple of ways:
14 # 1) USE="-savedconfig" and set/unset the remaining flags to obtain the features
15 # you want, and possibly a lot more.
17 # 2) You can create your own configuration file by doing
19 # FEATURES="keepwork" USE="savedconfig -*" emerge axtls
20 # cd /var/tmp/portage/net-libs/axtls*/work/axTLS
23 # Now configure axtls as you want. Finally save your config file:
25 # cp config/.config /etc/portage/savedconfig/net-libs/axtls-${PV}
27 # where ${PV} is the current version. You can then run emerge again with
28 # your configuration by doing
30 # USE="savedconfig" emerge axtls
32 ################################################################################
36 DESCRIPTION="Embedded client/server TLSv1 SSL library and small HTTP(S) server"
37 HOMEPAGE="http://axtls.sourceforge.net/"
38 SRC_URI="mirror://sourceforge/axtls/${MY_PN}-${PV}.tar.gz"
39 S="${WORKDIR}/${PN}-code"
43 KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~x86"
45 IUSE="httpd cgi-lua cgi-php static static-libs doc"
47 # TODO: add ipv6, and c#, java, lua, perl bindings
48 # Currently these all have some issue
49 DEPEND="doc? ( app-doc/doxygen )"
52 cgi-lua? ( dev-lang/lua )
53 cgi-php? ( dev-lang/php[cgi] )
56 #Note1: static, cgi-* makes no sense if httpd is not given
67 ebegin "Creating axtls user and group"
68 enewgroup ${AXTLS_GROUP}
69 enewuser ${AXTLS_USER} -1 -1 -1 ${AXTLS_GROUP}
76 epatch "${FILESDIR}/explicit-libdir-r1.patch"
78 #We want CONFIG_DEBUG to avoid stripping
79 #but not for debugging info
80 sed -i -e 's: -g::' config/Rules.mak || die
81 sed -i -e 's: -g::' config/makefile.conf || die
87 cp "${FILESDIR}"/config config/.config || die
89 #Respect CFLAGS/LDFLAGS
90 sed -i -e "s:^CONFIG_EXTRA_CFLAGS_OPTIONS.*$:CONFIG_EXTRA_CFLAGS_OPTIONS=\"${CFLAGS}\":" \
92 sed -i -e "s:^CONFIG_EXTRA_LDFLAGS_OPTIONS.*$:CONFIG_EXTRA_LDFLAGS_OPTIONS=\"${LDLAGS}\":" \
95 #The logic is that the default config file enables everything and we disable
96 #here with sed unless a USE flags says to keep it
99 sed -i -e 's:^CONFIG_HTTP_STATIC_BUILD:# CONFIG_HTTP_STATIC_BUILD:' \
100 config/.config || die
102 if ! use cgi-php && ! use cgi-lua; then
103 sed -i -e 's:^CONFIG_HTTP_HAS_CGI:# CONFIG_HTTP_HAS_CGI:' \
104 config/.config || die
106 if ! use cgi-php; then
107 sed -i -e 's:,.php::' config/.config || die
109 if ! use cgi-lua; then
110 sed -i -e 's:\.lua,::' \
112 -e 's:^CONFIG_HTTP_ENABLE_LUA:# CONFIG_HTTP_ENABLE_LUA:' \
113 config/.config || die
116 sed -i -e 's:^CONFIG_AXHTTPD:# CONFIG_AXHTTPD:' \
117 config/.config || die
120 yes "n" | emake -j1 oldconfig > /dev/null || die
123 multilib_src_configure() {
124 #Per-ABI substitutions.
125 sed -i -e 's:^LIBDIR.*/lib:LIBDIR = $(PREFIX)/'"$(get_libdir):" \
128 #Use CC as the host compiler for mconf
129 sed -i -e "s:^HOSTCC.*:HOSTCC=${CC}:" \
130 config/Rules.mak || die
132 if use savedconfig; then
133 restore_config config/.config
134 if [[ -f config/.config ]]; then
135 ewarn "Using saved config, all other USE flags ignored"
137 ewarn "No saved config, seeding with the default"
138 cp "${FILESDIR}"/config config/.config || die
140 yes "" | emake -j1 oldconfig > /dev/null || die
146 multilib_src_install() {
147 if multilib_is_native_abi && use savedconfig; then
148 save_config config/.config
151 emake PREFIX="${ED}/usr" install
153 if ! use static-libs; then
154 rm -f "${ED}"/usr/$(get_libdir)/libaxtls.a || die
157 # The build system needs to install before it builds docs
158 if multilib_is_native_abi && use doc; then
164 multilib_src_install_all() {
165 if [[ -f "${ED}"/usr/bin/htpasswd ]]; then
166 mv "${ED}"/usr/bin/{,ax}htpasswd || die
170 newinitd "${FILESDIR}"/axhttpd.initd axhttpd
171 newconfd "${FILESDIR}"/axhttpd.confd axhttpd
174 docompress -x /usr/share/doc/${PF}/README