aboutsummaryrefslogtreecommitdiffstats
path: root/print/tex/Makefile
blob: 4aec8dd8aa501a5839807c7c79e682cd620fdbd2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#define this if you want to build LaTeX too
MAKE_LATEX= yes

PKGNAME=    tex
DISTFILES=  web2c.tar.gz web.tar.gz tex_base.tar.gz cm_tfm.tar.gz \
        mf_lib.tar.gz cm_mf.tar.gz      modes.mf 

EXTRACT_ONLY=   web2c.tar.gz web.tar.gz tex_base.tar.gz cm_tfm.tar.gz \
        mf_lib.tar.gz cm_mf.tar.gz


FTPGET=     ${WRKDIR}/ftpget
CURDIR=     ${.CURDIR}


DISTNAME=   web2c-6.1

#other equivalent sites: ftp.shsu.edu ftp.dante.de
CTAN=       ftp.tex.ac.uk


.if defined (MAKE_LATEX)
DISTFILES+= latex_mf.tar.gz latex_tfm.tar.gz latex_base.tar.gz
EXTRACT_ONLY+=  latex_base.tar.gz latex_mf.tar.gz latex_tfm.tar.gz
.endif

BASES=      mf.base cmmf.base 
FORMATS=    tex.fmt 

CFLAGS=     -O2

BUILD_COOKIE=       ${WRKDIR}/.build_done

pre-fetch:
    @if [ ! -d ${DISTDIR} ]; then mkdir -p ${DISTDIR}; fi
    @mkdir -p ${WRKDIR}
    @${SCRIPTDIR}/ftpget magic ${WRKDIR}

fetch: pre-fetch ${DISTFILES}

fetch-file:
    @echo ">> ${file_out} doesn't seem to exist on this system."; 
    @echo ">> Attempting to fetch it from a master site."; 
    @${FTPGET} ${CTAN} ${ftp_dir} ${file_in} ${file_out}
    @if [ ! -f ${file_out} ]; then \
        echo ">> Couldn't fetch it - please try to retreive this";\
        echo ">> port manually into ${DISTDIR} and try again."; \
        exit 1; \
     else \
        echo ">> ${file_out} Fetched!" ; \
     fi;
    
web2c.tar.gz: 
    @(cd ${DISTDIR}; if [ ! -f $@ ]; then \
      make -f ${CURDIR}/Makefile fetch-file FTPGET=${FTPGET} \
        ftp_dir=/tex-archive/systems/web2c file_in=web2c.tar.gz file_out=$@; \
     fi;)
web.tar.gz: 
    @(cd ${DISTDIR}; if [ ! -f $@ ]; then \
      make -f ${CURDIR}/Makefile fetch-file FTPGET=${FTPGET} \
        ftp_dir=/tex-archive/systems/web2c file_in=web.tar.gz file_out=$@; \
     fi;)
cm_mf.tar.gz:
    @(cd ${DISTDIR}; if [ ! -f $@ ]; then \
      make -f ${CURDIR}/Makefile fetch-file FTPGET=${FTPGET} \
        ftp_dir=/tex-archive/fonts file_in=cm/mf.tar.gz file_out=$@; \
     fi;)
cm_tfm.tar.gz:
    @(cd ${DISTDIR}; if [ ! -f $@ ]; then \
      make -f ${CURDIR}/Makefile fetch-file FTPGET=${FTPGET} \
        ftp_dir=/tex-archive/fonts file_in=cm/tfm.tar.gz file_out=$@; \
     fi;)
mf_lib.tar.gz: 
    @(cd ${DISTDIR}; if [ ! -f $@ ]; then \
      make -f ${CURDIR}/Makefile fetch-file FTPGET=${FTPGET} \
        ftp_dir=/tex-archive/systems/knuth file_in=lib.tar.gz file_out=$@; \
     fi;)
modes.mf:
    @(cd ${DISTDIR}; if [ ! -f $@ ]; then \
      make -f ${CURDIR}/Makefile fetch-file FTPGET=${FTPGET} \
        ftp_dir=/tex-archive/fonts/modes file_in=modes.mf file_out=$@; \
     fi;)
tex_base.tar.gz:
    @(cd ${DISTDIR}; if [ ! -f $@ ]; then \
      make -f ${CURDIR}/Makefile fetch-file FTPGET=${FTPGET} \
            ftp_dir=/tex-archive/macros file_in=plain/base.tar.gz file_out=$@; \
     fi;)
latex_base.tar.gz:
    @(cd ${DISTDIR}; if [ ! -f $@ ]; then \
      make -f ${CURDIR}/Makefile fetch-file FTPGET=${FTPGET} \
            ftp_dir=/tex-archive/macros file_in=latex/base.tar.gz file_out=$@; \
    fi;)
