aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzi <zi@FreeBSD.org>2012-02-12 08:27:03 +0800
committerzi <zi@FreeBSD.org>2012-02-12 08:27:03 +0800
commita3f1377fb2b2d5d783fa0d4472e3f6e1535e7526 (patch)
tree7362e7df6daf41abb521a13cc0e3c11966e7456b
parent3c6d223cd649830820c04423da5fdf0f07be23e2 (diff)
downloadfreebsd-ports-gnome-a3f1377fb2b2d5d783fa0d4472e3f6e1535e7526.tar.gz
freebsd-ports-gnome-a3f1377fb2b2d5d783fa0d4472e3f6e1535e7526.tar.zst
freebsd-ports-gnome-a3f1377fb2b2d5d783fa0d4472e3f6e1535e7526.zip
- Add support to build/install the net-snmp python modules
PR: ports/162140 Requested by: Geoffrey Huntley <ghuntley@ghuntley.com>
-rw-r--r--net-mgmt/net-snmp/Makefile37
-rw-r--r--net-mgmt/net-snmp/pkg-plist3
2 files changed, 40 insertions, 0 deletions
diff --git a/net-mgmt/net-snmp/Makefile b/net-mgmt/net-snmp/Makefile
index 38ede3d4731e..5ae09ec2fae2 100644
--- a/net-mgmt/net-snmp/Makefile
+++ b/net-mgmt/net-snmp/Makefile
@@ -20,11 +20,14 @@ OPTIONS= IPV6 "Build with IPv6 support" on \
MFD_REWRITES "Build with 64-bit Interface Counters" off \
PERL "Install additional perl modules" on \
PERL_EMBEDDED "Build embedded perl" on \
+ PYTHON "Install additional python modules" off \
DUMMY "Enable dummy values as placeholders" on \
TKMIB "Install graphical MIB browser" off \
DMALLOC "Enable dmalloc debug memory allocator" off \
UNPRIVILEGED "Allow unprivileged users to execute net-snmp" off
+.include <bsd.port.options.mk>
+
MAKE_JOBS_UNSAFE= yes
GNU_CONFIGURE= yes
@@ -46,6 +49,33 @@ CONFIGURE_ARGS+=--enable-shared --enable-internal-md5 \
CONFIGURE_ARGS+=--with-defaults
.endif
+.if defined(WITH_PYTHON)
+# borrowed from bsd.python.mk and adapted for our needs
+PYEASYINSTALL_CMD?= ${LOCALBASE}/bin/easy_install-${PYTHON_VER}
+PYEASYINSTALL_BINDIR?= ${PREFIX}/bin
+PYEASYINSTALL_SITELIBDIR?= ${PYTHONPREFIX_SITELIBDIR}
+PYDISTUTILS_PKGNAME?= netsnmp-python
+PYDISTUTILS_PKGVERSION?= 1.0a1
+PYEASYINSTALL_INSTALLARGS?= -q -N -S ${PYTHON_SITELIBDIR} \
+ -d ${PYEASYINSTALL_SITELIBDIR} \
+ -s ${PYEASYINSTALL_BINDIR} \
+ ${PYDISTUTILS_PKGNAME}==${PYDISTUTILS_PKGVERSION}
+PYEASYUNINSTALL_UNINSTALLARGS?= -q -N -m -S ${PYTHON_SITELIBDIR} \
+ -d ${PYEASYINSTALL_SITELIBDIR} \
+ -s ${PYEASYINSTALL_BINDIR} \
+ ${PYDISTUTILS_PKGNAME}
+USE_PYTHON= yes
+RUN_DEPENDS+= easy_install:${PORTSDIR}/devel/py-setuptools
+BUILD_DEPENDS+= easy_install:${PORTSDIR}/devel/py-setuptools
+CONFIGURE_ARGS+=--with-python-modules
+PLIST_SUB+= WITH_PYTHON="" PYTHON_VER=${PYTHON_VER}
+PLIST_SUB+= PYDISTUTILS_PKGVERSION=${PYDISTUTILS_PKGVERSION}
+PLIST_SUB+= PYINSTALL="@exec ${SETENV} PYTHONPATH=${PYEASYINSTALL_SITELIBDIR} ${PYEASYINSTALL_CMD} ${PYEASYINSTALL_INSTALLARGS}"
+PLIST_SUB+= PYUNINSTALL="@unexec ${PYEASYINSTALL_CMD} ${PYEASYUNINSTALL_UNINSTALLARGS}"
+.else
+PLIST_SUB+= WITH_PYTHON="@comment "
+.endif
+
.include <bsd.port.pre.mk>
CONFIGURE_ARGS+= --with-openssl="${OPENSSLBASE}"
@@ -247,6 +277,13 @@ post-configure:
s!^.*#undef.*(HAVE_${hdr:U:S/./_/g:S/\//_/g}).*$$!#define \1 1!g' \
${WRKSRC}/include/net-snmp/net-snmp-config.h
.endfor
+.if defined(WITH_PYTHON)
+ @(cd ${WRKSRC}/python; \
+ ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYSETUP} setopt -c bdist_egg \
+ -o plat-name -s "" --basedir=${WRKSRC}; \
+ ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYSETUP} setopt -c bdist \
+ -o plat-name -s "" --basedir=${WRKSRC})
+.endif
post-build:
.if defined(WITH_PERL)
diff --git a/net-mgmt/net-snmp/pkg-plist b/net-mgmt/net-snmp/pkg-plist
index 9d320aae2406..90c0d3c792c2 100644
--- a/net-mgmt/net-snmp/pkg-plist
+++ b/net-mgmt/net-snmp/pkg-plist
@@ -467,6 +467,9 @@ sbin/snmptrapd
%%WITH_PERL%%@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/NetSNMP/agent
%%WITH_PERL%%@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/NetSNMP
%%WITH_PERL%%@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/Bundle
+%%WITH_PYTHON%%%%PYINSTALL%%
+%%WITH_PYTHON%%%%PYUNINSTALL%%
+%%WITH_PYTHON%%%%PYTHON_SITELIBDIR%%/netsnmp_python-%%PYDISTUTILS_PKGVERSION%%-py%%PYTHON_VER%%.egg
@exec mkdir /var/agentx
@dirrm include/net-snmp/system
@dirrm include/net-snmp/machine