# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=5 inherit eutils cmake-utils git-2 linux-info systemd DESCRIPTION="Encrypted networking for regular people" HOMEPAGE="https://github.com/cjdelisle/cjdns" EGIT_REPO_URI="git://github.com/cjdelisle/cjdns.git \ https://github.com/cjdelisle/cjdns.git" EGIT_COMMIT="628b8f983ad87ca9b36d1e7aa6832a22b50f414a" LICENSE="GPL-3" SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="hardened" # static-libs" RDEPEND="dev-libs/libevent net-libs/nacl" DEPEND="${RDEPEND} sys-devel/gcc:4.6" pkg_setup() { linux-info_pkg_setup if ! linux_config_exists; then eerror "Unable to check your kernel for TUN support" else CONFIG_CHECK="~TUN" ERROR_TUN="Your kernel lacks TUN support." fi } src_prepare() { local required_version="4.6" einfo "checking current gcc profile" if ! version_is_at_least ${required_version} $(gcc-version) ; then eerror "${P} requires gcc-${required_version} or greater to build." eerror "Have you gcc-config'ed to the latest version?" die "current gcc profile is less than ${required_version}" fi epatch "${FILESDIR}/FindNACL.cmake-${PV}.diff" } src_configure() { if ! use hardened ; then export NO_PIE=1 ewarn "ASLR disabled" fi ## Building NO_STATIC will break compiling with the included copy of libuv. ## #if use static-libs ; then # export STATIC=1 #else # export NO_STATIC=1 #fi GIT_VERSION=${EGIT_COMMIT} cmake-utils_src_configure } src_install() { systemd_dounit contrib/systemd/cjdns.service newinitd "$FILESDIR/cjdns.runscript" cjdns dodoc README.md dodoc rfcs/* cd "${CMAKE_BUILD_DIR}/admin/angel" || die "could not chdir to admin/angel" dolib.a libcjdns-*.a mv cjdroute2 cjdroute dosbin cjdns cjdroute } pkg_postinst() { local config_file="cjdroute.conf" local config_path="${ROOT}etc/${config_file}" if [[ ! -e "${config_path}" ]] ; then ebegin "Generating ${config_file}..." (umask 077 && cjdroute --genconf > "${T}/${config_file}") || die "cjdroute --genconf failed" mv "${T}/${config_file}" "${config_path}" eend ${?} || die "Failed to generate and install ${config_file}" elog "The keys in ${config_path} have been autogenerated during " elog "emerge, they are not defaults and do not need to be overwritten." fi ewarn "Protect ${config_path}! A lost conf file means you have " ewarn "lost your password and connections and anyone who connected " ewarn "to you will no longer be able to connect. A *compromised* " ewarn "conf file means that other people can impersonate you on " ewarn "the network." }