Sophie

Sophie

distrib > Mageia > cauldron > i586 > by-pkgid > 54f3c839673ae73220b7d5c27c132a41 > files > 1

alsa-sof-firmware-2024.03-1.mga10.nonfree.src.rpm

# This is a firmware package, so binaries (which are not run on the host)
# in the end package are expected.
%define _binaries_in_noarch_packages_terminate_build   0
%global _firmwarepath  /usr/lib/firmware
%global _xz_opts -9 --check=crc32

%global sof_ver 2024.03
%global sof_ver_avs 2024.02

%global tplg_version 1.2.4

Summary:        Firmware and topology files for Sound Open Firmware project
Name:           alsa-sof-firmware
Version:        %{sof_ver}
Release:        %mkrel 1
# See later in the spec for a breakdown of licensing
License:        BSD
Group:          System/Kernel and hardware
URL:            https://github.com/thesofproject/sof-bin
Source:         https://github.com/thesofproject/sof-bin/releases/download/v%{sof_ver}/sof-bin-%{sof_ver}.tar.gz
Source2:        https://github.com/thesofproject/avs-topology-xml/releases/download/v%{sof_ver_avs}/avs-topology_%{sof_ver_avs}.tar.gz
BuildRequires:  alsa-utils >= %{tplg_version}
Conflicts:      alsa-firmware <= 1.2.1-6

# noarch, since the package is firmware
BuildArch:      noarch

%description
This package contains the firmware binaries for the Sound Open Firmware project.

%package debug
Requires:       alsa-sof-firmware
Summary:        Debug files for Sound Open Firmware project
License:        BSD

%description debug
This package contains the debug files for the Sound Open Firmware project.


%prep
%autosetup -n sof-bin-%{sof_ver}

mkdir -p firmware/intel

for d in sof sof-ipc4 sof-ipc4-tplg sof-tplg; do \
  mv "${d}" firmware/intel; \
done

ln -s sof-ipc4-tplg firmware/intel/sof-ace-tplg

mkdir avs
tar xvzf %{SOURCE2} --strip-components=1 --directory=avs
mv avs/LICENSE LICENCE.avs
mv avs/lib/firmware/intel/avs firmware/intel
echo "%{sof_ver_avs}" > manifest.avs.txt

# remove NXP firmware files
rm Notice.NXP LICENCE.NXP
rm -rf firmware/intel/sof-tplg/sof-imx8*

# remove Mediatek firmware files
rm -rf firmware/intel/sof-tplg/sof-mt8*

# use xz compression
xz -z %{_xz_opts} manifest.txt
for d in sof sof-ipc4; do \
  find -P "firmware/intel/${d}" -type f -name "*.ri" -exec xz -z %{_xz_opts} {} \;
  for f in $(find -P "firmware/intel/${d}" -type l -name "*.ri"); do \
    l=$(readlink "${f}"); \
    n=$(dirname "${f}"); \
    b=$(basename "${f}"); \
    rm "${f}"; \
    pushd "${n}"; \
    ln -svf "${l}.xz" "${b}.xz"; \
    popd; \
  done
done
for d in sof-tplg sof-ipc4-tplg; do \
  find -P "firmware/intel/${d}"  -type f -name "*.tplg" -exec xz -z %{_xz_opts} {} \;
done
for d in avs; do \
  find -P "firmware/intel/${d}"  -type f -name "*.bin" -exec xz -z %{_xz_opts} {} \;
done

%build
# SST topology files (not SOF related, but it's a Intel hw support
# and this package seems a good place to distribute them
alsatplg -c /usr/share/alsa/topology/hda-dsp/skl_hda_dsp_generic-tplg.conf \
         -o firmware/skl_hda_dsp_generic-tplg.bin
