logo

overlay

My (experimental) gentoo overlay

inspircd-2.0.27.ebuild (3247B)


      1 # Copyright 1999-2018 Gentoo Foundation
      2 # Distributed under the terms of the GNU General Public License v2
      3 
      4 EAPI="7"
      5 
      6 inherit toolchain-funcs user
      7 
      8 DESCRIPTION="Inspire IRCd - The Stable, High-Performance Modular IRCd"
      9 HOMEPAGE="https://inspircd.github.com/"
     10 SRC_URI="https://github.com/inspircd/inspircd/archive/v${PV}.tar.gz -> ${P}.tar.gz"
     11 
     12 LICENSE="GPL-2"
     13 SLOT="0"
     14 KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
     15 IUSE="geoip gnutls ipv6 ldap libressl mysql pcre posix postgres sqlite openssl tre"
     16 
     17 RDEPEND="
     18 	dev-lang/perl
     19 	openssl? (
     20 		!libressl? ( dev-libs/openssl:= )
     21 		libressl? ( dev-libs/libressl:= )
     22 	)
     23 	geoip? ( dev-libs/geoip )
     24 	gnutls? ( net-libs/gnutls:= dev-libs/libgcrypt:0 )
     25 	ldap? ( net-nds/openldap )
     26 	mysql? ( dev-db/mysql-connector-c:= )
     27 	postgres? ( dev-db/postgresql:= )
     28 	pcre? ( dev-libs/libpcre )
     29 	sqlite? ( >=dev-db/sqlite-3.0 )
     30 	tre? ( dev-libs/tre )"
     31 DEPEND="${RDEPEND}"
     32 
     33 DOCS=( docs/. )
     34 PATCHES=( "${FILESDIR}"/${P}-fix-path-builds.patch )
     35 
     36 pkg_setup() {
     37 	enewgroup ${PN}
     38 	enewuser ${PN} -1 -1 -1 ${PN}
     39 }
     40 
     41 src_prepare() {
     42 	default
     43 
     44 	# Patch the inspircd launcher with the inspircd user
     45 	sed -i -e "s/@UID@/${PN}/" "${S}/make/template/${PN}" || die
     46 }
     47 
     48 src_configure() {
     49 	local extras=""
     50 
     51 	use geoip && extras+="m_geoip.cpp,"
     52 	use gnutls && extras+="m_ssl_gnutls.cpp,"
     53 	use ldap && extras+="m_ldapauth.cpp,m_ldapoper.cpp,"
     54 	use mysql && extras+="m_mysql.cpp,"
     55 	use pcre && extras+="m_regex_pcre.cpp,"
     56 	use posix && extras+="m_regex_posix.cpp,"
     57 	use postgres && extras+="m_pgsql.cpp,"
     58 	use sqlite && extras+="m_sqlite3.cpp,"
     59 	use openssl && extras+="m_ssl_openssl.cpp,"
     60 	use tre && extras+="m_regex_tre.cpp,"
     61 
     62 	# The first configuration run enables certain "extra" InspIRCd
     63 	# modules, the second run generates the actual makefile.
     64 	if [[ -n "${extras}" ]]; then
     65 		./configure --disable-interactive --enable-extras=${extras%,}
     66 	fi
     67 
     68 	local myconf=(
     69 		--with-cc="$(tc-getCXX)"
     70 		--disable-interactive
     71 		--prefix="/usr/$(get_libdir)/${PN}"
     72 		--config-dir="/etc/${PN}"
     73 		--data-dir="/var/lib/${PN}/data"
     74 		--log-dir="/var/log/${PN}"
     75 		--binary-dir="/usr/bin"
     76 		--module-dir="/usr/$(get_libdir)/${PN}/modules"
     77 		$(usex ipv6 '' '--disable-ipv6')
     78 		$(usex gnutls '--enable-gnutls' '')
     79 		$(usex openssl '--enable-openssl' ''))
     80 	./configure "${myconf[@]}"
     81 }
     82 
     83 src_compile() {
     84 	emake V=1 LDFLAGS="${LDFLAGS}" CXXFLAGS="${CXXFLAGS}"
     85 }
     86 
     87 src_install() {
     88 	emake INSTUID=${PN} DESTDIR="${D%/}" install
     89 
     90 	insinto "/usr/include/${PN}"
     91 	doins -r include/.
     92 
     93 	einstalldocs
     94 
     95 	newinitd "${FILESDIR}/${PN}.initd" "${PN}"
     96 	newconfd "${FILESDIR}/${PN}.confd" "${PN}"
     97 
     98 	keepdir "/var/log/${PN}"
     99 
    100 	diropts -o"${PN}" -g"${PN}" -m0700
    101 	keepdir "/var/lib/${PN}/data"
    102 }
    103 
    104 pkg_postinst() {
    105 	if [[ -z "${REPLACING_VERSIONS}" ]]; then
    106 		# This is a new installation
    107 		elog "You will find example configuration files under "
    108 		elog "/usr/share/doc/${PN}"
    109 		elog "Read the ${PN}.conf.example file carefully before "
    110 		elog "starting the service."
    111 	fi
    112 	local pv
    113 	for pv in ${REPLACING_VERSIONS}; do
    114 		if ver_test "${pv}" -lt "2.0.24-r1"; then
    115 			elog "Starting with 2.0.24-r1 the daemon is no longer started"
    116 			elog "with the --logfile option and you are thus expected to define"
    117 			elog "logging in the InspIRCd configuration file if you want it."
    118 			break
    119 		fi
    120 	done
    121 }