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

Name:       system76-dkms
Version:    1.0.17
Release:    1
Summary:    system76-dkms 
License:    GPLv3
URL:        https://github.com/pop-os/system76-dkms

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

# 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-dkms-82d1bf5e.tar.gz

#Packages required for build
#BuildRequires: dbus-devel

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

# More detailed description of the package
%description
System76 DKMS (Dynamic Kernel Module Support)
-----
 This DKMS driver provides airplane mode, keyboard backlight, and fan support
 for System76 laptops.
 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-dkms

%install
install -D -m 0644 *.c -t "%{buildroot}%{_usrsrc}/system76-0.23.git.35.82d1bf5e/"
install -m 0644 Makefile -t "%{buildroot}%{_usrsrc}/system76-0.23.git.35.82d1bf5e/"
install -m 0644 debian/system76-dkms.dkms "%{buildroot}%{_usrsrc}/system76-0.23.git.35.82d1bf5e/dkms.conf"

# do after installation
%post
sed -i 's/PACKAGE_VERSION="#MODULE_VERSION#"/PACKAGE_VERSION="0.23.git.35.82d1bf5e"/g' %{_usrsrc}/system76-0.23.git.35.82d1bf5e/dkms.conf
# change module id also in C code.
sed -i 's/MODULE_VERSION("\(.*\)");/MODULE_VERSION("\1-0.23.git.35.82d1bf5e");/g' %{_usrsrc}/system76-0.23.git.35.82d1bf5e/system76.c

/usr/bin/env dkms add -m system76 -v 0.23.git.35.82d1bf5e --rpm_safe_upgrade
/usr/bin/env dkms build -m system76 -v 0.23.git.35.82d1bf5e
/usr/bin/env dkms install -m system76 -v 0.23.git.35.82d1bf5e --force

# do before uninstallation
%preun
/usr/bin/env rmmod system76 || : 
/usr/bin/env dkms remove -m system76 -v 0.23.git.35.82d1bf5e --all --rpm_safe_upgrade || :

# do after uninstallation, bugfix
%postun
rm -rfv /var/lib/dkms/system76/0.23.git.35.82d1bf5e

# Those files will be in the rpm
%files
%{_usrsrc}/system76-0.23.git.35.82d1bf5e

# Changelog
%changelog
* Sat Dec 28 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.17-1
- bump Version to: 1.0.17-1
- fetch upstream
- 1.0.17

* Wed Dec 18 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.16-3
- bump Version to: 1.0.16-3

* Wed Dec 18 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.16-2
- bump Version to: 1.0.16-2
- fetch upstream
- .gitignore: ignore files generated by make
- Fix building on Linux 6.12

* Thu Oct 17 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.16-1
- bump Version to: 1.0.16-1
- fetch upstream
- 1.0.16
- Condionally returns void
- led: Notify on color change
- Add bonw15-b

* Wed Jul 31 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.15-2
- bump Version to: 1.0.15-2

* Thu Jul 18 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.15-1
- bump Version to: 1.0.15-1
- fetch upstream
- Re-add bonw13 to legacy DMI table

* Thu Feb 15 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.14-10
rebuild for F40
- bump Version to: 1.0.14-10

* Wed Feb 14 2024 Marcin Szydelski <marcin@szydelscy.pl> 1.0.14-9
try to build for epel9
- bump Version to: 1.0.14-9

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

* Sun Nov 26 2023 Marcin Szydelski <marcin@szydelscy.pl> 1.0.14-7
- bump Version to: 1.0.14-7

* Sun Nov 26 2023 Marcin Szydelski <marcin@szydelscy.pl> 1.0.14-6
- bump Version to: 1.0.14-6
- Merge branch 'pop-os:master' into master
- Update debian/compat version

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

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

* Sat Aug 13 2022 Marcin Szydelski <marcin@szydelscy.pl> 1.0.14-3
- bump Version to: 1.0.14-3

* Tue Jul 26 2022 Marcin Szydelski <marcin@szydelscy.pl> 1.0.14-2
- bump Version to: 1.0.14-2
- Require openssl

* Thu Jul 21 2022 Marcin Szydelski <marcin@szydelscy.pl> 1.0.14-1
- bump Version to: 1.0.14-1
- package number

* Wed Feb 02 2022 Marcin Szydelski <marcin@szydelscy.pl> 0.23-1
- Merge branch 'pop-os:master' into master
- Add kudu6

* Thu Sep 16 2021 Marcin Szydelski <marcin@szydelscy.pl> 0.22-1
- Merge branch 'pop-os:master' into master
- 1.0.13 - Add pang11
- Merge branch 'pop-os:master' into master
- galp2/3, bonw13: Remove unnecessary functions
- Remove DMI_TABLE_LEGACY
- Fix module load on galp3
- Fix serval keyboard backlights
- Merge pull request #18 from pop-os/master
- Make initramfs hook executable

* Sat Jan 16 2021 Marcin Szydelski <marcin@szydelscy.pl> 0.21-1
- Merge pull request #17 from pop-os/master
- Use WMI event for airplane mode on pang10
- Do not access NV device if not present

* Fri Nov 27 2020 Marcin Szydelski <marcin@szydelscy.pl> 0.20-1
- Merge pull request #16 from pop-os/master
- Fix ignored error when creating polling task
- 1.0.11 - Use WMI event for airplane mode on serw12

* Sat Nov 21 2020 Marcin Szydelski <marcin@szydelscy.pl> 0.19-1
- Merge pull request #15 from pop-os/master
- 1.0.10 - Add pang10

* Mon Aug 24 2020 Marcin Szydelski <marcin@szydelscy.pl> 0.18-1
- Merge pull request #14 from pop-os/master
- Fixed 'Section mismatch in reference' warnings in GCC 10

