1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit 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 eapply "${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
89 cp "${FILESDIR}"/config config/.config || die
91 #Respect CFLAGS/LDFLAGS
92 sed -i -e "s:^CONFIG_EXTRA_CFLAGS_OPTIONS.*$:CONFIG_EXTRA_CFLAGS_OPTIONS=\"${CFLAGS}\":" \
94 sed -i -e "s:^CONFIG_EXTRA_LDFLAGS_OPTIONS.*$:CONFIG_EXTRA_LDFLAGS_OPTIONS=\"${LDLAGS}\":" \
97 #The logic is that the default config file enables everything and we disable
98 #here with sed unless a USE flags says to keep it
100 if ! use static; then
101 sed -i -e 's:^CONFIG_HTTP_STATIC_BUILD:# CONFIG_HTTP_STATIC_BUILD:' \
102 config/.config || die
104 if ! use cgi-php && ! use cgi-lua; then
105 sed -i -e 's:^CONFIG_HTTP_HAS_CGI:# CONFIG_HTTP_HAS_CGI:' \
106 config/.config || die
108 if ! use cgi-php; then
109 sed -i -e 's:,.php::' config/.config || die
111 if ! use cgi-lua; then
112 sed -i -e 's:\.lua,::' \
114 -e 's:^CONFIG_HTTP_ENABLE_LUA:# CONFIG_HTTP_ENABLE_LUA:' \
115 config/.config || die
118 sed -i -e 's:^CONFIG_AXHTTPD:# CONFIG_AXHTTPD:' \
119 config/.config || die
122 yes "n" | emake -j1 oldconfig > /dev/null || die
125 multilib_src_configure() {
126 #Per-ABI substitutions.
127 sed -i -e 's:^LIBDIR.*/lib:LIBDIR = $(PREFIX)/'"$(get_libdir):" \
130 #Use CC as the host compiler for mconf
131 sed -i -e "s:^HOSTCC.*:HOSTCC=${CC}:" \
132 config/Rules.mak || die
134 if use savedconfig; then
135 restore_config config/.config
136 if [[ -f config/.config ]]; then
137 ewarn "Using saved config, all other USE flags ignored"
139 ewarn "No saved config, seeding with the default"
140 cp "${FILESDIR}"/config config/.config || die
142 yes "" | emake -j1 oldconfig > /dev/null || die
148 multilib_src_install() {
149 if multilib_is_native_abi && use savedconfig; then
150 save_config config/.config
153 emake PREFIX="${ED}/usr" install
155 if ! use static-libs; then
156 rm -f "${ED}"/usr/$(get_libdir)/libaxtls.a || die
159 # The build system needs to install before it builds docs
160 if multilib_is_native_abi && use doc; then
166 multilib_src_install_all() {
167 if [[ -f "${ED}"/usr/bin/htpasswd ]]; then
168 mv "${ED}"/usr/bin/{,ax}htpasswd || die
172 newinitd "${FILESDIR}"/axhttpd.initd axhttpd
173 newconfd "${FILESDIR}"/axhttpd.confd axhttpd
176 docompress -x /usr/share/doc/${PF}/README