source: projects/texlive-vtlpkg/branches/2011/tlpdb2rpmspec.sh.in @ 5246

Revision 5246, 27.2 KB checked in by munepi, 12 years ago (diff)

updated dot.vtlpkg.conf.in and tlpdb2rpmspec.sh.in: defined ASYMPTOTE_PACKAGE

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