# use xz compression
xz -z %{_xz_opts} firmware/*.bin
chmod 0644 firmware/*.bin.xz

%install
mkdir -p %{buildroot}%{_firmwarepath}
cp -ra firmware/* %{buildroot}%{_firmwarepath}

# gather files and directories
FILEDIR=$(pwd)
pushd %{buildroot}/%{_firmwarepath}
find -P . -name "*.ri.xz" | sed -e '/^.$/d' >> $FILEDIR/alsa-sof-firmware.files
#find -P . -name "*.tplg" | sed -e '/^.$/d' >> $FILEDIR/alsa-sof-firmware.files
find -P . -name "*.ldc" | sed -e '/^.$/d' > $FILEDIR/alsa-sof-firmware.debug-files
find -P . -type d | sed -e '/^.$/d' > $FILEDIR/alsa-sof-firmware.dirs
popd
sed -i -e 's:^./::' alsa-sof-firmware.{files,debug-files,dirs}
sed -i -e 's!^!/usr/lib/firmware/!' alsa-sof-firmware.{files,debug-files,dirs}
sed -e 's/^/%%dir /' alsa-sof-firmware.dirs >> alsa-sof-firmware.files

cat alsa-sof-firmware.files

%files -f alsa-sof-firmware.files
%license LICENCE*
%doc README*
%doc manifest.txt.xz
%doc manifest.avs.txt
%dir %{_firmwarepath}

# Licence: 3-clause BSD
%{_firmwarepath}/*.bin.xz

# Licence: 3-clause BSD
# .. for files with suffix .tplg
%{_firmwarepath}/intel/sof-tplg/*.tplg.xz
%{_firmwarepath}/intel/sof-ipc4-tplg/*.tplg.xz
%{_firmwarepath}/intel/sof-ace-tplg

# Licence: Apache 2.0
%{_firmwarepath}/intel/avs/*.bin.xz

# Licence: SOF (3-clause BSD plus others)
# .. for files with suffix .ri

%files debug -f alsa-sof-firmware.debug-files

%pretrans -p <lua>
path = "%{_firmwarepath}/intel/sof-tplg"
st = posix.stat(path)
if st and st.type == "link" then
  os.remove(path)
end

path1 = "%{_firmwarepath}/intel/sof-ace-tplg"
path2 = "%{_firmwarepath}/intel/sof-ipc4-tplg"
st = posix.stat(path1)
if st and st.type == "directory" then
  os.rename(path1, path2)
end


%changelog
* Wed Apr 03 2024 daviddavid <daviddavid> 2024.03-1.mga10
+ Revision: 2054133
- new version: 2024.03

* Sat Sep 16 2023 daviddavid <daviddavid> 2.2.6-1.mga10.nonfree
+ Revision: 1987045
- new version: 2.2.6

* Fri May 19 2023 luigiwalser <luigiwalser> 2.2.5-1.mga9.nonfree
+ Revision: 1957375
- 2.2.5

* Tue Jan 17 2023 luigiwalser <luigiwalser> 2.2.4-1.mga9.nonfree
+ Revision: 1934162
- 2.2.4

* Fri Dec 09 2022 ghibo <ghibo> 2.2.3-1.mga9.nonfree
+ Revision: 1919799
- Update to release 2.2.3

* Tue Sep 27 2022 luigiwalser <luigiwalser> 2.2.2-1.mga9.nonfree
+ Revision: 1892751
- 2.2.2

* Thu May 19 2022 tmb <tmb> 2.1.1-1.mga9.nonfree
+ Revision: 1858878
- update to 2.1.1

* Fri Apr 15 2022 umeabot <umeabot> 2.0-2.mga9.nonfree
+ Revision: 1850286
- Mageia 9 Mass Rebuild

* Tue Mar 22 2022 luigiwalser <luigiwalser> 2.0-1.mga9.nonfree
+ Revision: 1817993
- 2.0

* Sat Dec 25 2021 luigiwalser <luigiwalser> 1.9.3-1.mga9.nonfree
+ Revision: 1763640
- 1.9.3

* Fri Nov 26 2021 luigiwalser <luigiwalser> 1.9.2-1.mga9.nonfree
+ Revision: 1759334
- 1.9.2

* Wed Oct 13 2021 luigiwalser <luigiwalser> 1.9-1.mga9.nonfree
+ Revision: 1751192
- 1.9

* Thu Jul 01 2021 luigiwalser <luigiwalser> 1.8-1.mga9.nonfree
+ Revision: 1734472
- 1.8

* Mon Jun 14 2021 luigiwalser <luigiwalser> 1.7-1.mga9.nonfree
+ Revision: 1730614
- 1.7
- add SST Skylake HDA topology binary (rhbz#1933423)

* Sun Dec 27 2020 tmb <tmb> 1.6.1-1.mga8.nonfree
+ Revision: 1664053
- update to 1.6.1

* Wed Oct 21 2020 luigiwalser <luigiwalser> 1.6-1.mga8.nonfree
+ Revision: 1637862
- 1.6.0

* Sun May 31 2020 tv <tv> 1.5.0-1.mga8.nonfree
+ Revision: 1589206
- 1.5.0

* Sun May 31 2020 tv <tv> 1.4.2-2.mga8.nonfree
+ Revision: 1589134
- Fix the upgrade (make /usr/lib/firmware/intel/sof-tplg directory again)
- Remove the version from all paths
- Add missing symlink for sof-cfl.ri

* Mon Mar 30 2020 zezinho <zezinho> 1.4.2-1.mga8.nonfree
+ Revision: 1562322
- imported package alsa-sof-firmware