Bug 256912

Summary: emulators/yuzu-qt5: build fails when pkgconf is present
Product: Ports & Packages Reporter: Jung-uk Kim <jkim>
Component: Individual Port(s)Assignee: Jan Beich <jbeich>
Status: Closed FIXED    
Severity: Affects Only Me Keywords: patch
Priority: --- Flags: jbeich: maintainer-feedback+
jbeich: merge-quarterly+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Do not use pkgconf to find libusb for FreeBSD none

Description Jung-uk Kim freebsd_committer freebsd_triage 2021-06-30 19:56:23 UTC
Created attachment 226141 [details]
Do not use pkgconf to find libusb for FreeBSD

CMake fails to find libusb when pkgconf exists.

...

-- Found PkgConfig: /usr/local/bin/pkg-config (found version "1.7.4") 
CMake Warning at CMakeLists.txt:440 (message):
  libusb not found, falling back to externals

...

CMake Error at externals/libusb/CMakeLists.txt:109 (add_library):
  Cannot find source file:

    libusb/libusb/core.c

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .h .hh .h++
  .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .ispc


CMake Error at externals/libusb/CMakeLists.txt:109 (add_library):
  No SOURCES given to target: usb

...

The attached patch let us bypass the pkgconf test and successfully find the libusb from the base.

...

-- Checking for module 'libusb-1.0'
--   Found libusb-1.0, version 1.0.13
-- Found libusb-1.0: /usr/include, /usr/lib/libusb.so

...
Comment 1 Jung-uk Kim freebsd_committer freebsd_triage 2021-06-30 20:19:40 UTC
FYI, the following commit broke FreeBSD.

https://github.com/yuzu-emu/yuzu/commit/55dd027115e72ca2ffc6a0bbf8f131d380c73faa
Comment 2 commit-hook freebsd_committer freebsd_triage 2021-07-27 15:11:09 UTC
A commit in branch main references this bug:

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

commit b2a8fc817e26955c5c60f9bcc540a7d335aa41bc
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2021-06-15 22:43:01 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2021-07-27 15:10:27 +0000

    emulators/yuzu: unbreak with pkgconf after 72cb3d2eba79

    CMake Error at externals/libusb/CMakeLists.txt:109 (add_library):
      Cannot find source file:

        libusb/libusb/core.c

      Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .h .hh .h++
      .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .ispc

    CMake Error at externals/libusb/CMakeLists.txt:109 (add_library):
      No SOURCES given to target: usb

    PR:             256912
    Submitted by:   jkim (based on)

 emulators/yuzu/Makefile | 1 +
 emulators/yuzu/distinfo | 2 ++
 2 files changed, 3 insertions(+)
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-07-27 15:12:10 UTC
A commit in branch 2021Q3 references this bug:

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

commit f2b114375a433c9d980953d1191bcb6e5dcfc3fb
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2021-06-15 22:43:01 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2021-07-27 15:11:03 +0000

    emulators/yuzu: unbreak with pkgconf after 72cb3d2eba79

    CMake Error at externals/libusb/CMakeLists.txt:109 (add_library):
      Cannot find source file:

        libusb/libusb/core.c

      Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .h .hh .h++
      .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .ispc

    CMake Error at externals/libusb/CMakeLists.txt:109 (add_library):
      No SOURCES given to target: usb

    PR:             256912
    Submitted by:   jkim (based on)

    (cherry picked from commit b2a8fc817e26955c5c60f9bcc540a7d335aa41bc)

 emulators/yuzu/Makefile | 1 +
 emulators/yuzu/distinfo | 2 ++
 2 files changed, 3 insertions(+)
Comment 4 Jan Beich freebsd_committer freebsd_triage 2021-07-27 15:13:34 UTC
Sorry it took so long. I've tried to come up with an upstreamable fix but failed, opting to simplify your version instead.