commit aaff581644a7703964765923c2600f4a6c8a4d2a Author: Jakub Bogusz <qbo...@pld-linux.org> Date: Sun Dec 3 21:22:19 2017 +0100
- added i2c patch, enable linux-i2c driver using libi2c library nut-i2c.patch | 39 +++++++++++++++++++++++++++++++++++++++ nut.spec | 7 ++++++- 2 files changed, 45 insertions(+), 1 deletion(-) --- diff --git a/nut.spec b/nut.spec index 2446418..dced6f3 100644 --- a/nut.spec +++ b/nut.spec @@ -1,10 +1,10 @@ # TODO: -# - --with-linux-i2c (requires i2c-dev.h header with i2c_smbus_* inline functions) # - upsdrvctl (used by ups.init) doesn't recognize status and reload commands # # Conditional build: %bcond_without cgi # CGI support %bcond_without freeipmi # IPMI support +%bcond_without i2c # I2C support %bcond_without neon # neon based XML/HTTP driver %bcond_without powerman # PowerMan support %bcond_without snmp # SNMP driver @@ -31,6 +31,7 @@ Patch4: %{name}-matrix.patch Patch5: systemd-sysconfig.patch Patch6: bcmxcp-off-by-one.patch Patch7: %{name}-build.patch +Patch8: %{name}-i2c.patch URL: http://www.networkupstools.org/ BuildRequires: asciidoc >= 8.6.3 BuildRequires: autoconf >= 2.60 @@ -38,6 +39,7 @@ BuildRequires: automake BuildRequires: avahi-devel >= 0.6.30 %{?with_freeipmi:BuildRequires: freeipmi-devel} %{?with_cgi:BuildRequires: gd-devel >= 2.0.15} +%{?with_i2c:BuildRequires: libi2c-devel} BuildRequires: libltdl-devel BuildRequires: libstdc++-devel BuildRequires: libtool @@ -206,6 +208,7 @@ Statyczne biblioteki NUT-a. %patch5 -p1 %patch6 -p1 %patch7 -p1 +%patch8 -p1 %build %{__libtoolize} @@ -227,6 +230,7 @@ Statyczne biblioteki NUT-a. --with-cgi%{!?with_cgi:=no} \ --with-dev \ --with-ipmi%{!?with_freeipmi:=no} \ + --with-linux-i2c%{!?with_i2c:=no} \ --with-neon%{!?with_neon:=no} \ --with-openssl \ --with-powerman%{!?with_powerman:=no} \ @@ -371,6 +375,7 @@ fi %attr(755,root,root) /lib/nut/apcsmart %attr(755,root,root) /lib/nut/apcsmart-old %attr(755,root,root) /lib/nut/apcupsd-ups +%{?with_i2c:%attr(755,root,root) /lib/nut/asem} %attr(755,root,root) /lib/nut/bcmxcp %{?with_usb:%attr(755,root,root) /lib/nut/bcmxcp_usb} %attr(755,root,root) /lib/nut/belkin diff --git a/nut-i2c.patch b/nut-i2c.patch new file mode 100644 index 0000000..d7bb025 --- /dev/null +++ b/nut-i2c.patch @@ -0,0 +1,39 @@ +--- nut-2.7.4/configure.ac.orig 2017-12-03 20:59:45.766861382 +0100 ++++ nut-2.7.4/configure.ac 2017-12-03 21:04:32.550191441 +0100 +@@ -475,14 +475,7 @@ + if test "${nut_with_linux_i2c}" != no; then + case ${target_os} in + linux* ) +- AC_CHECK_DECLS( +- [i2c_smbus_read_word_data, i2c_smbus_write_word_data, i2c_smbus_read_block_data], +- [nut_with_linux_i2c="yes"], +- [nut_with_linux_i2c="no"], +- [#include <stdio.h> +- #include <linux/i2c-dev.h> +- ] +- ) ++ AC_CHECK_LIB([i2c], [i2c_smbus_read_word_data], [nut_with_linux_i2c="yes"], [nut_with_linux_i2c="no"]) + ;; + * ) + nut_with_linux_i2c="no" +--- nut-2.7.4/drivers/asem.c.orig 2015-12-29 13:08:34.000000000 +0100 ++++ nut-2.7.4/drivers/asem.c 2017-12-03 21:08:50.156855165 +0100 +@@ -35,6 +35,7 @@ + #include <errno.h> + #include <unistd.h> + #include <linux/i2c-dev.h> ++#include <i2c/smbus.h> + + #include "main.h" + +--- nut-2.7.4/drivers/Makefile.am.orig 2016-03-08 13:01:11.000000000 +0100 ++++ nut-2.7.4/drivers/Makefile.am 2017-12-03 21:16:08.973516822 +0100 +@@ -225,7 +225,7 @@ + macosx_ups_SOURCES = macosx-ups.c + + # Asem +-asem_LDADD = $(LDADD_DRIVERS) ++asem_LDADD = $(LDADD_DRIVERS) -li2c + asem_SOURCES = asem.c + + # nutdrv_qx USB/Serial ================================================================ ---- gitweb: http://git.pld-linux.org/gitweb.cgi/packages/nut.git/commitdiff/aaff581644a7703964765923c2600f4a6c8a4d2a _______________________________________________ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit