pullup 3232
[pkgsrcv2.git] / mk / tex.buildlink3.mk
1 # $NetBSD: tex.buildlink3.mk,v 1.16 2006/08/11 13:32:28 wiz Exp $
2 #
3 # This file is included by packages that need a TeX package to work.
4 #
5 # The following variables may be set by the pkgsrc user in mk.conf:
6 #
7 # TEX_DEFAULT
8 #       The user's favorite TeX implementation.
9 #
10 #       Possible values: teTeX3
11 #       Default value: teTeX3
12 #
13 # The following variables may be set by a package:
14 #
15 # TEX_DEPMETHOD
16 #       Select whether TeX is a runtime dependency or only needed
17 #       when building the package.
18 #
19 #       Possible values: build run
20 #       Default value: run
21 #
22 # TEX_ACCEPTED
23 #       List of TeX implementations that the package supports.
24 #
25 #       Possible values: teTeX3
26 #       Default value: teTeX3
27 #
28 # After including this file, the following variables may be used, but not
29 # in directives like .if, .for, etc.
30 #
31 # PKG_TEXMFPREFIX
32 #       Absolute pathname of the directory where the standard TeX files
33 #       can be found.
34 #
35 #       Typical values: ${PREFIX}/share/texmf ${PREFIX}/share/texmf-dist
36 #
37 # PKG_LOCALTEXMFPREFIX
38 #       Absolute pathname of the directory where extensions for TeX can
39 #       be found.
40 #
41 #       Typical values: ${PREFIX}/share/texmf ${PREFIX}/share/texmf-local
42 #
43 # TEX_TYPE
44 #       The TeX implementation that has been selected based on the
45 #       package's and the user's preferences.
46 #
47 #       Typical values: teTeX3
48 #
49
50 # NOTE: before all TeX-related packages are converted to use these
51 # variables, we will keep PKG_TEXMFPREFIX = PKG_LOCALTEXMFPREFIX =
52 # ${PREFIX}/share/texmf
53
54 .if !defined(TEX_BUILDLINK3_MK)
55 TEX_BUILDLINK3_MK=      # defined
56
57 .include "../../mk/bsd.prefs.mk"
58
59 TEX_DEPMETHOD?= run
60
61 # Assume only teTeX 3 is supported by default.
62 TEX_ACCEPTED?=  teTeX3
63
64 # set up variables for buildlink or depends
65 #
66 BUILDLINK_API_DEPENDS.teTeX3=   teTeX-bin-3.[0-9]*
67 BUILDLINK_PKGSRCDIR.teTeX3=     ../../print/teTeX3-bin
68
69 # Determine the TeX version to be used.
70 #
71 .if !defined(_TEX_TYPE)
72 _TEX_TYPE=      ${TEX_DEFAULT}
73 .endif
74
75 .if !empty(TEX_ACCEPTED:M${_TEX_TYPE})
76 TEX_TYPE=       ${_TEX_TYPE}
77 .else
78 TEX_TYPE=       none
79 .endif
80
81 # Set version specifics.
82 #
83 .if ${TEX_TYPE} == "teTeX3"
84 _TEX_DEPENDENCY=        ${BUILDLINK_API_DEPENDS.teTeX3}
85 _TEX_PKGSRCDIR= ${BUILDLINK_PKGSRCDIR.teTeX3}
86 .endif
87
88 .endif  # TEX_BUILDLINK3_MK
89
90 .if ${TEX_TYPE} == "none"
91 PKG_FAIL_REASON=        \
92         "${_TEX_TYPE} is not an acceptable (${TEX_ACCEPTED})\
93             TeX version for ${PKGNAME}."
94 .else
95 PLIST_SUBST+=   TEX_TYPE=${TEX_TYPE:Q}
96 .if (${TEX_DEPMETHOD} == "build")
97 BUILD_DEPENDS+= ${_TEX_DEPENDENCY}:${_TEX_PKGSRCDIR}
98 .else
99 TEX_DEPMETHOD:= run
100 .  include "${_TEX_PKGSRCDIR}/buildlink3.mk"
101
102 .endif
103 .endif