MFH: r476722 x11-wm/blackbox: Fix build with Clang 6, Fix TOOLS_ONLY option

Clang 6 (on 12-CURRENT) reports the following error during build:

EWMH.cc:250:7: error: non-constant-expression cannot be narrowed from type
'long' to 'unsigned long' in initializer list [-Wc++11-narrowing]
    { static_cast<long>(x), static_cast<long>(y) };
      ^~~~~~~~~~~~~~~~~~~~

There was also a bug introduced 4 years ago which removed the MAN1 variable a
later INSTALL_MAN macro relied on [1]. This caused a build/install failure
when the TOOLS_ONLY option was enabled.

This change fixes those two issues.

While I'm here level up port compliance:

  - Add LICENSE_FILE
  - Convert to OPTIONS helpers
  - Regenerate patches

[1] http://svnweb.freebsd.org/changeset/ports/346174
[2] https://lists.freebsd.org/pipermail/freebsd-ports/2018-August/114039.html

PR:		226708
Submitted by:	<Trond Endrestol ximalas info> (Clang 6 fix)
Approved by:	Andrew J. Caines <A J Caines halplant com> (technically)
Approved by:	portmgr (implicit, build fixes, framework compliance)
Reported by:	Erich Dollansky <freebsd ed lists sumeritec com> [2]

