From jylefort@brutele.be  Thu Dec 14 20:54:07 2006
Return-Path: <jylefort@brutele.be>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 6B10B16A7B7
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 14 Dec 2006 20:54:07 +0000 (UTC)
	(envelope-from jylefort@brutele.be)
Received: from mirapoint7.brutele.be (mirapoint7.brutele.be [212.68.199.151])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0B7A2440FD
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 14 Dec 2006 20:47:13 +0000 (GMT)
	(envelope-from jylefort@brutele.be)
Received: from host-212-68-244-81.brutele.be (host-212-68-244-81.brutele.be [212.68.244.81])
	by mirapoint7.brutele.be (MOS 3.7.5a-GA)
	with ESMTP id ABZ28253;
	Thu, 14 Dec 2006 21:48:24 +0100 (CET)
Received: from jsite.lefort.net (jsite.lefort.net [192.168.1.2])
	by gateway.lefort.net (Postfix) with ESMTP id E902754CF
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 14 Dec 2006 21:48:23 +0100 (CET)
Received: by jsite.lefort.net (Postfix, from userid 1000)
	id D7DFF7B; Thu, 14 Dec 2006 21:48:23 +0100 (CET)
Message-Id: <20061214204823.D7DFF7B@jsite.lefort.net>
Date: Thu, 14 Dec 2006 21:48:23 +0100 (CET)
From: Jean-Yves Lefort <jylefort@FreeBSD.org>
Reply-To: Jean-Yves Lefort <jylefort@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Misc improvements to audio/gnuitar
X-Send-Pr-Version: 3.113

>Number:         106730
>Category:       ports
>Synopsis:       Misc improvements to audio/gnuitar
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gabor
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 14 21:00:26 GMT 2006
>Closed-Date:    Tue Dec 19 21:09:05 GMT 2006
>Last-Modified:  Tue Dec 19 21:10:16 GMT 2006
>Originator:     Jean-Yves Lefort
>Release:        FreeBSD 6.2-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD jsite.lefort.net 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #0: Tue Oct 24 19:03:08 CEST 2006 jylefort@jsite.lefort.net:/usr/obj/usr/src/sys/JSITE i386
>Description:
- Make it setuid-root so that it can set realtime scheduling priority
  (making it drop root privileges immediately after)
- Install a desktop entry
- Move to LOCALBASE
- Makefile cleanups
>How-To-Repeat:
>Fix:
diff -ruN /usr/ports/audio/gnuitar/Makefile gnuitar/Makefile
--- /usr/ports/audio/gnuitar/Makefile	Fri Dec  8 14:46:26 2006
+++ gnuitar/Makefile	Thu Dec 14 21:38:07 2006
@@ -5,6 +5,7 @@
 
 PORTNAME=		gnuitar
 PORTVERSION=		0.3.2
