[Midnightbsd-cvs] mports [15419] trunk/x11-wm/blackbox: switch to USES for includes, allow tools only builds, fix build when using clang

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Sep 7 09:01:55 EDT 2013


Revision: 15419
          http://svnweb.midnightbsd.org/mports/?rev=15419
Author:   laffer1
Date:     2013-09-07 09:01:54 -0400 (Sat, 07 Sep 2013)
Log Message:
-----------
switch to USES for includes, allow tools only builds, fix build when using clang

Modified Paths:
--------------
    trunk/x11-wm/blackbox/Makefile
    trunk/x11-wm/blackbox/distinfo

Added Paths:
-----------
    trunk/x11-wm/blackbox/files/
    trunk/x11-wm/blackbox/files/patch-lib_Display.cc
    trunk/x11-wm/blackbox/files/patch-lib_Menu.cc
    trunk/x11-wm/blackbox/files/patch-lib_Texture.cc
    trunk/x11-wm/blackbox/files/patch-src_Screen.cc
    trunk/x11-wm/blackbox/files/patch-src_Slit.cc
    trunk/x11-wm/blackbox/files/patch-src_Window.cc
    trunk/x11-wm/blackbox/files/patch-src_blackbox.cc
    trunk/x11-wm/blackbox/files/patch-src_main.cc
    trunk/x11-wm/blackbox/files/patch-util_bsetroot.cc

Modified: trunk/x11-wm/blackbox/Makefile
===================================================================
--- trunk/x11-wm/blackbox/Makefile	2013-09-04 12:10:10 UTC (rev 15418)
+++ trunk/x11-wm/blackbox/Makefile	2013-09-07 13:01:54 UTC (rev 15419)
@@ -2,34 +2,50 @@
 
 PORTNAME=	blackbox
 PORTVERSION=	0.70.1
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	x11-wm
 MASTER_SITES=	SF/${PORTNAME}wm/${PORTNAME}wm/Blackbox%20${PORTVERSION}
 
 MAINTAINER=	ports at MidnightBSD.org
 COMMENT=	A small and fast window manager for X11R6
+
 LICENSE=	mit
 
-PORTDOCS=	AUTHORS COMPLIANCE ChangeLog LICENSE README RELNOTES TODO
-MAN1=		blackbox.1
-
+GNU_CONFIGURE=	yes
+USES=		pathfix pkgconfig iconv
 USE_XORG=	x11 xft
-USE_GNOME=	gnomehack pkgconfig
-GNU_CONFIGURE=	yes
-USE_ICONV=	yes
 
+MAN1=		bsetbg.1 bsetroot.1
+PORTDOCS=	README.bbtools README.bsetbg
+
+OPTIONS_DEFINE=		TOOLS_ONLY
+TOOLS_ONLY_DESC=	Do not install window manager, only tools
+
+.include <bsd.mport.options.mk>
+
+.if ${PORT_OPTIONS:MTOOLS_ONLY}
+PKGNAMESUFFIX=	-tools
+COMMENT+=	(tools only)
+MAKE_ARGS=	SUBDIRS="doc lib util" bin_PROGRAMS=bsetroot
+INSTALL_TARGET=	-C util install		# XXX dirty hack :(
+.else
+MAN1+=		blackbox.1
+PORTDOCS+=	AUTHORS COMPLIANCE ChangeLog README RELNOTES TODO
+.endif
+
 post-patch:
-	@${REINPLACE_CMD} -e 's#-pedantic##' ${WRKSRC}/configure
-	@${REINPLACE_CMD} -e 's# bsetroot.1 bsetbg.1##' ${WRKSRC}/doc/Makefile.in
-	# Fix the build with libX11 > 1.40
+# Fix the build with libX11 > 1.40
 	@${REINPLACE_CMD} -e 's/_XUTIL_H_/_X11&/' ${WRKSRC}/lib/Util.hh
 
 post-install:
