axtls-2.1.3.ebuild 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  4. inherit multilib multilib-minimal savedconfig toolchain-funcs user
  5. ################################################################################
  6. # axtls CONFIG MINI-HOWTO
  7. #
  8. # Note: axtls is highly configurable and uses mconf, like the linux kernel.
  9. # You can configure it in a couple of ways:
  10. #
  11. # 1) USE="-savedconfig" and set/unset the remaining flags to obtain the features
  12. # you want, and possibly a lot more.
  13. #
  14. # 2) You can create your own configuration file by doing
  15. #
  16. # FEATURES="keepwork" USE="savedconfig -*" emerge axtls
  17. # cd /var/tmp/portage/net-libs/axtls*/work/axTLS
  18. # make menuconfig
  19. #
  20. # Now configure axtls as you want. Finally save your config file:
  21. #
  22. # cp config/.config /etc/portage/savedconfig/net-libs/axtls-${PV}
  23. #
  24. # where ${PV} is the current version. You can then run emerge again with
  25. # your configuration by doing
  26. #
  27. # USE="savedconfig" emerge axtls
  28. #
  29. ################################################################################
  30. MY_PN=${PN/tls/TLS}
  31. DESCRIPTION="Embedded client/server TLSv1 SSL library and small HTTP(S) server"
  32. HOMEPAGE="http://axtls.sourceforge.net/"
  33. SRC_URI="mirror://sourceforge/axtls/${MY_PN}-${PV}.tar.gz"
  34. S="${WORKDIR}/${PN}-code"
  35. LICENSE="BSD GPL-2"
  36. SLOT="0/1"
  37. KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~x86"
  38. IUSE="httpd cgi-lua cgi-php static static-libs doc"
  39. # TODO: add ipv6, and c#, java, lua, perl bindings
  40. # Currently these all have some issue
  41. DEPEND="doc? ( app-doc/doxygen )"
  42. RDEPEND="
  43. httpd? (
  44. cgi-lua? ( dev-lang/lua )
  45. cgi-php? ( dev-lang/php[cgi] )
  46. )"
  47. #Note1: static, cgi-* makes no sense if httpd is not given
  48. REQUIRED_USE="
  49. static? ( httpd )
  50. cgi-lua? ( httpd )
  51. cgi-php? ( httpd )"
  52. AXTLS_GROUP="axtls"
  53. AXTLS_USER="axtls"
  54. pkg_setup() {
  55. use httpd && {
  56. ebegin "Creating axtls user and group"
  57. enewgroup ${AXTLS_GROUP}
  58. enewuser ${AXTLS_USER} -1 -1 -1 ${AXTLS_GROUP}
  59. }
  60. }
  61. src_prepare() {
  62. tc-export AR CC
  63. eapply "${FILESDIR}/explicit-libdir-r1.patch"
  64. #We want CONFIG_DEBUG to avoid stripping
  65. #but not for debugging info
  66. sed -i -e 's: -g::' config/Rules.mak || die
  67. sed -i -e 's: -g::' config/makefile.conf || die
  68. eapply_user
  69. multilib_copy_sources
  70. }
  71. use_flag_config() {
  72. cp "${FILESDIR}"/config config/.config || die
  73. #Respect CFLAGS/LDFLAGS
  74. sed -i -e "s:^CONFIG_EXTRA_CFLAGS_OPTIONS.*$:CONFIG_EXTRA_CFLAGS_OPTIONS=\"${CFLAGS}\":" \
  75. config/.config || die
  76. sed -i -e "s:^CONFIG_EXTRA_LDFLAGS_OPTIONS.*$:CONFIG_EXTRA_LDFLAGS_OPTIONS=\"${LDLAGS}\":" \
  77. config/.config || die
  78. #The logic is that the default config file enables everything and we disable
  79. #here with sed unless a USE flags says to keep it
  80. if use httpd; then
  81. if ! use static; then
  82. sed -i -e 's:^CONFIG_HTTP_STATIC_BUILD:# CONFIG_HTTP_STATIC_BUILD:' \
  83. config/.config || die
  84. fi
  85. if ! use cgi-php && ! use cgi-lua; then
  86. sed -i -e 's:^CONFIG_HTTP_HAS_CGI:# CONFIG_HTTP_HAS_CGI:' \
  87. config/.config || die
  88. fi
  89. if ! use cgi-php; then
  90. sed -i -e 's:,.php::' config/.config || die
  91. fi
  92. if ! use cgi-lua; then
  93. sed -i -e 's:\.lua,::' \
  94. -e 's:lua:php:' \
  95. -e 's:^CONFIG_HTTP_ENABLE_LUA:# CONFIG_HTTP_ENABLE_LUA:' \
  96. config/.config || die
  97. fi
  98. else
  99. sed -i -e 's:^CONFIG_AXHTTPD:# CONFIG_AXHTTPD:' \
  100. config/.config || die
  101. fi
  102. yes "n" | emake -j1 oldconfig > /dev/null || die
  103. }
  104. multilib_src_configure() {
  105. #Per-ABI substitutions.
  106. sed -i -e 's:^LIBDIR.*/lib:LIBDIR = $(PREFIX)/'"$(get_libdir):" \
  107. Makefile || die
  108. #Use CC as the host compiler for mconf
  109. sed -i -e "s:^HOSTCC.*:HOSTCC=${CC}:" \
  110. config/Rules.mak || die
  111. if use savedconfig; then
  112. restore_config config/.config
  113. if [[ -f config/.config ]]; then
  114. ewarn "Using saved config, all other USE flags ignored"
  115. else
  116. ewarn "No saved config, seeding with the default"
  117. cp "${FILESDIR}"/config config/.config || die
  118. fi
  119. yes "" | emake -j1 oldconfig > /dev/null || die
  120. else
  121. use_flag_config
  122. fi
  123. }
  124. multilib_src_install() {
  125. if multilib_is_native_abi && use savedconfig; then
  126. save_config config/.config
  127. fi
  128. emake PREFIX="${ED}/usr" install
  129. if ! use static-libs; then
  130. rm -f "${ED}"/usr/$(get_libdir)/libaxtls.a || die
  131. fi
  132. # The build system needs to install before it builds docs
  133. if multilib_is_native_abi && use doc; then
  134. emake docs
  135. dodoc -r docsrc/html
  136. fi
  137. }
  138. multilib_src_install_all() {
  139. if [[ -f "${ED}"/usr/bin/htpasswd ]]; then
  140. mv "${ED}"/usr/bin/{,ax}htpasswd || die
  141. fi
  142. if use httpd; then
  143. newinitd "${FILESDIR}"/axhttpd.initd axhttpd
  144. newconfd "${FILESDIR}"/axhttpd.confd axhttpd
  145. fi
  146. docompress -x /usr/share/doc/${PF}/README
  147. dodoc README
  148. }