From nobody@FreeBSD.org  Wed Mar  5 21:24:01 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 581F4190
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  5 Mar 2014 21:24:01 +0000 (UTC)
Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 2B05AF64
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  5 Mar 2014 21:24:01 +0000 (UTC)
Received: from cgiserv.freebsd.org ([127.0.1.6])
	by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s25LO02X095161
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 5 Mar 2014 21:24:00 GMT
	(envelope-from nobody@cgiserv.freebsd.org)
Received: (from nobody@localhost)
	by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s25LO0Gj095155;
	Wed, 5 Mar 2014 21:24:00 GMT
	(envelope-from nobody)
Message-Id: <201403052124.s25LO0Gj095155@cgiserv.freebsd.org>
Date: Wed, 5 Mar 2014 21:24:00 GMT
From: Christian Elmerot <christian@elmerot.se>
To: freebsd-gnats-submit@FreeBSD.org
Subject: multimedia/libvpx: allow building with zsh
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         187304
>Category:       ports
>Synopsis:       multimedia/libvpx: allow building with zsh
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ashish
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 05 21:30:00 UTC 2014
>Closed-Date:    
>Last-Modified:  Thu Mar  6 12:10:01 UTC 2014
>Originator:     Christian Elmerot
>Release:        10-STABLE
>Organization:
>Environment:
>Description:
Changes to libvpx have rendered it unable to be built by default using zsh. By making the port detect if zsh is installed and have the user disable EXAMPLES will enable proper building using zsh instead of bash which removes additional dependencies when zsh is already installed.

There are several bash-isms in examples/gen_example_code.sh & examples/gen_example_text.sh such as short if statements, tests and printf that fails for zsh making EXAMPLES currently a no-go. ANy fixes for those files should likely be upstreamed


>How-To-Repeat:
$ cd /usr/ports/shells/zsh; make install
$ cd /usr/ports/multimedia/libvpx; make install

>Fix:
  $ cd /usr/ports/shells/zsh; make install

Apply attached patch to Makefile for libvpx, Deselect EXAMPLES
  $ cd /usr/ports/multimedia/libvpx; make config; make install



Patch attached with submission follows:

--- Makefile.orig	2014-01-12 17:08:27.000000000 +0100
+++ Makefile	2014-03-05 22:07:23.721069292 +0100
@@ -13,7 +13,7 @@
 LICENSE=	BSD
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BUILD_DEPENDS=	bash:${PORTSDIR}/shells/bash \
+BUILD_DEPENDS=	${SHELL}:${PORTSDIR}/shells/${SHELL} \
 		yasm:${PORTSDIR}/devel/yasm
 
 USES=		gmake perl5
@@ -22,11 +22,12 @@
 USE_PERL5=	build
 USE_LDCONFIG=	yes
 
-OPTIONS_DEFINE=	DEBUG POSTPROC RUNTIME THREADS SHARED
+OPTIONS_DEFINE=	DEBUG POSTPROC RUNTIME THREADS SHARED EXAMPLES
 OPTIONS_DEFAULT=	POSTPROC RUNTIME THREADS SHARED
 POSTPROC_DESC=	Enable postprocessing
 RUNTIME_DESC=	Enable runtime CPU detection
 SHARED_DESC=	Enable shared-library support
+EXAMPLES_DESC=	Build and/or install examples (requires Bash)
 
 WRKSRC=		${WRKDIR}/${PORTNAME}-${DISTVERSION}
 ALL_TARGET=
@@ -46,9 +47,18 @@
 RUNTIME_CONFIGURE_ON=	--enable-runtime-cpu-detect
 THREADS_CONFIGURE_OFF=	--disable-multithread
 SHARED_CONFIGURE_ON=	--enable-shared
+EXAMPLES_CONFIGURE_OFF=	--disable-examples
 
 .include <bsd.port.options.mk>
 
+.if ${PORT_OPTIONS:MEXAMPLES}
+SHELL=		bash
+.elif exists(${LOCALBASE}/bin/zsh)
+SHELL=		zsh
+.else
+SHELL=		bash
+.endif
+
 .if ${OSVERSION}  < 900000
 .if ${ARCH} == "amd64"
 USE_GCC=	yes
