Blob Blame History Raw
# Generated by go2rpm
%bcond_without check

# https://github.com/tdewolff/minify
%global goipath         github.com/tdewolff/minify
Version:                2.5.0

%gometa

%global common_description %{expand:
Minify is a minifier package written in Go. It provides HTML5, CSS3, JS, JSON,
SVG and XML minifiers and an interface to implement any other minifier.
Minification is the process of removing bytes from a file (such as whitespace)
without changing its output and therefore shrinking its size and speeding up
transmission over the internet and possibly parsing. The implemented minifiers
are designed for high performance.

The core functionality associates mimetypes with minification functions,
allowing embedded resources (like CSS or JS within HTML files) to be minified as
well. Users can add new implementations that are triggered based on a mimetype
(or pattern), or redirect to an external command (like ClosureCompiler,
UglifyCSS, ...).}

%global golicenses      LICENSE.md
%global godocs          README.md README-minify.md

Name:           %{goname}
Release:        2%{?dist}
Summary:        Go minifiers for web formats

License:        MIT
URL:            %{gourl}
Source0:        %{gosource}

BuildRequires:  golang(github.com/dustin/go-humanize)
BuildRequires:  golang(github.com/fsnotify/fsnotify)
BuildRequires:  golang(github.com/matryer/try)
BuildRequires:  golang(github.com/spf13/pflag)
BuildRequires:  (golang(github.com/tdewolff/parse) >= 2.3.6 with golang(github.com/tdewolff/parse) < 3)
BuildRequires:  (golang(github.com/tdewolff/parse/buffer) >= 2.3.6 with golang(github.com/tdewolff/parse/buffer) < 3)
BuildRequires:  (golang(github.com/tdewolff/parse/css) >= 2.3.6 with golang(github.com/tdewolff/parse/css) < 3)
BuildRequires:  (golang(github.com/tdewolff/parse/html) >= 2.3.6 with golang(github.com/tdewolff/parse/html) < 3)
BuildRequires:  (golang(github.com/tdewolff/parse/js) >= 2.3.6 with golang(github.com/tdewolff/parse/js) < 3)
BuildRequires:  (golang(github.com/tdewolff/parse/json) >= 2.3.6 with golang(github.com/tdewolff/parse/json) < 3)
BuildRequires:  (golang(github.com/tdewolff/parse/strconv) >= 2.3.6 with golang(github.com/tdewolff/parse/strconv) < 3)
BuildRequires:  (golang(github.com/tdewolff/parse/svg) >= 2.3.6 with golang(github.com/tdewolff/parse/svg) < 3)
BuildRequires:  (golang(github.com/tdewolff/parse/xml) >= 2.3.6 with golang(github.com/tdewolff/parse/xml) < 3)

%if %{with check}
# Tests
BuildRequires:  golang(github.com/tdewolff/test)
%endif

%description
%{common_description}

%gopkg

%prep
%goprep
mv cmd/minify/README.md README-minify.md
# Depend on unversioned tdewolff/parse until Go modules are supported in Fedora
# Provide unversioned import path until Go modules are supported in Fedora
sed -i \
    -e 's|"github.com/tdewolff/parse/v2|"github.com/tdewolff/parse|' \
    -e 's|"github.com/tdewolff/minify/v2|"github.com/tdewolff/minify|' \
    $(find . -name '*.go')

%build
%gobuild -o %{gobuilddir}/bin/gominify %{goipath}/cmd/minify

%install
%gopkginstall
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

%if %{with check}
%check
%gocheck
%endif

%files
%license LICENSE.md
%doc README.md README-minify.md
%{_bindir}/*

%gopkgfiles

%changelog
* Wed Jul 03 22:53:20 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 2.5.0-2
- Update to new macros

* Fri May 17 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.5.0-1
- Update to latest version

* Tue Apr 23 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.4.0-1
- Update to latest version

* Sat Mar 02 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.3.8-2
- Uncomment test BRs
- Depend on unversioned tdewolff/parse until Go modules are supported in Fedora

* Sun Feb 10 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 2.3.8-1
- First package for Fedora