1 %define php_min_version 5.2.1
2 Summary: Combines, minifies, and caches JavaScript and CSS files on demand to speed up page loads
6 License: New BSD License
7 Group: Applications/WWW
8 #Source0: https://github.com/mrclay/minify/archive/%{version}/%{name}-%{version}.tar.gz
9 Source0: https://github.com/glensc/minify/archive/lessphp-dev3/%{name}-%{version}.tar.gz
10 # Source0-md5: a84596d6b4febde3d5f4b00698b7cc70
12 Patch1: pear-firephp.patch
13 Patch2: yui-path.patch
14 Patch3: contentfunc-params.patch
16 Source2: lighttpd.conf
17 URL: http://code.google.com/p/minify/
18 BuildRequires: rpmbuild(macros) >= 1.654
20 Requires: php-%{name} = %{version}-%{release}
23 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
25 %define _webapps /etc/webapps
26 %define _webapp %{name}
27 %define _sysconfdir %{_webapps}/%{_webapp}
28 %define _appdir %{_datadir}/%{_webapp}
29 %define cachedir /var/cache/%{name}
32 %define _noautoreq_pear .*Minify/Loader.php FirePHPCore/FirePHP.class.php
35 Minify is a PHP5 app that helps you follow several of Yahoo!'s Rules
36 for High Performance Web Sites.
38 It combines multiple CSS or Javascript files, removes unnecessary
39 whitespace and comments, and serves them with gzip encoding and
40 optimal client-side cache headers.
42 %package -n php-%{name}
43 Summary: Minify Classes
44 Group: Applications/WWW
45 Requires: php(core) >= %{php_min_version}
48 Requires: php(mbstring)
52 Requires: php-yui-css-compressor
53 Suggests: lessphp >= 0.4.0
54 Suggests: php-firephp-FirePHPCore
56 %description -n php-%{name}
60 Summary: Minify URI Builder
61 Group: Applications/WWW
62 Requires: %{name} = %{version}-%{release}
63 Requires: php(core) >= %{php_min_version}
70 Summary: Unit tests for Minify
71 Group: Applications/WWW
72 Requires: %{name} = %{version}-%{release}
74 %description unit_tests
75 Unit tests for Minify.
87 find -type f | xargs chmod a-x
89 # not needed for functionality
90 %{__rm} min/lib/Minify/YUI/CssCompressor.java
91 %{__rm} -r min/lib/MrClay
93 # php-firephp-FirePHPCore
94 %{__rm} min/lib/FirePHP.php
96 # php-yui-css-compressor
97 %{__rm} min/lib/CSSmin.php
99 # cleanup backups after patching
100 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
103 rm -rf $RPM_BUILD_ROOT
104 install -d $RPM_BUILD_ROOT{%{php_data_dir},%{_sysconfdir},%{_appdir},%{cachedir}}
106 cp -a min/*.php min/builder $RPM_BUILD_ROOT%{_appdir}
107 cp -a min/lib/* $RPM_BUILD_ROOT%{php_data_dir}
109 for config in config.php groupsConfig.php; do
110 mv $RPM_BUILD_ROOT{%{_appdir}/$config,%{_sysconfdir}}
111 ln -s %{_sysconfdir}/$config $RPM_BUILD_ROOT%{_appdir}
114 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
115 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
116 cp -p $RPM_BUILD_ROOT%{_sysconfdir}/{apache,httpd}.conf
118 %triggerin -- apache1 < 1.3.37-3, apache1-base
119 %webapp_register apache %{_webapp}
121 %triggerun -- apache1 < 1.3.37-3, apache1-base
122 %webapp_unregister apache %{_webapp}
124 %triggerin -- apache < 2.2.0, apache-base
125 %webapp_register httpd %{_webapp}
127 %triggerun -- apache < 2.2.0, apache-base
128 %webapp_unregister httpd %{_webapp}
130 %triggerin -- lighttpd
131 %webapp_register lighttpd %{_webapp}
133 %triggerun -- lighttpd
134 %webapp_unregister lighttpd %{_webapp}
137 rm -rf $RPM_BUILD_ROOT
140 if [ "$1" = 0 ]; then
141 echo %{cachedir}/* | xargs rm -rf
145 %defattr(644,root,root,755)
147 %dir %attr(750,root,http) %{_sysconfdir}
148 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
149 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
150 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
151 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php
152 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/groupsConfig.php
156 %dir %attr(771,root,http) %{cachedir}
159 %defattr(644,root,root,755)
162 %files -n php-%{name}
163 %defattr(644,root,root,755)
164 %dir %{php_data_dir}/HTTP
165 %{php_data_dir}/HTTP/ConditionalGet.php
166 %{php_data_dir}/HTTP/Encoder.php
167 %{php_data_dir}/DooDigestAuth.php
168 %{php_data_dir}/JSMin.php
169 %{php_data_dir}/JSMinPlus.php
170 %{php_data_dir}/Minify.php
171 %{php_data_dir}/Minify