Subject: pkg/20586: net/unison: enable gtk GUI
To: None <gnats-bugs@gnats.netbsd.org>
From: None <joachim@cms.tecmath.com>
List: netbsd-bugs
Date: 03/05/2003 14:48:21
>Number:         20586
>Category:       pkg
>Synopsis:       enable gtk GUI for net/unison
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 05 05:52:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Joachim Koenig-Baltes
>Release:        NetBSD 1.6P
>Organization:
	
>Environment:
	
	
System: NetBSD compaq 1.6P NetBSD 1.6P (JOACHIM_ISDN) #0: Wed Mar 5 10:43:19 CET 2003 joachim@compaq:/usr/src/sys/arch/i386/compile/JOACHIM_ISDN i386
Architecture: i386
Machine: i386
>Description:
unison has a nice gtk GUI mode implemented via x11/lablgtk. As the GUI (text
or gtk) can be selected at runtime via '-ui text', '-ui graphic' command line
options, there is IMHO no need to create two different packages with different
user interfaces.
>How-To-Repeat:
install net/unison and use it in text mode and wonder if there is a graphic
mode available.
>Fix:
I've adapted the Makefile to use the gtk GUI and added a dependency to lablgtk.
Also, when building on SunOS, ocamlopt can be used too.

I bumped PKGREVISION to 1. As the tarball is called src.tar.gz it is installed
in its own DIST_SUBDIR. The PKGREVISION suprisingly changed PKGNAME from
unison-2.9.1 as defined in the Makefile to unison-2.9.1nb1 and thus the
DIST_SUBDIR derived from it, which is unwanted as src.tar.gz did not change.

So I had a look at the PKGNAME change caused by the PKGREVISION definition and
used the saved PKGNAME in variable PKGNAME_NOREV. Unfortunately, this variable
is only available when PKGREVISION is defined, so when unison 2.9.2 or later
comes out, the Makefile has to be changed again. But the problem is bsd.pkg.mk
and the strange PKGNAME semantics.

patch below:

--- Makefile.orig       2002-09-18 09:57:29.000000000 +0200
+++ Makefile    2003-03-05 14:47:07.000000000 +0100
@@ -10,21 +10,24 @@
 HOMEPAGE=      http://www.cis.upenn.edu/~bcpierce/unison/
 COMMENT=       file-synchronization tool
 
+PKGREVISION=   1
+
 BUILD_DEPENDS= ocaml>=3.00:../../lang/ocaml
 BUILD_DEPENDS+=        bash>=2.05:../../shells/bash2
 
-DIST_SUBDIR=   ${PKGNAME}
+# when PKGREVISION is not defined, change PKGNAME_NOREV to PKGNAME
+DIST_SUBDIR=   ${PKGNAME_NOREV}
 
 # docs: unison-manual.pdf/html/ps/dvi
-WRKSRC=                ${WRKDIR}/${PKGNAME}
+WRKSRC=                ${WRKDIR}/${PKGNAME_NOREV}
 USE_GMAKE=     yes
-MAKE_FLAGS+=   CFLAGS="" UISTYLE=text
+MAKE_FLAGS+=   CFLAGS="" UISTYLE=gtk
 MAKE_ENV+=     HOME=${WRKDIR}
 
 .include "../../mk/bsd.prefs.mk"
 
-.if (${MACHINE_ARCH} != "i386")
-# we don't have ocamlopt on non-i386 so don't try and use it
+.if (${MACHINE_ARCH} != "i386" && ${OPSYS} != 'SunOS')
+# we don't have ocamlopt on non-i386 or non-SunOS so don't try and use it
 MAKE_FLAGS+=   NATIVE=false
 .endif
 
@@ -40,4 +43,5 @@
                ${INSTALL_MAN} ${WRKSRC}/ROADMAP.txt ${PREFIX}/share/doc/unison
                ${INSTALL_MAN} ${WRKSRC}/TODO.txt ${PREFIX}/share/doc/unison
 
+.include "../../x11/lablgtk/buildlink2.mk"
 .include "../../mk/bsd.pkg.mk"

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