#Basic Information
Name:             smc-fonts
Version:          6.1
Release:          13
Summary:          Open Type Fonts for Malayalam script
License:          GPLv3+ with exceptions and GPLv2+ with exceptions and GPL-2.0-or-later and GPL-2.0-only and GPL-1.0-or-later and OFL-1.1
URL:              http://savannah.nongnu.org/projects/smc
Source0:          http://download-mirror.savannah.gnu.org/releases/smc/fonts/malayalam-fonts-%{version}.tar.xz
Source1:          65-0-smc-meera.conf
Source2:          67-smc-anjalioldlipi.conf
Source3:          67-smc-dyuthi.conf
Source4:          67-smc-kalyani.conf
Source5:          65-0-smc-rachana.conf
Source6:          67-smc-raghumalayalam.conf
Source7:          67-smc-suruma.conf

#Dependency
BuildRequires:    fontpackages-devel > 1.13 fontforge >= 20080429 dos2unix

BuildArch:        noarch

Provides:         smc-fonts-common = %{version}-%{release}
Provides:         smc-anjalioldlipi-fonts = %{version}-%{release}
Provides:         smc-dyuthi-fonts = %{version}-%{release}
Provides:         smc-kalyani-fonts = %{version}-%{release}
Provides:         smc-meera-fonts = %{version}-%{release}
Provides:         smc-rachana-fonts = %{version}-%{release}
Provides:         smc-raghumalayalam-fonts = %{version}-%{release}
Provides:         smc-suruma-fonts = %{version}-%{release}
Obsoletes:        smc-fonts-common < %{version}-%{release}
Obsoletes:        smc-anjalioldlipi-fonts < %{version}-%{release}
Obsoletes:        smc-dyuthi-fonts < %{version}-%{release}
Obsoletes:        smc-kalyani-fonts < %{version}-%{release}
Obsoletes:        smc-meera-fonts < %{version}-%{release}
Obsoletes:        smc-rachana-fonts < %{version}-%{release}
Obsoletes:        smc-raghumalayalam-fonts < %{version}-%{release}
Obsoletes:        smc-suruma-fonts < %{version}-%{release}

%description
The SMC Fonts package contains malayalam unicode font family for Malayalam
script, including fonts such as anjalioldlipi, dyuthi, kalyani, meera, rachana,
raghumalayalam and suruma.

Swathanthra Malayalam Computing (SMC) is a free software collective engaged in
development, localization, standardization and popularization of various Free
and Open Source Softwares in Malayalam language.

#Build sections
%prep
%setup -q -n fonts

%build
dos2unix */COPYING
dos2unix Rachana/LICENSE
chmod +x generate.pe
make

%install
install -m 0755 -d %{buildroot}%{_fontdir}
install -m 0644 -p AnjaliOldLipi/*.ttf %{buildroot}%{_fontdir}
install -m 0644 -p Dyuthi/*.ttf %{buildroot}%{_fontdir}
install -m 0644 -p Kalyani/*.ttf %{buildroot}%{_fontdir}
install -m 0644 -p Meera/*.ttf %{buildroot}%{_fontdir}
install -m 0644 -p Rachana/*.ttf %{buildroot}%{_fontdir}
install -m 0644 -p RaghuMalayalamSans/*.ttf %{buildroot}%{_fontdir}
install -m 0644 -p Suruma/*.ttf %{buildroot}%{_fontdir}

install -m 0755 -d %{buildroot}%{_fontconfig_templatedir} %{buildroot}%{_fontconfig_confdir}
install -m 0644 -p %{SOURCE1} %{buildroot}%{_fontconfig_templatedir}/65-0-smc-meera.conf
install -m 0644 -p %{SOURCE2} %{buildroot}%{_fontconfig_templatedir}/67-smc-anjalioldlipi.conf
install -m 0644 -p %{SOURCE3} %{buildroot}%{_fontconfig_templatedir}/67-smc-dyuthi.conf
install -m 0644 -p %{SOURCE4} %{buildroot}%{_fontconfig_templatedir}/67-smc-kalyani.conf
install -m 0644 -p %{SOURCE5} %{buildroot}%{_fontconfig_templatedir}/65-0-smc-rachana.conf
install -m 0644 -p %{SOURCE6} %{buildroot}%{_fontconfig_templatedir}/67-smc-raghumalayalam.conf
install -m 0644 -p %{SOURCE7} %{buildroot}%{_fontconfig_templatedir}/67-smc-suruma.conf
for fconf in 65-0-smc-meera.conf \
         67-smc-anjalioldlipi.conf \
         67-smc-dyuthi.conf \
         67-smc-kalyani.conf \
         65-0-smc-rachana.conf \
         67-smc-raghumalayalam.conf \
         67-smc-suruma.conf ; do
  ln -s %{_fontconfig_templatedir}/$fconf %{buildroot}%{_fontconfig_confdir}/$fconf
done

# Add AppStream data
install -Dm 0644 -p smc.metainfo.xml \
        %{buildroot}%{_datadir}/appdata/smc.metainfo.xml
install -Dm 0644 -p AnjaliOldLipi/smc-anjalioldlipi.metainfo.xml \
        %{buildroot}%{_datadir}/appdata/smc-anjalioldlipi.metainfo.xml
install -Dm 0644 -p Dyuthi/smc-dyuthi.metainfo.xml \
        %{buildroot}%{_datadir}/appdata/smc-dyuthi.metainfo.xml
install -Dm 0644 -p Kalyani/smc-kalyani.metainfo.xml \
        %{buildroot}%{_datadir}/appdata/smc-kalyani.metainfo.xml
install -Dm 0644 -p Meera/smc-meera.metainfo.xml \
        %{buildroot}%{_datadir}/appdata/smc-meera.metainfo.xml
install -Dm 0644 -p Rachana/smc-rachana.metainfo.xml \
        %{buildroot}%{_datadir}/appdata/smc-rachana.metainfo.xml
install -Dm 0644 -p RaghuMalayalamSans/smc-raghumalayalam.metainfo.xml \
        %{buildroot}%{_datadir}/appdata/smc-raghumalayalam.metainfo.xml
install -Dm 0644 -p Suruma/smc-suruma.metainfo.xml \
        %{buildroot}%{_datadir}/appdata/smc-suruma.metainfo.xml

#Files list
mkdir -p tmp_docs
for f in */README;do
    cp -a $f tmp_docs/${f//\//.}
done
mkdir -p tmp_copyrights
for f in */COPYING;do
    cp -a $f tmp_copyrights/${f//\//.}
done
cp -a Rachana/LICENSE tmp_copyrights/Rachana.LICENSE

#Files list
%files
%doc ChangeLog tmp_docs/*README
%license tmp_copyrights/*COPYING tmp_copyrights/*LICENSE
%{_fontconfig_templatedir}/*smc*.conf
%{_fontconfig_confdir}/*smc*.conf
%{_datadir}/appdata/smc*.xml
%{_fontdir}/*.ttf

%changelog
* Fri Jun 14 2024 yao_xin <yao_xin001@hoperun.com> - 6.1-13
- License compliance rectification

* Fri Nov 15 2019 openEuler Buildteam <buildteam@openeuler.org> - 6.1-12
- Package init
