Blob Blame History Raw
Name:		yuicompressor
Version:	2.4.8
Release:	2%{?dist}
Summary:	YUI Compressor - The Yahoo JavaScript and CSS Compressor

#		Source 0 is BSD, Source 1 is MPLv1.1 or GPLv2+
License:	BSD and (MPLv1.1 or GPLv2+)
URL:		https://yui.github.com/%{name}/
Source0:	https://github.com/yui/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
#		The yuicompressor uses the javascript parser from rhino.
#		However, it calls private functions not exported by the
#		rhino jar, so it can not use the jar provided by the
#		distribution. The upstream source unjars a bundled copy of
#		the rhino jar and builds using its precompiled class files.
#		This violates the no precompiled sources guidelines. Only
#		part of the rhino source tree is used by yuicompressor. The
#		upstream sources also contains modified versions of a few
#		of the rhino sources. These changes are restored by patch 0.
#		Source 1 is a slimmed down version of the rhino sources of
#		the same version that is bundled in the upstream sources.
#		Source 2 is the	script used to create Source 1.
Source1:	%{name}-rhino1_7R2.tar.gz
Source2:	%{name}-rhino.sh
#		Man page - copied from Debian
Source3:	%{name}.1
#		Pom file based on template from upstream:
#		https://github.com/yui/yuicompressor/raw/master/maven_central/template/pom.xml.template
Source4:	%{name}.pom
#		This patch restores yuicompressor's changes to the rhino
#		sources overwritten by Source 1
Patch0:		%{name}-rhino.patch
#		Remove references to prebuilt jars in build.xml
Patch1:		%{name}-remove-jars.patch
#		Fix test script - only test yuicompressor, not rhino
Patch2:		%{name}-tests.patch

BuildArch:	noarch
BuildRequires:	ant
BuildRequires:	javapackages-local
BuildRequires:	mvn(net.sf:jargs)
Provides:	bundled(rhino) = 1.7R2

%description
The YUI Compressor is a JavaScript compressor which, in addition to
removing comments and white-spaces, obfuscates local variables using
the smallest possible variable name. This obfuscation is safe, even
when using constructs such as 'eval' or 'with' (although the
compression is not optimal in those cases) Compared to jsmin, the
average savings is around 20%.

The YUI Compressor is also able to safely compress CSS files. The
decision on which compressor is being used is made on the file
extension (js or css).

%prep
%setup -q -a 1
%patch0 -p1
%patch1 -p1
%patch2 -p1
# Remove prebuilt jars
rm -rf lib/*
ln -s $(build-classpath jargs) lib

%build
%ant

%install
%mvn_artifact %{SOURCE4} build/%{name}-%{version}.jar
%mvn_install

%jpackage_script com.yahoo.platform.yui.compressor.Bootstrap "" "" jargs:%{name} %{name} true

mkdir -p %{buildroot}%{_mandir}/man1
install -m 644 %{SOURCE3} %{buildroot}%{_mandir}/man1

%check
tests/suite.sh

%files -f .mfiles
%{_bindir}/%{name}
%doc %{_mandir}/man1/%{name}.1*
%doc README.md doc/CHANGELOG
%license LICENSE.TXT LICENSE.txt

%changelog
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Tue Dec 05 2017 Mattias Ellert <mattias.ellert@physics.uu.se> - 2.4.8-1
- Initial packaging for Fedora