blob: fe4f2dcfb0e14e77fd713a8e5ec6ab2f3158724c [file] [log] [blame]
#
# Copyright 2020 Google LLC
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
EAPI=7
inherit cros-debug toolchain-funcs
DESCRIPTION="Backend-agnostic network configuration in YAML"
HOMEPAGE="https://netplan.io/"
SRC_URI="https://github.com/canonical/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="*"
IUSE="systemd"
REQUIRED_USE="systemd"
DEPEND="
>=dev-libs/glib-2.58.3-r5
>=dev-libs/libyaml-0.2.2
sys-apps/systemd
"
RDEPEND="
>=dev-python/netifaces-0.10.9
>=dev-libs/libyaml-0.2.2
>=dev-python/pyyaml-3.13[libyaml(+)]
"
src_prepare() {
# Adding this patch so that makefile accepts custom pkg-config
eapply "${FILESDIR}/${P}-modify-makefile-to-accept-custom-pkg-config.patch"
sed -i -e "s:\$(DOCDIR)/netplan:\$(DOCDIR)/${PF}:" Makefile || die
# baselayout-1 compat
if has_version ">=sys-apps/baselayout-2.0.0"; then
sed -i -e 's:sbin/wpa_supplicant:usr/sbin/wpa_supplicant:' src/networkd.c || die
fi
eapply_user
}
src_compile() {
emake clean
emake DESTDIR="${D}" LIBDIR="\${PREFIX}/$(get_libdir)" \
HOSTPKGCONFIG="$(tc-getPKG_CONFIG)" CC="$(tc-getCC)" \
CFLAGS="${CFLAGS} -Wno-unused-variable"
}
src_install() {
if [[ -f Makefile ]] || [[ -f GNUmakefile ]] || [[ -f makefile ]] ; then
emake DESTDIR="${D}" LIBDIR="\${PREFIX}/$(get_libdir)" \
HOSTPKGCONFIG="$(tc-getPKG_CONFIG)" CC="$(tc-getCC)" \
CFLAGS="${CFLAGS} -Wno-unused-variable" install
fi
einstalldocs
}