package/libftdi1: new package

This version of libftdi can coexists beside the 0.x version.

Signed-off-by: Daniel Sangue <daniel.sangue@sangue.ch>
[Samuel Martin:
  - libftdi1.mk: bump to version 1.2 and add hash
  - cleanup uneeded libusb-compat stuff
  - Config.in: add comment when ftdipp1 deps are not met
  - fix typos in variable names and legit CMake options for *_CONF_OPTS
  - add support for python bindings and ftdi_eeprom
  - fix static build
  - fix build with toolchain w/o C++ support
]
Signed-off-by: Samuel Martin <s.martin49@gmail.com>

[Thomas:
 - reorder Config.in option properties: first the "bool" property,
   then the "selects", then the "depends on".
 - remove "thread" dependency from the libftdipp1 comment since the
   whole package can anyway not be selected if there's no thread
   support.
 - fix a big mistake in the .mk file:
    $(if BR2_PACKAGE_PYTHON,python,python3)
   replaced by:
    $(if $(BR2_PACKAGE_PYTHON),python,python3)
 - add license information.]

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
Daniel Sangue 2015-03-08 12:26:02 +01:00 committed by Thomas Petazzoni
parent da489487d7
commit 2620a1ac2d
7 changed files with 255 additions and 0 deletions

View File

@ -756,6 +756,7 @@ menu "Hardware handling"
source "package/libcec/Config.in"
source "package/libfreefare/Config.in"
source "package/libftdi/Config.in"
source "package/libftdi1/Config.in"
source "package/libhid/Config.in"
source "package/libiio/Config.in"
source "package/libinput/Config.in"

View File

