source: projects/texlive-vtlpkg/trunk/tlpdb2rpmspec.sh.in @ 3943

Revision 3943, 24.4 KB checked in by munepi, 13 years ago (diff)

updated tlpdb2rpmspec.sh.in: make symlinks of core script utils; applied texlive-vtlpkg-2009-vine.patch: remove arch dependent binaries

  • Property svn:executable set to *
RevLine 
[1476]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
10Usage:  $(basename $0) [option] [pkgname]
11
12This script generates a rpm spec file for CTAN and collection-* packages of TeX Live.
13
14Options:
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
29Supoort collections-* packages:
30$(egrep "^name collection-" $TLPDB | sed -e "s,name ,,g")
31EOF
32}
33
34check-parameter(){
35    [ -z "$*" ] && Usage && return 1
36
37    while [ ! -z "$*" ]; do
38        case $1 in
[1521]39            --name|--category|--revision|--depend|--shortdesc|--longdesc|--execute|--catalogue-ctan|--catalogue-date|--catalogue-license|--catalogue-version|--filelist)
[1476]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                ;;
[1521]48            --minimal-collections|--standard-collections|--full-collections)
49                [ ! -f /etc/vine-release ] && \
50                    echo "E: support Vine Linux only" && return 1
51                ;;
52            *)
[1784]53                [ -z "$(egrep -n "^name $1$" $TLPDB)" ] && \
54                    echo "E: unknown option or package: $1" && return 1
[1476]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]
65tlpkg4a(){
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
[1496]85    is_pkg=0
[2975]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    ) | \
[1476]91        while read field; do
92            ## find the record of $pkg
[1496]93            echo "$field" | egrep -q "^name $pkg" && is_pkg=1
94            [ $is_pkg -eq 0 ] && continue
[1476]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]
113tlpkg2speclicense(){
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]
147tlpkg2manifest(){
148    [ $# -eq 1 ] || return 1
149    local pkg=$1
150    local pkgdeps="$(tlpkg4a --depend $pkg)"
[1521]151    local i=
[1476]152
153    tlpkg4a --filelist $pkg || return 1
154
[1496]155    ## if $pkg is not collection-*, only return the filelist of $pkg
156    echo $pkg | egrep -q "^collection-" || return 0
157
[1476]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]
170tlpkg2maplist(){
171    [ $# -eq 1 ] || return 1
172    local pkg=$1
173    local pkgdeps="$(tlpkg4a --depend $pkg)"
[1521]174    local i=
[1476]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
[1496]189## tlpkg2inilist [pkgname]
190tlpkg2inilist(){
191    [ $# -eq 1 ] || return 1
192    local pkg=$1
193    local pkgdeps="$(tlpkg4a --depend $pkg)"
[1521]194    local i=
[1476]195
[1496]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
[1476]210## mkrpmspec [pkgname]
211mkrpmspec(){
212    [ $# -eq 1 ] || return 1
213    local pkg=$1
[1521]214    local i=
[1476]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
[1499]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)
[1521]243    [ -z "${PKG_MANIFEST}" ] && \
244        echo "W: empty manifest: $pkg" && return 1
[1499]245
[1476]246    with_docpkg=0
247    [ -z "$(echo $pkg | grep "collection-documentation")" ] && \
[1499]248        [ ! -z "$(echo "${PKG_MANIFEST}" | grep texmf-dist/doc/)" ] && \
[1476]249        with_docpkg=1
250
[1496]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
[1476]261cat<<EOF
262## -*- coding: utf-8-unix -*-
[1709]263## NOTE: This spec file is generated by $(basename $0) ${VERSION}-${RELEASE}:
264## $(basename $0) $pkg
[1476]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}
[2499]283%define __perl_provides %{nil}
284%define __perl_requires %{nil}
[1476]285
286Autoreq: 0
287
288Summary: ${RPM_SUMMARY}
[1499]289Summary(ja): ${RPM_SUMMARY}
[1476]290Name: texlive-$pkg
291Version: ${VERSION}
[1915]292Release: ${RELEASE}%{?_dist_release}
[1476]293License: ${RPM_LICENSE}
294Group: Applications/Publishing
295URL:http://www.tug.org/texlive/
296
297Requires: texlive = %{version}
298$RPM_REQUIRES
299
300Requires(post):         texlive = %{version}
301Requires(postun):       texlive = %{version}
302BuildRequires:          texlive-sources = %{version}
303
304BuildArch:      noarch
305Buildroot:      %{_tmppath}/%{name}-%{version}-root
306
307Vendor:         ${RPM_VENDOR}
308Distribution:   ${RPM_DISTRIBUTION}
309Packager:       ${RPM_PACKAGER}
310
311%description
312The TeX Live software distribution offers a complete TeX system for a
313variety of Unix, Macintosh, Windows and other platforms. It
314encompasses programs for editing, typesetting, previewing and printing
315of TeX documents in many different languages, and a large collection
316of TeX macros and font libraries.
317
318The distribution includes extensive general documentation about TeX,
319as well as the documentation for the included software packages.
320
[1499]321This package is a collection of ${PKG_SHORTDESC}:
322${PKG_LONGDESC}
[1476]323
324This package contains the following CTAN packages:
[1499]325${PKG_CTANPKGSLIST}
[1476]326
[1499]327%description -l ja
328TeX Live ソフトウェアディストリビューションは、
329さまざまな Unix, Macintosh, Windows、および
330他のプラットホームに対して完全な TeX システムを提供します。
331多くの異なった言語を含む TeX ドキュメントの
332編集、組版、閲覧、印刷するためのプログラム、
333そして、TeX マクロやフォントライブラリの大きなコレクションを
334同梱しています。
335
336このディストリビューションは
337同梱しているソフトウェアパッケージのためのドキュメントばかりでなく、
338TeX に関するたくさんの一般的なドキュメントを含んでいます。
339
340このパッケージは以下のようなパッケージ集です。
341${PKG_SHORTDESC}:
342${PKG_LONGDESC}
343
344このパッケージは以下の CTAN パッケージを含んでいます:
345${PKG_CTANPKGSLIST}
346
[1476]347EOF
348
349## subpackage: %{name}-doc
350if [ $with_docpkg -eq 1 ]; then
351    cat<<EOF
352%package doc
353Summary: TeX Live: Documentation files of %{name}
354Group: Applications/Publishing
355Requires: %{name} = %{version}-%{release}
356
357%description doc
358This package contains documentation files of %{name}.
359
360EOF
361fi
362
363cat<<EOF
364%prep
365
366%build
367
368%install
369[ -n "%{buildroot}" -a "%{buildroot}" != / ] && %__rm -rf %{buildroot}
370
371PREF=%{buildroot}%{tex_destdir}
372
373manifest=(
[1499]374${PKG_MANIFEST}
[1476]375)
376
377%__mkdir_p \${PREF}/texmf-dist
378for i in "\${manifest[@]}"; do
379    %__install -D %{texlive_src}/\$i \${PREF}/\$i
380done
[3943]381EOF
[1476]382
[3943]383cat<<EOF
384## make symlinks of core script utils
385mk_symlinks=(
386texlive-collection-binextra,/usr/bin/dviasm,/usr/share/texmf-dist/scripts/dviasm/dviasm.py
387texlive-collection-binextra,/usr/bin/findhyph,/usr/share/texmf-dist/scripts/findhyph/findhyph
388texlive-collection-binextra,/usr/bin/fragmaster,/usr/share/texmf-dist/scripts/fragmaster/fragmaster.pl
389texlive-collection-binextra,/usr/bin/latex2man,/usr/share/texmf-dist/scripts/latex2man/latex2man
390texlive-collection-binextra,/usr/bin/latexmk,/usr/share/texmf-dist/scripts/latexmk/latexmk.pl
391texlive-collection-binextra,/usr/bin/listings-ext.sh,/usr/share/texmf-dist/scripts/listings-ext/listings-ext.sh
392texlive-collection-binextra,/usr/bin/mkjobtexmf,/usr/share/texmf-dist/scripts/mkjobtexmf/mkjobtexmf.pl
393texlive-collection-binextra,/usr/bin/pdfcrop,/usr/share/texmf-dist/scripts/pdfcrop/pdfcrop.pl
394texlive-collection-binextra,/usr/bin/pkfix,/usr/share/texmf-dist/scripts/pkfix/pkfix.pl
395texlive-collection-binextra,/usr/bin/pkfix-helper,/usr/share/texmf-dist/scripts/pkfix-helper/pkfix-helper
396texlive-collection-binextra,/usr/bin/purifyeps,/usr/share/texmf-dist/scripts/purifyeps/purifyeps
397texlive-collection-binextra,/usr/bin/texcount,/usr/share/texmf-dist/scripts/texcount/texcount.pl
398texlive-collection-binextra,/usr/bin/texdiff,/usr/share/texmf-dist/scripts/texdiff/texdiff
399texlive-collection-binextra,/usr/bin/texdirflatten,/usr/share/texmf-dist/scripts/texdirflatten/texdirflatten
400texlive-collection-binextra,/usr/bin/texloganalyser,/usr/share/texmf-dist/scripts/texloganalyser/texloganalyser
401texlive-collection-context,/usr/bin/context,/usr/share/texmf-dist/scripts/context/stubs/unix/context
402texlive-collection-context,/usr/bin/ctxtools,/usr/share/texmf-dist/scripts/context/stubs/unix/ctxtools
403texlive-collection-context,/usr/bin/luatools,/usr/share/texmf-dist/scripts/context/lua/luatools.lua
404texlive-collection-context,/usr/bin/makempy,/usr/share/texmf-dist/scripts/context/stubs/unix/makempy
405texlive-collection-context,/usr/bin/mpstools,/usr/share/texmf-dist/scripts/context/stubs/unix/mpstools
406texlive-collection-context,/usr/bin/mptopdf,/usr/share/texmf-dist/scripts/context/stubs/unix/mptopdf
407texlive-collection-context,/usr/bin/mtxrun,/usr/share/texmf-dist/scripts/context/lua/mtxrun.lua
408texlive-collection-context,/usr/bin/mtxtools,/usr/share/texmf-dist/scripts/context/stubs/unix/mtxtools
409texlive-collection-context,/usr/bin/pdftools,/usr/share/texmf-dist/scripts/context/stubs/unix/pdftools
410texlive-collection-context,/usr/bin/pstopdf,/usr/share/texmf-dist/scripts/context/stubs/unix/pstopdf
411texlive-collection-context,/usr/bin/rlxtools,/usr/share/texmf-dist/scripts/context/stubs/unix/rlxtools
412texlive-collection-context,/usr/bin/runtools,/usr/share/texmf-dist/scripts/context/stubs/unix/runtools
413texlive-collection-context,/usr/bin/texexec,/usr/share/texmf-dist/scripts/context/stubs/unix/texexec
414texlive-collection-context,/usr/bin/texfont,/usr/share/texmf-dist/scripts/context/stubs/unix/texfont
415texlive-collection-context,/usr/bin/texmfstart,/usr/share/texmf-dist/scripts/context/ruby/texmfstart.rb
416texlive-collection-context,/usr/bin/textools,/usr/share/texmf-dist/scripts/context/stubs/unix/textools
417texlive-collection-context,/usr/bin/texutil,/usr/share/texmf-dist/scripts/context/stubs/unix/texutil
418texlive-collection-context,/usr/bin/tmftools,/usr/share/texmf-dist/scripts/context/stubs/unix/tmftools
419texlive-collection-context,/usr/bin/xmltools,/usr/share/texmf-dist/scripts/context/stubs/unix/xmltools
420texlive-collection-fontutils,/usr/bin/afm2afm,/usr/share/texmf-dist/scripts/fontools/afm2afm
421texlive-collection-fontutils,/usr/bin/autoinst,/usr/share/texmf-dist/scripts/fontools/autoinst
422texlive-collection-fontutils,/usr/bin/cmap2enc,/usr/share/texmf-dist/scripts/fontools/cmap2enc
423texlive-collection-fontutils,/usr/bin/epstopdf,/usr/share/texmf-dist/scripts/epstopdf/epstopdf.pl
424texlive-collection-fontutils,/usr/bin/font2afm,/usr/share/texmf-dist/scripts/fontools/font2afm
425texlive-collection-fontutils,/usr/bin/mkt1font,/usr/share/texmf-dist/scripts/accfonts/mkt1font
426texlive-collection-fontutils,/usr/bin/ot2kpx,/usr/share/texmf-dist/scripts/fontools/ot2kpx
427texlive-collection-fontutils,/usr/bin/pfm2kpx,/usr/share/texmf-dist/scripts/fontools/pfm2kpx
428texlive-collection-fontutils,/usr/bin/showglyphs,/usr/share/texmf-dist/scripts/fontools/showglyphs
429texlive-collection-fontutils,/usr/bin/vpl2ovp,/usr/share/texmf-dist/scripts/accfonts/vpl2ovp
430texlive-collection-fontutils,/usr/bin/vpl2vpl,/usr/share/texmf-dist/scripts/accfonts/vpl2vpl
431texlive-collection-langgreek,/usr/bin/mkgrkindex,/usr/share/texmf-dist/scripts/mkgrkindex/mkgrkindex
432texlive-collection-langindic,/usr/bin/ebong,/usr/share/texmf-dist/scripts/bengali/ebong.py
433texlive-collection-latex,/usr/bin/pdfatfi,/usr/share/texmf-dist/scripts/oberdiek/pdfatfi.pl
434texlive-collection-latexextra,/usr/bin/makeglossaries,/usr/share/texmf-dist/scripts/glossaries/makeglossaries
435texlive-collection-latexextra,/usr/bin/pdfannotextractor,/usr/share/texmf-dist/scripts/pax/pdfannotextractor.pl
436texlive-collection-latexextra,/usr/bin/pdfthumb,/usr/share/texmf-dist/scripts/ppower4/pdfthumb.tlu
437texlive-collection-latexextra,/usr/bin/perltex,/usr/share/texmf-dist/scripts/perltex/perltex
438texlive-collection-latexextra,/usr/bin/ppower4,/usr/share/texmf-dist/scripts/ppower4/ppower4.tlu
439texlive-collection-latexextra,/usr/bin/ps4pdf,/usr/share/texmf-dist/scripts/pst-pdf/ps4pdf
440texlive-collection-latexextra,/usr/bin/splitindex,/usr/share/texmf-dist/scripts/splitindex/perl/splitindex.pl
441texlive-collection-latexextra,/usr/bin/svn-multi,/usr/share/texmf-dist/scripts/svn-multi/svn-multi.pl
442texlive-collection-latexextra,/usr/bin/vpe,/usr/share/texmf-dist/scripts/vpe/vpe.pl
443texlive-collection-latexrecommended,/usr/bin/thumbpdf,/usr/share/texmf-dist/scripts/thumbpdf/thumbpdf.pl
444texlive-collection-pictures,/usr/bin/cachepic,/usr/share/texmf-dist/scripts/cachepic/cachepic.tlu
445texlive-collection-pictures,/usr/bin/epspdf,/usr/share/texmf-dist/scripts/epspdf/epspdf
446texlive-collection-pictures,/usr/bin/epspdftk,/usr/share/texmf-dist/scripts/epspdf/epspdftk
447texlive-collection-pictures,/usr/bin/fig4latex,/usr/share/texmf-dist/scripts/fig4latex/fig4latex
448texlive-collection-pstricks,/usr/bin/pst2pdf,/usr/share/texmf-dist/scripts/pst2pdf/pst2pdf.pl
449texlive-collection-science,/usr/bin/ulqda,/usr/share/texmf-dist/scripts/ulqda/ulqda.pl
450)
451%__mkdir_p %{buildroot}%{_bindir}
452pushd %{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
462popd
463EOF
464
465cat<<EOF
[1476]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
472for i in t1ascii t1asm t1binary t1disasm t1mac t1unmac; do
473    %__rm %{buildroot}%{_mandir}/man*/\${i}.* ||:
474done
475
476## man some files are provided by psutils
477for 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}.* ||:
479done
480
[1968]481## fix perl path
[1975]482for i in source/metapost/expressg/expressg.dtx \\
483         doc/metapost/expressg/n2mpsprl.prl \\
[1968]484         doc/latex/songbook/contrib/crd2sb/crd2sb; do
[1975]485    [ -f %{build_texmf}-dist/\${i} ] && \\
[1968]486        %__sed -i -e "s|^#!/usr/local/bin/perl|#!%{__perl}|" %{build_texmf}-dist/\${i}
487done
488
[1476]489## remove asymptote directries, which provides asymptote package
490find %{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
[1968]499## remove arch dependent binaries
500%__rm -f %{build_texmf}-dist/source/latex/splitindex/splitindex-{OpenBSD,Linux}-i386
501
[1476]502## remove unpackaging files
503find %{buildroot} | %__grep -e "\\.\(la\|a\)\$" | xargs %__rm -f
504find %{buildroot} | %__grep -e "\\.\(diff\|patch\)\$" | xargs %__rm -f
505
506## Files list
507find %{buildroot} -type f -or -type l | \\
508    %__sed -e "s|%{buildroot}||g" > filelist.full
509
510find %{buildroot}%{texmf}-dist -type d | \\
511    %__sed -e "s|^%{buildroot}|%dir |" \\
512           -e "s|\$|/|"             >> filelist.full
513
514EOF
515
516## subpackage: %{name}-doc
517if [ $with_docpkg -eq 1 ]; then
518    cat<<EOF
519## subpackages
520grep "/texmf-dist/doc/" filelist.full > filelist.doc
521cat filelist.doc filelist.full | sort | uniq -u > filelist.tmp
522%__mv -f filelist.tmp filelist.full
523
524EOF
525fi
526
527cat<<EOF
528%clean
529%__rm -rf %{buildroot}
530
531%post
532%{exec_texhash}
[1496]533
534EOF
535
536## Running updmap
537if [ $with_maplist -eq 1 ]; then
538    cat<<EOF
[1498]539[ -f %{texmf}/web2c/updmap.cfg ] || exit 0
540
[2499]541updmap_lock=%{texmf}/updmap.lock
[1496]542$(echo "$MAPLIST" | while read maptype map; do \
543    cat<<EOT
[2499]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}
[1496]550EOT
551done)
[2499]552
553rpm -q --quiet texlive-common || exit 0
554
555[ -f \${updmap_lock} ] && \\
556    echo -n "    " && \\
[1915]557    echo -n "Running updmap: recreate map files ... " && \\
558    %{exec_updmap} >/dev/null 2>&1 && \\
[2499]559    echo "done." && \\
560    rm -f \${updmap_lock}
[1496]561
562EOF
[1476]563fi
564
[1496]565## Running fmtutil
566if [ $with_inilist -eq 1 ]; then
567    cat<<EOF
[2499]568rpm -q --quiet texlive-common || exit 0
569
[1496]570echo -n "    "
571echo -n "Running fmtutil ... " && %{exec_fmtutil} && echo "done."
572
573EOF
[1476]574fi
575
[1496]576cat<<EOF
[1476]577exit 0
578
579
580%postun
581if [ "\$1" = 0 ]; then
582    %{exec_texhash}
[1496]583
584EOF
585
586## Running updmap
587if [ $with_maplist -eq 1 ]; then
588    cat<<EOF
[1498]589    [ -f %{texmf}/web2c/updmap.cfg ] || exit 0
590
[1496]591$(echo "$MAPLIST" | while read maptype map; do \
592    cat<<EOT
[1499]593    %{exec_updmap} --listmaps 2>/dev/null | egrep -q "^${maptype} ${map}" && \\
594        echo -n "    " && \\
595        echo -n "Running updmap: disable ${map} ... " && \\
[1915]596        %{exec_updmap} --nomkmap --disable ${map} >/dev/null 2>&1 && \\
[1496]597        echo "done."
598EOT
599done)
[2499]600    echo -n "    " && \\
601        echo -n "Running updmap: recreate map files ... " && \\
602        %{exec_updmap} >/dev/null 2>&1 && \\
603        echo "done."
[1496]604
605EOF
[1476]606fi
607
[1496]608cat<<EOF
609fi
610
[1476]611exit 0
612
613%files -f filelist.full
614%defattr(-,root,root)
615
616EOF
617## subpackage: %{name}-doc
618if [ $with_docpkg -eq 1 ]; then
619    cat<<EOF
620%files -f filelist.doc doc
621%defattr(-,root,root)
622
623EOF
624fi
625
626cat<<EOF
627%changelog
[3943]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)
[3329]636
637* Fri Jan 14 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2009-3
[3943]638- generated by $(basename $0) 2009-3: $(basename $0) $(echo $*)
[2499]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 $*)
[1968]643- removed arch dependent binaries (texlive-collection-latexextra)
644- fixed perl path
[1915]645- improved updmap process in %%post and %%postun
646
647* Sat Aug 07 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2009-1
[2499]648- generated by $(basename $0) 2009-1: $(basename $0) $(echo $*)
[1476]649EOF
650
651    return 0
652}
653
[1521]654## mkrpmcollection [--minimal-collections|--standard-collections|--full-collections]
655mkrpmcollection(){
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
[1918]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
[1521]681        rpmbuild -ba texlive-${i}-vl.spec || return 1
682    done
683
684    return 0
685}
686
[1476]687setup-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
[1521]713    ## category of collection-*
714    CATEGORYLIST=@@VTLPKG_CATEGORYLIST@@
715
[1476]716    ## set some booleans
717    with_option=0
718}
719
720##############################################################################
721
722setup-tlpdb2rpmspec || exit 1
723
724check-parameter $* || exit 1
725
726case $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        ;;
[1521]730    --minimal-collections|--standard-collections|--full-collections)
731        mkrpmcollection $1 || exit 1
[1476]732        ;;
733    *)
734        mkrpmspec $1 || exit 1
735        ;;
736esac
737
738exit
739
740### end of file
Note: See TracBrowser for help on using the repository browser.