]>
Commit | Line | Data |
---|---|---|
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 | |
4 | Name: minify | |
5 | Version: 3.0 | |
6 | Release: 2 | |
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-md5: a84596d6b4febde3d5f4b00698b7cc70 | |
12 | Patch0: paths.patch | |
13 | Patch1: pear-firephp.patch | |
14 | Patch2: yui-path.patch | |
15 | Patch3: contentfunc-params.patch | |
16 | Source1: apache.conf | |
17 | Source2: lighttpd.conf | |
18 | URL: http://code.google.com/p/minify/ | |
19 | BuildRequires: rpmbuild(macros) >= 1.654 | |
20 | BuildRequires: unzip | |
21 | Requires: php-%{name} = %{version}-%{release} | |
22 | Requires: webapps | |
23 | BuildArch: noarch | |
24 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
25 | ||
26 | %define _webapps /etc/webapps | |
27 | %define _webapp %{name} | |
28 | %define _sysconfdir %{_webapps}/%{_webapp} | |
29 | %define _appdir %{_datadir}/%{_webapp} | |
30 | %define cachedir /var/cache/%{name} | |
31 | ||
32 | # skip pear deps | |
33 | %define _noautoreq_pear .*Minify/Loader.php FirePHPCore/FirePHP.class.php | |
34 | ||
35 | %description | |
36 | Minify is a PHP5 app that helps you follow several of Yahoo!'s Rules | |
37 | for High Performance Web Sites. | |
38 | ||
39 | It combines multiple CSS or Javascript files, removes unnecessary | |
40 | whitespace and comments, and serves them with gzip encoding and | |
41 | optimal client-side cache headers. | |
42 | ||
43 | %package -n php-%{name} | |
44 | Summary: Minify Classes | |
45 | Group: Applications/WWW | |
46 | Requires: php(core) >= %{php_min_version} | |
47 | Requires: php(ctype) | |
48 | Requires: php(date) | |
49 | Requires: php(mbstring) | |
50 | Requires: php(pcre) | |
51 | Requires: php(spl) | |
52 | Requires: php-dirs | |
53 | Requires: php-yui-css-compressor | |
54 | Suggests: lessphp >= 0.4.0 | |
55 | Suggests: php-firephp-FirePHPCore | |
56 | ||
57 | %description -n php-%{name} | |
58 | Minify Classes. | |
59 | ||
60 | %package builder | |
61 | Summary: Minify URI Builder | |
62 | Group: Applications/WWW | |
63 | Requires: %{name} = %{version}-%{release} | |
64 | Requires: php(core) >= %{php_min_version} | |
65 | Requires: php(pcre) | |
66 | ||
67 | %description builder | |
68 | Minify URI Builder. | |
69 | ||
70 | %package unit_tests | |
71 | Summary: Unit tests for Minify | |
72 | Group: Applications/WWW | |
73 | Requires: %{name} = %{version}-%{release} | |
74 | ||
75 | %description unit_tests | |
76 | Unit tests for Minify. | |
77 | ||
78 | %prep | |
79 | %setup -qc | |
80 | mv %{name}-*/* . | |
81 | %undos -f php | |
82 | %patch0 -p1 | |
83 | %patch1 -p1 | |
84 | %patch2 -p1 | |
85 | %patch3 -p1 | |
86 | %undos UPGRADING.txt | |
87 | ||
88 | find -type f | xargs chmod a-x | |
89 | ||
90 | # not needed for functionality | |
91 | %{__rm} min/lib/Minify/YUI/CssCompressor.java | |
92 | %{__rm} -r min/lib/MrClay | |
93 | ||
94 | # php-firephp-FirePHPCore | |
95 | %{__rm} min/lib/FirePHP.php | |
96 | ||
97 | # php-yui-css-compressor | |
98 | %{__rm} min/lib/CSSmin.php | |
99 | ||
100 | # cleanup backups after patching | |
101 | find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f | |
102 | ||
103 | %install | |
104 | rm -rf $RPM_BUILD_ROOT | |
105 | install -d $RPM_BUILD_ROOT{%{php_data_dir},%{_sysconfdir},%{_appdir},%{cachedir}} | |
106 | ||
107 | cp -a min/*.php min/builder $RPM_BUILD_ROOT%{_appdir} | |
108 | cp -a min/lib/* $RPM_BUILD_ROOT%{php_data_dir} | |
109 | ||
110 | for config in config.php groupsConfig.php; do | |
111 | mv $RPM_BUILD_ROOT{%{_appdir}/$config,%{_sysconfdir}} | |
112 | ln -s %{_sysconfdir}/$config $RPM_BUILD_ROOT%{_appdir} | |
113 | done | |
114 | ||
115 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf | |
116 | cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf | |
117 | cp -p $RPM_BUILD_ROOT%{_sysconfdir}/{apache,httpd}.conf | |
118 | ||
119 | %triggerin -- apache1 < 1.3.37-3, apache1-base | |
120 | %webapp_register apache %{_webapp} | |
121 | ||
122 | %triggerun -- apache1 < 1.3.37-3, apache1-base | |
123 | %webapp_unregister apache %{_webapp} | |
124 | ||
125 | %triggerin -- apache < 2.2.0, apache-base | |
126 | %webapp_register httpd %{_webapp} | |
127 | ||
128 | %triggerun -- apache < 2.2.0, apache-base | |
129 | %webapp_unregister httpd %{_webapp} | |
130 | ||
131 | %triggerin -- lighttpd | |
132 | %webapp_register lighttpd %{_webapp} | |
133 | ||
134 | %triggerun -- lighttpd | |
135 | %webapp_unregister lighttpd %{_webapp} | |
136 | ||
137 | %clean | |
138 | rm -rf $RPM_BUILD_ROOT | |
139 | ||
140 | %preun | |
141 | if [ "$1" = 0 ]; then | |
142 | echo %{cachedir}/* | xargs rm -rf | |
143 | fi | |
144 | ||
145 | %files | |
146 | %defattr(644,root,root,755) | |
147 | %doc *.txt | |
148 | %dir %attr(750,root,http) %{_sysconfdir} | |
149 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf | |
150 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf | |
151 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf | |
152 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php | |
153 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/groupsConfig.php | |
154 | %dir %{_appdir} | |
155 | %{_appdir}/*.php | |
156 | ||
157 | %dir %attr(771,root,http) %{cachedir} | |
158 | ||
159 | %files builder | |
160 | %defattr(644,root,root,755) | |
161 | %{_appdir}/builder | |
162 | ||
163 | %files -n php-%{name} | |
164 | %defattr(644,root,root,755) | |
165 | %dir %{php_data_dir}/HTTP | |
166 | %{php_data_dir}/HTTP/ConditionalGet.php | |
167 | %{php_data_dir}/HTTP/Encoder.php | |
168 | %{php_data_dir}/DooDigestAuth.php | |
169 | %{php_data_dir}/JSMin.php | |
170 | %{php_data_dir}/JSMinPlus.php | |
171 | %{php_data_dir}/Minify.php | |
172 | %{php_data_dir}/Minify |