From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Marcus Hoffmann via buildroot <buildroot@buildroot.org>
Cc: Marcus Hoffmann <buildroot@bubu1.eu>, Marcus Hoffmann <bubu@bubu1.eu>
Subject: Re: [Buildroot] [PATCH] package/picotool: add patch to fix sparc static build
Date: Wed, 7 Aug 2024 22:05:57 +0200 [thread overview]
Message-ID: <20240807220557.604f9e3f@windsurf> (raw)
In-Reply-To: <20240807150952.765978-1-buildroot@bubu1.eu>
Hello Marcus,
On Wed, 7 Aug 2024 17:09:52 +0200
Marcus Hoffmann via buildroot <buildroot@buildroot.org> wrote:
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index ff3e787..d6e41da 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -58,7 +58,8 @@ else()
> + pico_platform_headers
> + pico_usb_reset_interface_headers
> + picoboot_connection_cxx
> +- ${LIBUSB_LIBRARIES})
> ++ ${LIBUSB_LIBRARIES}
> ++ ${PC_LIBUSB_LIBRARIES})
Thanks for working on this. Unfortunately, while this patch perhaps
works for you, it might breaks things for systems where pkg-config is
not available: you unconditionally use ${PC_LIBUSB_LIBRARIES}, which
will only have a value if pkg-config is used. Instead could you try
something like this:
diff --git a/cmake/FindLIBUSB.cmake b/cmake/FindLIBUSB.cmake
index 169f594..7ae02b3 100644
--- a/cmake/FindLIBUSB.cmake
+++ b/cmake/FindLIBUSB.cmake
@@ -17,14 +17,18 @@ else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
pkg_check_modules(PC_LIBUSB libusb-1.0)
+ IF (${PC_LIBUSB_FOUND})
+ SET(LIBUSB_INCLUDE_DIR ${PC_LIBUSB_INCLUDE_DIRS})
+ SET(LIBUSB_LIBRARIES ${PC_LIBUSB_LIBRARIES})
+ ENDIF ()
+ ENDIF ()
+ IF (NOT ${PC_LIBUSB_FOUND})
+ FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h
+ HINTS $ENV{LIBUSB_ROOT}/include/libusb-1.0)
+ FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb-1.0 usb-1.0 usb
+ HINTS $ENV{LIBUSB_ROOT}/VS2019/MS32/static)
+ include(FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR)
+ MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
ENDIF ()
- FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h
- HINTS $ENV{LIBUSB_ROOT}/include/libusb-1.0
- PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS})
- FIND_LIBRARY(LIBUSB_LIBRARIES NAMES libusb-1.0 usb-1.0 usb
- HINTS $ENV{LIBUSB_ROOT}/VS2019/MS32/static
- PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
- include(FindPackageHandleStandardArgs)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR)
- MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
endif (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
The logic is:
- If pkg-config has found the library, assign LIBUSB_INCLUDE_DIR and
LIBUSB_LIBRARIES to the values found by pkg-config
- If pkg-config has not found the library, proceed with find_path() and
find_library().
Of course, we drop the hints passed to find_path() and find_library()
that were results of pkg-config... as if pkg-config has returned
meaningful results, we will no longer be calling find_path() and
find_library().
I am not 100% sure of my change (I did not even test it), but I believe
it is closer to something that has a chance of being acceptable
upstream.
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2024-08-07 20:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 15:09 [Buildroot] [PATCH] package/picotool: add patch to fix sparc static build Marcus Hoffmann via buildroot
2024-08-07 20:05 ` Thomas Petazzoni via buildroot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240807220557.604f9e3f@windsurf \
--to=buildroot@buildroot.org \
--cc=bubu@bubu1.eu \
--cc=buildroot@bubu1.eu \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.