Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Apr 2015 16:29:01 +0000 (UTC)
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r384239 - in head/games/gtkradiant: . files
Message-ID:  <201504181629.t3IGT1eP029667@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: danfe
Date: Sat Apr 18 16:29:01 2015
New Revision: 384239
URL: https://svnweb.freebsd.org/changeset/ports/384239

Log:
  - Fix the build against modern libpng (do not try to access private data)
  - Clang insists that reference cannot be bound to dereferenced null pointer
    in well-defined C++ code (that is correct) and evaluates comparisons like
    &foo == 0 to false, which breaks GtkRadiant; "fix" this with a dirty hack
    by casting those "bad" references to a local volatile int variable
  - Remove no longer required and no-op -lpthread vs. -pthread patch hunk
  - Report operating system and correct compiler version in the About dialog
  - When fixing annoying "GtkSpinButton: setting an adjustment with non-zero
    page size is deprecated" warnings, replace find(1) with grep(1) to narrow
    down initial search results and, subsequently, sed(1) furiousness
  - Omit port revision bump as the port was BROKEN for quite some time

Added:
  head/games/gtkradiant/files/patch-radiant_treemodel.cpp   (contents, props changed)
Modified:
  head/games/gtkradiant/Makefile
  head/games/gtkradiant/files/patch-SConstruct
  head/games/gtkradiant/files/patch-makeversion.py
  head/games/gtkradiant/files/patch-tools__quake3__q3map2__image.c

Modified: head/games/gtkradiant/Makefile
==============================================================================
--- head/games/gtkradiant/Makefile	Sat Apr 18 16:12:48 2015	(r384238)
+++ head/games/gtkradiant/Makefile	Sat Apr 18 16:29:01 2015	(r384239)
@@ -5,7 +5,7 @@ PORTNAME=	gtkradiant
 PORTVERSION=	1.5.0
 PORTREVISION=	13
 CATEGORIES=	games cad
-MASTER_SITES=	${MASTER_SITE_IDSOFTWARE:S|$|source/:id|} \
+MASTER_SITES=	IDSOFTWARE/source/:id \
 		http://www.bsd-geek.de/FreeBSD/distfiles/:fb
 DISTNAME=	GtkRadiant-GPL
 DISTFILES=	${DISTNAME}${EXTRACT_SUFX}:id \
@@ -16,16 +16,14 @@ COMMENT=	Map editor for FPS games, by id
 
 LICENSE=	GPLv2
 
-BROKEN=		Does not support modern png
-
 LIB_DEPENDS=	libgtkglext-x11-1.0.so:${PORTSDIR}/x11-toolkits/gtkglext \
 		libmhash.so:${PORTSDIR}/security/mhash \
 		libpng.so:${PORTSDIR}/graphics/png
 
-SSP_UNSAFE=	yes
 USES=		pkgconfig python:build scons zip
 USE_GNOME=	gtk20 libxml2
 MAKE_ARGS=	${MAKE_ENV} BUILD=release
+SSP_UNSAFE=	yes
 
 DATADIR=	${PREFIX}/lib/${PORTNAME}
 WRKSRC=		${WRKDIR}/GPL/GtkRadiant
@@ -56,8 +54,8 @@ post-patch:
 			${WRKSRC}/plugins/mapq3/parse.h
 # Fix warnings of "GtkSpinButton: setting an adjustment with non-zero
 # page size is deprecated" (very annoying)
-	@${FIND} ${WRKSRC} -name '*.cpp' | ${XARGS} ${REINPLACE_CMD} \
-		-E 's|(gtk_adjustment_new[^)]*,)[^)]*|\1 0|'
+	@${GREP} -Rl --null gtk_adjustment_new ${WRKSRC} | ${XARGS} -0 \
+		${REINPLACE_CMD} -E 's|(gtk_adjustment_new[^)]*,)[^)]*|\1 0|'
 
 pre-install:
 	cd ${WRKSRC} && ${PYTHON_CMD} install.py

Modified: head/games/gtkradiant/files/patch-SConstruct
==============================================================================
--- head/games/gtkradiant/files/patch-SConstruct	Sat Apr 18 16:12:48 2015	(r384238)
+++ head/games/gtkradiant/files/patch-SConstruct	Sat Apr 18 16:29:01 2015	(r384239)
@@ -73,15 +73,6 @@
     
    def useGtkGLExt(self):
      self['CXXFLAGS'] += '`pkg-config gtkglext-1.0 --cflags` '
-@@ -269,6 +265,8 @@
-   def usePThread(self):
-     if ( OS == 'Darwin' ):
-       self['LINKFLAGS'] += '-lpthread -Wl,-stack_size,0x400000 '
-+    elif ( OS == 'FreeBSD' ):
-+      self['LINKFLAGS'] += '-pthread '
-     else:
-       self['LINKFLAGS'] += '-lpthread '
- 
 @@ -278,7 +276,7 @@
          print('ERROR: CheckLDD: target %s not found\n' % target[0])
          Exit(1)
@@ -91,3 +82,18 @@
      stdout_lines = ldd.fromchild.readlines()
      stderr_lines = ldd.childerr.readlines()
      ldd_ret = ldd.wait()