@ -0,0 +1,96 @@
From 7e57ff280b55b45e74329b9988279e8831d32eab Mon Sep 17 00:00:00 2001
From: Samuel Martin <s.martin49@gmail.com>
Date: Sun, 25 Jan 2015 09:45:04 +0100
Subject: [PATCH 1/2] cmake: use the standard CMake flag to drive the shared
object build
Remove the STATICLIBS CMake option (and the code handling it) and let
the standard CMake flags drive the shared object build.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
CMakeLists.txt | 2 --
ftdipp/CMakeLists.txt | 15 +--------------
src/CMakeLists.txt | 13 +------------
3 files changed, 2 insertions(+), 28 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 74f80f4..0ba0b08 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,8 +46,6 @@ set(CPACK_COMPONENT_SHAREDLIBS_GROUP "Development")
set(CPACK_COMPONENT_STATICLIBS_GROUP "Development")
set(CPACK_COMPONENT_HEADERS_GROUP "Development")
-option ( STATICLIBS "Build static libraries" ON )
-
# guess LIB_SUFFIX, don't take debian multiarch into account
if ( NOT DEFINED LIB_SUFFIX )
if( CMAKE_SYSTEM_NAME MATCHES "Linux"
diff --git a/ftdipp/CMakeLists.txt b/ftdipp/CMakeLists.txt
index 7500211..27e7884 100644
--- a/ftdipp/CMakeLists.txt
+++ b/ftdipp/CMakeLists.txt
@@ -23,8 +23,7 @@ if (FTDIPP)
set(FTDI_BUILD_CPP True PARENT_SCOPE)
message(STATUS "Building libftdi1++")
- # Shared library
- add_library(ftdipp1 SHARED ${cpp_sources})
+ add_library(ftdipp1 ${cpp_sources})
math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases
set_target_properties(ftdipp1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 2)
@@ -41,18 +40,6 @@ if (FTDIPP)
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
)
-
- # Static library
- if ( STATICLIBS )
- add_library(ftdipp1-static STATIC ${cpp_sources})
- set_target_properties(ftdipp1-static PROPERTIES OUTPUT_NAME "ftdipp1")
- set_target_properties(ftdipp1-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
-
- install ( TARGETS ftdipp1-static
- ARCHIVE DESTINATION lib${LIB_SUFFIX}
- COMPONENT staticlibs
- )
- endif ()
install ( FILES ${cpp_headers}
DESTINATION include/${PROJECT_NAME}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9fd86a6..501d4a8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -21,7 +21,7 @@ configure_file(ftdi_version_i.h.in "${CMAKE_CURRENT_BINARY_DIR}/ftdi_version_i.h
set(c_sources ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.c ${CMAKE_CURRENT_SOURCE_DIR}/ftdi_stream.c CACHE INTERNAL "List of c sources" )
set(c_headers ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.h CACHE INTERNAL "List of c headers" )
-add_library(ftdi1 SHARED ${c_sources})
+add_library(ftdi1 ${c_sources})
math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases
set_target_properties(ftdi1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 2)
@@ -38,17 +38,6 @@ install ( TARGETS ftdi1
ARCHIVE DESTINATION lib${LIB_SUFFIX}
)
-if ( STATICLIBS )
- add_library(ftdi1-static STATIC ${c_sources})
- target_link_libraries(ftdi1-static ${LIBUSB_LIBRARIES})
- set_target_properties(ftdi1-static PROPERTIES OUTPUT_NAME "ftdi1")
- set_target_properties(ftdi1-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
- install ( TARGETS ftdi1-static
- ARCHIVE DESTINATION lib${LIB_SUFFIX}
- COMPONENT staticlibs
- )
-endif ()
-
install ( FILES ${c_headers}
DESTINATION include/${PROJECT_NAME}
COMPONENT headers
--
2.2.2

View File

@ -0,0 +1,34 @@
From 81275d75ae88fe8ab1915d3ba260ea935e63c362 Mon Sep 17 00:00:00 2001
From: Samuel Martin <s.martin49@gmail.com>
Date: Sun, 25 Jan 2015 10:01:17 +0100
Subject: [PATCH 2/2] cmake: fix FindUSB1.cmake
Make sure all ldflags are correctly set, especially for static build.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
cmake/FindUSB1.cmake | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/cmake/FindUSB1.cmake b/cmake/FindUSB1.cmake
index b90e297..e7f1b3c 100644
--- a/cmake/FindUSB1.cmake
+++ b/cmake/FindUSB1.cmake
@@ -26,8 +26,12 @@ else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
PATH_SUFFIXES libusb-1.0
PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS})
- FIND_LIBRARY(LIBUSB_LIBRARIES NAMES usb-1.0
- PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
+ set(LIBUSB_LIBRARIES ${PC_LIBUSB_STATIC_LDFLAGS} ${PC_LIBUSB_STATIC_LDFLAGS_OTHER})
+ foreach(libname ${PC_LIBUSB_STATIC_LIBRARIES})
+ FIND_LIBRARY(lib NAMES ${libname}
+ PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS})
+ list(APPEND LIBUSB_LIBRARIES ${lib})
+ endforeach()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR)
--
2.2.2

View File

@ -0,0 +1,46 @@
From c215d5ecd985b57700e817920d0e99112b4a571b Mon Sep 17 00:00:00 2001
From: Samuel Martin <s.martin49@gmail.com>
Date: Sun, 25 Jan 2015 13:35:24 +0100
Subject: [PATCH] cmake: do not check for g++ when FTDIPP is disabled
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
CMakeLists.txt | 6 ++++--
ftdipp/CMakeLists.txt | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0ba0b08..e880211 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
# Project
-project(libftdi1)
+project(libftdi1 C)
set(MAJOR_VERSION 1)
set(MINOR_VERSION 2)
set(PACKAGE libftdi1)
@@ -145,7 +145,9 @@ else(DOCUMENTATION AND DOXYGEN_FOUND)
endif(DOCUMENTATION AND DOXYGEN_FOUND)
add_subdirectory(src)
-add_subdirectory(ftdipp)
+if(FTDIPP)
+ add_subdirectory(ftdipp)
+endif()
add_subdirectory(python)
add_subdirectory(ftdi_eeprom)
add_subdirectory(examples)
diff --git a/ftdipp/CMakeLists.txt b/ftdipp/CMakeLists.txt
index 27e7884..2d080f4 100644
--- a/ftdipp/CMakeLists.txt
+++ b/ftdipp/CMakeLists.txt
@@ -1,4 +1,5 @@
# Check
+project(libftdipp1 C CXX)
set(FTDI_BUILD_CPP False PARENT_SCOPE)
option ( FTDIPP "Build C++ binding library libftdi1++" ON )
--
2.2.2

View File

@ -0,0 +1,37 @@
config BR2_PACKAGE_LIBFTDI1
bool "libftdi1"
select BR2_PACKAGE_LIBUSB
depends on BR2_TOOLCHAIN_HAS_THREADS # libusb
help
Userspace access to FTDI USB interface chips (version 1.x)
http://www.intra2net.com/en/developer/libftdi/index.php
if BR2_PACKAGE_LIBFTDI1
config BR2_PACKAGE_LIBTFDI1_LIBFTDIPP1
bool "libfdtipp1"
select BR2_PACKAGE_BOOST
depends on BR2_INSTALL_LIBSTDCPP # boost
depends on BR2_LARGEFILE # boost
depends on BR2_TOOLCHAIN_HAS_THREADS # boost
help
C++ bindings for libftdi
comment "libfdtipp1 needs a toolchain w/ C++, largefile"
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_LARGEFILE
config BR2_PACKAGE_LIBTFDI1_PYTHON_BINDINGS
bool "python bindings"
depends on BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3
help
Python bindings for libftdi
config BR2_PACKAGE_LIBTFDI1_FDTI_EEPROM
select BR2_PACKAGE_LIBCONFUSE
bool "ftdi_eeprom tool"
endif # BR2_PACKAGE_LIBFTDI1
comment "libftdi1 needs a toolchain w/ threads"
depends on !BR2_TOOLCHAIN_HAS_THREADS

View File

@ -0,0 +1,2 @@
# Locally computed (after checking the signature from http://www.intra2net.com/en/developer/libftdi/download.php)
sha256 a6ea795c829219015eb372b03008351cee3fb39f684bff3bf8a4620b558488d6 libftdi1-1.2.tar.bz2

View File

@ -0,0 +1,39 @@
################################################################################
#
# libftdi1
#
################################################################################
LIBFTDI1_VERSION = 1.2
LIBFTDI1_SOURCE = libftdi1-$(LIBFTDI1_VERSION).tar.bz2
LIBFTDI1_SITE = http://www.intra2net.com/en/developer/libftdi/download/
LIBFTDI1_INSTALL_STAGING = YES
LIBFTDI1_DEPENDENCIES = libusb
LIBFTDI1_LICENSE = LGPLv2 (libftdi1), GPLv2 with exception (ftdipp1)
LIBFTDI1_LICENSE_FILES = LICENSE COPYING.GPL COPYING.LIB
LIBFTDI1_CONF_OPTS = -DDOCUMENTATION=OFF -DEXAMPLES=OFF
ifeq ($(BR2_PACKAGE_LIBTFDI1_LIBFTDIPP1),y)
LIBFTDI1_DEPENDENCIES += boost
LIBFTDI1_CONF_OPTS += -DFTDIPP=ON
else
LIBFTDI1_CONF_OPTS += -DFTDIPP=OFF
endif
ifeq ($(BR2_PACKAGE_LIBTFDI1_PYTHON_BINDINGS),y)
LIBFTDI1_DEPENDENCIES += $(if $(BR2_PACKAGE_PYTHON),python,python3) host-swig
LIBFTDI1_CONF_OPTS += -DPYTHON_BINDINGS=ON
else
LIBFTDI1_CONF_OPTS += -DPYTHON_BINDINGS=OFF
endif
ifeq ($(BR2_PACKAGE_LIBTFDI1_FDTI_EEPROM),y)
# ftdi_eeprom optionally depends on libintl, so make sure gettext is built
# _before_ libfitdi1 when gettext is enbaled.
LIBFTDI1_DEPENDENCIES += libconfuse $(if $(BR2_PACKAGE_GETTEXT),gettext)
LIBFTDI1_CONF_OPTS += -DFTDI_EEPROM=ON
else
LIBFTDI1_CONF_OPTS += -DFTDI_EEPROM=OFF
endif
$(eval $(cmake-package))