Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jul 2013 09:12:26 GMT
From:      Scot Hetzel <swhetzel@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/180159: Mk/Uses/jpeg.mk: Used to add dependancy on either jpeg or libjpeg-turbo ports
Message-ID:  <201307010912.r619CQH2002154@oldred.freebsd.org>
Resent-Message-ID: <201307010920.r619K0Sl063418@freefall.freebsd.org>

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

>Number:         180159
>Category:       ports
>Synopsis:       Mk/Uses/jpeg.mk:  Used to add dependancy on either jpeg or libjpeg-turbo ports
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 01 09:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Scot Hetzel
>Release:        
>Organization:
>Environment:
>Description:
Currently, there are 2 versions of JPEG (graphics/jpeg and libjpeg-turbo) that supply their own version of the jpeg library.

When attempting to build packages for ports that can use either port, the package fails to build due to one of the dependencies only has:

LIB_DEPENDS= jpeg:${PORTSDIR}/graphics/jpeg
>How-To-Repeat:
Try to build /usr/ports/net/tigervnc with the HPJPG option enabled.  It will fail to build due to one of the indirect dependencies graphics/jasper (built with the graphics/jpeg port) causes a conflict between graphics/jpeg and graphics/libjpeg-turbo as both ports install the same files.

See ports/179236
>Fix:
The attached patch adds a new USES feature for jpeg allowing the appropriate jpeg port to be selected.

USES+= jpeg:[build,run,lib]
- if ${PREFIX}/include/turbojpeg.h is found
  use graphics/libjpeg-turbo, otherwise use graphics/jpeg

USES+= jpeg:[build,run,lib]:jpeg
- uses graphics/jpeg

USES+= jpeg:[build,run,lib]:turbo
- uses graphics/libjpeg-turbo

Ports can use this new feature by adding HPJPG to OPTIONS_DEFINE and the following description:

HPJPG_DESC= Build with High-Performance JPEG support

Then below the '.include <bsd.port.options.mk>' line add the following:

.if ${PORT_OPTIONS:MHPJPG}
USES+= jpeg[:lib]:turbo
.else
USES+= jpeg[:lib]
.endif

NOTE:
1. the 'lib' arg is optional, as that is the default.
2. HPJPG was taken from the net/tigervnc port

Patch attached with submission follows:

# $FreeBSD$ 
# 
# handle dependency on the graphics/jpeg or graphics/libjpeg-turbo ports
# 
# MAINTAINER: portmgr@FreeBSD.org 
# 
# Feature:      jpeg
# Usage:        USES=jpeg or USES=jpeg:ARGS 
# Valid ARGS:   build, run, lib (default, implicit), turbo, jpeg
# 
# turbo		use graphics/libjpeg-turbo
# jpeg		use graphics/jpeg
#
# if neither turbo or jpeg is specified, then we will default to
# graphics/jpeg, unless graphics/libjpeg-turbo port is installed.
#
.if !defined(_INCLUDE_USES_JPEG_MK) 
_INCLUDE_USES_JPEG_MK=       yes 

.if !defined(jpeg_ARGS) 
jpeg_ARGS=	lib
.endif 

_valid_ARGS=	build run lib turbo jpeg
_jpeg_ARGS=	${jpeg_ARGS:C/\:/ /g}

.if defined(jpeg_ARGS)
.  for arg in ${_jpeg_ARGS}
.    if empty(_valid_ARGS:M${arg})
IGNORE= Incorrect 'USES+=jpeg:${jpeg_ARGS}' usage: argument [${arg}] is not recognized
.    endif
.  endfor
.endif

.if exists(${PREFIX}/include/turbojpeg.h)
.  if empty(_jpeg_ARGS:Mjpeg)
_jpeg_ARGS+=turbo
.  endif
.endif

.if ${_jpeg_ARGS:Mjpeg}
.  if exists(${PREFIX}/bin/tjbench)
IGNORE= The graphics/libjpeg-turbo port is installed, uninstall it to use graphics/jpeg
.  endif
.endif

.if ${_jpeg_ARGS:Mturbo}
.  if exists(${PREFIX}/bin/jpegexiforient)
IGNORE= The graphics/jpeg port is installed, uninstall it to use graphics/libjpeg-turbo
.  endif
.endif

.if ${_jpeg_ARGS:Mturbo}
_JPEG_DEPENDS=		tjbench:${PORTSDIR}/graphics/libjpeg-turbo
_JPEG_LIB_DEPENDS=	turbojpeg:${PORTSDIR}/graphics/libjpeg-turbo
.else 
_JPEG_DEPENDS=		jpegexiforient:${PORTSDIR}/graphics/jpeg
_JPEG_LIB_DEPENDS=	jpeg:${PORTSDIR}/graphics/jpeg
.endif

.if ${_jpeg_ARGS:Mbuild}
BUILD_DEPENDS+=	${_JPEG_DEPENDS} 
.elif ${_jpeg_ARGS:Mrun} 
RUN_DEPENDS+=	${_JPEG_DEPENDS} 
.else
LIB_DEPENDS+=	${_JPEG_LIB_DEPENDS}
.endif 
 
.endif

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



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