apcupsd tries to link its binaries using cc (rather than c++) with a static
link to -lsupc++, for people who "care about binary portability between
Linux distributions".

the simplest fix seems to be to just use c++ to link, switching it to
libstdc++ as usual.

ok?

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/apcupsd/Makefile,v
retrieving revision 1.33
diff -u -p -r1.33 Makefile
--- Makefile    3 Jun 2016 08:11:09 -0000       1.33
+++ Makefile    25 May 2017 13:23:29 -0000
@@ -8,6 +8,7 @@ DISTNAME =              apcupsd-3.14.14
 PKGNAME-main =         ${DISTNAME}
 PKGNAME-cgi =          ${DISTNAME:S/-/-cgi-/}
 PKGNAME-x11 =          ${DISTNAME:S/-/-x11-/}
+REVISION =             0
 
 CATEGORIES =           sysutils
 
@@ -18,8 +19,10 @@ MAINTAINER =         Kirill Bychkov <kirby@open
 # GPLv2
 PERMIT_PACKAGE_CDROM = Yes
 
+WANTLIB =              ${LIBCXX} c m pthread
+
 LIB_DEPENDS-main =     devel/libusb-compat
-WANTLIB-main =         c pthread usb
+WANTLIB-main =         ${WANTLIB} usb
 
 MASTER_SITES =         ${MASTER_SITE_SOURCEFORGE:=apcupsd/}
 
@@ -52,7 +55,7 @@ MULTI_PACKAGES =      -main
 MULTI_PACKAGES +=      -cgi
 PREFIX-cgi =           ${WEB_ROOT}
 CONFIGURE_ARGS +=      --enable-cgi
-WANTLIB-cgi =          c pthread gd
+WANTLIB-cgi =          ${WANTLIB} gd
 LIB_DEPENDS-cgi =      graphics/gd
 RUN_DEPENDS-cgi =
 
@@ -63,11 +66,12 @@ LIB_DEPENDS-x11 =   devel/gconf2 \
                        x11/gtk+2
 RUN_DEPENDS-x11 =      devel/desktop-file-utils
 
+WANTLIB-x11 += ${WANTLIB}
 WANTLIB-x11 += X11 Xcomposite Xcursor Xdamage Xext Xfixes Xi Xinerama
-WANTLIB-x11 += Xrandr Xrender atk-1.0 c cairo fontconfig freetype
-WANTLIB-x11 += gconf-2 gdk-x11-2.0 gdk_pixbuf-2.0 gio-2.0 glib-2.0
-WANTLIB-x11 += gobject-2.0 gthread-2.0 gtk-x11-2.0 intl pango-1.0 
pangocairo-1.0
-WANTLIB-x11 += pangoft2-1.0 pthread z
+WANTLIB-x11 += Xrandr Xrender atk-1.0 cairo fontconfig freetype gconf-2
+WANTLIB-x11 += gdk-x11-2.0 gdk_pixbuf-2.0 gio-2.0 glib-2.0 gobject-2.0
+WANTLIB-x11 += gthread-2.0 gtk-x11-2.0 intl pango-1.0 pangocairo-1.0
+WANTLIB-x11 += pangoft2-1.0 z
 .endif
 
 FAKE_FLAGS =           sysconfdir=${TRUEPREFIX}/share/examples/apcupsd/etc
Index: patches/patch-configure
===================================================================
RCS file: patches/patch-configure
diff -N patches/patch-configure
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-configure     25 May 2017 13:23:29 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+We care more about building with clang than binary portability between
+Linux distributions.
+
+Index: configure
+--- configure.orig
++++ configure
+@@ -12397,7 +12397,9 @@ $as_echo "$as_me: error: gethostbyname_r is required" 
+    ;;
+ esac
+ 
+-if test -n "$GCC"; then
++if true; then
++      LD="$CXX"
++else
+    # Starting with GCC 3.0, you must link C++ programs against either
+    # libstdc++ (shared by default), or libsupc++ (always static).  If
+    # you care about binary portability between Linux distributions,

Reply via email to