File roundcubemail-skin-now-larry.spec of Package roundcubemail-skin-now-larry

%if 0%{?opensuse_bs}
#!BuildIgnore:  php-mysqlnd
#!BuildIgnore:  roundcubemail-plugin-jqueryui-skin-classic
#!BuildIgnore:  roundcubemail-skin-classic
#!BuildIgnore:  roundcubemail-plugin-managesieve-skin-classic
#!BuildIgnore:  roundcubemail-plugin-acl-skin-classic
#!BuildIgnore:  roundcubemail-skin-classic
#!BuildIgnore:  lighttpd
#!BuildIgnore:  cherokee
#!BuildIgnore:  nginx
#!BuildIgnore:  httpd-itk
%endif

Name:           roundcubemail-skin-now-larry
Version:        0.3.6
Release:	    3%{?dist}
Summary:        Kolab Now skin for Roundcube

Group:          Web/Applications
License:        CC-BY-SA
URL:            http://www.kolab.org
Source0:        http://mirror.kolabsys.com/pub/releases/%{name}-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  roundcubemail(skin-chameleon) >= 0.3.8
BuildRequires:  roundcubemail(skin-chameleon-assets) >= 0.3.8

%if "%{_arch}" != "ppc64" && "%{_arch}" != "ppc64le"
BuildRequires:  nodejs-less
%if 0%{?suse_version} < 1
BuildRequires:  uglify-js
%endif
%else
BuildRequires:  php-lessphp
%endif

BuildRequires:  python

Requires:       roundcubemail(skin-now-larry) = %{?epoch:%%{epoch}:}%{version}-%{release}
Requires:       roundcubemail(skin-now-larry-assets) = %{?epoch:%%{epoch}:}%{version}-%{release}

%description
This package contains a Kolab Groupware skin for the Roundcube web mail
interface.

%package core
Summary:        Now skin for Roundcube
Group:          Applications/Internet
Requires:       roundcubemail >= 1.1
Requires:       roundcubemail(skin-larry) >= 1.1
Provides:       roundcubemail(skin-now-larry) = %{?epoch:%%{epoch}:}%{version}-%{release}

%description core
Kolab skin for Roundcube

%package assets
Summary:        Assets for the Now skin
Group:          Applications/Internet
Requires:       roundcubemail(skin-larry-assets) >= 1.1
Provides:       roundcubemail(skin-now-larry-assets) = %{?epoch:%%{epoch}:}%{version}-%{release}

%description assets
Assets for the Now skin

%prep
%setup -q

%build

%install
mkdir -p \
    %{buildroot}/%{_datadir}/roundcubemail/skins/now-larry/ \
    %{buildroot}/%{_datadir}/roundcubemail/public_html/assets/skins/now-larry/