+PORTREVISION=		1
 CATEGORIES=		audio multimedia
 MASTER_SITES=		${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	${PORTNAME}
@@ -13,19 +14,31 @@
 COMMENT=	The real-time guitar processor
 
 USE_BZIP2=	yes
-USE_X_PREFIX=	YES
-USE_GNOME=	gtk20 glib20
-WANT_GNOME=	YES
-GNU_CONFIGURE=	YES
+USE_GNOME=	gtk20
+GNU_CONFIGURE=	yes
 CONFIGURE_ARGS+=--with-gtk2 \
 		--enable-clip-everywhere \
 		--enable-float
 
+DESKTOP_ENTRIES="GNUitar" \
+		"Apply guitar effects in real-time" \
+		"gnuitar" \
+		"gnuitar" \
+		"" \
+		true
+
 pre-fetch:
 	@${CAT} pkg-message
 
 post-patch:
 	@${REINPLACE_CMD} -e "s|-lpthread|${PTHREAD_LIBS}|g" \
 		${WRKSRC}/configure ${WRKSRC}/src/Makefile
+
+post-install:
+	${MKDIR} ${PREFIX}/share/pixmaps
+	${INSTALL_DATA} ${WRKSRC}/src/gnuitar.xpm ${PREFIX}/share/pixmaps
+# make it setuid-root to be able to set realtime priority (root
+# privileges are dropped in the main routine)
+	${CHMOD} u+s ${PREFIX}/bin/gnuitar
 
 .include <bsd.port.mk>
diff -ruN /usr/ports/audio/gnuitar/files/patch-src_main.c gnuitar/files/patch-src_main.c
--- /usr/ports/audio/gnuitar/files/patch-src_main.c	Thu Jan  1 01:00:00 1970
+++ gnuitar/files/patch-src_main.c	Thu Dec 14 21:41:37 2006
@@ -0,0 +1,35 @@
+--- src/main.c.orig	Fri Apr 15 16:37:41 2005
++++ src/main.c	Thu Dec 14 21:41:20 2006
+@@ -109,6 +109,9 @@
+ #include <fcntl.h>
+ #include <sys/types.h>
+ 
++#include <sys/types.h>
++#include <unistd.h>
++
+ #ifdef DEMO
+ #define DEMO_MSG "\n\nThis is the demo version of the GNUitar program." \
+     "\nYou may download the full version as a source distribution" \
+@@ -953,9 +956,6 @@
+     struct sched_param p;
+ 
+ 
+-    if ((error = init_sound()) != ERR_NOERROR)
+-	return error;
+-
+     max_priority = sched_get_priority_max(SCHED_FIFO);
+     p.sched_priority = max_priority;
+ 
+@@ -964,6 +964,12 @@
+ 	    ("\nFailed to set scheduler priority. (Are you running as root?)");
+ 	printf("\nContinuing with default priority");
+     }
++
++    setuid(getuid());       /* drop root privileges */
++
++    if ((error = init_sound()) != ERR_NOERROR)
++	return error;
++
+     if (pthread_create(&audio_thread, NULL, audio_thread_start, NULL)) {
+ 	fprintf(stderr, "\nAudio thread creation failed!");
+ 	return ERR_THREAD;
diff -ruN /usr/ports/audio/gnuitar/pkg-plist gnuitar/pkg-plist
--- /usr/ports/audio/gnuitar/pkg-plist	Sat Dec  3 23:22:11 2005
+++ gnuitar/pkg-plist	Thu Dec 14 21:38:34 2006
@@ -11,5 +11,7 @@
 share/doc/gnuitar/README
 share/doc/gnuitar/TODO
 share/doc/gnuitar/ChangeLog
+share/pixmaps/gnuitar.xpm
 @dirrm share/doc/gnuitar/docs
 @dirrm share/doc/gnuitar
+@dirrmtry share/pixmaps
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->gabor 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Thu Dec 14 21:00:58 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=106730 
State-Changed-From-To: open->closed 
State-Changed-By: gabor 
State-Changed-When: Tue Dec 19 21:05:45 UTC 2006 
State-Changed-Why:  
Committed with a slight change, thanks! I moved the setuid 
part to OPTIONS so that one not be forced to install it as suid. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/106730: commit references a PR
Date: Tue, 19 Dec 2006 21:05:24 +0000 (UTC)

 gabor       2006-12-19 21:05:15 UTC
 
   FreeBSD ports repository
 
   Modified files:
     audio/gnuitar        Makefile pkg-plist 
   Added files:
     audio/gnuitar/files  patch-src_main.c 
   Log:
   - Add OPTION to install as suid so that it can set realtime scheduling [1]
   - Install a desktop entry [1]
   - Move to LOCALBASE [1]
   - Makefile cleanups [1]
   - Add support for NOPORTDOCS
   - Bump PORTREVISION [1]
   
   PR:             ports/106730
   Submitted by:   jylefort [1]
   Approved by:    erwin (mentor)
   
   Revision  Changes    Path
   1.5       +37 -4     ports/audio/gnuitar/Makefile
   1.1       +35 -0     ports/audio/gnuitar/files/patch-src_main.c (new)
   1.2       +2 -14     ports/audio/gnuitar/pkg-plist
 _______________________________________________
 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"
 
>Unformatted:
