File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -98,14 +98,20 @@ build_hydrasdr() {
9898
9999 git clone --depth 1 " ${HYDRASDR_REPO} " " ${src_dir} "
100100
101- # Find libusb library path (handles both x86_64 and arm64)
102- local libusb_lib=$( find /usr/lib -name " libusb-1.0.so" 2> /dev/null | head -n 1)
103- [[ -z " ${libusb_lib} " ]] && libusb_lib=$( find /lib -name " libusb-1.0.so" 2> /dev/null | head -n 1)
101+ # Use pkg-config to find libusb (more reliable than manual search)
102+ local libusb_cflags=$( pkg-config --cflags libusb-1.0 2> /dev/null || true)
103+ local libusb_libs=$( pkg-config --libs libusb-1.0 2> /dev/null || true)
104+ local libusb_libdir=$( pkg-config --variable=libdir libusb-1.0 2> /dev/null || true)
104105
105- cmake -S " ${src_dir} /libhydrasdr" -B " ${src_dir} /libhydrasdr/build" \
106- -DCMAKE_BUILD_TYPE=Release \
107- -DCMAKE_INSTALL_PREFIX=" ${install_dir} " \
108- ${libusb_lib: +-DLIBUSB_LIBRARIES=" ${libusb_lib} " -DLIBUSB_INCLUDE_DIRS=" /usr/include/libusb-1.0" }
106+ local cmake_args=" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${install_dir} "
107+
108+ # If pkg-config found libusb, help CMake find it
109+ if [[ -n " ${libusb_libdir} " ]]; then
110+ cmake_args=" ${cmake_args} -DLIBUSB_LIBRARIES=${libusb_libdir} /libusb-1.0.so"
111+ cmake_args=" ${cmake_args} -DLIBUSB_INCLUDE_DIRS=$( pkg-config --variable=includedir libusb-1.0) /libusb-1.0"
112+ fi
113+
114+ cmake -S " ${src_dir} /libhydrasdr" -B " ${src_dir} /libhydrasdr/build" ${cmake_args}
109115
110116 cmake --build " ${src_dir} /libhydrasdr/build" -j " ${JOBS} "
111117 cmake --install " ${src_dir} /libhydrasdr/build"
You can’t perform that action at this time.
0 commit comments