[SCM] libindi packaging branch, master, updated. debian/1.4.1+dfsg-3

Pino Toscano pino at moszumanska.debian.org
Sat Dec 2 17:29:53 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/krap/libindi.git;a=commitdiff;h=2da2e2c

The following commit has been merged in the master branch:
commit 2da2e2c6bc4f42c2bb8f2b415175fc564d787cc3
Author: Pino Toscano <pino at debian.org>
Date:   Sat Nov 25 08:40:23 2017 +0100

    backport two upstream patches
    
    - rewrite the libusb-1.0 cmake search
    - fix one libusb.h include
---
 debian/changelog                                   |   6 +
 debian/patches/series                              |   2 +
 debian/patches/upstream_Fix-libusb.h-include.patch |  21 ++
 .../upstream_cmake-rewrite-libusb-1.0-search.patch | 306 +++++++++++++++++++++
 4 files changed, 335 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 1c6b932..33cbad6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,11 @@
 libindi (1.4.1+dfsg-2) UNRELEASED; urgency=medium
 
+  [ Pino Toscano ]
+  * Backport upstream commit b6fc36c4e3df7321ba2fa41d4c1a9d91fc32eef3 to fix
+    the cmake search for libusb-1.0 (most for non-Linux architectures); patch
+    upstream_cmake-rewrite-libusb-1.0-search.patch.
+  * Backport upstream commit 921b6a1a5536642967ea4c3d481a48fd8a2ed296 to fix
+    one libusb.h include; patch upstream_Fix-libusb.h-include.patch.
 
  -- Debian Krap Maintainers <debian-qt-kde at lists.debian.org>  Sat, 25 Nov 2017 08:23:43 +0100
 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..0e4aa13
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+upstream_cmake-rewrite-libusb-1.0-search.patch
+upstream_Fix-libusb.h-include.patch
diff --git a/debian/patches/upstream_Fix-libusb.h-include.patch b/debian/patches/upstream_Fix-libusb.h-include.patch
new file mode 100644
index 0000000..d6a8e2a
--- /dev/null
+++ b/debian/patches/upstream_Fix-libusb.h-include.patch
@@ -0,0 +1,21 @@
+From 921b6a1a5536642967ea4c3d481a48fd8a2ed296 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <toscano.pino at tiscali.it>
+Date: Fri, 24 Nov 2017 21:56:28 +0100
+Subject: [PATCH] Fix libusb.h include
+
+Drop the libusb-1.0 prefix, just like it is done elsewhere.
+---
+ libindi/libs/indibase/hid_libusb.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/libindi/libs/indibase/hid_libusb.c
++++ b/libindi/libs/indibase/hid_libusb.c
+@@ -52,7 +52,7 @@
+ #include <wchar.h>
+ 
+ /* GNU / LibUSB */
+-#include "libusb-1.0/libusb.h"
++#include <libusb.h>
+ #include "iconv.h"
+ 
+ #include "hidapi.h"
diff --git a/debian/patches/upstream_cmake-rewrite-libusb-1.0-search.patch b/debian/patches/upstream_cmake-rewrite-libusb-1.0-search.patch
new file mode 100644
index 0000000..52d1289
--- /dev/null
+++ b/debian/patches/upstream_cmake-rewrite-libusb-1.0-search.patch
@@ -0,0 +1,306 @@
+From b6fc36c4e3df7321ba2fa41d4c1a9d91fc32eef3 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <toscano.pino at tiscali.it>
+Date: Fri, 24 Nov 2017 21:41:39 +0100
+Subject: [PATCH] cmake: rewrite libusb-1.0 search
+
+The current FindUSB-1.cmake is a mess: the search uses pkg-config only
+as fallback, it mixes USB vs LIBUSB_1 prefixes, it mixes USB-1 vs USB_1
+naming, it uses hardcoded paths, and the libusb_error_name() check is
+done only on Linux.
+
+As solution, write a brand-new FindUSB1.cmake module: it uses pkg-config
+in the right way, it provides coherent naming for variables, and the
+libusb_error_name() is done for any OS.
+
+As side change, the define for USB1_HAS_LIBUSB_ERROR_NAME is not
+automatically added to the build system, but written in a config-usb.h
+file which is used where needed.
+---
+ 3rdparty/indi-asi/CMakeLists.txt        |   6 +-
+ 3rdparty/indi-dsi/CMakeLists.txt        |   4 +-
+ 3rdparty/indi-gphoto/CMakeLists.txt     |   4 +-
+ 3rdparty/indi-mgen/CMakeLists.txt       |   6 +-
+ 3rdparty/indi-mi/CMakeLists.txt         |   4 +-
+ 3rdparty/indi-qhy/CMakeLists.txt        |   6 +-
+ 3rdparty/indi-ssag/CMakeLists.txt       |   4 +-
+ 3rdparty/indi-sx/CMakeLists.txt         |  12 ++--
+ 3rdparty/indi-sx/config-usb.h.cmake     |   2 +
+ 3rdparty/indi-sx/sxccdusb.cpp           |   4 +-
+ 3rdparty/libapogee/CMakeLists.txt       |   4 +-
+ 3rdparty/libfishcamp/CMakeLists.txt     |   4 +-
+ cmake_modules/FindUSB-1.cmake           | 114 --------------------------------
+ cmake_modules/FindUSB1.cmake            |  83 +++++++++++++++++++++++
+ libindi/CMakeLists.txt                  |  12 ++--
+ libindi/config-usb.h.cmake              |   2 +
+ libindi/libs/indibase/indiusbdevice.cpp |   4 +-
+ 17 files changed, 128 insertions(+), 147 deletions(-)
+ create mode 100644 3rdparty/indi-sx/config-usb.h.cmake
+ delete mode 100644 cmake_modules/FindUSB-1.cmake
+ create mode 100644 cmake_modules/FindUSB1.cmake
+ create mode 100644 libindi/config-usb.h.cmake
+
+--- a/cmake_modules/FindUSB-1.cmake
++++ /dev/null
+@@ -1,114 +0,0 @@
+-# - Try to find libusb-1.0
+-# Once done this will define
+-#
+-#  USB-1_FOUND - system has libusb
+-#  LIBUSB_1_INCLUDE_DIRS - the libusb include directory
+-#  LIBUSB_1_LIBRARIES - Link these to use libusb
+-#  LIBUSB_1_DEFINITIONS - Compiler switches required for using libusb
+-#
+-#  Adapted from cmake-modules Google Code project
+-#
+-#  Copyright (c) 2006 Andreas Schneider <mail at cynapses.org>
+-#
+-#  (Changes for libusb) Copyright (c) 2008 Kyle Machulis <kyle at nonpolynomial.com>
+-#
+-# Redistribution and use is allowed according to the terms of the New BSD license.
+-#
+-# CMake-Modules Project New BSD License
+-#
+-# Redistribution and use in source and binary forms, with or without
+-# modification, are permitted provided that the following conditions are met:
+-#
+-# * Redistributions of source code must retain the above copyright notice, this
+-#   list of conditions and the following disclaimer.
+-#
+-# * Redistributions in binary form must reproduce the above copyright notice,
+-#   this list of conditions and the following disclaimer in the
+-#   documentation and/or other materials provided with the distribution.
+-#
+-# * Neither the name of the CMake-Modules Project nor the names of its
+-#   contributors may be used to endorse or promote products derived from this
+-#   software without specific prior written permission.
+-#
+-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+-# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+-#  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+-# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-#
+-
+-if (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
+-  # in cache already
+-  set(USB-1_FOUND TRUE)
+-else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
+-
+-  find_path(LIBUSB_1_INCLUDE_DIR
+-    NAMES
+-        libusb.h
+-    PATHS
+-      /usr/include
+-      /usr/include/libusb-1.0
+-      /usr/local/include
+-      /usr/local/include/libusb-1.0
+-      /opt/local/include
+-      /opt/local/include/libusb-1.0
+-      /sw/include
+-  )
+-
+-  find_library(LIBUSB_1_LIBRARY
+-    NAMES
+-      usb-1.0
+-    PATHS
+-      /usr/lib
+-      /usr/local/lib
+-      /opt/local/lib
+-      /sw/lib
+-  )
+-
+-  set(LIBUSB_1_INCLUDE_DIRS
+-    ${LIBUSB_1_INCLUDE_DIR}
+-  )
+-  set(LIBUSB_1_LIBRARIES
+-    ${LIBUSB_1_LIBRARY}
+-  )
+-
+-  if (LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES)
+-     set(USB-1_FOUND TRUE)
+-  else (LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES)
+-     find_package(PkgConfig)
+-     pkg_check_modules(LIBUSB_1 QUIET libusb-1.0)
+-     set(LIBUSB_1_DEFINITIONS ${LIBUSB_1_CFLAGS} ${LIBUSB_1_CFLAGS_OTHER})
+-  endif (LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES)
+-
+-  if (USB-1_FOUND)
+-    if (NOT USB-1_FIND_QUIETLY)
+-      message(STATUS "Found libusb-1.0:")
+-	  message(STATUS " - Includes: ${LIBUSB_1_INCLUDE_DIRS}")
+-	  message(STATUS " - Libraries: ${LIBUSB_1_LIBRARIES}")
+-    endif (NOT USB-1_FIND_QUIETLY)
+-    set(CMAKE_REQUIRED_INCLUDES ${LIBUSB_1_INCLUDE_DIRS})
+-    set(CMAKE_REQUIRED_LIBRARIES ${LIBUSB_1_LIBRARIES})
+-    if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+-      include (CheckCXXSourceCompiles)
+-      check_cxx_source_compiles("#include <libusb.h> 
+-        int main() { libusb_error_name(0); return 0; }" ERROR_NAME_COMPILE)
+-      if (NOT ERROR_NAME_COMPILE)
+-        add_definitions("-DNO_ERROR_NAME")
+-        message(STATUS " - 1.0.8 or older")
+-      endif (NOT ERROR_NAME_COMPILE)
+-    endif () 
+-  else (USB-1_FOUND)
+-    if (USB-1_FIND_REQUIRED)
+-      message(FATAL_ERROR "Could not find libusb-1.0. Please install libusb-1.0 along with the development package.")
+-    endif (USB-1_FIND_REQUIRED)
+-  endif (USB-1_FOUND)
+-
+-  # show the LIBUSB_1_INCLUDE_DIRS and LIBUSB_1_LIBRARIES variables only in the advanced view
+-  mark_as_advanced(LIBUSB_1_INCLUDE_DIRS LIBUSB_1_LIBRARIES)
+-
+-endif (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
+--- /dev/null
++++ b/cmake_modules/FindUSB1.cmake
+@@ -0,0 +1,83 @@
++# - Try to find libusb-1.0
++# Once done this will define
++#
++#  USB1_FOUND - system has libusb-1.0
++#  USB1_INCLUDE_DIRS - the libusb-1.0 include directories
++#  USB1_LIBRARIES - Link these to use libusb-1.0
++#  USB1_DEFINITIONS - Compiler switches required for using libusb-1.0
++#
++#  USB1_HAS_LIBUSB_ERROR_NAME - defined when libusb-1.0 has libusb_error_name()
++
++#=============================================================================
++# Copyright (c) 2017 Pino Toscano <toscano.pino at tiscali.it>
++#
++# Redistribution and use in source and binary forms, with or without
++# modification, are permitted provided that the following conditions
++# are met:
++#
++# 1. Redistributions of source code must retain the copyright
++#    notice, this list of conditions and the following disclaimer.
++# 2. Redistributions in binary form must reproduce the copyright
++#    notice, this list of conditions and the following disclaimer in the
++#    documentation and/or other materials provided with the distribution.
++# 3. The name of the author may not be used to endorse or promote products
++#    derived from this software without specific prior written permission.
++#
++# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++#=============================================================================
++
++find_package(PkgConfig)
++pkg_check_modules(PC_LIBUSB1 QUIET libusb-1.0)
++
++find_path(USB1_INCLUDE_DIR
++  NAMES
++    libusb.h
++  HINTS
++    ${PC_LIBUSB1_INCLUDE_DIRS}
++  PATH_SUFFIXES
++    libusb-1.0
++)
++
++find_library(USB1_LIBRARY
++  NAMES
++    ${PC_LIBUSB1_LIBRARIES}
++    usb-1.0
++  HINTS
++    ${PC_LIBUSB1_LIBRARY_DIRS}
++)
++
++set(USB1_INCLUDE_DIRS ${USB1_INCLUDE_DIR})
++set(USB1_LIBRARIES ${USB1_LIBRARY})
++
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(USB1
++  FOUND_VAR
++    USB1_FOUND
++  REQUIRED_VARS
++    USB1_LIBRARY
++    USB1_INCLUDE_DIR
++  VERSION_VAR
++    PC_LIBUSB1_VERSION
++)
++
++mark_as_advanced(USB1_INCLUDE_DIRS USB1_LIBRARIES)
++
++if(USB1_FOUND)
++  include(CheckCXXSourceCompiles)
++  include(CMakePushCheckState)
++  cmake_push_check_state(RESET)
++  set(CMAKE_REQUIRED_INCLUDES ${USB1_INCLUDE_DIRS})
++  set(CMAKE_REQUIRED_LIBRARIES ${USB1_LIBRARIES})
++  check_cxx_source_compiles("#include <libusb.h> 
++    int main() { libusb_error_name(0); return 0; }" USB1_HAS_LIBUSB_ERROR_NAME)
++  cmake_pop_check_state()
++endif()
+--- a/libindi/CMakeLists.txt
++++ b/libindi/CMakeLists.txt
+@@ -213,7 +213,7 @@ find_package(Threads REQUIRED)
+ find_package(ZLIB REQUIRED)
+ find_package(CFITSIO REQUIRED)
+ find_package(Nova REQUIRED)
+-find_package(USB-1 REQUIRED)
++find_package(USB1 REQUIRED)
+ find_package(CURL REQUIRED)
+ find_package(GSL REQUIRED)
+ # libjpeg for V4L2
+@@ -229,7 +229,7 @@ include_directories( ${CMAKE_CURRENT_SOU
+ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/libs/indibase)
+ include_directories( ${CFITSIO_INCLUDE_DIR})
+ include_directories( ${NOVA_INCLUDE_DIR})
+-include_directories( ${LIBUSB_1_INCLUDE_DIRS})
++include_directories( ${USB1_INCLUDE_DIRS})
+ include_directories( ${GSL_INCLUDE_DIRS})
+ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/libs/webcam)
+@@ -300,20 +300,20 @@ add_definitions(-U__STRICT_ANSI__)
+ find_package(Iconv REQUIRED)
+ add_library(indidriver STATIC ${indidriver_SRCS} ${hidapi_SRCS})
+ set_target_properties(indidriver PROPERTIES VERSION ${CMAKE_INDI_VERSION_STRING} SOVERSION ${INDI_SOVERSION} OUTPUT_NAME indidriver)
+-target_link_libraries(indidriver ${ICONV_LIBRARIES} ${LIBUSB_1_LIBRARIES} ${NOVA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CFITSIO_LIBRARIES} ${M_LIB} ${ZLIB_LIBRARY} ${JPEG_LIBRARY})
++target_link_libraries(indidriver ${ICONV_LIBRARIES} ${USB1_LIBRARIES} ${NOVA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CFITSIO_LIBRARIES} ${M_LIB} ${ZLIB_LIBRARY} ${JPEG_LIBRARY})
+ install(TARGETS indidriver ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ else()
+ ## Static indidriver Library
+ add_library(indidriverstatic STATIC ${indidriver_SRCS} ${libwebcam_SRCS} ${hidapi_SRCS})
+ set_target_properties(indidriverstatic PROPERTIES COMPILE_FLAGS "-fPIC")
+ set_target_properties(indidriverstatic PROPERTIES VERSION ${CMAKE_INDI_VERSION_STRING} SOVERSION ${INDI_SOVERSION} OUTPUT_NAME indidriver)
+-target_link_libraries(indidriverstatic ${LIBUSB_1_LIBRARIES} ${NOVA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CFITSIO_LIBRARIES} ${M_LIB} ${ZLIB_LIBRARY} ${JPEG_LIBRARY})
++target_link_libraries(indidriverstatic ${USB1_LIBRARIES} ${NOVA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CFITSIO_LIBRARIES} ${M_LIB} ${ZLIB_LIBRARY} ${JPEG_LIBRARY})
+ install(TARGETS indidriverstatic ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ ## Dynamic indidriver Library
+ add_library(indidriver SHARED ${indidriver_SRCS} ${libwebcam_SRCS} ${hidapi_SRCS})
+ set_target_properties(indidriver PROPERTIES COMPILE_FLAGS "-fPIC")
+ set_target_properties(indidriver PROPERTIES VERSION ${CMAKE_INDI_VERSION_STRING} SOVERSION ${INDI_SOVERSION} OUTPUT_NAME indidriver)
+-target_link_libraries(indidriver ${LIBUSB_1_LIBRARIES} ${NOVA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CFITSIO_LIBRARIES} ${M_LIB} ${ZLIB_LIBRARY} ${JPEG_LIBRARY})
++target_link_libraries(indidriver ${USB1_LIBRARIES} ${NOVA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CFITSIO_LIBRARIES} ${M_LIB} ${ZLIB_LIBRARY} ${JPEG_LIBRARY})
+ install(TARGETS indidriver LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ endif(CYGWIN)
+ 
+--- /dev/null
++++ b/libindi/config-usb.h.cmake
+@@ -0,0 +1,2 @@
++/* Define when libusb-1.0 has libusb_error_name() */
++#cmakedefine USB1_HAS_LIBUSB_ERROR_NAME
+--- a/libindi/libs/indibase/indiusbdevice.cpp
++++ b/libindi/libs/indibase/indiusbdevice.cpp
+@@ -23,7 +23,9 @@
+ 
+ #include <string.h>
+ 
+-#ifdef NO_ERROR_NAME
++#include <config-usb.h>
++
++#ifndef USB1_HAS_LIBUSB_ERROR_NAME
+ const char * LIBUSB_CALL libusb_error_name(int errcode)
+ {
+   static char buffer[30];

-- 
libindi packaging



More information about the pkg-kde-commits mailing list