logo

overlay

My (experimental) gentoo overlay

inspircd-9999.ebuild (3682B)


      1 # Copyright 1999-2019 Gentoo Authors
      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="http://www.inspircd.org/"
     10 if [[ "${PV}" == "9999" ]]
     11 then
     12 	inherit git-r3
     13 
     14 	EGIT_REPO_URI="https://github.com/inspircd/inspircd.git"
     15 else
     16 	SRC_URI="https://github.com/inspircd/inspircd/archive/v${PV}.tar.gz -> ${P}.tar.gz"
     17 	KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
     18 fi
     19 
     20 LICENSE="GPL-2"
     21 SLOT="0"
     22 IUSE="geoip gnutls ldap libressl mbedtls mysql pcre posix postgres sqlite openssl sslrehash tre"
     23 
     24 REQUIRED_USE="sslrehash? ( || ( gnutls mbedtls openssl ) )"
     25 
     26 RDEPEND="
     27 	dev-lang/perl
     28 	dev-libs/utfcpp:=
     29 	openssl? (
     30 		!libressl? ( dev-libs/openssl:= )
     31 		libressl? ( dev-libs/libressl:= )
     32 	)
     33 	geoip? ( dev-libs/geoip )
     34 	gnutls? ( net-libs/gnutls:= dev-libs/libgcrypt:0 )
     35 	ldap? ( net-nds/openldap )
     36 	mysql? ( dev-db/mysql-connector-c:= )
     37 	mbedtls? ( net-libs/mbedtls:= )
     38 	postgres? ( dev-db/postgresql:= )
     39 	pcre? ( dev-libs/libpcre )
     40 	sqlite? ( >=dev-db/sqlite-3.0 )
     41 	tre? ( dev-libs/tre )
     42 "
     43 DEPEND="${RDEPEND}"
     44 
     45 DOCS=( docs/. )
     46 
     47 pkg_setup() {
     48 	enewgroup ${PN}
     49 	enewuser ${PN} -1 -1 -1 ${PN}
     50 }
     51 
     52 src_prepare() {
     53 	default
     54 
     55 	rm -r vendor/utfcpp || die "Failed removing bundling of utfcpp"
     56 	grep -l 'vendor_directory("utfcpp")' -r src | xargs sed -i 's/vendor_directory("utfcpp")/utf8/' || die "Failed changing the flag for utfcpp"
     57 }
     58 
     59 src_configure() {
     60 	local extras=""
     61 
     62 	tc-export CXX
     63 
     64 	# NOTE: remove when modulemanager is rewrote
     65 	# extra modules are found in src/modules/extra
     66 	use geoip && extras+="m_geoip.cpp,"
     67 	use gnutls && extras+="m_ssl_gnutls.cpp,"
     68 	use ldap && extras+="m_ldapauth.cpp,m_ldapoper.cpp,"
     69 	use mysql && extras+="m_mysql.cpp,"
     70 	use pcre && extras+="m_regex_pcre.cpp,"
     71 	use posix && extras+="m_regex_posix.cpp,"
     72 	use postgres && extras+="m_pgsql.cpp,"
     73 	use sqlite && extras+="m_sqlite3.cpp,"
     74 	use openssl && extras+="m_ssl_openssl.cpp,"
     75 	use tre && extras+="m_regex_tre.cpp,"
     76 	use mbedtls && extras+="m_ssl_mbedtls.cpp,"
     77 	use sslrehash && extras+="m_sslrehashsignal.cpp,"
     78 
     79 	# The first configuration run enables certain "extra" InspIRCd
     80 	# modules, the second run generates the actual makefile.
     81 	if [[ -n "${extras}" ]]; then
     82 		./configure --disable-interactive --enable-extras=${extras%,}
     83 	fi
     84 
     85 	# Remove --development on stable release ebuild
     86 	local myconf=(
     87 		--disable-interactive
     88 		--development
     89 		--prefix="/usr/$(get_libdir)/${PN}"
     90 		--config-dir="/etc/${PN}"
     91 		--data-dir="/var/lib/${PN}/data"
     92 		--log-dir="/var/log/${PN}"
     93 		--binary-dir="/usr/bin"
     94 		--module-dir="/usr/$(get_libdir)/${PN}/modules"
     95 		--gid=${PN}
     96 		--uid=${PN}
     97 	)
     98 
     99 	./configure "${myconf[@]}"
    100 }
    101 
    102 src_compile() {
    103 	emake V=1 LDFLAGS="${LDFLAGS}" CXXFLAGS="${CXXFLAGS}"
    104 }
    105 
    106 src_install() {
    107 	emake INSTUID=${PN} DESTDIR="${D%/}" install
    108 
    109 	insinto "/usr/include/${PN}"
    110 	doins -r include/.
    111 
    112 	einstalldocs
    113 
    114 	newinitd "${FILESDIR}/${PN}.initd" "${PN}"
    115 	newconfd "${FILESDIR}/${PN}.confd" "${PN}"
    116 
    117 	keepdir "/var/log/${PN}"
    118 
    119 	diropts -o"${PN}" -g"${PN}" -m0700
    120 	keepdir "/var/lib/${PN}/data"
    121 }
    122 
    123 pkg_postinst() {
    124 	if [[ -z "${REPLACING_VERSIONS}" ]]; then
    125 		# This is a new installation
    126 		elog "You will find example configuration files under "
    127 		elog "/usr/share/doc/${PN}"
    128 		elog "Read the ${PN}.conf.example file carefully before "
    129 		elog "starting the service."
    130 	fi
    131 	local pv
    132 	for pv in ${REPLACING_VERSIONS}; do
    133 		if ver_test "${pv}" -lt "2.0.24-r1"; then
    134 			elog "Starting with 2.0.24-r1 the daemon is no longer started"
    135 			elog "with the --logfile option and you are thus expected to define"
    136 			elog "logging in the InspIRCd configuration file if you want it."
    137 			break
    138 		fi
    139 	done
    140 }