Name: i2c-tools Version: 4.1 Release: 1 Summary: A heterogeneous set of I2C tools for Linux License: GPLv2+ LGPLv2+ URL: https://i2c.wiki.kernel.org/index.php/I2C_Tools Source0: https://www.kernel.org/pub/software/utils/i2c-tools/%{name}-%{version}.tar.xz BuildRequires: perl-generators BuildRequires: python3-devel BuildRequires: gcc Requires: systemd-udev kmod Provides: libi2c%{?_isa} = %{version}-%{release} Obsoletes: libi2c Obsoletes: python2-i2c-tools %description This package contains a heterogeneous set of I2C tools for Linux: a bus probing tool, a chip dumper, register-level access helpers, EEPROM decoding scripts, and more. %package devel Summary: Development files for the I2C library License: LGPLv2+ Requires: libi2c%{?_isa} = %{version}-%{release} %description devel %{summary}. %package help Summary: i2c-tools help %description help %{summary}. %package eepromer Summary: Programs for reading / writing i2c / smbus eeproms # /usr/sbin/eeprom is Public Domain, the rest is GPLv2+ License: GPLv2+ and Public Domain # For the device nodes Requires: %{name} = %{version}-%{release} %description eepromer Programs for reading / writing i2c / smbus eeproms. Notice that writing the eeproms in your system is very dangerous and is likely to render your system unusable. Do not install, let alone use this, unless you really, _really_ know what you are doing. %package -n python3-i2c-tools Summary: Python 3 bindings for Linux SMBus access through i2c-dev License: GPLv2 %{?python_provide:%python_provide python3-i2c-tools} Requires: libi2c%{?_isa} = %{version}-%{release} %description -n python3-i2c-tools Python 3 bindings for Linux SMBus access through i2c-dev %package perl Summary: i2c tools written in Perl License: GPLv2+ Requires: libi2c%{?_isa} = %{version}-%{release} %description perl A collection of tools written in perl for use with i2c devices. #Build sections %prep %autosetup -n %{name}-%{version} -p1 %build make CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" BUILD_STATIC_LIB=0 EXTRA=eeprog pushd eepromer make CFLAGS="$RPM_OPT_FLAGS -I../include" LDFLAGS="$RPM_LD_FLAGS" popd pushd py-smbus CFLAGS="$RPM_OPT_FLAGS -I../include" LDFLAGS="$RPM_LD_FLAGS" \ %{__python3} setup.py build -b build-py3 popd %install %make_install PREFIX=%{_prefix} BUILD_STATIC_LIB=0 \ EXTRA=eeprog libdir=%{_libdir} install -m 755 eepromer/{eepromer,eeprom} \ $RPM_BUILD_ROOT%{_sbindir} install -m 644 eepromer/{eepromer,eeprom}.8 \ $RPM_BUILD_ROOT%{_mandir}/man8 # Rename README file mv eepromer/README eepromer/README.programs mv py-smbus/README py-smbus/README.py mv eeprom/README eeprom/README.perl pushd py-smbus %{__python3} setup.py build -b build-py3 install --skip-build --root=$RPM_BUILD_ROOT popd # cleanup rm -f $RPM_BUILD_ROOT%{_bindir}/decode-edid.pl # Remove unpleasant DDC tools. KMS already exposes the EDID block in sysfs, # and edid-decode is a more complete tool than decode-edid. rm -f $RPM_BUILD_ROOT%{_bindir}/{ddcmon,decode-edid} # for i2c-dev ondemand loading through kmod mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d echo "alias char-major-89-* i2c-dev" > \ $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/i2c-dev.conf # for /dev/i2c-# creation (which are needed for kmod i2c-dev autoloading) mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/udev/makedev.d for (( i = 0 ; i < 8 ; i++ )) do echo "i2c-$i" >> $RPM_BUILD_ROOT%{_sysconfdir}/udev/makedev.d/99-i2c-dev.nodes done # auto-load i2c-dev after reboot mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modules-load.d echo 'i2c-dev' > $RPM_BUILD_ROOT%{_prefix}/lib/modules-load.d/%{name}.conf #Install and uninstall scripts %post # load i2c-dev after the first install if [ "$1" = 1 ] ; then /usr/sbin/modprobe i2c-dev fi exit 0 %ldconfig_post -n libi2c %ldconfig_postun -n libi2c %files %license COPYING COPYING.LGPL %config(noreplace) %{_sysconfdir}/modprobe.d/i2c-dev.conf %config(noreplace) %{_sysconfdir}/udev/makedev.d/99-i2c-dev.nodes %{_prefix}/lib/modules-load.d/%{name}.conf %{_sbindir}/i2c* %exclude %{_sbindir}/i2c-stub* %{_libdir}/libi2c.so.0* %files devel %dir %{_includedir}/i2c %{_includedir}/i2c/smbus.h %{_libdir}/libi2c.so %files help %{_mandir}/man8/i2c*.8.gz %{_mandir}/man8/eepro*.8.gz %{_mandir}/man1/decode-*.1.gz %doc CHANGES README %doc eepromer/README* %doc eeprog/README.eeprog %doc py-smbus/README.py %doc eeprom/README.perl %files eepromer %{_sbindir}/eepro* %files -n python3-i2c-tools %{python3_sitearch}/* %files perl %{_bindir}/decode-* %{_sbindir}/i2c-stub* %changelog * Fri Jan 3 2020 openEuler Buildteam - 4.1-1 - Upgrade to Version 4.1 * Wed Sep 19 2018 openEuler Buildteam - 4.0-12 - Package init