latex_mf.tar.gz:
    @(cd ${DISTDIR}; if [ ! -f $@ ]; then \
      make -f ${CURDIR}/Makefile fetch-file FTPGET=${FTPGET} \
        ftp_dir=/tex-archive/fonts file_in=latex/mf.tar.gz file_out=$@; \
     fi;)
latex_tfm.tar.gz:
    @(cd ${DISTDIR}; if [ ! -f $@ ]; then \
      make -f ${CURDIR}/Makefile fetch-file FTPGET=${FTPGET} \
        ftp_dir=/tex-archive/fonts file_in=latex/tfm.tar.gz file_out=$@; \
     fi;)

build: ${BUILD_COOKIE}

${BUILD_COOKIE}:
    @echo "===>  Building for ${DISTNAME}"
    @(cd ${WRKSRC}/web2c; make triptrap)
    @(cd ${WRKSRC}/web2c; make run-triptrap)
    @(cd ${WRKSRC}/web2c; make clean-triptrap)

    @(cd ${WRKSRC}; make CFLAGS="${CFLAGS}" programs)
    @(cd ${WRKSRC}; MFINPUTS=${WRKDIR}/mf; export MFINPUTS;\
        make bases="${BASES}" bases)
.if defined (MAKE_LATEX)
    @(cd ${WRKDIR}/latex/base; TEXPOOL=${WRKSRC}/web2c/tex; export TEXPOOL; \
        ${WRKSRC}/web2c/tex/initex unpack.ins)
    @(cd ${WRKDIR}/latex/base; TEXFONTS=${WRKDIR}/cm/tfm:${WRKDIR}/latex/tfm; \
      export TEXFONTS; TEXINPUTS=${WRKDIR}/lib:.; export TEXINPUTS; \
      TEXPOOL=${WRKSRC}/web2c/tex; export TEXPOOL;\
        ${WRKSRC}/web2c/tex/initex latex.ltx)
.endif
    @(cd ${WRKSRC}/web2c; TEXINPUTS=${WRKDIR}/lib:${WRKSRC}; export TEXINPUTS;\
      TEXFONTS=${WRKDIR}/cm/tfm:${WRKDIR}/latex/tfm; export TEXFONTS; \
        make fmts="${FORMATS}" fmts)
    @touch -f ${BUILD_COOKIE}

install:
    @echo "===>  Installing for ${DISTNAME}"
    @(cd ${WRKSRC}/web2c; make install-exec INSTALL_PROGRAM="/usr/bin/install -c -s")
.if defined(MAKE_LATEX)
    @(/usr/bin/install -c -m 644 ${WRKDIR}/latex/base/latex.fmt \
                ${PREFIX}/lib/texmf/ini/)
.endif
    @(cd ${WRKSRC}/web2c; make install-manpages)
    @(cd ${WRKSRC}/web2c; make install-data bases="${BASES}" fmts="${FORMATS}")
    @mkdir -p ${PREFIX}/lib/texmf/fonts/tfm
    @(cd ${WRKDIR}/cm/tfm; install -c -m 644 *.tfm ${PREFIX}/lib/texmf/fonts/tfm)
.if defined(MAKE_LATEX)
    @(cd ${WRKDIR}/latex/tfm; install -c -m 644 *.tfm ${PREFIX}/lib/texmf/fonts/tfm)
.endif
    @mkdir -p ${PREFIX}/lib/texmf/mf
    @(cd ${WRKDIR}/mf; install -c -m 644 *.mf ${PREFIX}/lib/texmf/mf)
    @mkdir -p ${PREFIX}/lib/texmf/tex
    @(cd ${WRKDIR}/lib; install -c -m 644 *.tex ${PREFIX}/lib/texmf/tex)
    @(cd ${WRKDIR}/plain/base; install -c -m 644 *.tex ${PREFIX}/lib/texmf/tex)
.if defined(MAKE_LATEX)
    @(cd ${WRKDIR}/latex/base; for f in latexbug.tex testpage.tex \
       lablst.tex idx.tex nfssfont.tex small2e.tex sample2e.tex docstrip.tex \
       *.cls *.clo *.sty *.fd *.def *.cfg ; do \
        if [ -f $${f} ]; then install -c -m 644  $${f} ${PREFIX}/lib/texmf/tex; fi; done)
    @(cd ${WRKDIR}/latex/base; for f in *.ist ; do \
        install -c -m 644 $${f} ${PREFIX}/lib/makeindex ; done) 
.endif

.include <bsd.port.mk>