From nobody@FreeBSD.org  Fri Sep  9 20:07:35 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6CAE3106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  9 Sep 2011 20:07:35 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 526C18FC15
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  9 Sep 2011 20:07:35 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p89K7ZSW006299
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 9 Sep 2011 20:07:35 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p89K7Ze7006298;
	Fri, 9 Sep 2011 20:07:35 GMT
	(envelope-from nobody)
Message-Id: <201109092007.p89K7Ze7006298@red.freebsd.org>
Date: Fri, 9 Sep 2011 20:07:35 GMT
From: bf <bf@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH]x11-toolkits/scintilla: fix linking, sparc64 build, respect LDFLAGS, trim patch
X-Send-Pr-Version: www-3.1
X-GNATS-Notify: cyberbotx@cyberbotx.com

>Number:         160598
>Category:       ports
>Synopsis:       [PATCH]x11-toolkits/scintilla: fix linking, sparc64 build, respect LDFLAGS, trim patch
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bf
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 09 20:10:02 UTC 2011
>Closed-Date:    Tue Sep 13 11:49:02 UTC 2011
>Last-Modified:  Tue Sep 13 11:49:02 UTC 2011
>Originator:     bf
>Release:        
>Organization:
-
>Environment:
>Description:
--Remove USE_GCC=4.2+ which is satisfied by all supported versions of FreeBSD, and prevents builds with later versions of GCC.

--Pass LDFLAGS to build, and use them and CXXFLAGS in linking -- some flags requires this.

--Fix typo in PICFLAG -- sparc64 has none(it should use -fPIC), and other archs are assigned both -fPIC and -fpic(they should just use -fpic). Pass to build in the standard way via CFLAGS (added to CXXFLAGS by default).

--Trim the patch a bit -- remove some lines rather than commenting them out (they're still in the body of the patch for reference)

--Since we're already altering the CXXFLAGS line, just use the patch to get rid of -Os, eliminating the extra sed pattern 

--Fix linking:

define and use a CONFIGLIBS variable -- the $(CONFIGFLAGS:cflags=libs) construct isn't working, because substitution is occurring too late, as can be seen in build logs -- for example:

http://pointyhat.freebsd.org/errorlogs/amd64-9-latest-logs/scintilla-2.28.log

meaning that the resulting libraries are missing all of the ELF DT_NEEDED flags for gtk, etc.

Re-order link lines, so that they are in proper link order, and add --as-needed.  This can of course cause problems if there are unresolved symbols in any of the gtk libraries, or problems with link order in the pkg-config output, which is why it is not turned on by default everywhere, but on the other hand it can trim many unneeded dependencies, and is currently being used without problems on the same libraries in the associated port editors/scite.  But if there are some doubts about this part of the patch, I'll remove --as-needed.






>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/x11-toolkits/scintilla/Makefile,v
retrieving revision 1.64
diff -u -r1.64 Makefile
--- Makefile	5 Sep 2011 15:33:27 -0000	1.64
+++ Makefile	7 Sep 2011 05:49:36 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	scintilla
 PORTVERSION=	2.28
+PORTREVISION=	1
 CATEGORIES=	x11-toolkits
 MASTER_SITES=	SF/scintilla/SciTE/${PORTVERSION}
 DISTNAME=	scite${PORTVERSION:S/.//g}
@@ -22,20 +23,21 @@
 MAKEFILE=	makefile
 USE_LDCONFIG=	yes
 USE_GNOME=	gtk20
-USE_GCC=	4.2+
 MAKE_JOBS_SAFE=	yes
+MAKE_ENV+=	LDFLAGS="${LDFLAGS}"
+CFLAGS+=	-DPIC ${PICFLAG}
 
 .include <bsd.port.pre.mk>
 
 .if ${ARCH} == "sparc64"
-MAKE_ARGS+=	PICFLAGS=-DPIC
+PICFLAG?=	-fPIC
 .else
-MAKE_ARGS+=	PICFLAGS="-DPIC -fPIC -fpic"
+PICFLAG?=	-fpic
 .endif
 
 post-patch:
-	@${REINPLACE_CMD} -e 's|[(]CC[)]|(CXX)|g ; s|[(]CCOMP[)]|(CC)|g ; \
-		s| -Os||g' ${WRKSRC}/makefile
+	@${REINPLACE_CMD} -e 's|[(]CC[)]|(CXX)|g ; s|[(]CCOMP[)]|(CC)|g' \
+		${WRKSRC}/makefile
 
 do-install:
 	${MKDIR} ${PREFIX}/include/scintilla
Index: files/patch-aa
===================================================================
RCS file: /home/pcvs/ports/x11-toolkits/scintilla/files/patch-aa,v
retrieving revision 1.26
diff -u -r1.26 patch-aa
--- files/patch-aa	4 Jul 2011 18:25:04 -0000	1.26
+++ files/patch-aa	7 Sep 2011 01:50:25 -0000
@@ -1,6 +1,6 @@
---- makefile.orig	2011-05-02 05:11:17.000000000 -0400
-+++ makefile	2011-07-03 21:09:17.000000000 -0400
-@@ -7,14 +7,14 @@
+--- makefile.orig	2011-07-31 22:49:04.000000000 -0400
++++ makefile	2011-09-06 20:44:00.000000000 -0400
+@@ -7,14 +7,7 @@
  # Also works with ming32-make on Windows.
  
  .SUFFIXES: .cxx .c .o .h .a
@@ -12,18 +12,11 @@
 -CCOMP = gcc
 -endif
 -AR = ar
-+#ifdef CLANG
-+#CC = clang
-+#CCOMP = clang
-+#else
-+#CC = g++
-+#CCOMP = gcc
-+#endif
-+AR = $(CXX) -shared
++AR = $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared
  RANLIB = touch
  
  ifdef GTK3
-@@ -36,7 +36,8 @@
+@@ -36,7 +29,8 @@
  COMPLIB=..\bin\scintilla.a
  else
  DEL = rm -f
@@ -33,7 +26,7 @@
  endif
  
  vpath %.h ../src ../include ../lexlib
-@@ -55,24 +56,24 @@
+@@ -55,14 +49,15 @@
  endif
  
  ifdef DEBUG
@@ -41,21 +34,17 @@
 +CXXFLAGS+=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS)
  else
 -CXXFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS)
