Ticket #51668: Portfile

File Portfile, 5.4 KB (added by dliessi (Davide Liessi), 8 years ago)
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id$
3
4PortSystem          1.0
5PortGroup           texlive 1.0
6
7name                texlive-texdist
8version             1
9categories          tex
10platforms           darwin
11supported_archs     noarch
12license             public-domain
13maintainers         gmail.com:davide.liessi openmaintainer
14description         TeXDist directory structure for MacPorts' TeX Live
15long_description    ${description}. \
16                    It is used by MacTeX's texdist utility and TeX \
17                    Distribution Preference Pane to switch between TeX \
18                    distributions. \
19                    \nSee /Library/TeX/Distributions/TeXDist-description.rtf \
20                    (also distributed with MacTeX).
21homepage            http://www.tug.org/mactex/multipletexdistributions.html
22master_sites
23
24fetch {}
25checksum {}
26extract {}
27use_configure       no
28build {}
29
30# The directories MacPorts-TeXLive.texdist and MacPorts-teTeX.texdist in
31# /Library/TeX/Distributions/ and MacPorts-TeXLive and MacPorts-teTeX in
32# /Library/TeX/Distributions/.FactoryDefaults/ are considered by
33# TeX Live / MacTeX developers as owned by MacPorts.
34#
35# From a private email exchange with Richard Koch:
36#
37#    "Do you have direct contact with the MacPorts people. If so, you
38#     might propose that
39#     [...]
40#     b) From now on, they install the data structure themselves.
41#     Surely b) is the correct option, and I follow it for all distributions
42#     except Fink-tetex, MacPorts-teTeX, and MacPorts-TeXLive."
43#
44#    "> I'm willing to help improving this (e.g. I could prepare a port
45#     > for the data structure in MacPorts), [...]
46#     AHA. Then it is great that you wrote. Go ahead and write your own data,
47#     and reuse the names I used, because then MacTeX will not overwrite it."
48#
49#    "From now on, these entries will not be created by MacTeX. If the
50#     entries already exist, either because we wrote them or because you
51#     changed them, MacTeX won't change them. If you remove the entries
52#     entirely, then new versions of MacTeX won't add them back, but the
53#     rare use of old install packages will."
54#
55# Moreover, they are useful only if MacPorts' TeX Live is installed, so
56# removing the old ones here and not restoring them in post-deactivate
57# does no harm to the user. Consider also that teTeX does not exist
58# anymore in MacPorts.
59
60set td_root         /Library/TeX/Distributions
61set td_fd           /.FactoryDefaults
62if {[string equal ${prefix} {/opt/local}]} {
63    set td_name     MacPorts-TeXLive
64} else {
65    regsub -all {/} [string trim ${prefix} {/}] {_} prefix_
66    set td_name     MacPorts-${prefix_}-TeXLive
67}
68set td_mp           ${td_root}/${td_name}.texdist
69set td_mpfd         ${td_root}${td_fd}/${td_name}/Contents
70
71destroot.violate_mtree  yes
72
73destroot {
74    xinstall -d ${destroot}${td_mp}
75    ln -s ..${td_fd}/${td_name}/Contents ${destroot}${td_mp}/Contents
76
77    xinstall -d ${destroot}${td_mpfd}/AllTexmf
78    ln -s ${texlive_texmfports} ${destroot}${td_mpfd}/AllTexmf/texmf
79    ln -s ${texlive_texmfdist} ${destroot}${td_mpfd}/AllTexmf/texmf-dist
80    ln -s ${texlive_texmfdist}/doc ${destroot}${td_mpfd}/AllTexmf/texmf-doc
81    ln -s ${texlive_texmflocal} ${destroot}${td_mpfd}/AllTexmf/texmf-local
82    ln -s ${texlive_texmfsysvar} ${destroot}${td_mpfd}/AllTexmf/texmf-var
83
84    xinstall -d ${destroot}${td_mpfd}/Doc
85    ln -s ${texlive_texmfdist}/doc ${destroot}${td_mpfd}/Doc/texmf-dist-doc
86    ln -s ${texlive_texmfports}/doc ${destroot}${td_mpfd}/Doc/texmf-doc
87    ln -s ${texlive_texmfdist}/doc ${destroot}${td_mpfd}/Doc/texmf-doc-doc
88    ln -s ${texlive_texmfdist}/doc ${destroot}${td_mpfd}/Doc/texmf-var-doc
89
90    ln -s ${prefix}/share/info ${destroot}${td_mpfd}/Info
91    ln -s ${prefix}/share/man ${destroot}${td_mpfd}/Man
92
93    xinstall -d ${destroot}${td_mpfd}/Programs
94    ln -s ${texlive_mactex_texbindir} ${destroot}${td_mpfd}/Programs/i386
95    ln -s ${texlive_mactex_texbindir} ${destroot}${td_mpfd}/Programs/x86_64
96    ln -s ${texlive_mactex_texbindir} ${destroot}${td_mpfd}/Programs/powerpc
97    ln -s ${texlive_mactex_texbindir} ${destroot}${td_mpfd}/Programs/ppc
98    ln -s ${texlive_mactex_texbindir} ${destroot}${td_mpfd}/Programs/texbin
99
100    xinstall -d ${destroot}${td_mpfd}/Resources/English.lproj
101    xinstall -m 644 ${filespath}/Description.rtf \
102        ${destroot}${td_mpfd}/Resources/English.lproj/Description.rtf
103    reinplace "s|%%PREFIX%%|${prefix}|g" \
104        ${destroot}${td_mpfd}/Resources/English.lproj/Description.rtf
105
106    ln -s ${prefix}/share ${destroot}${td_mpfd}/Root
107
108    set td_vfile [open ${destroot}${td_mpfd}/TeXDistVersion w]
109    puts ${td_vfile} "1"
110    close ${td_vfile}
111
112    ln -s ${texlive_texmflocal} ${destroot}${td_mpfd}/TexmfLocal
113    ln -s ${texlive_texmfsysvar} ${destroot}${td_mpfd}/TexmfSysVar
114}
115
116pre-activate {
117    if {[string equal ${prefix} {/opt/local}]} {
118        if {[file exists ${td_root}/MacPorts-TeXLive.texdist]} {
119            delete file ${td_root}/MacPorts-TeXLive.texdist
120        }
121        if {[file exists ${td_root}${td_fd}/MacPorts-TeXLive]} {
122            delete file ${td_root}${td_fd}/MacPorts-TeXLive
123        }
124        if {[file exists ${td_root}/MacPorts-teTeX.texdist]} {
125            delete file ${td_root}/MacPorts-teTeX.texdist
126        }
127        if {[file exists ${td_root}${td_fd}/MacPorts-teTeX]} {
128            delete file ${td_root}${td_fd}/MacPorts-teTeX
129        }
130    }
131}