+.if ${PORT_OPTIONS:MTOOLS_ONLY}
+	@${REINPLACE_CMD} -E '/[^s]\/blackbox|bstyleconvert|lib|include/d' \
+		${TMPPLIST}
+	${INSTALL_MAN} ${MAN1:S#^#${WRKSRC}/doc/#} ${MANPREFIX}/man/man1
+.endif
 .if !defined(NOPORTDOCS)
-	${MKDIR} ${DOCSDIR}
-.for doc in ${PORTDOCS}
-	${INSTALL_DATA} ${WRKSRC}/${doc} ${DOCSDIR}/
-.endfor
+	@${MKDIR} ${DOCSDIR}
+	${INSTALL_DATA} ${PORTDOCS:S#^#${WRKSRC}/#} ${DOCSDIR}
 .endif
 
 .include <bsd.port.mk>

Modified: trunk/x11-wm/blackbox/distinfo
===================================================================
--- trunk/x11-wm/blackbox/distinfo	2013-09-04 12:10:10 UTC (rev 15418)
+++ trunk/x11-wm/blackbox/distinfo	2013-09-07 13:01:54 UTC (rev 15419)
@@ -1,3 +1,2 @@
 SHA256 (blackbox-0.70.1.tar.gz) = e394561d4426cf17e21eb5cc32e2972eb1af92d04a41808a41b1fb95320bd659
-RMD160 (blackbox-0.70.1.tar.gz) = ab80c43d42dbfac23c9f981885f25a42c66f51a6
 SIZE (blackbox-0.70.1.tar.gz) = 650400

Added: trunk/x11-wm/blackbox/files/patch-lib_Display.cc
===================================================================
--- trunk/x11-wm/blackbox/files/patch-lib_Display.cc	                        (rev 0)
+++ trunk/x11-wm/blackbox/files/patch-lib_Display.cc	2013-09-07 13:01:54 UTC (rev 15419)
@@ -0,0 +1,36 @@
+--- lib/Display.cc.orig	2005-01-03 10:42:38.000000000 +0100
++++ lib/Display.cc	2013-08-31 15:42:48.395906537 +0200
+@@ -25,6 +25,7 @@
+ #include "Display.hh"
+ 
+ #include <algorithm>
++#include <cstdlib>
+ 
+ #include <X11/Xutil.h>
+ 
+@@ -32,7 +33,6 @@
+ #include <fcntl.h>
+ #include <stdio.h>
+ 
+-
+ namespace bt {
+ 
+   void createBitmapLoader(const Display &display);
+@@ -68,7 +68,7 @@
+   if (!(xdisplay = XOpenDisplay(dpy_name))) {
+     fprintf(stderr, "bt::Display: failed to open display '%s'\n",
+             dpy_name ? dpy_name : "");
+-    ::exit(2);
++    std::exit(2);
+   }
+ 
+ #ifdef DEBUG
+@@ -77,7 +77,7 @@
+ 
+   if (fcntl(XConnectionNumber(xdisplay), F_SETFD, 1) == -1) {
+     fprintf(stderr, "bt::Display: failed to mark connection close-on-exec\n");
+-    ::exit(2);
++    std::exit(2);
+   }
+ 
+   if (!multi_head || ScreenCount(xdisplay) == 1) {

Added: trunk/x11-wm/blackbox/files/patch-lib_Menu.cc
===================================================================
--- trunk/x11-wm/blackbox/files/patch-lib_Menu.cc	                        (rev 0)
+++ trunk/x11-wm/blackbox/files/patch-lib_Menu.cc	2013-09-07 13:01:54 UTC (rev 15419)
@@ -0,0 +1,71 @@
+--- lib/Menu.cc.orig	2013-08-31 15:45:50.982895002 +0200
++++ lib/Menu.cc	2013-08-31 15:53:36.911861215 +0200
+@@ -30,6 +30,8 @@
+ #include "PixmapCache.hh"
+ #include "Resource.hh"
+ 
++#include <cstdlib>
++
+ #include <X11/Xlib.h>
+ #include <X11/keysym.h>
+ 
+@@ -135,11 +137,11 @@
+ 
+   str = resource.read("menu.title.marginWidth", "Menu.Title.MarginWidth", "1");
+   title_margin =
+-    static_cast<unsigned int>(std::max(strtol(str.c_str(), 0, 0), 0l));
++    static_cast<unsigned int>(std::max(std::strtol(str.c_str(), 0, 0), 0l));
+ 
+   str = resource.read("menu.frame.marginWidth", "Menu.Frame.MarginWidth", "1");
+   frame_margin =
+-    static_cast<unsigned int>(std::max(strtol(str.c_str(), 0, 0), 0l));
++    static_cast<unsigned int>(std::max(std::strtol(str.c_str(), 0, 0), 0l));
+ }
+ 
+ 
+@@ -363,7 +365,7 @@
+   } else {
+     index = std::min(static_cast<size_t>(index), _items.size());
+     it = _items.begin();
+-    std::advance<ItemList::iterator, signed>(it, index);
++    std::advance(it, index);
+   }
+ 
+   it = _items.insert(it, item);
+@@ -514,7 +516,7 @@
+ 
+ void bt::Menu::removeIndex(unsigned int index) {
+   ItemList::iterator it = _items.begin();
+-  std::advance<ItemList::iterator, signed>(it, index);
++  std::advance(it, index);
+   if (it == _items.end())
+     return; // item not found
+   removeItemByIterator(it);
+@@ -1035,7 +1037,7 @@
+     const ItemList::const_iterator &end = _items.end();
+     ItemList::const_iterator anchor = _items.begin();
+     if (_active_index != ~0u) {
+-      std::advance<ItemList::const_iterator, signed>(anchor, _active_index);
++      std::advance(anchor, _active_index);
+ 
+       // go one paste the current active index
+       if (anchor != end && !anchor->separator)
+@@ -1055,8 +1057,7 @@
+     ItemList::const_reverse_iterator anchor = _items.rbegin();
+     const ItemList::const_reverse_iterator &end = _items.rend();
+     if (_active_index != ~0u) {
+-      std::advance<ItemList::const_reverse_iterator, signed>
+-        (anchor, _items.size() - _active_index - 1);
++      std::advance(anchor, _items.size() - _active_index - 1);
+ 
+       // go one item past the current active index
+       if (anchor != end && !anchor->separator)
+@@ -1174,7 +1175,7 @@
+     }
+ 
+     fprintf(stderr, "Error: bt::Menu::verifyId: id %u already used\n", id);
+-    abort();
++    std::abort();
+   }
+ 
+   std::vector<bool>::iterator it =

Added: trunk/x11-wm/blackbox/files/patch-lib_Texture.cc
===================================================================
--- trunk/x11-wm/blackbox/files/patch-lib_Texture.cc	                        (rev 0)
+++ trunk/x11-wm/blackbox/files/patch-lib_Texture.cc	2013-09-07 13:01:54 UTC (rev 15419)
@@ -0,0 +1,19 @@
+--- lib/Texture.cc.orig	2013-08-31 15:55:19.995853042 +0200
++++ lib/Texture.cc	2013-08-31 15:55:47.288909835 +0200
+@@ -28,6 +28,7 @@
+ #include "Resource.hh"
+ 
+ #include <algorithm>
++#include <cstdlib>
+ 
+ #include <X11/Xlib.h>
+ #include <ctype.h>
+@@ -184,7 +185,7 @@
+ 
+     const std::string bstr =
+       resource.read(name + ".borderWidth", className + ".BorderWidth", "1");
+-    unsigned int bw = static_cast<unsigned int>(strtoul(bstr.c_str(), 0, 0));
++    unsigned int bw = static_cast<unsigned int>(std::strtoul(bstr.c_str(), 0, 0));
+     texture.setBorderWidth(bw);
+   }
+ 

Added: trunk/x11-wm/blackbox/files/patch-src_Screen.cc
===================================================================
--- trunk/x11-wm/blackbox/files/patch-src_Screen.cc	                        (rev 0)
+++ trunk/x11-wm/blackbox/files/patch-src_Screen.cc	2013-09-07 13:01:54 UTC (rev 15419)
@@ -0,0 +1,19 @@
+--- src/Screen.cc.orig	2008-11-17 11:30:06.000000000 -0800
++++ src/Screen.cc	2008-11-17 11:31:37.000000000 -0800
+@@ -1870,11 +1870,12 @@
+ 
+   if (event->message_type == _blackbox->ewmh().numberOfDesktops()) {
+     unsigned int number = event->data.l[0];
+-    if (number > workspaceCount()) {
+-      for (; number != workspaceCount(); --number)
++    unsigned int wsCount = workspaceCount();
++    if (number > wsCount) {
++      for (; number != wsCount; --number)
+         addWorkspace();
+-    } else if (number < workspaceCount()) {
+-      for (; number != workspaceCount(); ++number)
++    } else if (number < wsCount) {
++      for (; number != wsCount; ++number)
+         removeLastWorkspace();
+     }
+   } else if (event->message_type == _blackbox->ewmh().desktopNames()) {

Added: trunk/x11-wm/blackbox/files/patch-src_Slit.cc
===================================================================
--- trunk/x11-wm/blackbox/files/patch-src_Slit.cc	                        (rev 0)
+++ trunk/x11-wm/blackbox/files/patch-src_Slit.cc	2013-09-07 13:01:54 UTC (rev 15419)
@@ -0,0 +1,16 @@
+--- src/Slit.cc.orig	2005-01-04 20:58:33.000000000 +0800
++++ src/Slit.cc	2011-06-21 13:31:00.000000000 +0800
+@@ -248,6 +248,13 @@
+     bt::PixmapCache::find(screen->screenNumber(), texture,
+                           frame.rect.width(), frame.rect.height(),
+                           frame.pixmap);
++
++  if ((texture.texture() & bt::Texture::Gradient) && frame.pixmap)
++    XSetWindowBackgroundPixmap(display, frame.window, frame.pixmap);
++  else if ((texture.texture() & bt::Texture::Solid))
++    XSetWindowBackground(display, frame.window,
++      texture.color1().pixel(screen->screenNumber()));
++
+   XClearArea(display, frame.window, 0, 0,
+              frame.rect.width(), frame.rect.height(), True);
+ 

Added: trunk/x11-wm/blackbox/files/patch-src_Window.cc
===================================================================
--- trunk/x11-wm/blackbox/files/patch-src_Window.cc	                        (rev 0)
+++ trunk/x11-wm/blackbox/files/patch-src_Window.cc	2013-09-07 13:01:54 UTC (rev 15419)
@@ -0,0 +1,74 @@
+--- src/Window.cc.orig	2013-08-31 15:58:41.720845042 +0200
++++ src/Window.cc	2013-08-31 16:00:13.671837757 +0200
+@@ -33,6 +33,8 @@
+ #include "Workspace.hh"
+ #include "blackbox.hh"
+ 
++#include <cstdlib>
++
+ #include <Pen.hh>
+ #include <PixmapCache.hh>
+ #include <Unicode.hh>
+@@ -3699,14 +3701,14 @@
+              wtop = y,
+           wbottom = y + height - 1,
+   // left, right, top + bottom are for rect, douterleft = left border of rect
+-       dinnerleft = abs(wleft - rect.left()),
+-      dinnerright = abs(wright - rect.right()),
+-        dinnertop = abs(wtop - rect.top()),
+-     dinnerbottom = abs(wbottom - rect.bottom()),
+-       douterleft = abs(wright - rect.left()),
+-      douterright = abs(wleft - rect.right()),
+-        doutertop = abs(wbottom - rect.top()),
+-     douterbottom = abs(wtop - rect.bottom());
++       dinnerleft = std::abs(wleft - rect.left()),
++      dinnerright = std::abs(wright - rect.right()),
++        dinnertop = std::abs(wtop - rect.top()),
++     dinnerbottom = std::abs(wbottom - rect.bottom()),
++       douterleft = std::abs(wright - rect.left()),
++      douterright = std::abs(wleft - rect.right()),
++        doutertop = std::abs(wbottom - rect.top()),
++     douterbottom = std::abs(wtop - rect.bottom());
+ 
+   if ((wtop <= rect.bottom() && wbottom >= rect.top())
+       || doutertop <= snap_distance
+@@ -3749,8 +3751,8 @@
+     const int cwy = y + height / 2;
+     const int crx = rect.x() + rect.width() / 2;
+     const int cry = rect.y() + rect.height() / 2;
+-    const int cdx = abs(cwx - crx);
+-    const int cdy = abs(cwy - cry);
++    const int cdx = std::abs(cwx - crx);
++    const int cdy = std::abs(cwy - cry);
+     if (cdx <= snap_distance)
+       // snap to horizontal center
+       *dx = x - (rect.x() + ((rect.width() - width) / 2));
+@@ -3773,13 +3775,13 @@
+   if (edge_distance) {
+     collisionAdjust(&dx, &dy, *x, *y, frame.rect.width(), frame.rect.height(),
+                     _screen->availableArea(), edge_distance, true);
+-    nx = (dx != init_dx && abs(dx) < abs(nx)) ? dx : nx; dx = init_dx;
+-    ny = (dy != init_dy && abs(dy) < abs(ny)) ? dy : ny; dy = init_dy;
++    nx = (dx != init_dx && std::abs(dx) < std::abs(nx)) ? dx : nx; dx = init_dx;
++    ny = (dy != init_dy && std::abs(dy) < std::abs(ny)) ? dy : ny; dy = init_dy;
+     if (!blackbox->resource().fullMaximization()) {
+       collisionAdjust(&dx, &dy, *x, *y, frame.rect.width(), frame.rect.height(),
+                       _screen->screenInfo().rect(), edge_distance);
+-      nx = (dx != init_dx && abs(dx) < abs(nx)) ? dx : nx; dx = init_dx;
+-      ny = (dy != init_dy && abs(dy) < abs(ny)) ? dy : ny; dy = init_dy;
++      nx = (dx != init_dx && std::abs(dx) < std::abs(nx)) ? dx : nx; dx = init_dx;
++      ny = (dy != init_dy && std::abs(dy) < std::abs(ny)) ? dy : ny; dy = init_dy;
+     }
+   }
+   if (win_distance) {
+@@ -3791,8 +3793,8 @@
+           win->workspace() == _screen->currentWorkspace()) {
+         collisionAdjust(&dx, &dy, *x, *y, frame.rect.width(),
+                         frame.rect.height(), win->frame.rect, win_distance);
+-        nx = (dx != init_dx && abs(dx) < abs(nx)) ? dx : nx; dx = init_dx;
+-        ny = (dy != init_dy && abs(dy) < abs(ny)) ? dy : ny; dy = init_dy;
++        nx = (dx != init_dx && std::abs(dx) < std::abs(nx)) ? dx : nx; dx = init_dx;
++        ny = (dy != init_dy && std::abs(dy) < std::abs(ny)) ? dy : ny; dy = init_dy;
+       }
+     }
+   }

Added: trunk/x11-wm/blackbox/files/patch-src_blackbox.cc
===================================================================
--- trunk/x11-wm/blackbox/files/patch-src_blackbox.cc	                        (rev 0)
+++ trunk/x11-wm/blackbox/files/patch-src_blackbox.cc	2013-09-07 13:01:54 UTC (rev 15419)
@@ -0,0 +1,28 @@
+--- src/blackbox.cc.orig	2013-08-31 16:03:04.354825567 +0200
++++ src/blackbox.cc	2013-08-31 16:12:46.759944855 +0200
+@@ -27,6 +27,8 @@
+ #include "Slit.hh"
+ #include "Window.hh"
+ 
++#include <cstdlib>
++
+ #include <Pen.hh>
+ #include <PixmapCache.hh>
+ #include <Util.hh>
+@@ -36,6 +38,7 @@
+ #include <sys/stat.h>
+ #include <assert.h>
+ #include <signal.h>
++#include <stdlib.h>
+ #include <unistd.h>
+ 
+ // #define FOCUS_DEBUG
+@@ -422,7 +425,7 @@
+   if (managed == 0) {
+     fprintf(stderr, "%s: no managable screens found, exiting...\n",
+             applicationName().c_str());
+-    ::exit(3);
++    std::exit(3);
+   }
+ 
+   screen_list_count = managed;

Added: trunk/x11-wm/blackbox/files/patch-src_main.cc
===================================================================
--- trunk/x11-wm/blackbox/files/patch-src_main.cc	                        (rev 0)
+++ trunk/x11-wm/blackbox/files/patch-src_main.cc	2013-09-07 13:01:54 UTC (rev 15419)
@@ -0,0 +1,45 @@
+--- src/main.cc.orig	2013-08-31 16:15:04.709773262 +0200
++++ src/main.cc	2013-08-31 16:15:45.604774045 +0200
+@@ -24,6 +24,8 @@
+ 
+ // #define PRINT_SIZES
+ 
++#include <cstdlib>
++
+ #if defined(PRINT_SIZES)
+ #  include "Screen.hh"
+ #  include "Slit.hh"
+@@ -69,7 +71,7 @@
+ #endif // SHAPE
+          );
+ 
+-  ::exit(exitval);
++  std::exit(exitval);
+ }
+ 
+ int main(int argc, char **argv) {
+@@ -87,13 +89,13 @@
+              "Copyright (c) 1997 - 2000, 2002 - 2005 Bradley T Hughes\n",
+              __blackbox_version);
+ 
+-      ::exit(0);
++      std::exit(0);
+     } else if (! strcmp(argv[i], "-rc")) {
+       // look for alternative rc file to use
+ 
+       if ((++i) >= argc) {
+         fprintf(stderr, "error: '-rc' requires and argument\n");
+-        ::exit(1);
++        std::exit(1);
+       }
+ 
+       rc_file = argv[i];
+@@ -103,7 +105,7 @@
+ 
+       if ((++i) >= argc) {
+         fprintf(stderr, "error: '-display' requires an argument\n");
+-        ::exit(1);
++	std::exit(1);
+       }
+ 
+       dpy_name = argv[i];

Added: trunk/x11-wm/blackbox/files/patch-util_bsetroot.cc
===================================================================
--- trunk/x11-wm/blackbox/files/patch-util_bsetroot.cc	                        (rev 0)
+++ trunk/x11-wm/blackbox/files/patch-util_bsetroot.cc	2013-09-07 13:01:54 UTC (rev 15419)
@@ -0,0 +1,42 @@
+--- util/bsetroot.cc.orig	2013-08-31 16:18:50.697762748 +0200
++++ util/bsetroot.cc	2013-08-31 16:19:53.695753444 +0200
+@@ -28,6 +28,7 @@
+ #include <Texture.hh>
+ 
+ #include <cctype>
++#include <cstdlib>
+ 
+ #include <X11/Xatom.h>
+ #include <stdio.h>
+@@ -68,11 +69,11 @@
+     } else if (! strcmp("-mod", argv[i])) {
+       if ((++i) >= argc) usage();
+ 
+-      mod_x = atoi(argv[i]);
++      mod_x = std::atoi(argv[i]);
+ 
+       if ((++i) >= argc) usage();
+ 
+-      mod_y = atoi(argv[i]);
++      mod_y = std::atoi(argv[i]);
+ 
+       if (mod_x < 1) mod_x = 1;
+       if (mod_y < 1) mod_y = 1;
+@@ -336,7 +337,7 @@
+           "  -to <color>              gradient end color\n\n"
+           "  -solid <color>           solid color\n\n"
+           "  -help                    print this help text and exit\n");
+-  exit(exit_code);
++  std::exit(exit_code);
+ }
+ 
+ int main(int argc, char **argv) {
+@@ -350,7 +351,7 @@
+       if ((++i) >= argc) {
+         fprintf(stderr, "error: '-display' requires an argument\n");
+ 
+-        ::exit(1);
++        std::exit(1);
+       }
+ 
+       display_name = argv[i];



More information about the Midnightbsd-cvs mailing list