-+CXXFLAGS+=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS)
++CXXFLAGS+=-DNDEBUG $(CXXBASEFLAGS) $(THREADFLAGS)
  endif
  
  CFLAGS:=$(CXXFLAGS)
  
--CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION))
-+CONFIGFLAGS:=$(shell pkg-config --cflags gtk+-2.0 gthread-2.0)
+ CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION))
++CONFIGLIBS:=$(shell pkg-config --libs $(GTKVERSION))
  MARSHALLER=scintilla-marshal.o
  
  .cxx.o:
--	$(CC) $(CONFIGFLAGS) $(CXXFLAGS) -c $<
-+	$(CC) $(PICFLAGS) $(CONFIGFLAGS) $(CXXFLAGS) -c $<
- .c.o:
--	$(CCOMP) $(CONFIGFLAGS) $(CFLAGS) -w -c $<
-+	$(CCOMP) $(PICFLAGS) $(CONFIGFLAGS) $(CFLAGS) -w -c $<
+@@ -72,7 +67,7 @@
  
  LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx))))
  
@@ -64,7 +53,7 @@
  
  clean:
  	$(DEL) *.o $(COMPLIB)
-@@ -85,9 +86,11 @@
+@@ -85,9 +80,11 @@
  	ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSetSimple.o PlatGTK.o \
  	KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o ViewStyle.o \
  	RESearch.o RunStyles.o Selection.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
@@ -72,10 +61,10 @@
 -	$(AR) rc $@ $^
 -	$(RANLIB) $@
 +	$(MARSHALLER)
-+	$(AR) $(CONFIGFLAGS:cflags=libs) -o $@ $^
++	$(AR) -o $@ $^ -Wl,--as-needed $(CONFIGLIBS)
 +
 +$(LEXRLIB): $(LEXOBJS)
-+	$(AR) $(CONFIGFLAGS:cflags=libs) -o $@ $^
++	$(AR) -o $@ $^ -Wl,--as-needed $(CONFIGLIBS)
  
  # Automatically generate header dependencies with "make deps"
  include deps.mak


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->bf 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Fri Sep 9 20:10:13 UTC 2011 
Responsible-Changed-Why:  
Submitter has GNATS access (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=160598 
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Fri Sep 9 20:10:19 UTC 2011 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=160598 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: cyberbotx@cyberbotx.com
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/160598: [PATCH]x11-toolkits/scintilla: fix linking, sparc64 build, respect LDFLAGS, trim patch
Date: Fri, 9 Sep 2011 20:10:17 UT

 Maintainer of x11-toolkits/scintilla,
 
 Please note that PR ports/160598 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/160598
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: Naram Qashat <cyberbotx@cyberbotx.com>
To: bug-followup@FreeBSD.org
Cc: Edwin Groothuis <edwin@FreeBSD.org>
Subject: Re: ports/160598: [PATCH]x11-toolkits/scintilla: fix linking, sparc64
 build, respect LDFLAGS, trim patch
Date: Sat, 10 Sep 2011 10:52:41 -0400

 I approve this patch.
 
 Naram Qashat
 
 On 09/09/11 16:10, Edwin Groothuis wrote:
 > Maintainer of x11-toolkits/scintilla,
 >
 > Please note that PR ports/160598 has just been submitted.
 >
 > If it contains a patch for an upgrade, an enhancement or a bug fix
 > you agree on, reply to this email stating that you approve the patch
 > and a committer will take care of it.
 >
 > The full text of the PR can be found at:
 >      http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/160598
 >

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/160598: commit references a PR
Date: Tue, 13 Sep 2011 11:30:36 +0000 (UTC)

 bf          2011-09-13 11:30:22 UTC
 
   FreeBSD ports repository
 
   Modified files:
     x11-toolkits/scintilla Makefile 
     x11-toolkits/scintilla/files patch-aa 
   Log:
   Fix linking and sparc64 build; small clean-up
   
   PR:             160598
   Approved by:    Naram Qashat (maintainer)
   
   Revision  Changes    Path
   1.65      +7 -5      ports/x11-toolkits/scintilla/Makefile
   1.27      +13 -24    ports/x11-toolkits/scintilla/files/patch-aa
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: feedback->closed 
State-Changed-By: bf 
State-Changed-When: Tue Sep 13 11:49:00 UTC 2011 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=160598 
>Unformatted:
