Bug 97183 - Update port: net/libnids to 1.21
Summary: Update port: net/libnids to 1.21
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Peter Pentchev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-12 18:30 UTC by Vasil Dimov
Modified: 2009-05-17 11:54 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vasil Dimov freebsd_committer freebsd_triage 2006-05-12 18:30:24 UTC
* Update net/libnids from 1.20 to 1.21
* Get rid of libnet -devel or not -devel selection and fallback to
  net/libnet which is now stable
* Make libnet and glib2 optional via OPTIONS
* Fix innocent configure warning by defining CONFIGURE_TARGET
* Add ${PTHREAD_LIBS} to LDFLAGS because glib is not recognised otherwise
  (undefined reference to pthread...)
* Add support for building and installing shared library. Unfortunately
  this fails on amd64 because lib/libnet.a is not ready (PIC) to be
  included in shared libraries and libnet.so is not installed.
  See the comment in Makefile for the exact error message.

Fix: 

-- 
Vasil Dimov
gro.DSBeerF@dv

Testing can show the presence of bugs, but not their absence.
                -- Edsger W. Dijkstra--njmgFaZ337rqg7KKE5dh8qw3osmEznXXSPHafMySsp9k7nSX
Content-Type: text/plain; name="libnids_1.20-1.21.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="libnids_1.20-1.21.diff"

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/net/libnids/Makefile,v
retrieving revision 1.16
diff -u -r1.16 Makefile
--- Makefile	14 Nov 2005 17:07:03 -0000	1.16
+++ Makefile	12 May 2006 17:16:48 -0000
@@ -6,8 +6,7 @@
 #
 
 PORTNAME=	libnids
-PORTVERSION=	1.20
-PORTREVISION=	1
+PORTVERSION=	1.21
 CATEGORIES=	net security
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	${PORTNAME}
@@ -15,21 +14,62 @@
 MAINTAINER=	roam@FreeBSD.org
 COMMENT=	Network monitoring library with TCP/IP reassembly
 
-.if defined(WITH_LIBNET_DEVEL)
-BUILD_DEPENDS=	libnet*>=1.1.2,1:${PORTSDIR}/net/libnet
+OPTIONS=	LIBNET "Include code requiring libnet" On \
+		GLIB2 "Use GLIB2 for multiprocessing support" On
+
+GNU_CONFIGURE=	yes
+CONFIGURE_TARGET=	--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
+CONFIGURE_ENV=	CFLAGS="-I${LOCALBASE}/include" \
+		LDFLAGS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}"
+
+MAKE_ENV=	LDFLAGS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}"
+
+.include <bsd.port.pre.mk>
+
+LIBNAMEORIG=	${PORTNAME}.so.${PORTVERSION}
+LIBNAME=	${LIBNAMEORIG:R}
+
+# /usr/bin/ld: /usr/local/lib/libnet.a(libnet_build_ip.o): \
+# relocation R_X86_64_32 can not be used when making a shared object; \
+# recompile with -fPIC
+.if ${ARCH} == "i386"
+CONFIGURE_ARGS+=	--enable-shared
+INSTALLS_SHLIB=	yes
+PLIST_SUB=	SHARED=""
 .else
-BUILD_DEPENDS=	libnet*<=1.1.0,1:${PORTSDIR}/net/libnet10
+PLIST_SUB=	SHARED="@comment "
 .endif
 
-GNU_CONFIGURE=	yes
-CONFIGURE_ENV+=	CFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib"
+.if !defined(WITHOUT_LIBNET)
+BUILD_DEPENDS+=	${LOCALBASE}/lib/libnet.a:${PORTSDIR}/net/libnet
+RUN_DEPENDS+=	${LOCALBASE}/lib/libnet.a:${PORTSDIR}/net/libnet
+.else
+CONFIGURE_ARGS+=	--disable-libnet
+.endif
 
-MAN3=		libnids.3
+.if !defined(WITHOUT_GLIB2)
+LIB_DEPENDS+=	glib-2.0:${PORTSDIR}/devel/glib20
+.else
+CONFIGURE_ARGS+=	--disable-libglib
+.endif
+
+MAN3=	libnids.3
+
+# linking without LDFLAGS - this should be reported upstream
+post-patch:
+	${REINPLACE_CMD} -e 's/$$(CC) -shared/$$(CC) -shared $$(LDFLAGS)/' \
+		${WRKSRC}/src/Makefile.in
+	${REINPLACE_CMD} -e 's/${LIBNAMEORIG}/${LIBNAME}/' \
+		${WRKSRC}/src/Makefile.in
 
 do-install:
-		${INSTALL_DATA} ${WRKSRC}/src/nids.h ${PREFIX}/include
-		${INSTALL_DATA} ${WRKSRC}/src/libnids.a ${PREFIX}/lib
-		${INSTALL_MAN} ${WRKSRC}/src/libnids.3 ${PREFIX}/man/man3
+.if defined(INSTALLS_SHLIB)
+	${INSTALL_DATA} ${WRKSRC}/src/${LIBNAME} ${PREFIX}/lib
+	${LN} -s ${PREFIX}/lib/${LIBNAME} ${PREFIX}/lib/${LIBNAME:R}
+.endif
+	${INSTALL_DATA} ${WRKSRC}/src/nids.h ${PREFIX}/include
+	${INSTALL_DATA} ${WRKSRC}/src/libnids.a ${PREFIX}/lib
+	${INSTALL_MAN} ${WRKSRC}/src/libnids.3 ${PREFIX}/man/man3
 
 post-install:
 .if !defined(NOPORTDOCS)
@@ -39,4 +79,4 @@
 .endfor
 .endif
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
Index: distinfo
===================================================================
RCS file: /home/pcvs/ports/net/libnids/distinfo,v
retrieving revision 1.11
diff -u -r1.11 distinfo
--- distinfo	22 Jan 2006 21:23:12 -0000	1.11
+++ distinfo	12 May 2006 17:16:48 -0000
@@ -1,3 +1,3 @@
-MD5 (libnids-1.20.tar.gz) = a36cbd45cbada12420ecc8f82a7e0852
-SHA256 (libnids-1.20.tar.gz) = c5a7553f64bed2384ecc9535e67cf7d80ccf7f7f34ab8b132703b60d0eaec604
-SIZE (libnids-1.20.tar.gz) = 119226
+MD5 (libnids-1.21.tar.gz) = 8c43dd7d66350eed99a29be50bc5615f
+SHA256 (libnids-1.21.tar.gz) = 91ec08b9aeb2f869009b5b099f318c476f75942db64804eb50acde94696f4bf5
+SIZE (libnids-1.21.tar.gz) = 140138
Index: pkg-plist
===================================================================
RCS file: /home/pcvs/ports/net/libnids/pkg-plist,v
retrieving revision 1.3
diff -u -r1.3 pkg-plist
--- pkg-plist	29 Oct 2003 14:13:08 -0000	1.3
+++ pkg-plist	12 May 2006 17:16:48 -0000
@@ -1,5 +1,7 @@
 include/nids.h
 lib/libnids.a
+%%SHARED%%lib/libnids.so
+%%SHARED%%lib/libnids.so.1
 %%PORTDOCS%%%%DOCSDIR%%/API.html
 %%PORTDOCS%%%%DOCSDIR%%/API.txt
 %%PORTDOCS%%%%DOCSDIR%%/LINUX
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2006-05-12 18:44:11 UTC
Responsible Changed
From-To: freebsd-ports-bugs->roam

Over to maintainer
Comment 2 Peter Pentchev freebsd_committer freebsd_triage 2006-05-25 13:22:30 UTC
State Changed
From-To: open->analyzed

Looking into it...
Comment 3 Peter Pentchev 2006-06-12 14:47:17 UTC
On Fri, May 12, 2006 at 08:27:48PM +0300, Vasil Dimov wrote:
> >Synopsis:       Update port: net/libnids to 1.21
> >Description:


For the present, I committed a partial version of your patch.

> * Update net/libnids from 1.20 to 1.21
> * Get rid of libnet -devel or not -devel selection and fallback to
>   net/libnet which is now stable
> * Make libnet and glib2 optional via OPTIONS
> * Fix innocent configure warning by defining CONFIGURE_TARGET


Those were all in the version that I committed.

> * Add ${PTHREAD_LIBS} to LDFLAGS because glib is not recognised otherwise
>   (undefined reference to pthread...)


PTHREAD_CFLAGS needed to be added to CFLAGS, too :)  Not on modern 5.x
or 6.x, 's true, but still... :)

> * Add support for building and installing shared library. Unfortunately
>   this fails on amd64 because lib/libnet.a is not ready (PIC) to be
>   included in shared libraries and libnet.so is not installed.
>   See the comment in Makefile for the exact error message.


For the present, I decided to leave things as they are - never build
a shared library, at least until libnet grows proper shared library
support.  IMHO, it would not really be a very good thing to build
a shared library on some platforms and only a static one on others -
then ports dependent on libnids would need to conditionally add it to
their LIB_DEPENDS or not, depending on the platform.  Still, thanks
a lot for your work on this - you've uncovered a couple of real libnids
build problems there!

I'm looking into what it would take to get libnet to build a proper
shared library now.

G'luck,
Peter

-- 
Peter Pentchev	roam@ringlet.net    roam@cnsys.bg    roam@FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
If this sentence didn't exist, somebody would have invented it.
Comment 4 Martin Wilke freebsd_committer freebsd_triage 2009-05-17 11:46:07 UTC
State Changed
From-To: analyzed->feedback

any process here or can we close this one?
Comment 5 Peter Pentchev freebsd_committer freebsd_triage 2009-05-17 11:53:07 UTC
State Changed
From-To: feedback->closed

Getting libnet to build a shared library should be done upstream, I think.