ports/106198: [PATCH] editors/xenon: Fix BROKENness

Peter Johnson johnson.peter at gmail.com
Sat Dec 2 05:40:25 UTC 2006


>Number:         106198
>Category:       ports
>Synopsis:       [PATCH] editors/xenon: Fix BROKENness
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 02 05:40:24 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Peter Johnson
>Release:        FreeBSD 6.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD 6.1-RELEASE
>Description:
Fix bad C++, which currently has the port marked as BROKEN on >= 5.x
(>= gcc 3.4.2).
>How-To-Repeat:
Marked BROKEN on >= 5.x (due to bad C++).
>Fix:
Patch attached.

--- unbreak-xenon.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/editors/xenon/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- Makefile	7 May 2006 10:55:39 -0000	1.15
+++ Makefile	2 Dec 2006 05:30:51 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	xenon
 PORTVERSION=	1.0.0
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	editors
 MASTER_SITES=	http://sydney.proximity.com.au/~ben/xenon/dist/ \
 		ftp://yankee.proximitygroup.com/pub/xenon/
@@ -22,19 +22,22 @@
 
 MAN1=		xe.1
 
-FIX_FILES=	Xe.h XeApp.h XeFontTable.C XeFontTable.h XeKeyTable.C \
-		XeKeyTable.h XeObjectTable.h
+FIX_FILES=	Xe.h XeApp.C XeApp.h XeFontTable.C XeKeyTable.C \
+		XeKeyTable.h XeObject.C XeObject.h XeObjectTable.h XeText.C \
+		XeText.h
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} >= 500113
-BROKEN=	"Does not compile (bad C++ code)"
-.endif
-
 do-configure:
 .for file in ${FIX_FILES}
 	@${REINPLACE_CMD} -e 's|#include <ext/|#include <|' \
-		-e 's|ulong|u_long|g' -e 's|uint|u_int|g' ${WRKSRC}/${file}
+		-e 's|ulong|u_long|g' -e 's|uint|u_int|g' \
+		-e 's|#include <slist>|#include <list>|' \
+		-e 's|std::slist|std::list|g' \
+		-e 's|#include <hash_map>|#include <ext/hash_map>|' \
+		-e 's|std::hash_map|__gnu_cxx::hash_map|g' \
+		-e 's|std::hash|__gnu_cxx::hash|g' \
+		${WRKSRC}/${file}
 .endfor
 
 do-install:
Index: files/patch-Makefile.common
===================================================================
RCS file: files/patch-Makefile.common
diff -N files/patch-Makefile.common
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-Makefile.common	2 Dec 2006 05:30:51 -0000
@@ -0,0 +1,20 @@
+--- makefiles/Makefile.common.orig	Sat Aug  4 16:59:06 2001
++++ makefiles/Makefile.common	Fri Dec  1 20:33:15 2006
+@@ -67,7 +67,7 @@
+ MKDEPEND = ./mkdepend
+ DEPEND = .depend
+ 
+-_CCFLAGS = $(ARCH) $(CCFLAGS) $(INCLUDES)
++_CCFLAGS = $(CCFLAGS) $(INCLUDES)
+ _LDFLAGS = $(TARGETLIB) $(LIBS)
+ 
+ #LDFLAGS = $(TARGETLIB)  -lXpm -lX11
+@@ -94,7 +94,7 @@
+ #	$(CC) -shared -o $(TARGETSO) $(OBJECTS)
+ 
+ $(TARGET): $(TARGETLIB) $(AUXTARGET).o
+-	$(CC) $(ARCH) $(LDFLAGS) $(AUXTARGET).o $(_LDFLAGS) -o $(TARGET)
++	$(CC) $(LDFLAGS) $(AUXTARGET).o $(_LDFLAGS) -o $(TARGET)
+ 
+ #$(SHTARGET): $(TARGETSO) $(TARGET).o
+ #	$(CC) -o $(TARGET) -g $(TARGET).o $(SHLDFLAGS)
Index: files/patch-XeFontTable.h
===================================================================
RCS file: files/patch-XeFontTable.h
diff -N files/patch-XeFontTable.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-XeFontTable.h	2 Dec 2006 05:30:51 -0000
@@ -0,0 +1,29 @@
+--- XeFontTable.h.orig	Wed Aug  1 04:22:25 2001
++++ XeFontTable.h	Fri Dec  1 20:55:07 2006
+@@ -18,21 +18,21 @@
+ // hash function object for std::string - maybe move this to Xe.h if it
+ // turns out that string keyed hash_maps are used elsewhere
+ 
+-namespace std
++namespace __gnu_cxx
+ {
+-template<> struct hash<string>
++template<> struct hash<std::string>
+ {
+-    size_t  operator()(const string& s) const
++    size_t  operator()(const std::string& s) const
+     {
+ 	return __stl_hash_string(s.c_str());
+     }
+ };
+ }
+ 
+-class XeFontTable : public std::hash_map<std::string, XFontStruct*> {
++class XeFontTable : public __gnu_cxx::hash_map<std::string, XFontStruct*> {
+ public:
+     XeFontTable(void)
+-	: std::hash_map<std::string, XFontStruct*>(64) {}
++	: __gnu_cxx::hash_map<std::string, XFontStruct*>(64) {}
+     ~XeFontTable();
+         
+     XFontStruct*	getFont(const char* fontname);
Index: files/patch-XeText.C
===================================================================
RCS file: files/patch-XeText.C
diff -N files/patch-XeText.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-XeText.C	2 Dec 2006 05:30:51 -0000
@@ -0,0 +1,33 @@
+--- XeText.C.orig	Sat Jan  5 20:39:39 2002
++++ XeText.C	Fri Dec  1 21:25:34 2006
+@@ -1612,26 +1612,19 @@
+ 	
+ 	if(_numUndos >= _maxUndos) {
+ 		
+-		// $$$ calling previous() here assums _undoList is not empty
+-		// previous() is O(N) where N is the number of undo items in the list
+-		// if this turns out to be too much of a performance penalty, use
+-		// std::list instead of std::slist for _undoList
+-		
+-		std::slist<Undo*>::iterator pos = _undoList.previous(_undoList.end());
+-		Undo* undo = *pos;
++		Undo* undo = _undoList.back();
+ 		
+ 		_undoBuf.remove(KRBUF_END, _undoBuf.length() - undo->len);
+ 		delete undo;
+-		_undoList.erase(pos);
++		_undoList.pop_back();
+ 		
+ 		if (!_undoList.empty()) {
+-			pos = _undoList.previous(_undoList.end());
+-			undo = *pos;
++			undo = _undoList.back();
+ 			
+ 			if (undo && undo->type == InsertSelection) {
+ 				_undoBuf.remove(KRBUF_END, _undoBuf.length() - undo->len);
+ 				delete undo;
+-				_undoList.erase(pos);
++				_undoList.pop_back();
+ 			}
+ 		}
+ 		
--- unbreak-xenon.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list