1 %define php_min_version 5.2.1
2 %include /usr/lib/rpm/macros.php
3 Summary: Combines, minifies, and caches JavaScript and CSS files on demand to speed up page loads
7 License: New BSD License
8 Group: Applications/WWW
9 #Source0: https://github.com/mrclay/minify/archive/%{version}/%{name}-%{version}.tar.gz
10 #Source0: https://github.com/glensc/minify/archive/lessphp-dev3/%{name}-%{version}.tar.gz
11 Source0: https://github.com/mrclay/minify/archive/e271c37/%{name}-%{version}.tar.gz
12 # Source0-md5: 4691fc13004fa5863bbfece3f70f6f6a
14 Patch1: pear-firephp.patch
15 Patch2: yui-path.patch
16 Patch3: contentfunc-params.patch
18 Source2: lighttpd.conf
19 URL: https://github.com/mrclay/minify
20 BuildRequires: rpmbuild(macros) >= 1.654
22 Requires: php-%{name} = %{version}-%{release}
25 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
27 %define _webapps /etc/webapps
28 %define _webapp %{name}
29 %define _sysconfdir %{_webapps}/%{_webapp}
30 %define _appdir %{_datadir}/%{_webapp}
31 %define cachedir /var/cache/%{name}
34 %define _noautoreq_pear .*Minify/Loader.php FirePHPCore/FirePHP.class.php
37 Minify is a PHP5 app that helps you follow several of Yahoo!'s Rules
38 for High Performance Web Sites.
40 It combines multiple CSS or Javascript files, removes unnecessary
41 whitespace and comments, and serves them with gzip encoding and
42 optimal client-side cache headers.
44 %package -n php-%{name}
45 Summary: Minify Classes
46 Group: Applications/WWW
47 Requires: php(core) >= %{php_min_version}
50 Requires: php(mbstring)
54 Requires: php-yui-css-compressor
55 Suggests: lessphp >= 0.4.0
56 Suggests: php-firephp-FirePHPCore
58 %description -n php-%{name}
62 Summary: Minify URI Builder
63 Group: Applications/WWW
64 Requires: %{name} = %{version}-%{release}
65 Requires: php(core) >= %{php_min_version}
72 Summary: Unit tests for Minify
73 Group: Applications/WWW
74 Requires: %{name} = %{version}-%{release}
76 %description unit_tests
77 Unit tests for Minify.
89 find -type f | xargs chmod a-x
91 # not needed for functionality
94 # cleanup backups after patching
95 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
98 rm -rf $RPM_BUILD_ROOT
99 install -d $RPM_BUILD_ROOT{%{php_data_dir},%{_sysconfdir},%{_appdir},%{cachedir}}
101 cp -a *.php builder $RPM_BUILD_ROOT%{_appdir}
102 cp -a lib/* $RPM_BUILD_ROOT%{php_data_dir}
104 for config in config.php groupsConfig.php; do
105 mv $RPM_BUILD_ROOT{%{_appdir}/$config,%{_sysconfdir}}
106 ln -s %{_sysconfdir}/$config $RPM_BUILD_ROOT%{_appdir}
109 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
110 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
111 cp -p $RPM_BUILD_ROOT%{_sysconfdir}/{apache,httpd}.conf
113 %triggerin -- apache1 < 1.3.37-3, apache1-base
114 %webapp_register apache %{_webapp}
116 %triggerun -- apache1 < 1.3.37-3, apache1-base
117 %webapp_unregister apache %{_webapp}
119 %triggerin -- apache < 2.2.0, apache-base
120 %webapp_register httpd %{_webapp}
122 %triggerun -- apache < 2.2.0, apache-base
123 %webapp_unregister httpd %{_webapp}
125 %triggerin -- lighttpd
126 %webapp_register lighttpd %{_webapp}
128 %triggerun -- lighttpd
129 %webapp_unregister lighttpd %{_webapp}
132 rm -rf $RPM_BUILD_ROOT
135 if [ "$1" = 0 ]; then
136 echo %{cachedir}/* | xargs rm -rf
140 %defattr(644,root,root,755)
142 %dir %attr(750,root,http) %{_sysconfdir}
143 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
144 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
145 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
146 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php
147 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/groupsConfig.php
151 %dir %attr(771,root,http) %{cachedir}
154 %defattr(644,root,root,755)
157 %files -n php-%{name}
158 %defattr(644,root,root,755)
159 %dir %{php_data_dir}/HTTP
160 %{php_data_dir}/HTTP/ConditionalGet.php
161 %{php_data_dir}/HTTP/Encoder.php
162 %{php_data_dir}/DooDigestAuth.php
163 %{php_data_dir}/Minify.php
164 %{php_data_dir}/Minify