Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Dec 2006 21:48:23 +0100 (CET)
From:      Jean-Yves Lefort <jylefort@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/106730: Misc improvements to audio/gnuitar
Message-ID:  <20061214204823.D7DFF7B@jsite.lefort.net>
Resent-Message-ID: <200612142100.kBEL0Qbf028468@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         106730
>Category:       ports
>Synopsis:       Misc improvements to audio/gnuitar
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 14 21:00:26 GMT 2006
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



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