+@@ -317,7 +313,13 @@
+ # export the globals
+ GLOBALS = 'g_env INSTALL SETUP g_cpu'
+ 
+-radiant_makeversion('\\ngcc version: %s.%s.%s' % ( ver_cc[0], ver_cc[1], ver_cc[2] ) )
++def get_compiler_info(cxx):
++  ret = commands.getstatusoutput('%s -v' % cxx)
++  if (ret[0] != 0): return None
++  info = re.search('(gcc|clang) version [0-9.]+', ret[1])
++  return info.group(0) if info else None
++
++radiant_makeversion('\\n%s' % get_compiler_info(CXX))
+ 
+ # end general configuration ----------------------
+ 

Modified: head/games/gtkradiant/files/patch-makeversion.py
==============================================================================
--- head/games/gtkradiant/files/patch-makeversion.py	Sat Apr 18 16:12:48 2015	(r384238)
+++ head/games/gtkradiant/files/patch-makeversion.py	Sat Apr 18 16:29:01 2015	(r384239)
@@ -1,20 +1,22 @@
 --- ./makeversion.py.orig	Sun Feb 12 16:47:01 2006
 +++ ./makeversion.py	Thu Mar 16 16:09:46 2006
-@@ -39,8 +39,6 @@
+@@ -37,9 +37,7 @@
+ # ouput:
+ #   include/aboutmsg.h
  
- import sys, re, string, os
- 
--import svn
+-import sys, re, string, os
 -
+-import svn
++import sys, re, string, os, platform
+ 
  def get_version():
    # version
-   f = open('include/version.default', 'r')
-@@ -82,7 +80,7 @@ def radiant_makeversion(append_about):
+@@ -82,7 +80,7 @@
      line = f.readline()
      f.close()
    else:
 -    line = "Custom build based on revision " + str(svn.getRevision(os.getcwd()))
-+    line = "Custom build based on revision 1.0"
++    line = "Custom build for %s (%s)" % (platform.system(), platform.machine())
    # optional additional message
    if ( not append_about is None ):
      line += append_about

Added: head/games/gtkradiant/files/patch-radiant_treemodel.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/games/gtkradiant/files/patch-radiant_treemodel.cpp	Sat Apr 18 16:29:01 2015	(r384239)
@@ -0,0 +1,39 @@
+--- radiant/treemodel.cpp.orig	2006-02-10 22:01:20 UTC
++++ radiant/treemodel.cpp
+@@ -1243,7 +1243,13 @@ const char* node_get_name(scene::Node& n
+ 
+ const char* node_get_name_safe(scene::Node& node)
+ {
+-  if(&node == 0)
++  // Reference cannot be bound to dereferenced null pointer in well-defined
++  // C++ code, and Clang will assume that comparison below always evaluates
++  // to false, resulting in segmentation fault.  Use a dirty hack to insist
++  // that Clang checks it for null.
++  volatile int n = (int)&node;
++
++  if(n == 0)
+   {
+     return "";
+   }
+@@ -1264,7 +1270,9 @@ GraphTreeNode* graph_tree_model_find_par
+ 
+ void node_attach_name_changed_callback(scene::Node& node, const NameCallback& callback)
+ {
+-  if(&node != 0)
++  volatile int n = (int)&node;		// see the comment on line 1246
++
++  if(n != 0)
+   {
+     Nameable* nameable = Node_getNameable(node);
+     if(nameable != 0)
+@@ -1275,7 +1283,9 @@ void node_attach_name_changed_callback(s
+ }
+ void node_detach_name_changed_callback(scene::Node& node, const NameCallback& callback)
+ {
+-  if(&node != 0)
++  volatile int n = (int)&node;		// see the comment on line 1246
++
++  if(n != 0)
+   {
+     Nameable* nameable = Node_getNameable(node);
+     if(nameable != 0)

Modified: head/games/gtkradiant/files/patch-tools__quake3__q3map2__image.c
==============================================================================
--- head/games/gtkradiant/files/patch-tools__quake3__q3map2__image.c	Sat Apr 18 16:12:48 2015	(r384238)
+++ head/games/gtkradiant/files/patch-tools__quake3__q3map2__image.c	Sat Apr 18 16:29:01 2015	(r384239)
@@ -1,15 +1,10 @@
 --- tools/quake3/q3map2/image.c.orig	2006-02-10 23:01:20.000000000 +0100
 +++ tools/quake3/q3map2/image.c	2012-05-26 20:56:51.000000000 +0200
-@@ -35,6 +35,7 @@
- 
- /* dependencies */
- #include "q3map2.h"
-+#include "pngpriv.h"
- 
- 
- 
-@@ -180,7 +181,7 @@
- 	png->io_ptr = &pb; /* hack! */
+@@ -177,10 +177,9 @@ static void LoadPNGBuffer( byte *buffer,
+ 	pb.size = size;
+ 	pb.offset = 0;
+ 	png_set_read_fn( png, &pb, PNGReadData );
+-	png->io_ptr = &pb; /* hack! */
  	
  	/* set error longjmp */
 -	if( setjmp( png->jmpbuf ) )



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504181629.t3IGT1eP029667>