git: c5c27487bb1b - 2023Q2 - graphics/libyuv: track libjpeg dependency

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Sun, 07 May 2023 05:18:57 UTC
The branch 2023Q2 has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c5c27487bb1bf1e4df343a7a2f976c3cf73b5d78

commit c5c27487bb1bf1e4df343a7a2f976c3cf73b5d78
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-05-07 05:10:21 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-05-07 05:18:53 +0000

    graphics/libyuv: track libjpeg dependency
    
    -- Found JPEG: /usr/local/lib/libjpeg.so (found version "80")
    [...]
    Error: /usr/local/bin/yuvconvert is linked to /usr/local/lib/libjpeg.so.8 from graphics/jpeg-turbo but it is not declared as a dependency
    Warning: you need USES+=jpeg
    
    PR:             267163
    (cherry picked from commit 78d127100976a6e431088b58b887c297ccf87573)
---
 graphics/libyuv/Makefile                   |  7 +++++++
 graphics/libyuv/files/patch-CMakeLists.txt | 18 ++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/graphics/libyuv/Makefile b/graphics/libyuv/Makefile
index b9cd848610cb..50c7be667514 100644
--- a/graphics/libyuv/Makefile
+++ b/graphics/libyuv/Makefile
@@ -10,6 +10,7 @@
 
 PORTNAME=	libyuv
 DISTVERSION=	0.0.1789
+PORTREVISION=	1
 CATEGORIES=	graphics
 MASTER_SITES=	LOCAL/mikael/libyuv/:libyuv \
 		LOCAL/tcberner/libyuv/:libyuv
@@ -28,6 +29,12 @@ SUB_LIST=	DISTVERSION=${DISTVERSION}
 
 LIBYUV_HASH=	0896c34873e83ca3d1690286a94e278a81d0a760
 
+OPTIONS_DEFINE=	JPEG
+OPTIONS_DEFAULT=JPEG
+
+JPEG_USES=		jpeg
+JPEG_CMAKE_BOOL_OFF=	CMAKE_DISABLE_FIND_PACKAGE_JPEG
+
 # sha256 changes everytime you download the archive, need to host it on freefall
 # To download the distfile: as mikael: make MAINTAINER_MODE=yes fetch
 .if defined(MAINTAINER_MODE)
diff --git a/graphics/libyuv/files/patch-CMakeLists.txt b/graphics/libyuv/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..f8bfd4ded342
--- /dev/null
+++ b/graphics/libyuv/files/patch-CMakeLists.txt
@@ -0,0 +1,18 @@
+https://chromium.googlesource.com/libyuv/libyuv.git/+/c365da9c6c3a%5E!/
+https://chromium.googlesource.com/libyuv/libyuv.git/+/f428a642e3d8%5E!/
+
+--- CMakeLists.txt.orig	2021-10-26 08:34:37 UTC
++++ CMakeLists.txt
+@@ -35,10 +35,10 @@ TARGET_LINK_LIBRARIES	( yuvconvert ${ly_lib_static} )
+ TARGET_LINK_LIBRARIES	( yuvconvert ${ly_lib_static} )
+ 
+ 
+-INCLUDE ( FindJPEG )
++find_package ( JPEG )
+ if (JPEG_FOUND)
+   include_directories( ${JPEG_INCLUDE_DIR} )
+-  target_link_libraries( yuvconvert ${JPEG_LIBRARY} )
++  target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} )
+   add_definitions( -DHAVE_JPEG )
+ endif()
+