cp -av /usr/share/roundcubemail/skins/chameleon/* \
    %{buildroot}/%{_datadir}/roundcubemail/skins/now-larry/.

cp -av /usr/share/roundcubemail/public_html/assets/skins/chameleon/* \
    %{buildroot}/%{_datadir}/roundcubemail/public_html/assets/skins/now-larry/.

rm -rf skins/now-larry/colors.sh

cp -av skins/now-larry/* %{buildroot}/%{_datadir}/roundcubemail/skins/now-larry/.

orig_dir=%{buildroot}/%{_datadir}/roundcubemail/skins/now-larry/
asset_dir=%{buildroot}/%{_datadir}/roundcubemail/public_html/assets/skins/now-larry/

# Compress the CSS
for file in `find ${orig_dir} -type f -name "*.less" ! -name "colors.less" | grep -vE "${orig_dir}/(plugins|skins)/"`; do
    asset_loc=$(dirname $(echo ${file} | %{__sed} -e "s|${orig_dir}|$asset_dir|g"))
    %{__mkdir_p} ${asset_loc}
    (
        %{_bindir}/lessc -x ${file} > ${asset_loc}/$(basename ${file} .less).css || \
            cat $(dirname ${file})/colors.less ${file} | %{_bindir}/plessc -r -f=compressed > ${asset_loc}/$(basename ${file} .less).css
        ) && \
        %{__rm} -rf ${file} || \
        %{__mv} -v ${file} ${asset_loc}/$(basename ${file})
done

# Compress the JS, but not the already minified
for file in `find ${orig_dir} -type f -name "*.js" ! -name "*.min.js" | grep -vE "${orig_dir}/(plugins|skins)/"`; do
    asset_loc=$(dirname $(echo ${file} | %{__sed} -e "s|${orig_dir}|$asset_dir|g"))
    %{__mkdir_p} ${asset_loc}
    uglifyjs ${file} > ${asset_loc}/$(basename ${file}) && \
        %{__rm} -rf ${file} || \
        %{__mv} -v ${file} ${asset_loc}/$(basename ${file})
done

# The already minified JS can just be copied over to the assets location
for file in `find ${orig_dir} -type f -name "*.min.js" | grep -vE "${orig_dir}/(plugins|skins)/"`; do
    asset_loc=$(dirname $(echo ${file} | %{__sed} -e "s|${orig_dir}|$asset_dir|g"))
    %{__mkdir_p} ${asset_loc}
    %{__mv} -v ${file} ${asset_loc}/$(basename ${file})
done

# Other assets
for file in $(find ${orig_dir} -type f \
        -name "*.eot" -o \
        -name "*.gif" -o \
        -name "*.ico" -o \
        -name "*.jpg" -o \
        -name "*.png" -o \
        -name "*.svg" -o \
        -name "*.swf" -o \
        -name "*.tif" -o \
        -name "*.ttf" -o \
        -name "*.woff" | \
        grep -vE "${orig_dir}/(plugins|skins)/"
    ); do
    asset_loc=$(dirname $(echo ${file} | %{__sed} -e "s|${orig_dir}|$asset_dir|g"))
    %{__mkdir_p} ${asset_loc}
    %{__mv} -vf ${file} ${asset_loc}/$(basename $file)
done

%files
%defattr(-,root,root,-)

%files core
%defattr(-,root,root,-)
%if 0%{?suse_version}
%dir %{_datadir}/roundcubemail/
%dir %{_datadir}/roundcubemail/skins/
%dir %{_datadir}/roundcubemail/public_html/assets/
%dir %{_datadir}/roundcubemail/public_html/assets/skins/
%endif
%{_datadir}/roundcubemail/skins/now-larry/

%files assets
%{_datadir}/roundcubemail/public_html/assets/skins/now-larry/

%changelog
* Sat Jan 19 2019 Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> - 0.3.6-3
- Rebuild against base skin updates

* Mon Nov 12 2018 Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> - 0.3.6-2
- Rebuild to be obsoleted with responsive skin

* Thu May 31 2018 Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> - 0.3.6-1
- Release of version 0.3.6

* Thu Apr 12 2018 Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> - 0.3.5-1
- Release of version 0.3.5

* Sun Mar  6 2016 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.3.4-1
- Release of version 0.3.4

* Thu Dec  3 2015 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.3.3-2
- Allow skin to be built using php-based less

* Fri Mar 27 2015 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.3.3-1
- Release of version 0.3.3

* Wed Feb 25 2015 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.3.2-3
- Rebuild against version 0.3.4 of the chameleon skin

* Thu Jan 29 2015 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.3.2-2
- Rebuild against version 0.3.3 of the chameleon skin

* Mon Jan 26 2015 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.3.2-1
- Release of version 0.3.2

* Fri Jan 23 2015 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.3.1-4
- Rebuild against the new chameleon version

* Wed Jan  7 2015 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.3.1-1
- Release of version 0.3.1

* Fri Dec 19 2014 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.3.0-1
- Release 0.3.0 for #4049, #4056 and inclusion of base skin fixes

* Tue Dec  9 2014 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.2-1
- Version 0.2

* Mon Dec  8 2014 Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> - 0.1-1
- First package