1 | #!/bin/bash |
---|
2 | # tlpdb2rpmspec |
---|
3 | # |
---|
4 | # Copyright 2010 Munehiro Yamamoto <munepi@vinelinux.org> |
---|
5 | # This file is licensed under the GNU General Public License version 2 |
---|
6 | # or any later version. |
---|
7 | |
---|
8 | Usage(){ |
---|
9 | cat<<EOF |
---|
10 | Usage: $(basename $0) [option] [pkgname] |
---|
11 | |
---|
12 | This script generates a rpm spec file for CTAN and collection-* packages of TeX Live. |
---|
13 | |
---|
14 | Options: |
---|
15 | --name: return [pkgname] |
---|
16 | --category: return the category of [pkgname] |
---|
17 | --revision: return the revision of [pkgname] |
---|
18 | --depend: return dependencies of [pkgname] |
---|
19 | --shortdesc: return the short description of [pkgname] |
---|
20 | --longdesc: return the description of [pkgname] |
---|
21 | --execute: return post processe of [pkgname] |
---|
22 | --catalogue-ctan: return the locate of [pkgname] |
---|
23 | --catalogue-date: return the last update of [pkgname] |
---|
24 | --catalogue-license: return the license of [pkgname] |
---|
25 | --catalogue-version: return the version of [pkgname] |
---|
26 | --filelist: return the filelist of [pkgname] |
---|
27 | --help: show this help |
---|
28 | |
---|
29 | Supoort collections-* packages: |
---|
30 | $(egrep "^name collection-" $TLPDB | sed -e "s,name ,,g") |
---|
31 | EOF |
---|
32 | } |
---|
33 | |
---|
34 | check-parameter(){ |
---|
35 | [ -z "$*" ] && Usage && return 1 |
---|
36 | |
---|
37 | while [ ! -z "$*" ]; do |
---|
38 | case $1 in |
---|
39 | --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist) |
---|
40 | [ $with_option -eq 1 ] && \ |
---|
41 | echo "E: you only give one option" && return 1 |
---|
42 | with_option=1 |
---|
43 | ;; |
---|
44 | --help) |
---|
45 | Usage |
---|
46 | return 1 |
---|
47 | ;; |
---|
48 | --minimal-collections|--standard-collections|--full-collections) |
---|
49 | [ ! -f /etc/vine-release ] && \ |
---|
50 | echo "E: support Vine Linux only" && return 1 |
---|
51 | ;; |
---|
52 | *) |
---|
53 | [ -z "$(egrep -n "^name $1$" $TLPDB)" ] && \ |
---|
54 | echo "E: unknown option or package: $1" && return 1 |
---|
55 | ;; |
---|
56 | esac |
---|
57 | shift |
---|
58 | done |
---|
59 | |
---|
60 | return 0 |
---|
61 | } |
---|
62 | |
---|
63 | |
---|
64 | ## tlpkg4a [--name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist] [pkgname] |
---|
65 | tlpkg4a(){ |
---|
66 | [ $# -eq 2 ] || return 1 |
---|
67 | local opt=$1 |
---|
68 | local pkg=$2 |
---|
69 | local fieldname=$(echo $opt | sed -e "s,--,,") |
---|
70 | |
---|
71 | ## check param |
---|
72 | case $opt in |
---|
73 | --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist) |
---|
74 | ;; |
---|
75 | *) |
---|
76 | echo "E: unknown option: $opt" |
---|
77 | exit 1 |
---|
78 | ;; |
---|
79 | esac |
---|
80 | |
---|
81 | ## get the head line of $pkg record |
---|
82 | pkg_LINE=$(egrep -n "^name $pkg$" $TLPDB | cut -d":" -f 1) |
---|
83 | |
---|
84 | ## read tlpdb |
---|
85 | is_pkg=0 |
---|
86 | ( |
---|
87 | [ "$opt" = "--filelist" ] && \ |
---|
88 | tail -n $(( $TLPDB_MAXLINE - $pkg_LINE + 1 )) $TLPDB || \ |
---|
89 | tail -n $(( $TLPDB_MAXLINE - $pkg_LINE + 1 )) $TLPDB | egrep -v -e "^ " |
---|
90 | ) | \ |
---|
91 | while read field; do |
---|
92 | ## find the record of $pkg |
---|
93 | echo "$field" | egrep -q "^name $pkg" && is_pkg=1 |
---|
94 | [ $is_pkg -eq 0 ] && continue |
---|
95 | |
---|
96 | ## return the values of its field name |
---|
97 | if [ "$opt" = "--filelist" ]; then |
---|
98 | ## NOTE: we only need texmf-dist directories |
---|
99 | echo "$field" | egrep "^texmf-dist" | \ |
---|
100 | sed -e "s, details=.*,," -e "s, language=.*,," |
---|
101 | else |
---|
102 | echo "$field" | egrep "^${fieldname} " | sed -e "s,${fieldname} ,," |
---|
103 | fi |
---|
104 | |
---|
105 | ## end of the record of $pkg |
---|
106 | echo "$field" | egrep -q "^[[:blank:]]*$" && break |
---|
107 | done |
---|
108 | |
---|
109 | return 0 |
---|
110 | } |
---|
111 | |
---|
112 | ## tlpkg2speclicense [pkgname] |
---|
113 | tlpkg2speclicense(){ |
---|
114 | [ $# -eq 1 ] || return 1 |
---|
115 | local pkg=$1 |
---|
116 | |
---|
117 | case $(tlpkg4a --catalogue-license $pkg) in |
---|
118 | gpl3) echo "GPLv3+";; |
---|
119 | gpl2) echo "GPLv2+";; |
---|
120 | gpl) echo "GPL+";; |
---|
121 | lppl|lppl1.2|lppl1.3) echo "LPPL";; |
---|
122 | other-free) echo "Freely redistributable without restriction";; |
---|
123 | pd) echo "Public Domain";; |
---|
124 | noinfo) echo "No Info";; |
---|
125 | lgpl) echo "LGPLv2+";; |
---|
126 | gfsl) echo "LPPL";; |
---|
127 | bsd) echo "BSD";; |
---|
128 | knuth) echo "Knuth";; |
---|
129 | unknown) echo "Unknown";; |
---|
130 | gfl) echo "LPPL";; |
---|
131 | artistic2) echo "Artistic 2.0";; |
---|
132 | fdl) echo "GFDL";; |
---|
133 | collection) echo "Public Domain";; |
---|
134 | artistic) echo "Artistic";; |
---|
135 | other) echo "Other";; |
---|
136 | ofl) echo "OFSFLD";; |
---|
137 | apache2) echo "ASL 2.0";; |
---|
138 | nosource) echo "No Source";; |
---|
139 | nosell) echo "No Sell";; |
---|
140 | nocommercial) echo "Non-commercial";; |
---|
141 | *) return 1;; |
---|
142 | esac |
---|
143 | return 0 |
---|
144 | } |
---|
145 | |
---|
146 | ## tlpkg2manifest [pkgname] |
---|
147 | tlpkg2manifest(){ |
---|
148 | [ $# -eq 1 ] || return 1 |
---|
149 | local pkg=$1 |
---|
150 | local pkgdeps="$(tlpkg4a --depend $pkg)" |
---|
151 | local i= |
---|
152 | |
---|
153 | tlpkg4a --filelist $pkg || return 1 |
---|
154 | |
---|
155 | ## if $pkg is not collection-*, only return the filelist of $pkg |
---|
156 | echo $pkg | egrep -q "^collection-" || return 0 |
---|
157 | |
---|
158 | ##!! we need pure filelist of $pkg; remove collection-* |
---|
159 | pkgdeps=$(echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g") |
---|
160 | |
---|
161 | [ -z "$pkgdeps" ] && return 0 |
---|
162 | for i in $pkgdeps; do |
---|
163 | tlpkg4a --filelist $i || return 1 |
---|
164 | done |
---|
165 | |
---|
166 | return 0 |
---|
167 | } |
---|
168 | |
---|
169 | ## tlpkg2maplist [pkgname] |
---|
170 | tlpkg2maplist(){ |
---|
171 | [ $# -eq 1 ] || return 1 |
---|
172 | local pkg=$1 |
---|
173 | local pkgdeps="$(tlpkg4a --depend $pkg)" |
---|
174 | local i= |
---|
175 | |
---|
176 | tlpkg4a --execute $pkg | grep -e "Map" | sed -e "s,^add,,g" |
---|
177 | |
---|
178 | ##!! we need pure filelist of $pkg; remove collection-* |
---|
179 | pkgdeps=$(echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g") |
---|
180 | |
---|
181 | [ -z "$pkgdeps" ] && return 0 |
---|
182 | for i in $pkgdeps; do |
---|
183 | tlpkg4a --execute $i | grep -e "Map" | sed -e "s,^add,,g" |
---|
184 | done |
---|
185 | |
---|
186 | return 0 |
---|
187 | } |
---|
188 | |
---|
189 | ## tlpkg2inilist [pkgname] |
---|
190 | tlpkg2inilist(){ |
---|
191 | [ $# -eq 1 ] || return 1 |
---|
192 | local pkg=$1 |
---|
193 | local pkgdeps="$(tlpkg4a --depend $pkg)" |
---|
194 | local i= |
---|
195 | |
---|
196 | ## search AddFormat, AddHypen |
---|
197 | tlpkg4a --execute $pkg | grep -e "Add" |
---|
198 | |
---|
199 | ##!! we need pure filelist of $pkg; remove collection-* |
---|
200 | pkgdeps=$(echo $pkgdeps | sed -e "s,collection-[-A-Za-z0-9]*,,g") |
---|
201 | |
---|
202 | [ -z "$pkgdeps" ] && return 0 |
---|
203 | for i in $pkgdeps; do |
---|
204 | tlpkg4a --execute $i | grep -e "Add" |
---|
205 | done |
---|
206 | |
---|
207 | return 0 |
---|
208 | } |
---|
209 | |
---|
210 | ## mkrpmspec [pkgname] |
---|
211 | mkrpmspec(){ |
---|
212 | [ $# -eq 1 ] || return 1 |
---|
213 | local pkg=$1 |
---|
214 | local i= |
---|
215 | |
---|
216 | RPM_SUMMARY="TeX Live: $(tlpkg4a --shortdesc $pkg)" |
---|
217 | |
---|
218 | ## Requires tag for texlive |
---|
219 | RPM_REQUIRES=$(for i in $(tlpkg4a --depend $pkg | egrep "^collection-" | egrep -v "^collection-documentation"); do echo "Requires: texlive-$i = %{version}"; done) |
---|
220 | |
---|
221 | ## License tag |
---|
222 | RPM_LICENSE="$(tlpkg2speclicense $pkg)," |
---|
223 | for i in $(tlpkg4a --depend $pkg | egrep -v "^collection-"); do |
---|
224 | tmp=$(tlpkg2speclicense $i) |
---|
225 | echo "$RPM_LICENSE" | grep -q "${tmp}," |
---|
226 | [ $? -eq 1 ] && RPM_LICENSE="${RPM_LICENSE} ${tmp}," |
---|
227 | done |
---|
228 | RPM_LICENSE=$(echo "$RPM_LICENSE" | sed -e "s/,$//" | sed -e "s/^, //") |
---|
229 | [ -z "$RPM_LICENSE" ] && RPM_LICENSE=distributable |
---|
230 | |
---|
231 | PKG_SHORTDESC=$(tlpkg4a --shortdesc $pkg) |
---|
232 | PKG_LONGDESC=$(tlpkg4a --longdesc $pkg) |
---|
233 | |
---|
234 | PKG_CTANPKGSLIST=$(for i in $(tlpkg4a --depend $pkg); do \ |
---|
235 | if [ -z "$(echo "$i" | grep "collection-")" ]; then \ |
---|
236 | echo -n "$i: "; \ |
---|
237 | tmp=$(tlpkg4a --shortdesc $i); \ |
---|
238 | [ -z "${tmp}" ] && echo || echo "$tmp"; \ |
---|
239 | fi |
---|
240 | done) |
---|
241 | |
---|
242 | PKG_MANIFEST=$(tlpkg2manifest $pkg) |
---|
243 | [ -z "${PKG_MANIFEST}" ] && \ |
---|
244 | echo "W: empty manifest: $pkg" && return 1 |
---|
245 | |
---|
246 | with_docpkg=0 |
---|
247 | [ -z "$(echo $pkg | grep "collection-documentation")" ] && \ |
---|
248 | [ ! -z "$(echo "${PKG_MANIFEST}" | grep texmf-dist/doc/)" ] && \ |
---|
249 | with_docpkg=1 |
---|
250 | |
---|
251 | with_maplist=0 |
---|
252 | MAPLIST="$(tlpkg2maplist $pkg)" |
---|
253 | [ ! -z "$MAPLIST" ] && with_maplist=1 |
---|
254 | ##echo $with_maplist && echo "$MAPLIST" && exit |
---|
255 | |
---|
256 | with_inilist=0 |
---|
257 | INILIST="$(tlpkg2inilist $pkg)" |
---|
258 | [ ! -z "$INILIST" ] && with_inilist=1 |
---|
259 | ##echo $with_inilist && echo "$INILIST" && exit |
---|
260 | |
---|
261 | cat<<EOF |
---|
262 | ## -*- coding: utf-8-unix -*- |
---|
263 | ## NOTE: This spec file is generated by $(basename $0) ${VERSION}-${RELEASE}: |
---|
264 | ## $(basename $0) $pkg |
---|
265 | |
---|
266 | %bcond_with firstbuild |
---|
267 | |
---|
268 | %define tex_destdir %{_datadir} |
---|
269 | %define texmf %{tex_destdir}/texmf |
---|
270 | %define texlive_src %{tex_destdir}/texlive-sources |
---|
271 | %define build_tex_destdir %{buildroot}%{tex_destdir} |
---|
272 | %define build_texmf %{buildroot}%{texmf} |
---|
273 | |
---|
274 | %define exec_mktexlsr [ -x %{_bindir}/texconfig-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/texconfig-sys rehash |
---|
275 | %define exec_texhash [ -x %{_bindir}/texhash ] && PATH=%{_bindir}:\$PATH %{_bindir}/texhash |
---|
276 | %define exec_updmap [ -x %{_bindir}/updmap-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/updmap-sys --nostop |
---|
277 | %define exec_fmtutil [ -x %{_bindir}/fmtutil-sys ] && PATH=%{_bindir}:\$PATH %{_bindir}/fmtutil-sys --all >/dev/null 2>&1 |
---|
278 | %define exec_upddeffont [ -x %{_sbindir}/update-defaultfont ] && %{_sbindir}/update-defaultfont 2> /dev/null |
---|
279 | %define vartexfonts %{_var}/lib/texmf |
---|
280 | |
---|
281 | %define __find_provides %{nil} |
---|
282 | %define __find_requires %{nil} |
---|
283 | %define __perl_provides %{nil} |
---|
284 | %define __perl_requires %{nil} |
---|
285 | |
---|
286 | Autoreq: 0 |
---|
287 | |
---|
288 | Summary: ${RPM_SUMMARY} |
---|
289 | Summary(ja): ${RPM_SUMMARY} |
---|
290 | Name: texlive-$pkg |
---|
291 | Version: ${VERSION} |
---|
292 | Release: ${RELEASE}%{?_dist_release} |
---|
293 | License: ${RPM_LICENSE} |
---|
294 | Group: Applications/Publishing |
---|
295 | URL:http://www.tug.org/texlive/ |
---|
296 | |
---|
297 | Requires: texlive = %{version} |
---|
298 | $RPM_REQUIRES |
---|
299 | |
---|
300 | Requires(post): texlive = %{version} |
---|
301 | Requires(postun): texlive = %{version} |
---|
302 | BuildRequires: texlive-sources = %{version} |
---|
303 | |
---|
304 | BuildArch: noarch |
---|
305 | Buildroot: %{_tmppath}/%{name}-%{version}-root |
---|
306 | |
---|
307 | Vendor: ${RPM_VENDOR} |
---|
308 | Distribution: ${RPM_DISTRIBUTION} |
---|
309 | Packager: ${RPM_PACKAGER} |
---|
310 | |
---|
311 | %description |
---|
312 | The TeX Live software distribution offers a complete TeX system for a |
---|
313 | variety of Unix, Macintosh, Windows and other platforms. It |
---|
314 | encompasses programs for editing, typesetting, previewing and printing |
---|
315 | of TeX documents in many different languages, and a large collection |
---|
316 | of TeX macros and font libraries. |
---|
317 | |
---|
318 | The distribution includes extensive general documentation about TeX, |
---|
319 | as well as the documentation for the included software packages. |
---|
320 | |
---|
321 | This package is a collection of ${PKG_SHORTDESC}: |
---|
322 | ${PKG_LONGDESC} |
---|
323 | |
---|
324 | This package contains the following CTAN packages: |
---|
325 | ${PKG_CTANPKGSLIST} |
---|
326 | |
---|
327 | %description -l ja |
---|
328 | TeX Live ソフトウェアディストリビューションは、 |
---|
329 | さまざまな Unix, Macintosh, Windows、および |
---|
330 | 他のプラットホームに対して完全な TeX システムを提供します。 |
---|
331 | 多くの異なった言語を含む TeX ドキュメントの |
---|
332 | 編集、組版、閲覧、印刷するためのプログラム、 |
---|
333 | そして、TeX マクロやフォントライブラリの大きなコレクションを |
---|
334 | 同梱しています。 |
---|
335 | |
---|
336 | このディストリビューションは |
---|
337 | 同梱しているソフトウェアパッケージのためのドキュメントばかりでなく、 |
---|
338 | TeX に関するたくさんの一般的なドキュメントを含んでいます。 |
---|
339 | |
---|
340 | このパッケージは以下のようなパッケージ集です。 |
---|
341 | ${PKG_SHORTDESC}: |
---|
342 | ${PKG_LONGDESC} |
---|
343 | |
---|
344 | このパッケージは以下の CTAN パッケージを含んでいます: |
---|
345 | ${PKG_CTANPKGSLIST} |
---|
346 | |
---|
347 | EOF |
---|
348 | |
---|
349 | ## subpackage: %{name}-doc |
---|
350 | if [ $with_docpkg -eq 1 ]; then |
---|
351 | cat<<EOF |
---|
352 | %package doc |
---|
353 | Summary: TeX Live: Documentation files of %{name} |
---|
354 | Group: Applications/Publishing |
---|
355 | Requires: %{name} = %{version}-%{release} |
---|
356 | |
---|
357 | %description doc |
---|
358 | This package contains documentation files of %{name}. |
---|
359 | |
---|
360 | EOF |
---|
361 | fi |
---|
362 | |
---|
363 | cat<<EOF |
---|
364 | %prep |
---|
365 | |
---|
366 | %build |
---|
367 | |
---|
368 | %install |
---|
369 | [ -n "%{buildroot}" -a "%{buildroot}" != / ] && %__rm -rf %{buildroot} |
---|
370 | |
---|
371 | PREF=%{buildroot}%{tex_destdir} |
---|
372 | |
---|
373 | manifest=( |
---|
374 | ${PKG_MANIFEST} |
---|
375 | ) |
---|
376 | |
---|
377 | %__mkdir_p \${PREF}/texmf-dist |
---|
378 | for i in "\${manifest[@]}"; do |
---|
379 | %__install -D %{texlive_src}/\$i \${PREF}/\$i |
---|
380 | done |
---|
381 | EOF |
---|
382 | |
---|
383 | cat<<EOF |
---|
384 | ## make symlinks of core script utils |
---|
385 | mk_symlinks=( |
---|
386 | texlive-collection-binextra,/usr/bin/dviasm,/usr/share/texmf-dist/scripts/dviasm/dviasm.py |
---|
387 | texlive-collection-binextra,/usr/bin/findhyph,/usr/share/texmf-dist/scripts/findhyph/findhyph |
---|
388 | texlive-collection-binextra,/usr/bin/fragmaster,/usr/share/texmf-dist/scripts/fragmaster/fragmaster.pl |
---|
389 | texlive-collection-binextra,/usr/bin/latex2man,/usr/share/texmf-dist/scripts/latex2man/latex2man |
---|
390 | texlive-collection-binextra,/usr/bin/latexmk,/usr/share/texmf-dist/scripts/latexmk/latexmk.pl |
---|
391 | texlive-collection-binextra,/usr/bin/listings-ext.sh,/usr/share/texmf-dist/scripts/listings-ext/listings-ext.sh |
---|
392 | texlive-collection-binextra,/usr/bin/mkjobtexmf,/usr/share/texmf-dist/scripts/mkjobtexmf/mkjobtexmf.pl |
---|
393 | texlive-collection-binextra,/usr/bin/pdfcrop,/usr/share/texmf-dist/scripts/pdfcrop/pdfcrop.pl |
---|
394 | texlive-collection-binextra,/usr/bin/pkfix,/usr/share/texmf-dist/scripts/pkfix/pkfix.pl |
---|
395 | texlive-collection-binextra,/usr/bin/pkfix-helper,/usr/share/texmf-dist/scripts/pkfix-helper/pkfix-helper |
---|
396 | texlive-collection-binextra,/usr/bin/purifyeps,/usr/share/texmf-dist/scripts/purifyeps/purifyeps |
---|
397 | texlive-collection-binextra,/usr/bin/texcount,/usr/share/texmf-dist/scripts/texcount/texcount.pl |
---|
398 | texlive-collection-binextra,/usr/bin/texdiff,/usr/share/texmf-dist/scripts/texdiff/texdiff |
---|
399 | texlive-collection-binextra,/usr/bin/texdirflatten,/usr/share/texmf-dist/scripts/texdirflatten/texdirflatten |
---|
400 | texlive-collection-binextra,/usr/bin/texloganalyser,/usr/share/texmf-dist/scripts/texloganalyser/texloganalyser |
---|
401 | texlive-collection-context,/usr/bin/context,/usr/share/texmf-dist/scripts/context/stubs/unix/context |
---|
402 | texlive-collection-context,/usr/bin/ctxtools,/usr/share/texmf-dist/scripts/context/stubs/unix/ctxtools |
---|
403 | texlive-collection-context,/usr/bin/luatools,/usr/share/texmf-dist/scripts/context/lua/luatools.lua |
---|
404 | texlive-collection-context,/usr/bin/makempy,/usr/share/texmf-dist/scripts/context/stubs/unix/makempy |
---|
405 | texlive-collection-context,/usr/bin/mpstools,/usr/share/texmf-dist/scripts/context/stubs/unix/mpstools |
---|
406 | texlive-collection-context,/usr/bin/mptopdf,/usr/share/texmf-dist/scripts/context/stubs/unix/mptopdf |
---|
407 | texlive-collection-context,/usr/bin/mtxrun,/usr/share/texmf-dist/scripts/context/lua/mtxrun.lua |
---|
408 | texlive-collection-context,/usr/bin/mtxtools,/usr/share/texmf-dist/scripts/context/stubs/unix/mtxtools |
---|
409 | texlive-collection-context,/usr/bin/pdftools,/usr/share/texmf-dist/scripts/context/stubs/unix/pdftools |
---|
410 | texlive-collection-context,/usr/bin/pstopdf,/usr/share/texmf-dist/scripts/context/stubs/unix/pstopdf |
---|
411 | texlive-collection-context,/usr/bin/rlxtools,/usr/share/texmf-dist/scripts/context/stubs/unix/rlxtools |
---|
412 | texlive-collection-context,/usr/bin/runtools,/usr/share/texmf-dist/scripts/context/stubs/unix/runtools |
---|
413 | texlive-collection-context,/usr/bin/texexec,/usr/share/texmf-dist/scripts/context/stubs/unix/texexec |
---|
414 | texlive-collection-context,/usr/bin/texfont,/usr/share/texmf-dist/scripts/context/stubs/unix/texfont |
---|
415 | texlive-collection-context,/usr/bin/texmfstart,/usr/share/texmf-dist/scripts/context/ruby/texmfstart.rb |
---|
416 | texlive-collection-context,/usr/bin/textools,/usr/share/texmf-dist/scripts/context/stubs/unix/textools |
---|
417 | texlive-collection-context,/usr/bin/texutil,/usr/share/texmf-dist/scripts/context/stubs/unix/texutil |
---|
418 | texlive-collection-context,/usr/bin/tmftools,/usr/share/texmf-dist/scripts/context/stubs/unix/tmftools |
---|
419 | texlive-collection-context,/usr/bin/xmltools,/usr/share/texmf-dist/scripts/context/stubs/unix/xmltools |
---|
420 | texlive-collection-fontutils,/usr/bin/afm2afm,/usr/share/texmf-dist/scripts/fontools/afm2afm |
---|
421 | texlive-collection-fontutils,/usr/bin/autoinst,/usr/share/texmf-dist/scripts/fontools/autoinst |
---|
422 | texlive-collection-fontutils,/usr/bin/cmap2enc,/usr/share/texmf-dist/scripts/fontools/cmap2enc |
---|
423 | texlive-collection-fontutils,/usr/bin/epstopdf,/usr/share/texmf-dist/scripts/epstopdf/epstopdf.pl |
---|
424 | texlive-collection-fontutils,/usr/bin/font2afm,/usr/share/texmf-dist/scripts/fontools/font2afm |
---|
425 | texlive-collection-fontutils,/usr/bin/mkt1font,/usr/share/texmf-dist/scripts/accfonts/mkt1font |
---|
426 | texlive-collection-fontutils,/usr/bin/ot2kpx,/usr/share/texmf-dist/scripts/fontools/ot2kpx |
---|
427 | texlive-collection-fontutils,/usr/bin/pfm2kpx,/usr/share/texmf-dist/scripts/fontools/pfm2kpx |
---|
428 | texlive-collection-fontutils,/usr/bin/showglyphs,/usr/share/texmf-dist/scripts/fontools/showglyphs |
---|
429 | texlive-collection-fontutils,/usr/bin/vpl2ovp,/usr/share/texmf-dist/scripts/accfonts/vpl2ovp |
---|
430 | texlive-collection-fontutils,/usr/bin/vpl2vpl,/usr/share/texmf-dist/scripts/accfonts/vpl2vpl |
---|
431 | texlive-collection-langgreek,/usr/bin/mkgrkindex,/usr/share/texmf-dist/scripts/mkgrkindex/mkgrkindex |
---|
432 | texlive-collection-langindic,/usr/bin/ebong,/usr/share/texmf-dist/scripts/bengali/ebong.py |
---|
433 | texlive-collection-latex,/usr/bin/pdfatfi,/usr/share/texmf-dist/scripts/oberdiek/pdfatfi.pl |
---|
434 | texlive-collection-latexextra,/usr/bin/makeglossaries,/usr/share/texmf-dist/scripts/glossaries/makeglossaries |
---|
435 | texlive-collection-latexextra,/usr/bin/pdfannotextractor,/usr/share/texmf-dist/scripts/pax/pdfannotextractor.pl |
---|
436 | texlive-collection-latexextra,/usr/bin/pdfthumb,/usr/share/texmf-dist/scripts/ppower4/pdfthumb.tlu |
---|
437 | texlive-collection-latexextra,/usr/bin/perltex,/usr/share/texmf-dist/scripts/perltex/perltex |
---|
438 | texlive-collection-latexextra,/usr/bin/ppower4,/usr/share/texmf-dist/scripts/ppower4/ppower4.tlu |
---|
439 | texlive-collection-latexextra,/usr/bin/ps4pdf,/usr/share/texmf-dist/scripts/pst-pdf/ps4pdf |
---|
440 | texlive-collection-latexextra,/usr/bin/splitindex,/usr/share/texmf-dist/scripts/splitindex/perl/splitindex.pl |
---|
441 | texlive-collection-latexextra,/usr/bin/svn-multi,/usr/share/texmf-dist/scripts/svn-multi/svn-multi.pl |
---|
442 | texlive-collection-latexextra,/usr/bin/vpe,/usr/share/texmf-dist/scripts/vpe/vpe.pl |
---|
443 | texlive-collection-latexrecommended,/usr/bin/thumbpdf,/usr/share/texmf-dist/scripts/thumbpdf/thumbpdf.pl |
---|
444 | texlive-collection-pictures,/usr/bin/cachepic,/usr/share/texmf-dist/scripts/cachepic/cachepic.tlu |
---|
445 | texlive-collection-pictures,/usr/bin/epspdf,/usr/share/texmf-dist/scripts/epspdf/epspdf |
---|
446 | texlive-collection-pictures,/usr/bin/epspdftk,/usr/share/texmf-dist/scripts/epspdf/epspdftk |
---|
447 | texlive-collection-pictures,/usr/bin/fig4latex,/usr/share/texmf-dist/scripts/fig4latex/fig4latex |
---|
448 | texlive-collection-pstricks,/usr/bin/pst2pdf,/usr/share/texmf-dist/scripts/pst2pdf/pst2pdf.pl |
---|
449 | texlive-collection-science,/usr/bin/ulqda,/usr/share/texmf-dist/scripts/ulqda/ulqda.pl |
---|
450 | ) |
---|
451 | %__mkdir_p %{buildroot}%{_bindir} |
---|
452 | pushd %{buildroot}%{_bindir} |
---|
453 | for i in "\${mk_symlinks[@]}"; do |
---|
454 | tlc=\$(echo \$i | cut -f 1 -d",") |
---|
455 | lnk=\$(echo \$i | cut -f 2 -d"," | %__sed -e "s|/usr/bin/||") |
---|
456 | rlnk=\$(echo \$i | cut -f 3 -d"," | %__sed -e "s|/usr/|../|") |
---|
457 | |
---|
458 | [ "%{name}" = "\$tlc" ] || continue |
---|
459 | [ -f \$rlnk ] || exit 1 |
---|
460 | %__ln_s \$rlnk \$lnk || exit 1 |
---|
461 | done |
---|
462 | popd |
---|
463 | EOF |
---|
464 | |
---|
465 | cat<<EOF |
---|
466 | ## info |
---|
467 | %__rm -f %{buildroot}%{_infodir}/dir |
---|
468 | %__gzip -9nf %{buildroot}%{_infodir}/*info* ||: |
---|
469 | |
---|
470 | ## man |
---|
471 | ## man t1* files are provided by t1utils |
---|
472 | for i in t1ascii t1asm t1binary t1disasm t1mac t1unmac; do |
---|
473 | %__rm %{buildroot}%{_mandir}/man*/\${i}.* ||: |
---|
474 | done |
---|
475 | |
---|
476 | ## man some files are provided by psutils |
---|
477 | for i in epsffit extractres fixdlsrps fixfmps fixmacps fixpsditps fixpspps fixscribeps fixtpps fixwfwps fixwpps fixwwps getafm includeres psbook psmerge psnup psresize psselect pstops; do |
---|
478 | %__rm %{buildroot}%{_mandir}/man*/\${i}.* ||: |
---|
479 | done |
---|
480 | |
---|
481 | ## fix perl path |
---|
482 | for i in source/metapost/expressg/expressg.dtx \\ |
---|
483 | doc/metapost/expressg/n2mpsprl.prl \\ |
---|
484 | doc/latex/songbook/contrib/crd2sb/crd2sb; do |
---|
485 | [ -f %{build_texmf}-dist/\${i} ] && \\ |
---|
486 | %__sed -i -e "s|^#!/usr/local/bin/perl|#!%{__perl}|" %{build_texmf}-dist/\${i} |
---|
487 | done |
---|
488 | |
---|
489 | ## remove asymptote directries, which provides asymptote package |
---|
490 | find %{buildroot} -regex ".*asymptote.*" | xargs %__rm -rf |
---|
491 | # find %{buildroot} -name "Makefile" | xargs %__rm -f |
---|
492 | |
---|
493 | # ## remove xindy |
---|
494 | # find %{buildroot} -regex ".*xindy.*" | xargs %__rm -rf |
---|
495 | |
---|
496 | # ## remove tex4ht |
---|
497 | # find %{buildroot} -regex ".*tex4ht.*" | xargs %__rm -rf |
---|
498 | |
---|
499 | ## remove arch dependent binaries |
---|
500 | %__rm -f %{build_texmf}-dist/source/latex/splitindex/splitindex-{OpenBSD,Linux}-i386 |
---|
501 | |
---|
502 | ## remove unpackaging files |
---|
503 | find %{buildroot} | %__grep -e "\\.\(la\|a\)\$" | xargs %__rm -f |
---|
504 | find %{buildroot} | %__grep -e "\\.\(diff\|patch\)\$" | xargs %__rm -f |
---|
505 | |
---|
506 | ## Files list |
---|
507 | find %{buildroot} -type f -or -type l | \\ |
---|
508 | %__sed -e "s|%{buildroot}||g" > filelist.full |
---|
509 | |
---|
510 | find %{buildroot}%{texmf}-dist -type d | \\ |
---|
511 | %__sed -e "s|^%{buildroot}|%dir |" \\ |
---|
512 | -e "s|\$|/|" >> filelist.full |
---|
513 | |
---|
514 | EOF |
---|
515 | |
---|
516 | ## subpackage: %{name}-doc |
---|
517 | if [ $with_docpkg -eq 1 ]; then |
---|
518 | cat<<EOF |
---|
519 | ## subpackages |
---|
520 | grep "/texmf-dist/doc/" filelist.full > filelist.doc |
---|
521 | cat filelist.doc filelist.full | sort | uniq -u > filelist.tmp |
---|
522 | %__mv -f filelist.tmp filelist.full |
---|
523 | |
---|
524 | EOF |
---|
525 | fi |
---|
526 | |
---|
527 | cat<<EOF |
---|
528 | %clean |
---|
529 | %__rm -rf %{buildroot} |
---|
530 | |
---|
531 | %post |
---|
532 | %{exec_texhash} |
---|
533 | |
---|
534 | EOF |
---|
535 | |
---|
536 | ## Running updmap |
---|
537 | if [ $with_maplist -eq 1 ]; then |
---|
538 | cat<<EOF |
---|
539 | [ -f %{texmf}/web2c/updmap.cfg ] || exit 0 |
---|
540 | |
---|
541 | updmap_lock=%{texmf}/updmap.lock |
---|
542 | $(echo "$MAPLIST" | while read maptype map; do \ |
---|
543 | cat<<EOT |
---|
544 | %{exec_updmap} --listmaps 2>/dev/null | egrep -q "^#! ${maptype} ${map}" && \\ |
---|
545 | echo -n " " && \\ |
---|
546 | echo -n "Running updmap: enable ${map} ... " && \\ |
---|
547 | %{exec_updmap} --nomkmap --enable ${maptype} ${map} >/dev/null 2>&1 && \\ |
---|
548 | echo "done." && \\ |
---|
549 | touch \${updmap_lock} |
---|
550 | EOT |
---|
551 | done) |
---|
552 | |
---|
553 | rpm -q --quiet texlive-common || exit 0 |
---|
554 | |
---|
555 | [ -f \${updmap_lock} ] && \\ |
---|
556 | echo -n " " && \\ |
---|
557 | echo -n "Running updmap: recreate map files ... " && \\ |
---|
558 | %{exec_updmap} >/dev/null 2>&1 && \\ |
---|
559 | echo "done." && \\ |
---|
560 | rm -f \${updmap_lock} |
---|
561 | |
---|
562 | EOF |
---|
563 | fi |
---|
564 | |
---|
565 | ## Running fmtutil |
---|
566 | if [ $with_inilist -eq 1 ]; then |
---|
567 | cat<<EOF |
---|
568 | rpm -q --quiet texlive-common || exit 0 |
---|
569 | |
---|
570 | echo -n " " |
---|
571 | echo -n "Running fmtutil ... " && %{exec_fmtutil} && echo "done." |
---|
572 | |
---|
573 | EOF |
---|
574 | fi |
---|
575 | |
---|
576 | cat<<EOF |
---|
577 | exit 0 |
---|
578 | |
---|
579 | |
---|
580 | %postun |
---|
581 | if [ "\$1" = 0 ]; then |
---|
582 | %{exec_texhash} |
---|
583 | |
---|
584 | EOF |
---|
585 | |
---|
586 | ## Running updmap |
---|
587 | if [ $with_maplist -eq 1 ]; then |
---|
588 | cat<<EOF |
---|
589 | [ -f %{texmf}/web2c/updmap.cfg ] || exit 0 |
---|
590 | |
---|
591 | $(echo "$MAPLIST" | while read maptype map; do \ |
---|
592 | cat<<EOT |
---|
593 | %{exec_updmap} --listmaps 2>/dev/null | egrep -q "^${maptype} ${map}" && \\ |
---|
594 | echo -n " " && \\ |
---|
595 | echo -n "Running updmap: disable ${map} ... " && \\ |
---|
596 | %{exec_updmap} --nomkmap --disable ${map} >/dev/null 2>&1 && \\ |
---|
597 | echo "done." |
---|
598 | EOT |
---|
599 | done) |
---|
600 | echo -n " " && \\ |
---|
601 | echo -n "Running updmap: recreate map files ... " && \\ |
---|
602 | %{exec_updmap} >/dev/null 2>&1 && \\ |
---|
603 | echo "done." |
---|
604 | |
---|
605 | EOF |
---|
606 | fi |
---|
607 | |
---|
608 | cat<<EOF |
---|
609 | fi |
---|
610 | |
---|
611 | exit 0 |
---|
612 | |
---|
613 | %files -f filelist.full |
---|
614 | %defattr(-,root,root) |
---|
615 | |
---|
616 | EOF |
---|
617 | ## subpackage: %{name}-doc |
---|
618 | if [ $with_docpkg -eq 1 ]; then |
---|
619 | cat<<EOF |
---|
620 | %files -f filelist.doc doc |
---|
621 | %defattr(-,root,root) |
---|
622 | |
---|
623 | EOF |
---|
624 | fi |
---|
625 | |
---|
626 | cat<<EOF |
---|
627 | %changelog |
---|
628 | * Mon Mar 23 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-4 |
---|
629 | - generated by $(basename $0) 2009-4: $(basename $0) $(echo $*) |
---|
630 | - make symlinks of core script utils (texlive-collection-binextra, |
---|
631 | texlive-collection-context, texlive-collection-fontutils, |
---|
632 | texlive-collection-langgreek, texlive-collection-langindic, |
---|
633 | texlive-collection-latex, texlive-collection-latexextra, |
---|
634 | texlive-collection-latexrecommended, texlive-collection-pictures, |
---|
635 | texlive-collection-pstricks, texlive-collection-science) |
---|
636 | |
---|
637 | * Fri Jan 14 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-3 |
---|
638 | - generated by $(basename $0) 2009-3: $(basename $0) $(echo $*) |
---|
639 | - improved %%post |
---|
640 | |
---|
641 | * Fri Oct 01 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-2 |
---|
642 | - generated by $(basename $0) 2009-2: $(basename $0) $(echo $*) |
---|
643 | - removed arch dependent binaries (texlive-collection-latexextra) |
---|
644 | - fixed perl path |
---|
645 | - improved updmap process in %%post and %%postun |
---|
646 | |
---|
647 | * Sat Aug 07 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-1 |
---|
648 | - generated by $(basename $0) 2009-1: $(basename $0) $(echo $*) |
---|
649 | EOF |
---|
650 | |
---|
651 | return 0 |
---|
652 | } |
---|
653 | |
---|
654 | ## mkrpmcollection [--minimal-collections|--standard-collections|--full-collections] |
---|
655 | mkrpmcollection(){ |
---|
656 | local category=$(echo $1 | sed -e "s/--\([a-z]*\)-collections/\1/") |
---|
657 | local category_pkglist= |
---|
658 | local i= |
---|
659 | |
---|
660 | case $category in |
---|
661 | minimal|standard) |
---|
662 | category_pkglist=$(grep -e "${category}," $CATEGORYLIST | sed -e "s/${category},//g" | sed -e "s/,$//g") |
---|
663 | ;; |
---|
664 | full) |
---|
665 | category_pkglist=$(Usage | egrep "^collection-") |
---|
666 | ;; |
---|
667 | *) |
---|
668 | echo "E: unknown category: $category" |
---|
669 | return 1 |
---|
670 | ;; |
---|
671 | esac |
---|
672 | |
---|
673 | for i in ${category_pkglist}; do |
---|
674 | mkrpmspec $i > texlive-${i}-vl.spec |
---|
675 | if [ $? -eq 1 ]; then |
---|
676 | echo "texlive-${i}-vl.spec: " |
---|
677 | cat texlive-${i}-vl.spec |
---|
678 | rm -f texlive-${i}-vl.spec |
---|
679 | continue |
---|
680 | fi |
---|
681 | rpmbuild -ba texlive-${i}-vl.spec || return 1 |
---|
682 | done |
---|
683 | |
---|
684 | return 0 |
---|
685 | } |
---|
686 | |
---|
687 | setup-tlpdb2rpmspec(){ |
---|
688 | ## load your .vtlpkg.conf |
---|
689 | if [ -f ${HOME}/.vtlpkg.conf ]; then |
---|
690 | . ${HOME}/.vtlpkg.conf |
---|
691 | else |
---|
692 | echo "E: ${HOME}/.vtlpkg.conf: No such file" |
---|
693 | return 1 |
---|
694 | fi |
---|
695 | |
---|
696 | [ -z "$RPM_VENDOR" ] && \ |
---|
697 | echo "E: \$RPM_VENDOR is empty" && exit 1 |
---|
698 | [ -z "$RPM_DISTRIBUTION" ] && \ |
---|
699 | echo "E: \$RPM_DISTRIBUTION is empty" && exit 1 |
---|
700 | [ -z "$RPM_GPG_NAME" ] && \ |
---|
701 | echo "E: \$RPM_GPG_NAME is empty" && exit 1 |
---|
702 | [ -z "$RPM_PACKAGER" ] && \ |
---|
703 | echo "E: \$RPM_PACKAGER is empty" && exit 1 |
---|
704 | |
---|
705 | ## setup configurations |
---|
706 | VERSION=@@VTLPKG_VERSION@@ |
---|
707 | RELEASE=@@VTLPKG_RELEASE@@ |
---|
708 | |
---|
709 | ## set a tlpdb file for TeX Live, which is a package database file. |
---|
710 | TLPDB=@@VTLPKG_TLPDB@@ |
---|
711 | TLPDB_MAXLINE=$(wc -l $TLPDB | cut -d" " -f 1) |
---|
712 | |
---|
713 | ## category of collection-* |
---|
714 | CATEGORYLIST=@@VTLPKG_CATEGORYLIST@@ |
---|
715 | |
---|
716 | ## set some booleans |
---|
717 | with_option=0 |
---|
718 | } |
---|
719 | |
---|
720 | ############################################################################## |
---|
721 | |
---|
722 | setup-tlpdb2rpmspec || exit 1 |
---|
723 | |
---|
724 | check-parameter $* || exit 1 |
---|
725 | |
---|
726 | case $1 in |
---|
727 | --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist) |
---|
728 | tlpkg4a $1 $2 || exit 1 |
---|
729 | ;; |
---|
730 | --minimal-collections|--standard-collections|--full-collections) |
---|
731 | mkrpmcollection $1 || exit 1 |
---|
732 | ;; |
---|
733 | *) |
---|
734 | mkrpmspec $1 || exit 1 |
---|
735 | ;; |
---|
736 | esac |
---|
737 | |
---|
738 | exit |
---|
739 | |
---|
740 | ### end of file |
---|