# The following tag is to get correct syntax highlighting for this file in vim text editor
# vim: syntax=spec

Name:       system76-io-dkms
Version:    1.0.4
Release:    2
Summary:    system76-io-dkms 
License:    GPLv3
URL:        https://github.com/pop-os/system76-io-dkms

# Detailed information about the source Git repository and the source commit
# for the created rpm package
VCS:        git+git@github.com:szydell/system76-io-dkms.git#a2cae563f671ad58641b20a9be16af0b65c4a7cb:

# git_dir_pack macro places the repository content (the source files) into a tarball
# and returns its filename. The tarball will be used to build the rpm.
Source:     system76-io-dkms-a2cae563.tar.gz

#Packages required for build
#BuildRequires: dbus-devel

#Packages required to work
Requires: dkms
Requires: kernel-devel

# More detailed description of the package
%description
System76 IO DKMS (Dynamic Kernel Module Support)
-----
 DKMS driver for controlling System76 IO Board.
 The module is rebuilt through the DKMS system when a new kernel or module
 become available.
 
%define debug_package %{nil}

#--
%prep
%setup -T -b 0 -q -n system76-io-dkms

%install
install -D -m 0644 *.c -t "%{buildroot}%{_usrsrc}/system76-io-0.2.git.27.a2cae563/"
install -m 0644 Makefile -t "%{buildroot}%{_usrsrc}/system76-io-0.2.git.27.a2cae563/"
install -m 0644 debian/system76-io-dkms.dkms "%{buildroot}%{_usrsrc}/system76-io-0.2.git.27.a2cae563/dkms.conf"

# do after installation
%post
sed -i 's/PACKAGE_VERSION="#MODULE_VERSION#"/PACKAGE_VERSION="0.2.git.27.a2cae563"/g' %{_usrsrc}/system76-io-0.2.git.27.a2cae563/dkms.conf

/usr/bin/env dkms add -m system76-io -v 0.2.git.27.a2cae563 --rpm_safe_upgrade
/usr/bin/env dkms build -m system76-io -v 0.2.git.27.a2cae563
/usr/bin/env dkms install -m system76-io -v 0.2.git.27.a2cae563 --force

# do before uninstallation
%preun
/usr/bin/env rmmod system76-io || : 
/usr/bin/env dkms remove -m system76-io -v 0.2.git.27.a2cae563 --all --rpm_safe_upgrade || :

# do after uninstallation, bugfix
%postun
rm -rfv /var/lib/dkms/system76-io/0.2.git.27.a2cae563

# Those files will be in the rpm
%files
%{_usrsrc}/system76-io-0.2.git.27.a2cae563

# Changelog
%changelog
* Tue Nov 19 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.4-1
- bump Version to: 1.0.4-1
- fetch upstream
- 1.0.4: Build for arm64

* Thu Feb 15 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.3-4
Rebuild for F40
- bump Version to: 1.0.3-4

* Wed Feb 14 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.3-3
test build to check epel+rhel9
- bump Version to: 1.0.3-3

* Wed Feb 14 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.3-2
- bump Version to: 1.0.3-2
- fetch upstream
- Add dh-sequence-dkms to fix 24.04 build

* Sun Nov 26 2023 Marcin Szydelski <marcin@szydelscy.pl> 1.0.3-1
- bump Version to: 1.0.3-1
- Merge branch 'pop-os:master' into master
- Add thelio-io-2 support (#12)
- readme: Use more proper grammar for complete sentence
- Explain where Thelio Io board is used

* Tue May 23 2023 Marcin Szydelski <marcin@szydelscy.pl> 1.0.2-3
- bump Version to: 1.0.2-3

* Tue Mar 07 2023 Marcin Szydelski <marcin@szydelscy.pl> 1.0.2-2
- bump Version to: 1.0.2-2

* Thu Jul 21 2022 Marcin Szydelski <marcin@szydelscy.pl> 1.0.2-1
- bump Version to: 1.0.2-1
- publish version
- Merge branch 'pop-os:master' into master
- Update changelog
- Fix GCC unused-function error
- Fix GCC declaration-after-statement error
- Merge pull request #1 from pop-os/master
- Make initramfs hook executable

* Sun Feb 23 2020 Marcin Szydelski <marcin@szydelscy.pl> 0.2-1
just a tag bump

* Tue Dec 03 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.1-1
- rpm spec init
- Update changelog
- Add mutexes
- Increase buffer size to 32
- Return length of received revision
- Add support for reading revision
- Remove third fan
- 1.0.0
- Update name to bootloader
- Add bootloader support
- Add boot command
- Add retry
- Add suspend command support
- Add license
- Create README.md
- Update PID and VID
- Fix conversion to Io fan units
- Complete implementation of current control items
- Fix interface
- Remove dead code
- Major refactor and implementation of USB protocol
- Only match first interface
- Fix issues with registering hwmon device
- Use interface device for hwmon
- Add hwmon stubs
- init