Bug 190476

Summary: [patch] devel/gdcm: doesn't build if graphics/openjpeg is installed
Product: Ports & Packages Reporter: Lawrence Chen <beastie>
Component: Individual Port(s)Assignee: Pietro Cerutti <gahr>
Status: Closed FIXED    
Severity: Affects Only Me CC: mandree
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch none

Description Lawrence Chen 2014-06-02 00:04:59 UTC
Created attachment 143283 [details]
patch

Because most ports are working with graphics/openjpeg being 2.1, while some
	ports, such as this one, will only build against the older version.  But,
	seems cmake can detect that the newer version is available, cauing
	OPENJPEG_MAJOR_VERSION to be set to 2.

	While the source comes with openjpeg v1.4.0 and v2.0.0, it prefers the v1
	version by default requiring a option to be defined to select the v2 library.
	But, for this port the option to use system openjpeg is set.

	There's a comment that it doesn't provide an option to specify version when
	looking for the system openjpeg.

How-To-Repeat:
So, when I first tried to built the port, it complained that OPJ_UINT32
	wasn't defined.  Searching to find out where this is defined, found it to be
	in the openjpeg-2.1/openjpeg.h header.

	So, I tried to have it build again that, adding
	'-I${LOCALBASE}/include/openjpeg-2.1' to CFLAGS before the current entry.

	It then failed because opj_get_reversible wasn't declared.  Well, its not
	in the openjpeg-2.1/openjpeg.h header, but it is in the libopenjpeg/openjpeg.h
	header in the included 2.0.0 code.  But, I also searched the openjpeg
	subversion repo...there are nearly 2800 revisions... working back to r954, I
	gave up looking for it.

	So, try to make it use graphics/openjpeg15.  After a couple of tries, came
	up the ugly patches below.

Fix:
The patches below will:

	* Override the openjpeg library to link against to be
		${LOCALBASE}/lib/libopenjpeg.so
	* Force OPENJPEG_MAJOR_VERSION to be 1.
Comment 1 Matthias Andree freebsd_committer freebsd_triage 2014-06-06 18:14:31 UTC
Pietro, Beastie,

is the approach correct?  It appears we have both the openjpeg15 and openjpeg ports, so perhaps this should be made an option instead, with a sane default for package builds?
Comment 2 commit-hook freebsd_committer freebsd_triage 2014-06-10 07:53:57 UTC
A commit references this bug:

Author: gahr
Date: Tue Jun 10 07:53:23 UTC 2014
New revision: 357278
URL: http://svnweb.freebsd.org/changeset/ports/357278

Log:
  - Fix build with both OpenJPEG 1.5 and 2.0 are installed [1]
  - While at it, modernize the use of options and fix a couple of whitespaces

  PR:		190476
  Submitted by:	Lawrence Chen <beastie@tardisi.com>

Changes:
  head/devel/gdcm/Makefile
  head/devel/gdcm/files/patch-CMake_FindOpenJPEG.cmake
  head/devel/gdcm/pkg-plist
Comment 3 Pietro Cerutti freebsd_committer freebsd_triage 2014-06-10 07:59:21 UTC
Unfortunately gdcm doesn't support OpenJPEG 2 yet (although most of the boilerplate is there). I've just committed a fix that uses pkgconf to locate the correct OpenJPEG definitions.