@@ -85,7 +95,7 @@
 	@${REINPLACE_CMD} -e 's|%%DESTDIR%%|${STAGEDIR}|g' \
 	       	${WRKSRC}/build/make/Makefile ${WRKSRC}/libs.mk
 	@${GREP} -Rl '^#!/bin/bash' ${WRKSRC} |${XARGS} ${REINPLACE_CMD} \
-		-e 's,#!/bin/bash,#!/usr/bin/env bash,g'
+		-e 's,#!/bin/bash,#!/usr/bin/env ${SHELL},g'
 	@${GREP} -Rl -- '-l\?pthread' ${WRKSRC} |${XARGS} ${REINPLACE_CMD} -E \
 		-e 's/-l?pthread/${PTHREAD_LIBS}/g'
 


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->ashish 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Wed Mar 5 21:30:08 UTC 2014 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

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

From: ashish@FreeBSD.org (Ashish SHUKLA)
To: bug-followup@FreeBSD.org,christian@elmerot.se
Cc:  
Subject: Re: ports/187304: multimedia/libvpx: allow building with zsh
Date: Thu, 06 Mar 2014 17:39:47 +0530

 --=-=-=
 Content-Type: text/plain; charset=utf-8
 Content-Transfer-Encoding: quoted-printable
 
 Hi,
 
 Thanks for your diff. I'm not sure, if this is a good idea. Since it's more
 like your convenience, you can do something like:
 
 #v+
 =CE=BB ls -la $(which bash)
 lrwxr-xr-x  1 abbe  abbe  18 Mar  6 17:22 /home/abbe/bin/bash -> /usr/local=
 /bin/zsh
 =CE=BB pkg info zsh |head -1
 zsh-5.0.5
 =CE=BB pkg info bash |head -1
 pkg: No package(s) matching bash
 #v-
 
 For me the port builds/installs fine with `bash` setup as above. Let me know
 if this doesn't work for you.
 
 HTH
 =2D-=20
 Ashish SHUKLA      | GPG: F682 CDCC 39DC 0FEA E116  20B6 C746 CFA9 E74F A4B0
 Sent from my Emacs
 
 --=-=-=
 Content-Type: application/pgp-signature; name="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (FreeBSD)
 
 iQIcBAEBCgAGBQJTGGWPAAoJEMdGz6nnT6SwMoMP/i1nYLL7JAp4wg67JG/24er2
 lhgDbvvO5uByArQCYiIQriBBGX0HYLR+vewHf+eboHVK2eDBwOFxJgD0H374RLLu
 TtjVlDYXBi3F0ZkE/pS2ZycB7sit1gVrCLh4sNmvvvpdEDtkeIzwft/l7k0V1bfm
 VW1MAnXK7aT9BAu3LB+NxR/2Xc1s65aq5yjFyvUexfr6kSSPyQ2LiwQMDLeJbXdg
 hcuh+QYTNhvcWZ7A2NXi5M4Vb/6r/FrPyyiFsIiZlhJtV37Crz0YUcNdzIVDxWzV
 UobLRrYFhc1sURLF7PjZln2RTMPB11N+/gDnR4ytO1CBxK0oHMBnMO0wPPauqKPs
 BIZaB6Awx9iTvijMYqaMFtOiEqggJ2P/gsvcH4ZQWzNKHPNvif7sqP7LBKFB4Wpq
 Ijb3SEl8/lzQmSN4kcpVrib2uJR159LcG1U8px7/8hmhpnx1FMs5UutM9Grn2+9d
 ejcVKx4LC91geSVAHgmgp9dDBUVV6y2ndY6/4QEcbO5AHOdMRetl7r6yNB4Fycux
 SmBsWRU+/DJgSHG5UW5KX+Tm+iQnAj8twZXvBsKFscvpxsKvUtSJrW5WnmDVlVH7
 WMRUvl/X4u9AeGTHdhAQ4qIRuZBIW4AGnv4rI+8+vH5Kolsozi/O/4D6CeV87A5s
 ehhgiufDbNvrLjXiawr4
 =KKwo
 -----END PGP SIGNATURE-----
 --=-=-=--
>Unformatted:
