From 6eef4b8c6263af1938ea52bc6e3c6976678225ff Mon Sep 17 00:00:00 2001 From: Jacob Myers Date: Fri, 11 Jun 2010 21:58:38 -0400 Subject: These patches get usbmuxd compiling/working on FreeBSD. With minor changes, it could work on other BSD's also. --- CMakeLists.txt | 4 ++-- Modules/FindUSB.cmake | 15 ++++++++++++--- daemon/main.c | 2 +- tools/iproxy.c | 1 + 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 93fa715..8ed2e37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ set(LIBUSBMUXD_SOVERSION "1") message("-- Configuring usbmuxd v${VERSION_TAG}") if(NOT DEFINED LIB_SUFFIX) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) + if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(LIB_SUFFIX "64" CACHE STRING "Define suffix of library directory name (32/64)" ) else() set(LIB_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" ) @@ -67,7 +67,7 @@ add_definitions(-Wall) add_subdirectory (libusbmuxd) if (WITH_USBMUXD) add_subdirectory (daemon) - if (NOT WIN32 AND NOT APPLE) + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_subdirectory (udev) endif() endif() diff --git a/Modules/FindUSB.cmake b/Modules/FindUSB.cmake index d1d705a..486864f 100644 --- a/Modules/FindUSB.cmake +++ b/Modules/FindUSB.cmake @@ -9,8 +9,17 @@ include(LibFindMacros) # Dependencies -# Use pkg-config to get hints about paths -libfind_pkg_check_modules(USB_PKGCONF libusb-1.0>=1.0.3) +# pkg-config + libusb fails on FreeBSD, though libusb is in base +if(NOT(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")) + # Use pkg-config to get hints about paths + libfind_pkg_check_modules(USB_PKGCONF libusb-1.0>=1.0.3) + # We want to look for libusb-1.0 + set(USB_LIBRARY_NAME usb-1.0) +else() + set(USB_PKGCONF_INCLUDE_DIRS /usr/include) + set(USB_PKGCONF_LIBRARY_DIRS /usr/lib) + set(USB_LIBRARY_NAME usb) +endif() # Include dir find_path(USB_INCLUDE_DIR @@ -20,7 +29,7 @@ find_path(USB_INCLUDE_DIR # Finally the library itself find_library(USB_LIBRARY - NAMES usb-1.0 + NAMES ${USB_LIBRARY_NAME} PATHS ${USB_PKGCONF_LIBRARY_DIRS} ) diff --git a/daemon/main.c b/daemon/main.c index 789a202..140bee1 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -147,7 +147,7 @@ void set_signal_handlers(void) sigaction(SIGUSR2, &sa, NULL); } -#ifdef __APPLE__ +#if defined(__FreeBSD__) || defined(__APPLE__) static int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, const sigset_t *sigmask) { int ready; diff --git a/tools/iproxy.c b/tools/iproxy.c index 1855c67..4469c48 100644 --- a/tools/iproxy.c +++ b/tools/iproxy.c @@ -42,6 +42,7 @@ typedef unsigned int socklen_t; #include #endif #include +#include #include "sock_stuff.h" #include "usbmuxd.h" -- cgit v1.1-32-gdbae