diff --git a/libiio-gh545.patch b/libiio-gh545.patch new file mode 100644 index 0000000..747e7e7 --- /dev/null +++ b/libiio-gh545.patch @@ -0,0 +1,51 @@ +From 5c86f76a143523398823766a918bd5a64c0b325e Mon Sep 17 00:00:00 2001 +From: "Travis F. Collins" +Date: Mon, 8 Jun 2020 09:22:44 -0700 +Subject: [PATCH] Add support for DESTDIR for python builds + +This fixes #545 when running `make DESTDIR=./some/folder install`. If +DESTDIR is set we will try to find the library in that path. + +Signed-off-by: Travis F. Collins +--- + bindings/python/setup.py.cmakein | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/bindings/python/setup.py.cmakein b/bindings/python/setup.py.cmakein +index 26ba8aed..dd40c11c 100644 +--- a/bindings/python/setup.py.cmakein ++++ b/bindings/python/setup.py.cmakein +@@ -35,6 +35,15 @@ except: + long_description = description + + ++def find_recursive(folder, filename): ++ import os ++ ++ for root, dirs, files in os.walk(folder): ++ for file in files: ++ if file == filename: ++ return os.path.join(root, file) ++ ++ + class InstallWrapper(install): + """Before installing we check if the + libiio library is actually installed""" +@@ -55,7 +64,15 @@ class InstallWrapper(install): + # Non-windows, possibly Posix system + _iiolib = "iio" + try: +- _lib = _cdll(find_library(_iiolib), use_errno=True, use_last_error=True) ++ import os ++ ++ destdir = os.getenv("DESTDIR", "") ++ if destdir: ++ destdir = os.path.join("${CMAKE_BINARY_DIR}", destdir) ++ out = find_recursive(destdir, "libiio.so") ++ _lib = _cdll(out, use_errno=True, use_last_error=True) ++ else: ++ _lib = _cdll(find_library(_iiolib), use_errno=True, use_last_error=True) + if not _lib._name: + raise OSError + except OSError: + diff --git a/libiio-gh547.patch b/libiio-gh547.patch new file mode 100644 index 0000000..5817222 --- /dev/null +++ b/libiio-gh547.patch @@ -0,0 +1,45 @@ +From 192fa42af6508d13149a2f7ccdf27c3438692d21 Mon Sep 17 00:00:00 2001 +From: "Travis F. Collins" +Date: Mon, 8 Jun 2020 11:44:48 -0700 +Subject: [PATCH] Enable pydoc to be built without library installed + +This fixes some pathing issues with the sphinx doc that previously +required the library to be installed before sphinx doc could be +correctly built. This fixes #547 + +Signed-off-by: Travis F. Collins +--- + bindings/python/CMakeLists.txt | 3 ++- + bindings/python/setup.py.cmakein | 4 ++-- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt +index 0d899cb3..21b2d191 100644 +--- a/bindings/python/CMakeLists.txt ++++ b/bindings/python/CMakeLists.txt +@@ -43,7 +43,8 @@ if(WITH_DOC) + ${CMAKE_CURRENT_SOURCE_DIR}/doc/conf.py.in + ${CMAKE_CURRENT_SOURCE_DIR}/doc/conf.py) + add_custom_command(TARGET libiio-py POST_BUILD +- COMMAND ${SPHINX_EXECUTABLE} ++ COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_BINARY_DIR}" ++ ${SPHINX_EXECUTABLE} + -b html + -n + -c ${CMAKE_CURRENT_SOURCE_DIR}/doc +diff --git a/bindings/python/setup.py.cmakein b/bindings/python/setup.py.cmakein +index dd40c11c..cd14e2e9 100644 +--- a/bindings/python/setup.py.cmakein ++++ b/bindings/python/setup.py.cmakein +@@ -69,8 +69,8 @@ class InstallWrapper(install): + destdir = os.getenv("DESTDIR", "") + if destdir: + destdir = os.path.join("${CMAKE_BINARY_DIR}", destdir) +- out = find_recursive(destdir, "libiio.so") +- _lib = _cdll(out, use_errno=True, use_last_error=True) ++ fulllibpath = find_recursive(destdir, "libiio.so") ++ _lib = _cdll(fulllibpath, use_errno=True, use_last_error=True) + else: + _lib = _cdll(find_library(_iiolib), use_errno=True, use_last_error=True) + if not _lib._name: + diff --git a/libiio.spec b/libiio.spec index 61865a7..b5076d6 100644 --- a/libiio.spec +++ b/libiio.spec @@ -1,10 +1,12 @@ Name: libiio -Version: 0.19 -Release: 2%{?dist} +Version: 0.20 +Release: 1%{?dist} Summary: Library for Industrial IO License: LGPLv2 URL: https://analogdevicesinc.github.io/libiio/ Source0: https://github.com/analogdevicesinc/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Patch0: libiio-gh545.patch +Patch1: libiio-gh547.patch BuildRequires: bison BuildRequires: cmake @@ -17,6 +19,8 @@ BuildRequires: libusbx-devel BuildRequires: libxml2-devel BuildRequires: python3-devel BuildRequires: python3-setuptools +BuildRequires: python3-sphinx +BuildRequires: python3-sphinx_rtd_theme %description Library for interfacing with Linux IIO devices @@ -59,7 +63,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release} Python 3 bindings for Industrial IO %prep -%setup -q +%autosetup -p1 sed -i 's/${LIBIIO_VERSION_MAJOR}-doc//' CMakeLists.txt %build @@ -97,6 +101,9 @@ find %{buildroot} -name '*.la' -delete %{python3_sitelib}/libiio* %changelog +* Sat Jun 06 2020 Peter Robinson - 0.20-1 +- Update to 0.20 + * Tue May 26 2020 Miro HronĨok - 0.19-2 - Rebuilt for Python 3.9 diff --git a/sources b/sources index 10a2621..8657004 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libiio-0.19.tar.gz) = c904f517f95919caeedc0d1ddf80003233df2296364771216ef853d3b92f273ae7cdf4e7f972fa88f1483b25e762f749efe5117fa3f2b026b3adc5c5ab403b0a +SHA512 (libiio-0.20.tar.gz) = 2b6ef9f67642db4b06ba33f5c5b7b3fa3043c8963185c138e9946e01aaa790ad1453f3f522af18c4526da2b087752ec686228705d1a312e6b99146ded38b943e