* Tue Jun 30 2020 Marcin Szydelski <marcin@szydelscy.pl> 0.17-1
- Merge pull request #13 from pop-os/master
- Add oryp6

* Mon Apr 27 2020 Marcin Szydelski <marcin@szydelscy.pl> 0.16-1
- Merge pull request #12 from pop-os/master
- 1.0.8 - add addw2 and gaze15

* Fri Apr 17 2020 Marcin Szydelski <marcin@szydelscy.pl> 0.15-1
- Merge pull request #11 from pop-os/master
- 1.0.7 - Add serw12

* Tue Nov 05 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.14-1
- error on uninstall

* Fri Sep 20 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.13-1
- Merge pull request #10 from pop-os/master
- Fixed indentation error
- Added darp6 and galp4

* Tue Aug 06 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.12-1
- Merge branch 'master' of github.com:szydell/system76-dkms
- Merge pull request #9 from pop-os/master
- Add DRIVER_KB_LED to darp5

* Mon Aug 05 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.11-1
- next rm test
- next rm test
- next rm test
- cleaning test
- Merge pull request #8 from pop-os/master
- Add OLED support

* Tue Jul 02 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.10-1
- Merge pull request #7 from pop-os/master
- addp1 -> addw1
- Add addp1

* Tue Jun 04 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.9-1
- Merge pull request #6 from pop-os/master
- Disable hwmon driver for gaze14

* Wed May 08 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.8-1
- Merge pull request #5 from pop-os/master
- Add gaze14 with color keyboard and airplane mode serviced by Intel HID
- repos
- secondary repo

* Mon Apr 08 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.7-1
- Merge pull request #4 from pop-os/master
- Fix darp5 keyboard type

* Thu Apr 04 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.6-1
- Merge pull request #3 from pop-os/master
- Make oryp5 use HID airplane mode driver
- Add methods to disable unused driver functionality per model
- Update the way touchpad is handled to use events from PS/2 instead of WMI

* Tue Mar 05 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.5-1
- Readme
- Add serw11-b
- Create LICENSE
- Create README.md
- Add oryp5

* Sat Feb 09 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.4-1
- added rmmod to preun
- Remove initram part, add rpm_safe_upgrade to dkms, remove quiet in dkms

* Thu Feb 07 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.3-1
- dkms quiet
- rmdir fix

* Wed Jan 09 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.2-1
- rmdir and dkms sanity checks works fine
- Repair module number in system76.c to pass 'Running module version sanity
check.' in dkms
- remove empty directory in /usr/src after uninstall
- Merge pull request #1 from pop-os/master
- COPR path
- +dkms buid, install. +requires kernel-devel
- Merge branch 'master' of github.com:szydell/system76-dkms
- +dkms buid, install. +requires kernel-devel
- %%if dkms exists
- Add darp5

* Mon Jan 07 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.1-1
- copr status bar
- init rpm spec file
- Create README.md
- Add galp3-c
- Add galp3
- Merge pull request #16 from pop-os/less-logging
- Reduce logging by identifying debug log messages correctly
- Add bonw13 support
- Reset touchpad lock on resume
- Fix dmi check logic
- Begin matching galp2 and serw11 when System76 is the BIOS vendor
- 1.0.0 release
- Return ENODEV when model is not matched
- Define `KERNEL_DIR` onece and use it.
- gaze13 & kudu5
- Load system76-dkms in initrd
- Adjust messages
- Add NVIDIA HDA initialization
- Remove debug_wmi
- Set keyboard brightness to off by default
- Update changelog
- Remove scripts
- Merge branch 'master_bionic' of github.com:pop-os/system76-dkms into
master_bionic
- Add oryp4-b
- Create ISSUE_TEMPLATE.md
- 0.0.2 release
- Add galp3-b
- Move modules-load file to correct location
- Add modules-load.d file to ensure dkms module is loaded
- Add oryp4
- Revert "Add hard drive LED"
- Prepare for insertion into kernel
- Add hard drive LED
- Wait 2 seconds before re-enabling backlight to avoid race condition with EC
- Fix timing issues
- Reenable kb toggle
- Rename backlight to function with gsd again
- Add more WMBB debugging
- Fix resume from suspend keyboard backlight
- Revert "Attempt to fix issue with resetting LED brightness"
- Attempt to fix issue with resetting LED brightness
- Add sysfs files for LED color
- Revert "Remove enable WMI"
- Default keyboard backlight to off
- Remove enable WMI
- Fix name of kbd backlight
- Refactor keyboard led
- Set default brightness to one tick above lowest
- Adjust keyboard levels
- Reset keyboard brightness if it is turned back on
- WIP: Simplify keyboard LED code
- Enable GPU sensors
- Add fan control
- Fix off by one error
- Improve keyboard backlight keys
- Use F21 as it functions correctly
- Implement touchpad on/off
- Reenable touchpad lock
- Add keyboard LED class driver
- Add WMI debugging
- Raise polling frequency
- Lower poll frequency and turn off keyboard backlight by default
- Do not enable synaptics mode
- More complete rebuild process
- Fix power script
- Mark power script executable
- Add power saving script
- Modify DMI info
- Add scripts to make dev easier
- Fix keyboard max level
- Add touchpad lock code, fixes for new laptops
- Use EC functions to set KB color
- Add code to rewrite WMI methods using EC
- Rename fan.c to hwmon.c
- Format fan code
- Cleanup
- Update copyright
- More cleanup
- Use KEY_WLAN to fix issue with userspace recognition
- Cleanup
- Debian packaging
- System76 DKMS driver