Approved by:	miwi (ports-secteam)
This commit is contained in:
Kubilay Kocak 2018-08-21 07:16:14 +00:00
parent 43cc904301
commit 3fc373df77
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2018Q3/; revision=477707
11 changed files with 73 additions and 57 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= blackbox
PORTVERSION= 0.70.1
PORTREVISION= 5
PORTREVISION= 6
CATEGORIES= x11-wm
MASTER_SITES= SF/${PORTNAME}wm/${PORTNAME}wm/Blackbox%20${PORTVERSION}
@ -11,43 +11,44 @@ MAINTAINER= A.J.Caines@halplant.com
COMMENT= Small and fast window manager for X11R6
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
GNU_CONFIGURE= yes
USES= pathfix pkgconfig iconv
USE_XORG= x11 xft
GNU_CONFIGURE= yes
LDFLAGS+= ${ICONV_LIB}
PORTDOCS= README.bbtools README.bsetbg
MANPAGES= bsetbg.1 bsetroot.1
OPTIONS_DEFINE= TOOLS_ONLY
OPTIONS_DEFINE= TOOLS_ONLY
TOOLS_ONLY_DESC= Do not install window manager, only tools
TOOLS_ONLY_INSTALL_TARGET= -C util install # XXX dirty hack :(
TOOLS_ONLY_MAKE_ARGS= SUBDIRS="doc lib util" bin_PROGRAMS=bsetroot
TOOLS_ONLY_VARS= PKGNAMESUFFIX=-tools \
COMMENT+="(tools only)"
TOOLS_ONLY_VARS_OFF= PORTDOCS+="AUTHORS COMPLIANCE ChangeLog README RELNOTES TODO"
.include <bsd.port.options.mk>
.if ${ARCH} == armv6 || ${ARCH} == armv7
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src_Toolbar.cc
.endif
.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
PORTDOCS+= AUTHORS COMPLIANCE ChangeLog README RELNOTES TODO
.endif
post-patch:
# 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/#} ${STAGEDIR}${MANPREFIX}/man/man1
.endif
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${PORTDOCS:S#^#${WRKSRC}/#} ${STAGEDIR}${DOCSDIR}
post-install-TOOLS_ONLY-on:
@${REINPLACE_CMD} -E '/[^s]\/blackbox|bstyleconvert|lib|include/d' \
${TMPPLIST}
${INSTALL_MAN} ${MANPAGES:S#^#${WRKSRC}/doc/#} ${STAGEDIR}${MANPREFIX}/man/man1
.include <bsd.port.mk>

View File

@ -1,5 +1,5 @@
--- lib/Display.cc.orig 2005-01-03 10:42:38.000000000 +0100
+++ lib/Display.cc 2013-08-31 15:42:48.395906537 +0200
--- lib/Display.cc.orig 2005-01-03 09:42:38 UTC
+++ lib/Display.cc
@@ -25,6 +25,7 @@
#include "Display.hh"
@ -16,7 +16,7 @@
namespace bt {
void createBitmapLoader(const Display &display);
@@ -68,7 +68,7 @@
@@ -68,7 +68,7 @@ bt::Display::Display(const char *dpy_name, bool multi_
if (!(xdisplay = XOpenDisplay(dpy_name))) {
fprintf(stderr, "bt::Display: failed to open display '%s'\n",
dpy_name ? dpy_name : "");
@ -25,7 +25,7 @@
}
#ifdef DEBUG
@@ -77,7 +77,7 @@
@@ -77,7 +77,7 @@ bt::Display::Display(const char *dpy_name, bool multi_
if (fcntl(XConnectionNumber(xdisplay), F_SETFD, 1) == -1) {
fprintf(stderr, "bt::Display: failed to mark connection close-on-exec\n");

View File

@ -0,0 +1,15 @@
# Fix error: non-constant-expression cannot be narrowed from type 'long' to
# 'unsigned long' in initializer list [-Wc++11-narrowing]
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226708
--- lib/EWMH.cc.orig 2018-08-09 04:45:57 UTC
+++ lib/EWMH.cc
@@ -247,7 +247,7 @@ bool bt::EWMH::readDesktopGeometry(Window target,
void bt::EWMH::setDesktopViewport(Window target, int x, int y) const {
const unsigned long viewport[] =
- { static_cast<long>(x), static_cast<long>(y) };
+ { static_cast<unsigned long>(x), static_cast<unsigned long>(y) };
setProperty(target, XA_CARDINAL, net_desktop_viewport,
reinterpret_cast<const unsigned char *>(viewport), 2);
}

View File

@ -1,5 +1,5 @@
--- lib/Menu.cc.orig 2013-08-31 15:45:50.982895002 +0200
+++ lib/Menu.cc 2013-08-31 15:53:36.911861215 +0200
--- lib/Menu.cc.orig 2005-01-27 17:08:22 UTC
+++ lib/Menu.cc
@@ -30,6 +30,8 @@
#include "PixmapCache.hh"
#include "Resource.hh"
@ -9,7 +9,7 @@
#include <X11/Xlib.h>
#include <X11/keysym.h>
@@ -135,11 +137,11 @@
@@ -135,11 +137,11 @@ void bt::MenuStyle::load(const Resource &resource) {
str = resource.read("menu.title.marginWidth", "Menu.Title.MarginWidth", "1");
title_margin =
@ -23,7 +23,7 @@
}
@@ -363,7 +365,7 @@
@@ -363,7 +365,7 @@ unsigned int bt::Menu::insertItem(const MenuItem &item
} else {
index = std::min(static_cast<size_t>(index), _items.size());
it = _items.begin();
@ -32,7 +32,7 @@
}
it = _items.insert(it, item);
@@ -514,7 +516,7 @@
@@ -514,7 +516,7 @@ void bt::Menu::removeItem(unsigned int id) {
void bt::Menu::removeIndex(unsigned int index) {
ItemList::iterator it = _items.begin();
@ -41,7 +41,7 @@
if (it == _items.end())
return; // item not found
removeItemByIterator(it);
@@ -1035,7 +1037,7 @@
@@ -1035,7 +1037,7 @@ void bt::Menu::keyPressEvent(const XKeyEvent * const e
const ItemList::const_iterator &end = _items.end();
ItemList::const_iterator anchor = _items.begin();
if (_active_index != ~0u) {
@ -50,7 +50,7 @@
// go one paste the current active index
if (anchor != end && !anchor->separator)
@@ -1055,8 +1057,7 @@
@@ -1055,8 +1057,7 @@ void bt::Menu::keyPressEvent(const XKeyEvent * const e
ItemList::const_reverse_iterator anchor = _items.rbegin();
const ItemList::const_reverse_iterator &end = _items.rend();
if (_active_index != ~0u) {
@ -60,7 +60,7 @@
// go one item past the current active index
if (anchor != end && !anchor->separator)
@@ -1174,7 +1175,7 @@
@@ -1174,7 +1175,7 @@ unsigned int bt::Menu::verifyId(unsigned int id) {
}
fprintf(stderr, "Error: bt::Menu::verifyId: id %u already used\n", id);

View File

@ -1,5 +1,5 @@
--- lib/Texture.cc.orig 2013-08-31 15:55:19.995853042 +0200
+++ lib/Texture.cc 2013-08-31 15:55:47.288909835 +0200
--- lib/Texture.cc.orig 2005-03-15 07:01:36 UTC
+++ lib/Texture.cc
@@ -28,6 +28,7 @@
#include "Resource.hh"
@ -8,7 +8,7 @@
#include <X11/Xlib.h>
#include <ctype.h>
@@ -184,7 +185,7 @@
@@ -184,7 +185,7 @@ bt::Texture bt::textureResource(const Display &display
const std::string bstr =
resource.read(name + ".borderWidth", className + ".BorderWidth", "1");

View File

@ -1,6 +1,6 @@
--- 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 @@
--- src/Screen.cc.orig 2005-10-18 08:07:22 UTC
+++ src/Screen.cc
@@ -1870,11 +1870,12 @@ void BScreen::clientMessageEvent(const XClientMessageE
if (event->message_type == _blackbox->ewmh().numberOfDesktops()) {
unsigned int number = event->data.l[0];

View File

@ -1,6 +1,6 @@
--- 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 @@
--- src/Slit.cc.orig 2005-01-04 12:58:33 UTC
+++ src/Slit.cc
@@ -248,6 +248,13 @@ void Slit::reconfigure(void) {
bt::PixmapCache::find(screen->screenNumber(), texture,
frame.rect.width(), frame.rect.height(),
frame.pixmap);

View File

@ -1,5 +1,5 @@
--- src/Window.cc.orig 2013-08-31 15:58:41.720845042 +0200
+++ src/Window.cc 2013-08-31 16:00:13.671837757 +0200
--- src/Window.cc.orig 2005-10-18 08:01:41 UTC
+++ src/Window.cc
@@ -33,6 +33,8 @@
#include "Workspace.hh"
#include "blackbox.hh"
@ -9,7 +9,7 @@
#include <Pen.hh>
#include <PixmapCache.hh>
#include <Unicode.hh>
@@ -3699,14 +3701,14 @@
@@ -3699,14 +3701,14 @@ void collisionAdjust(int *dx, int *dy, int x, int y,
wtop = y,
wbottom = y + height - 1,
// left, right, top + bottom are for rect, douterleft = left border of rect
@ -32,7 +32,7 @@
if ((wtop <= rect.bottom() && wbottom >= rect.top())
|| doutertop <= snap_distance
@@ -3749,8 +3751,8 @@
@@ -3749,8 +3751,8 @@ void collisionAdjust(int *dx, int *dy, int x, int y,
const int cwy = y + height / 2;
const int crx = rect.x() + rect.width() / 2;
const int cry = rect.y() + rect.height() / 2;
@ -43,7 +43,7 @@
if (cdx <= snap_distance)
// snap to horizontal center
*dx = x - (rect.x() + ((rect.width() - width) / 2));
@@ -3773,13 +3775,13 @@
@@ -3773,13 +3775,13 @@ void BlackboxWindow::snapAdjust(int *x, int *y) {
if (edge_distance) {
collisionAdjust(&dx, &dy, *x, *y, frame.rect.width(), frame.rect.height(),
_screen->availableArea(), edge_distance, true);
@ -61,7 +61,7 @@
}
}
if (win_distance) {
@@ -3791,8 +3793,8 @@
@@ -3791,8 +3793,8 @@ void BlackboxWindow::snapAdjust(int *x, int *y) {
win->workspace() == _screen->currentWorkspace()) {
collisionAdjust(&dx, &dy, *x, *y, frame.rect.width(),
frame.rect.height(), win->frame.rect, win_distance);

View File

@ -1,5 +1,5 @@
--- src/blackbox.cc.orig 2013-08-31 16:03:04.354825567 +0200
+++ src/blackbox.cc 2013-08-31 16:12:46.759944855 +0200
--- src/blackbox.cc.orig 2005-10-18 11:33:25 UTC
+++ src/blackbox.cc
@@ -27,6 +27,8 @@
#include "Slit.hh"
#include "Window.hh"
@ -17,7 +17,7 @@
#include <unistd.h>
// #define FOCUS_DEBUG
@@ -422,7 +425,7 @@
@@ -422,7 +425,7 @@ Blackbox::Blackbox(char **m_argv, const char *dpy_name
if (managed == 0) {
fprintf(stderr, "%s: no managable screens found, exiting...\n",
applicationName().c_str());

View File

@ -1,5 +1,5 @@
--- src/main.cc.orig 2013-08-31 16:15:04.709773262 +0200
+++ src/main.cc 2013-08-31 16:15:45.604774045 +0200
--- src/main.cc.orig 2005-01-03 09:42:57 UTC
+++ src/main.cc
@@ -24,6 +24,8 @@
// #define PRINT_SIZES
@ -9,7 +9,7 @@
#if defined(PRINT_SIZES)
# include "Screen.hh"
# include "Slit.hh"
@@ -69,7 +71,7 @@
@@ -69,7 +71,7 @@ static void showHelp(int exitval) {
#endif // SHAPE
);
@ -18,7 +18,7 @@
}
int main(int argc, char **argv) {
@@ -87,13 +89,13 @@
@@ -87,13 +89,13 @@ int main(int argc, char **argv) {
"Copyright (c) 1997 - 2000, 2002 - 2005 Bradley T Hughes\n",
__blackbox_version);
@ -34,7 +34,7 @@
}
rc_file = argv[i];
@@ -103,7 +105,7 @@
@@ -103,7 +105,7 @@ int main(int argc, char **argv) {
if ((++i) >= argc) {
fprintf(stderr, "error: '-display' requires an argument\n");

View File

@ -1,5 +1,5 @@
--- util/bsetroot.cc.orig 2013-08-31 16:18:50.697762748 +0200
+++ util/bsetroot.cc 2013-08-31 16:19:53.695753444 +0200
--- util/bsetroot.cc.orig 2005-03-15 07:01:37 UTC
+++ util/bsetroot.cc
@@ -28,6 +28,7 @@
#include <Texture.hh>
@ -8,7 +8,7 @@
#include <X11/Xatom.h>
#include <stdio.h>
@@ -68,11 +69,11 @@
@@ -68,11 +69,11 @@ bsetroot::bsetroot(int argc, char **argv, char *dpy_na
} else if (! strcmp("-mod", argv[i])) {
if ((++i) >= argc) usage();
@ -22,7 +22,7 @@
if (mod_x < 1) mod_x = 1;
if (mod_y < 1) mod_y = 1;
@@ -336,7 +337,7 @@
@@ -336,7 +337,7 @@ void bsetroot::usage(int exit_code) {
" -to <color> gradient end color\n\n"
" -solid <color> solid color\n\n"
" -help print this help text and exit\n");
@ -31,7 +31,7 @@
}
int main(int argc, char **argv) {
@@ -350,7 +351,7 @@
@@ -350,7 +351,7 @@ int main(int argc, char **argv) {
if ((++i) >= argc) {
fprintf(stderr, "error: '-display' requires an argument\n");