LogoKolab Groupware OBS > Projects
Log In

View File roundcubemail-skin-cycomm.spec of Package roundcubemail-skin-cycomm (Project Kolab:16:Enterprise)

%if 0%{?opensuse_bs}
#!BuildIgnore: lighttpd
#!BuildIgnore: nginx
%endif

%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d}

%if 0%{?suse_version} < 1 && 0%{?fedora} < 1 && 0%{?rhel} < 7
%global with_systemd 0
%else
%global with_systemd 1
%endif

%if 0%{?suse_version}
%global httpd_group www
%global httpd_name apache2
%global httpd_user wwwrun
%else
%if 0%{?plesk}
%global httpd_group roundcube_sysgroup
%global httpd_name httpd
%global httpd_user roundcube_sysuser
%else
%global httpd_group apache
%global httpd_name httpd
%global httpd_user apache
%endif
%endif

%global datadir %{_datadir}/roundcubemail
%global plugindir %{datadir}/plugins
%global confdir %{_sysconfdir}/roundcubemail
%global tmpdir %{_var}/lib/roundcubemail

Name:               roundcubemail-skin-cycomm
Version:            0.4.5
Release:            1%{?dist}
Summary:            Kolab skin for Roundcube

Group:              Web/Applications
License:            CC-BY-SA
URL:                https://kolabsystems.com

Source0:            %{name}-%{version}.tar.gz
Source1:            comm.py

BuildArch:          noarch

BuildRequires:      nodejs-less
BuildRequires:      php-lessphp
BuildRequires:      python
BuildRequires:      roundcubemail(skin-elastic)
BuildRequires:      roundcubemail-plugin-libkolab-skin-elastic

Requires:           roundcubemail-core
Requires:           roundcubemail-plugin-libkolab-skin-elastic

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

%description
This package contains the Plesk Premium Email skin for Roundcube

%package core
Summary:            Plesk Premium Email Web Client skin
Group:              Applications/Internet
Requires:           roundcubemail-core >= 1.1
Provides:           roundcubemail(skin-cycomm) = %{?epoch:%%{epoch}:}%{version}-%{release}

%description core
Kolab skin for Roundcube

%package assets
Summary:            Assets for the Plesk Premium Email skin
Group:              Applications/Internet
Provides:           roundcubemail(skin-cycomm-assets) = %{?epoch:%%{epoch}:}%{version}-%{release}

%description assets
Assets for the Plesk Premium Email skin

%prep
%setup -q -n %{name}-%{version}

rm -rvf base4kids/
rm -rvf contargo/
rm -rvf kolab/
rm -rvf now/

find . | sort

find \
    %{datadir}/skins/elastic/ \
    %{datadir}/public_html/assets/skins/elastic/ \
    %{datadir}/plugins/libkolab/skins/elastic/ \
    %{datadir}/public_html/assets/plugins/libkolab/skins/elastic/ \
    -type f | sort | while read file; do
    target_dir=$(dirname ${file} | sed -e 's|%{datadir}|.|g' -e 's|./public_html/assets/|./|g' -e 's|./public_html/assets/plugins/libkolab/|./|g' -e 's/elastic/cycomm/g')
    file_name=$(basename ${file})
    if [ ! -d ${target_dir} ]; then
        %{__mkdir_p} ${target_dir}
    fi
    cp -av ${file} ${target_dir}
done

cat ./plugins/libkolab/skins/cycomm/libkolab.less

find . | sort

sed -i -e 's/"elastic"/"cycomm"/g' \
    $(find skins/cycomm/ plugins/libkolab/skins/cycomm/ -type f)

find cycomm/ -type f | sort | while read file; do
    target_dir="./skins/$(dirname ${file})"
    file_name=$(basename ${file})
    if [ ! -d ${target_dir} ]; then
        %{__mkdir_p} ${target_dir}
    fi
    cp -av ${file} ${target_dir}
done

rm -rvf cycomm/

sed -i -e 's/"elastic"/"cycomm"/g' plugins/libkolab/skins/cycomm/libkolab.less

find . | sort

%build
# Compile and compress the CSS
for file in `find . -type f -name "styles.less" -o -name "print.less" -o -name "embed.less" -o -name "libkolab.less"`; do
    %{_bindir}/lessc --relative-urls ${file} > $(dirname ${file})/$(basename ${file} .less).css

    sed -i \
        -e "s|../../../skins/cycomm/images/contactpic.png|../../../../skins/cycomm/images/contactpic.png|" \
        -e "s|../../../skins/cycomm/images/watermark.jpg|../../../../skins/cycomm/images/watermark.jpg|" \
        $(dirname ${file})/$(basename ${file} .less).css

    cat $(dirname ${file})/$(basename ${file} .less).css
done

for orig_dir in "skins/cycomm/" "plugins/libkolab/skins/cycomm/"; do
    asset_dir="public_html/assets/${orig_dir}"

    # Compress the CSS
    for file in `find ${orig_dir} -type f -name "*.css"`; do
        asset_loc=$(dirname $(echo ${file} | %{__sed} -e "s|${orig_dir}|${asset_dir}|g"))
        %{__mkdir_p} ${asset_loc}
        cat ${file} | %{_bindir}/python-cssmin > ${asset_loc}/$(basename ${file}) && \
            %{__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"`; 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"`; 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 "*.mp3" -o \
            -name "*.png" -o \
            -name "*.svg" -o \
            -name "*.swf" -o \
            -name "*.tif" -o \
            -name "*.ttf" -o \
            -name "*.woff" -o \
            -name "*.woff2"
        ); 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 || :

    # Purge empty directories
    find ${orig_dir} -type d -empty -delete || :
done

find . | sort

%install
%{__rm} -rvf %{buildroot}
%{__mkdir_p} \
    %{buildroot}%{datadir}/public_html/assets/skins/ \
    %{buildroot}%{datadir}/skins/

cp -av skins/cycomm/ %{buildroot}%{datadir}/skins/.
cp -av public_html/assets/skins/cycomm/ %{buildroot}%{datadir}/public_html/assets/skins/cycomm/
cp -av plugins/ %{buildroot}%{datadir}/plugins
cp -av public_html/assets/plugins/ %{buildroot}%{datadir}/public_html/assets/.

# Workaround for watermark.html
cp -av skins/cycomm/watermark.html %{buildroot}%{datadir}/public_html/assets/skins/cycomm/

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

%files core
%defattr(-,root,root,-)
%{datadir}/skins/cycomm/
%{datadir}/plugins/libkolab/

%files assets
%defattr(-,root,root,-)
%{datadir}/public_html/assets/skins/cycomm/
%{datadir}/public_html/assets/plugins/libkolab/

%changelog
* Wed Nov 17 2021 Jeroen van Meeuwen (Apheleia IT) <vanmeeuwen@apheleia-it.ch> - 0.4.5-1
- Release cycomm skin