The following diff fixes wrong libpthread linkage.

The bogus '-lpthread' was also ending into pkg-config files, and
infact I've spotted it while I was porting protobuf-c that depends
on protobuf...

$ diff -u /usr/local/lib/pkgconfig/protobuf.pc.orig  
/usr/local/lib/pkgconfig/protobuf.pc           
--- /usr/local/lib/pkgconfig/protobuf.pc.orig   Thu Jul  7 15:55:54 2011
+++ /usr/local/lib/pkgconfig/protobuf.pc        Thu Jul  7 15:50:19 2011
@@ -6,7 +6,7 @@
 Name: Protocol Buffers
 Description: Google's Data Interchange Format
 Version: 2.3.0
-Libs: -L${libdir} -lprotobuf -lz  -pthread -lpthread 
+Libs: -L${libdir} -lprotobuf -lz  -pthread 
 Cflags: -I${includedir} -pthread
 # Commented out because it crashes pkg-config *sigh*:
 #   http://bugs.freedesktop.org/show_bug.cgi?id=13265

$ diff -u /usr/local/lib/pkgconfig/protobuf-lite.pc.orig 
/usr/local/lib/pkgconfig/protobuf-lite.pc                                       
                                                       
--- /usr/local/lib/pkgconfig/protobuf-lite.pc.orig      Thu Jul  7 15:55:48 2011
+++ /usr/local/lib/pkgconfig/protobuf-lite.pc   Thu Jul  7 15:50:19 2011
@@ -6,7 +6,7 @@
 Name: Protocol Buffers
 Description: Google's Data Interchange Format
 Version: 2.3.0
-Libs: -L${libdir} -lprotobuf-lite -pthread -lpthread 
+Libs: -L${libdir} -lprotobuf-lite -pthread 
 Cflags: -I${includedir} -pthread
 # Commented out because it crashes pkg-config *sigh*:
 #   http://bugs.freedesktop.org/show_bug.cgi?id=13265


OK ?

Ciao,
David

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/protobuf/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- Makefile    15 Nov 2010 19:46:07 -0000      1.2
+++ Makefile    7 Jul 2011 13:55:01 -0000
@@ -3,6 +3,7 @@
 COMMENT =              c++ protocol buffers
 
 DISTNAME =             protobuf-2.3.0
+REVISION =             0
 
 SHARED_LIBS +=         protobuf        0.0   # .4.0
 SHARED_LIBS +=         protoc          0.0   # .4.0
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/devel/protobuf/patches/patch-configure,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-configure
--- patches/patch-configure     24 Mar 2010 19:03:37 -0000      1.1.1.1
+++ patches/patch-configure     7 Jul 2011 13:55:01 -0000
@@ -1,6 +1,6 @@
 $OpenBSD: patch-configure,v 1.1.1.1 2010/03/24 19:03:37 landry Exp $
---- configure.orig     Tue Jan 12 11:06:14 2010
-+++ configure  Tue Jan 12 11:08:22 2010
+--- configure.orig     Fri Jan  8 20:26:18 2010
++++ configure  Thu Jul  7 15:44:35 2011
 @@ -906,7 +906,6 @@ CXX
  CXXFLAGS
  CCC
@@ -9,6 +9,33 @@ $OpenBSD: patch-configure,v 1.1.1.1 2010
  
  # Initialize some variables set by options.
  ac_init_help=
+@@ -16887,7 +16886,7 @@ test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}"
+       # FIXME: -fPIC is required for -shared on many architectures,
+       # so we specify it here, but the right way would probably be to
+       # properly detect whether it is actually required.
+-      CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS"
++      CFLAGS="-shared -fPIC $CFLAGS $PTHREAD_CFLAGS"
+       LIBS="$PTHREAD_LIBS $LIBS"
+       CC="$PTHREAD_CC"
+ 
+@@ -17019,7 +17018,7 @@ echo "${ECHO_T}no" >&6; }
+       if test x"$done" = xno; then
+          { echo "$as_me:$LINENO: checking whether -lpthread fixes that" >&5
+ echo $ECHO_N "checking whether -lpthread fixes that... $ECHO_C" >&6; }
+-         LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
++         LIBS="-pthread $PTHREAD_LIBS $save_LIBS"
+          cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+ _ACEOF
+@@ -17069,7 +17068,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_i
+          if test "x$done" = xyes; then
+             { echo "$as_me:$LINENO: result: yes" >&5
+ echo "${ECHO_T}yes" >&6; }
+-            PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
++            PTHREAD_LIBS="-pthread $PTHREAD_LIBS"
+          else
+             { echo "$as_me:$LINENO: result: no" >&5
+ echo "${ECHO_T}no" >&6; }
 @@ -17294,12 +17293,6 @@ echo "$as_me: WARNING: could not find an STL hash_map"
     fi
  

Reply via email to