| @@ -1,322 +1,325 @@ | | | @@ -1,322 +1,325 @@ |
1 | # $NetBSD: haskell.mk,v 1.36 2021/09/27 14:30:47 nia Exp $ | | 1 | # $NetBSD: haskell.mk,v 1.37 2022/01/18 02:24:36 pho Exp $ |
2 | # | | 2 | # |
3 | # This Makefile fragment handles Haskell Cabal packages. | | 3 | # This Makefile fragment handles Haskell Cabal packages. |
4 | # Package configuration, building, installation, registration and | | 4 | # Package configuration, building, installation, registration and |
5 | # unregistration are fully automated. | | 5 | # unregistration are fully automated. |
6 | # See https://www.haskell.org/cabal/. | | 6 | # See https://www.haskell.org/cabal/. |
7 | # | | 7 | # |
8 | # Package-settable variables: | | 8 | # Package-settable variables: |
9 | # | | 9 | # |
10 | # PKGNAME | | 10 | # PKGNAME |
11 | # Defaults to hs-${DISTNAME}. | | 11 | # Defaults to hs-${DISTNAME}. |
12 | # | | 12 | # |
13 | # HOMEPAGE | | 13 | # HOMEPAGE |
14 | # MASTER_SITES | | 14 | # MASTER_SITES |
15 | # Default to HackageDB URLs. | | 15 | # Default to HackageDB URLs. |
16 | # | | 16 | # |
17 | # HASKELL_OPTIMIZATION_LEVEL | | 17 | # HASKELL_OPTIMIZATION_LEVEL |
18 | # Optimization level for compilation. | | 18 | # Optimization level for compilation. |
19 | # | | 19 | # |
20 | # Possible values: 0 1 2 | | 20 | # Possible values: 0 1 2 |
21 | # Default value: 2 | | 21 | # Default value: 2 |
22 | # | | 22 | # |
23 | # User-settable variables: | | 23 | # User-settable variables: |
24 | # | | 24 | # |
25 | # HASKELL_ENABLE_SHARED_LIBRARY | | 25 | # HASKELL_ENABLE_SHARED_LIBRARY |
26 | # Whether shared library should be built or not. | | 26 | # Whether shared library should be built or not. |
27 | # | | 27 | # |
28 | # Possible values: yes, no | | 28 | # Possible values: yes, no |
29 | # Default value: yes | | 29 | # Default value: yes |
30 | # | | 30 | # |
31 | # HASKELL_ENABLE_LIBRARY_PROFILING | | 31 | # HASKELL_ENABLE_LIBRARY_PROFILING |
32 | # Whether profiling library should be built or not. | | 32 | # Whether profiling library should be built or not. |
33 | # | | 33 | # |
34 | # Possible values: yes, no | | 34 | # Possible values: yes, no |
35 | # Default value: yes | | 35 | # Default value: yes |
36 | # | | 36 | # |
37 | # HASKELL_ENABLE_HADDOCK_DOCUMENTATION | | 37 | # HASKELL_ENABLE_HADDOCK_DOCUMENTATION |
38 | # Whether haddock documentation should be built or not. | | 38 | # Whether haddock documentation should be built or not. |
39 | # | | 39 | # |
40 | # Possible values: yes, no | | 40 | # Possible values: yes, no |
41 | # Default value: yes | | 41 | # Default value: yes |
42 | | | 42 | |
43 | .if !defined(HASKELL_MK) | | 43 | .if !defined(HASKELL_MK) |
44 | HASKELL_MK= # defined | | 44 | HASKELL_MK= # defined |
45 | | | 45 | |
46 | MKPIE_SUPPORTED= no | | | |
47 | | | | |
48 | .include "../../mk/bsd.fast.prefs.mk" | | 46 | .include "../../mk/bsd.fast.prefs.mk" |
49 | | | 47 | |
50 | HS_UPDATE_PLIST?= no | | 48 | HS_UPDATE_PLIST?= no |
51 | | | 49 | |
52 | BUILD_DEFS+= HASKELL_ENABLE_SHARED_LIBRARY | | 50 | BUILD_DEFS+= HASKELL_ENABLE_SHARED_LIBRARY |
53 | BUILD_DEFS+= HASKELL_ENABLE_LIBRARY_PROFILING | | 51 | BUILD_DEFS+= HASKELL_ENABLE_LIBRARY_PROFILING |
54 | BUILD_DEFS+= HASKELL_ENABLE_HADDOCK_DOCUMENTATION | | 52 | BUILD_DEFS+= HASKELL_ENABLE_HADDOCK_DOCUMENTATION |
55 | | | 53 | |
56 | # Declarations for ../../mk/misc/show.mk | | 54 | # Declarations for ../../mk/misc/show.mk |
57 | _VARGROUPS+= haskell | | 55 | _VARGROUPS+= haskell |
58 | _USER_VARS.haskell= \ | | 56 | _USER_VARS.haskell= \ |
59 | HASKELL_ENABLE_SHARED_LIBRARY \ | | 57 | HASKELL_ENABLE_SHARED_LIBRARY \ |
60 | HASKELL_ENABLE_LIBRARY_PROFILING \ | | 58 | HASKELL_ENABLE_LIBRARY_PROFILING \ |
61 | HASKELL_ENABLE_HADDOCK_DOCUMENTATION \ | | 59 | HASKELL_ENABLE_HADDOCK_DOCUMENTATION \ |
62 | HS_UPDATE_PLIST | | 60 | HS_UPDATE_PLIST |
63 | _SYS_VARS.haskell= \ | | 61 | _SYS_VARS.haskell= \ |
64 | PKGNAME DISTNAME MASTER_SITES MASTER_SITE_HASKELL_HACKAGE \ | | 62 | PKGNAME DISTNAME MASTER_SITES MASTER_SITE_HASKELL_HACKAGE \ |
65 | HOMEPAGE UNLIMIT_RESOURCES PREFIX | | 63 | HOMEPAGE UNLIMIT_RESOURCES PREFIX |
66 | _DEF_VARS.haskell= \ | | 64 | _DEF_VARS.haskell= \ |
67 | HASKELL_OPTIMIZATION_LEVEL \ | | 65 | HASKELL_OPTIMIZATION_LEVEL \ |
68 | HASKELL_PKG_NAME \ | | 66 | HASKELL_PKG_NAME \ |
69 | USE_LANGUAGES \ | | 67 | USE_LANGUAGES \ |
70 | CONFIGURE_ARGS \ | | 68 | CONFIGURE_ARGS \ |
71 | PLIST_SUBST \ | | 69 | PLIST_SUBST \ |
72 | PRINT_PLIST_AWK \ | | 70 | PRINT_PLIST_AWK \ |
73 | GENERATE_PLIST \ | | 71 | GENERATE_PLIST \ |
74 | PLIST_SRC \ | | 72 | PLIST_SRC \ |
75 | FILES_SUBST \ | | 73 | FILES_SUBST \ |
76 | INSTALLATION_DIRS \ | | 74 | INSTALLATION_DIRS \ |
77 | INSTALL_TEMPLATES \ | | 75 | INSTALL_TEMPLATES \ |
78 | DEINSTALL_TEMPLATES \ | | 76 | DEINSTALL_TEMPLATES \ |
79 | _HASKELL_VERSION_CMD \ | | 77 | _HASKELL_VERSION_CMD \ |
80 | _HASKELL_BIN \ | | 78 | _HASKELL_BIN \ |
81 | _HASKELL_PKG_BIN \ | | 79 | _HASKELL_PKG_BIN \ |
82 | _HASKELL_PKG_DESCR_FILE \ | | 80 | _HASKELL_PKG_DESCR_FILE \ |
83 | _HASKELL_PKG_ID_FILE \ | | 81 | _HASKELL_PKG_ID_FILE \ |
84 | _HASKELL_VERSION | | 82 | _HASKELL_VERSION |
85 | _USE_VARS.haskell= \ | | 83 | _USE_VARS.haskell= \ |
86 | PKG_VERBOSE \ | | 84 | PKG_VERBOSE \ |
87 | BUILDLINK_PREFIX.ghc \ | | 85 | BUILDLINK_PREFIX.ghc \ |
88 | PKGDIR DESTDIR \ | | 86 | PKGDIR DESTDIR \ |
89 | WRKSRC | | 87 | WRKSRC |
90 | _LISTED_VARS.haskell= \ | | 88 | _LISTED_VARS.haskell= \ |
91 | CONFIGURE_ARGS \ | | 89 | CONFIGURE_ARGS \ |
92 | PLIST_SUBST \ | | 90 | PLIST_SUBST \ |
93 | PRINT_PLIST_AWK \ | | 91 | PRINT_PLIST_AWK \ |
94 | FILES_SUBST | | 92 | FILES_SUBST |
95 | _IGN_VARS.haskell= \ | | 93 | _IGN_VARS.haskell= \ |
96 | USE_TOOLS CONFIGURE_ENV MAKE_ENV WARNINGS _* | | 94 | USE_TOOLS CONFIGURE_ENV MAKE_ENV WARNINGS _* |
97 | | | 95 | |
98 | PKGNAME?= hs-${DISTNAME} | | 96 | PKGNAME?= hs-${DISTNAME} |
99 | MASTER_SITES?= ${MASTER_SITE_HASKELL_HACKAGE:=${DISTNAME}/} | | 97 | MASTER_SITES?= ${MASTER_SITE_HASKELL_HACKAGE:=${DISTNAME}/} |
100 | HOMEPAGE?= http://hackage.haskell.org/package/${DISTNAME:C/-[^-]*$//} | | 98 | HOMEPAGE?= http://hackage.haskell.org/package/${DISTNAME:C/-[^-]*$//} |
101 | | | 99 | |
102 | # Cabal packages may use pkg-config, but url2pkg can't detect | | 100 | # Cabal packages may use pkg-config, but url2pkg can't detect |
103 | # that. (PHO: I think that should be handled by url2pkg (2009-05-20)) | | 101 | # that. (PHO: I think that should be handled by url2pkg (2009-05-20)) |
104 | USE_TOOLS+= pkg-config | | 102 | USE_TOOLS+= pkg-config |
105 | | | 103 | |
106 | # GHC can be a memory hog, so don't apply regular limits. | | 104 | # GHC can be a memory hog, so don't apply regular limits. |
107 | UNLIMIT_RESOURCES+= datasize virtualsize | | 105 | UNLIMIT_RESOURCES+= datasize virtualsize |
108 | | | 106 | |
109 | HASKELL_OPTIMIZATION_LEVEL?= 2 | | 107 | HASKELL_OPTIMIZATION_LEVEL?= 2 |
110 | HASKELL_ENABLE_SHARED_LIBRARY?= yes | | 108 | HASKELL_ENABLE_SHARED_LIBRARY?= yes |
111 | HASKELL_ENABLE_LIBRARY_PROFILING?= yes | | 109 | HASKELL_ENABLE_LIBRARY_PROFILING?= yes |
112 | HASKELL_ENABLE_HADDOCK_DOCUMENTATION?= yes | | 110 | HASKELL_ENABLE_HADDOCK_DOCUMENTATION?= yes |
113 | | | 111 | |
114 | .include "../../lang/ghc90/buildlink3.mk" | | 112 | .include "../../lang/ghc90/buildlink3.mk" |
115 | | | 113 | |
116 | # Some Cabal packages requires preprocessors to build, and we don't | | 114 | # Some Cabal packages requires preprocessors to build, and we don't |
117 | # want them to implicitly depend on such tools. Place dummy scripts by | | 115 | # want them to implicitly depend on such tools. Place dummy scripts by |
118 | # default. | | 116 | # default. |
119 | .include "../../mk/haskell/tools/alex.mk" | | 117 | .include "../../mk/haskell/tools/alex.mk" |
120 | .include "../../mk/haskell/tools/cpphs.mk" | | 118 | .include "../../mk/haskell/tools/cpphs.mk" |
121 | .include "../../mk/haskell/tools/happy.mk" | | 119 | .include "../../mk/haskell/tools/happy.mk" |
122 | | | 120 | |
123 | # Tools | | 121 | # Tools |
124 | _HASKELL_BIN= ${BUILDLINK_PREFIX.ghc:U${PREFIX}}/bin/ghc | | 122 | _HASKELL_BIN= ${BUILDLINK_PREFIX.ghc:U${PREFIX}}/bin/ghc |
125 | _HASKELL_PKG_BIN= ${BUILDLINK_PREFIX.ghc:U${PREFIX}}/bin/ghc-pkg | | 123 | _HASKELL_PKG_BIN= ${BUILDLINK_PREFIX.ghc:U${PREFIX}}/bin/ghc-pkg |
126 | | | 124 | |
127 | _HASKELL_VERSION_CMD= ${_HASKELL_BIN} -V 2>/dev/null | ${CUT} -d ' ' -f 8 | | 125 | _HASKELL_VERSION_CMD= ${_HASKELL_BIN} -V 2>/dev/null | ${CUT} -d ' ' -f 8 |
128 | _HASKELL_VERSION= ghc-${_HASKELL_VERSION_CMD:sh} | | 126 | _HASKELL_VERSION= ghc-${_HASKELL_VERSION_CMD:sh} |
129 | | | 127 | |
130 | # By default GHC uses a per-user default environment file if one is | | 128 | # By default GHC uses a per-user default environment file if one is |
131 | # available. Cabal has to be visible in order to compile Setup.?hs, | | 129 | # available. Cabal has to be visible in order to compile Setup.?hs, |
132 | # but per-user default environment files usually don't mark it as | | 130 | # but per-user default environment files usually don't mark it as |
133 | # visible. Tell GHC not to read any environment files. | | 131 | # visible. Tell GHC not to read any environment files. |
134 | _HASKELL_BUILD_SETUP_OPTS= -package-env - | | 132 | _HASKELL_BUILD_SETUP_OPTS= -package-env - |
135 | | | 133 | |
136 | # GHC requires C compiler. | | 134 | # GHC requires C compiler. |
137 | USE_LANGUAGES+= c | | 135 | USE_LANGUAGES+= c |
138 | | | 136 | |
139 | # Declarations for ../../mk/configure/configure.mk | | 137 | # Declarations for ../../mk/configure/configure.mk |
140 | CONFIGURE_ARGS+= --ghc | | 138 | CONFIGURE_ARGS+= --ghc |
141 | CONFIGURE_ARGS+= --with-compiler=${_HASKELL_BIN:Q} | | 139 | CONFIGURE_ARGS+= --with-compiler=${_HASKELL_BIN:Q} |
142 | CONFIGURE_ARGS+= --with-hc-pkg=${_HASKELL_PKG_BIN:Q} | | 140 | CONFIGURE_ARGS+= --with-hc-pkg=${_HASKELL_PKG_BIN:Q} |
143 | CONFIGURE_ARGS+= --prefix=${PREFIX:Q} | | 141 | CONFIGURE_ARGS+= --prefix=${PREFIX:Q} |
144 | | | 142 | |
| | | 143 | PKGSRC_OVERRIDE_MKPIE= yes |
| | | 144 | .if ${_PKGSRC_MKPIE} == "yes" |
| | | 145 | CONFIGURE_ARGS+= --ghc-option=-fPIC --ghc-option=-pie |
| | | 146 | .endif |
| | | 147 | |
145 | .if ${HASKELL_ENABLE_SHARED_LIBRARY} == "yes" | | 148 | .if ${HASKELL_ENABLE_SHARED_LIBRARY} == "yes" |
146 | CONFIGURE_ARGS+= --enable-shared --enable-executable-dynamic | | 149 | CONFIGURE_ARGS+= --enable-shared --enable-executable-dynamic |
147 | .else | | 150 | .else |
148 | CONFIGURE_ARGS+= --disable-shared --disable-executable-dynamic | | 151 | CONFIGURE_ARGS+= --disable-shared --disable-executable-dynamic |
149 | .endif | | 152 | .endif |
150 | | | 153 | |
151 | .if ${HASKELL_ENABLE_LIBRARY_PROFILING} == "yes" | | 154 | .if ${HASKELL_ENABLE_LIBRARY_PROFILING} == "yes" |
152 | CONFIGURE_ARGS+= --enable-library-profiling | | 155 | CONFIGURE_ARGS+= --enable-library-profiling |
153 | .else | | 156 | .else |
154 | CONFIGURE_ARGS+= --disable-library-profiling | | 157 | CONFIGURE_ARGS+= --disable-library-profiling |
155 | .endif | | 158 | .endif |
156 | | | 159 | |
157 | .if ${HASKELL_ENABLE_HADDOCK_DOCUMENTATION} == "yes" | | 160 | .if ${HASKELL_ENABLE_HADDOCK_DOCUMENTATION} == "yes" |
158 | CONFIGURE_ARGS+= --with-haddock=${BUILDLINK_PREFIX.ghc:Q}/bin/haddock | | 161 | CONFIGURE_ARGS+= --with-haddock=${BUILDLINK_PREFIX.ghc:Q}/bin/haddock |
159 | .endif | | 162 | .endif |
160 | | | 163 | |
161 | CONFIGURE_ARGS+= -O${HASKELL_OPTIMIZATION_LEVEL} | | 164 | CONFIGURE_ARGS+= -O${HASKELL_OPTIMIZATION_LEVEL} |
162 | | | 165 | |
163 | # Support RELRO. When PKGSRC_USE_RELRO isn't set to "no", | | 166 | # Support RELRO. When PKGSRC_USE_RELRO isn't set to "no", |
164 | # mk/compiler/{ghc,clang}.mk add "-Wl,-z,relro" and optionally | | 167 | # mk/compiler/{ghc,clang}.mk add "-Wl,-z,relro" and optionally |
165 | # "-Wl,-z,now" to LDFLAGS. Since Cabal doesn't respect the environment | | 168 | # "-Wl,-z,now" to LDFLAGS. Since Cabal doesn't respect the environment |
166 | # variable LDFLAGS, we need to be explicit about it. Note that -optl | | 169 | # variable LDFLAGS, we need to be explicit about it. Note that -optl |
167 | # is a GHC option which specifies options to be passed to CC, not LD, | | 170 | # is a GHC option which specifies options to be passed to CC, not LD, |
168 | # while linking executables and shared libraries. | | 171 | # while linking executables and shared libraries. |
169 | CONFIGURE_ARGS+= ${LDFLAGS:S/^/--ghc-options=-optl\ /} | | 172 | CONFIGURE_ARGS+= ${LDFLAGS:S/^/--ghc-options=-optl\ /} |
170 | # GHC heavily uses "ld -r" to combine multiple .o files but our ld | | 173 | # GHC heavily uses "ld -r" to combine multiple .o files but our ld |
171 | # wrapper is going to inject the relro flags. In this case these flags | | 174 | # wrapper is going to inject the relro flags. In this case these flags |
172 | # don't make sense so ld(1) emits warnings. Use the original, | | 175 | # don't make sense so ld(1) emits warnings. Use the original, |
173 | # non-wrapped ld(1) for merging objects as a dirty workaround. | | 176 | # non-wrapped ld(1) for merging objects as a dirty workaround. |
174 | _HS_ORIG_LD_CMD= ${SETENV} PATH=${_PATH_ORIG} which ld | | 177 | _HS_ORIG_LD_CMD= ${SETENV} PATH=${_PATH_ORIG} which ld |
175 | CONFIGURE_ARGS+= --ghc-options=-pgmlm\ ${_HS_ORIG_LD_CMD:sh} | | 178 | CONFIGURE_ARGS+= --ghc-options=-pgmlm\ ${_HS_ORIG_LD_CMD:sh} |
176 | CONFIGURE_ARGS+= --ghc-options=-optlm\ -r | | 179 | CONFIGURE_ARGS+= --ghc-options=-optlm\ -r |
177 | | | 180 | |
178 | .if !exists(${PKGDIR}/PLIST) | | 181 | .if !exists(${PKGDIR}/PLIST) |
179 | _HS_PLIST_STATUS= missing | | 182 | _HS_PLIST_STATUS= missing |
180 | .elif !${${GREP} "." ${PKGDIR}/PLIST || ${TRUE}:L:sh} | | 183 | .elif !${${GREP} "." ${PKGDIR}/PLIST || ${TRUE}:L:sh} |
181 | _HS_PLIST_STATUS= missing | | 184 | _HS_PLIST_STATUS= missing |
182 | .elif ${${GREP} HS_VERSION ${PKGDIR}/PLIST || ${TRUE}:L:sh} | | 185 | .elif ${${GREP} HS_VERSION ${PKGDIR}/PLIST || ${TRUE}:L:sh} |
183 | _HS_PLIST_STATUS= ok | | 186 | _HS_PLIST_STATUS= ok |
184 | .elif !${${GREP} "/package-description" ${PKGDIR}/PLIST || ${TRUE}:L:sh} | | 187 | .elif !${${GREP} "/package-description" ${PKGDIR}/PLIST || ${TRUE}:L:sh} |
185 | _HS_PLIST_STATUS= ok | | 188 | _HS_PLIST_STATUS= ok |
186 | .else | | 189 | .else |
187 | _HS_PLIST_STATUS= outdated | | 190 | _HS_PLIST_STATUS= outdated |
188 | .endif | | 191 | .endif |
189 | | | 192 | |
190 | # Starting from GHC 7.10 (or 7.8?), packages are installed in directories | | 193 | # Starting from GHC 7.10 (or 7.8?), packages are installed in directories |
191 | # with a hashed name, which makes it a bit more complicated to generate | | 194 | # with a hashed name, which makes it a bit more complicated to generate |
192 | # the PLIST. | | 195 | # the PLIST. |
193 | # | | 196 | # |
194 | | | 197 | |
195 | # There is no easy way to obtain a platform string such as | | 198 | # There is no easy way to obtain a platform string such as |
196 | # "x86_64-netbsd-ghc-9.0.1". If the package contains a library we | | 199 | # "x86_64-netbsd-ghc-9.0.1". If the package contains a library we |
197 | # could extract it from the description file, but if it's | | 200 | # could extract it from the description file, but if it's |
198 | # executable-only there's no such file. As a workaround we read the | | 201 | # executable-only there's no such file. As a workaround we read the |
199 | # description of "base" (which always exists) and extract the platform | | 202 | # description of "base" (which always exists) and extract the platform |
200 | # from it. | | 203 | # from it. |
201 | _HS_PLIST.platform.cmd= ${_HASKELL_PKG_BIN} --simple-output field base data-dir | | 204 | _HS_PLIST.platform.cmd= ${_HASKELL_PKG_BIN} --simple-output field base data-dir |
202 | _HS_PLIST.platform= ${_HS_PLIST.platform.cmd:sh:H:T} | | 205 | _HS_PLIST.platform= ${_HS_PLIST.platform.cmd:sh:H:T} |
203 | # Package ID formatted as "{name}-{version}-{hash}": this only exists | | 206 | # Package ID formatted as "{name}-{version}-{hash}": this only exists |
204 | # if the package contains a library. | | 207 | # if the package contains a library. |
205 | _HS_PLIST.lib.pkg-id.cmd= ${CAT} ${DESTDIR}${_HASKELL_PKG_ID_FILE} | | 208 | _HS_PLIST.lib.pkg-id.cmd= ${CAT} ${DESTDIR}${_HASKELL_PKG_ID_FILE} |
206 | _HS_PLIST.lib.pkg-id= ${exists(${DESTDIR}${_HASKELL_PKG_ID_FILE}):?${_HS_PLIST.lib.pkg-id.cmd:sh}:} | | 209 | _HS_PLIST.lib.pkg-id= ${exists(${DESTDIR}${_HASKELL_PKG_ID_FILE}):?${_HS_PLIST.lib.pkg-id.cmd:sh}:} |
207 | # Abbreviated compiler version. Used for shared libraries. | | 210 | # Abbreviated compiler version. Used for shared libraries. |
208 | _HS_PLIST.short-ver= ${_HASKELL_VERSION:S,-,,} | | 211 | _HS_PLIST.short-ver= ${_HASKELL_VERSION:S,-,,} |
209 | | | 212 | |
210 | PLIST_SUBST+= HS_PLATFORM=${_HS_PLIST.platform} | | 213 | PLIST_SUBST+= HS_PLATFORM=${_HS_PLIST.platform} |
211 | PLIST_SUBST+= HS_VERSION=${_HASKELL_VERSION} | | 214 | PLIST_SUBST+= HS_VERSION=${_HASKELL_VERSION} |
212 | PLIST_SUBST+= HS_VER=${_HS_PLIST.short-ver} | | 215 | PLIST_SUBST+= HS_VER=${_HS_PLIST.short-ver} |
213 | _HS_PLIST_SUBST.lib= HS_PKGID=${_HS_PLIST.lib.pkg-id} | | 216 | _HS_PLIST_SUBST.lib= HS_PKGID=${_HS_PLIST.lib.pkg-id} |
214 | PLIST_SUBST+= ${!empty(_HS_PLIST.lib.pkg-id):?${_HS_PLIST_SUBST.lib}:} | | 217 | PLIST_SUBST+= ${!empty(_HS_PLIST.lib.pkg-id):?${_HS_PLIST_SUBST.lib}:} |
215 | | | 218 | |
216 | PRINT_PLIST_AWK+= { gsub("${_HS_PLIST.platform}", "$${HS_PLATFORM}") } | | 219 | PRINT_PLIST_AWK+= { gsub("${_HS_PLIST.platform}", "$${HS_PLATFORM}") } |
217 | PRINT_PLIST_AWK+= { gsub("${_HASKELL_VERSION}", "$${HS_VERSION}" ) } | | 220 | PRINT_PLIST_AWK+= { gsub("${_HASKELL_VERSION}", "$${HS_VERSION}" ) } |
218 | PRINT_PLIST_AWK+= { gsub("${_HS_PLIST.short-ver}", "$${HS_VER}" ) } | | 221 | PRINT_PLIST_AWK+= { gsub("${_HS_PLIST.short-ver}", "$${HS_VER}" ) } |
219 | _HS_PRINT_PLIST_AWK.lib={ gsub("${_HS_PLIST.lib.pkg-id}", "$${HS_PKGID}" ) } | | 222 | _HS_PRINT_PLIST_AWK.lib={ gsub("${_HS_PLIST.lib.pkg-id}", "$${HS_PKGID}" ) } |
220 | PRINT_PLIST_AWK+= ${!empty(_HS_PLIST.lib.pkg-id):?${_HS_PRINT_PLIST_AWK.lib}:} | | 223 | PRINT_PLIST_AWK+= ${!empty(_HS_PLIST.lib.pkg-id):?${_HS_PRINT_PLIST_AWK.lib}:} |
221 | | | 224 | |
222 | .if ${_HS_PLIST_STATUS} == missing || ${_HS_PLIST_STATUS} == outdated | | 225 | .if ${_HS_PLIST_STATUS} == missing || ${_HS_PLIST_STATUS} == outdated |
223 | . if ${HS_UPDATE_PLIST} == yes | | 226 | . if ${HS_UPDATE_PLIST} == yes |
224 | GENERATE_PLIST+= ${MAKE} print-PLIST > ${PKGDIR}/PLIST; | | 227 | GENERATE_PLIST+= ${MAKE} print-PLIST > ${PKGDIR}/PLIST; |
225 | . endif | | 228 | . endif |
226 | GENERATE_PLIST+= \ | | 229 | GENERATE_PLIST+= \ |
227 | cd ${DESTDIR:Q}${PREFIX:Q} && \ | | 230 | cd ${DESTDIR:Q}${PREFIX:Q} && \ |
228 | ${FIND} * \( -type f -o -type l \) | ${SORT}; | | 231 | ${FIND} * \( -type f -o -type l \) | ${SORT}; |
229 | PLIST_SRC= # none | | 232 | PLIST_SRC= # none |
230 | .endif | | 233 | .endif |
231 | | | 234 | |
232 | .if ${_HS_PLIST_STATUS} == outdated && ${HS_UPDATE_PLIST} == no | | 235 | .if ${_HS_PLIST_STATUS} == outdated && ${HS_UPDATE_PLIST} == no |
233 | WARNINGS+= "[haskell.mk] The PLIST format is outdated." | | 236 | WARNINGS+= "[haskell.mk] The PLIST format is outdated." |
234 | WARNINGS+= "[haskell.mk] Set HS_UPDATE_PLIST=yes to update it automatically." | | 237 | WARNINGS+= "[haskell.mk] Set HS_UPDATE_PLIST=yes to update it automatically." |
235 | .endif | | 238 | .endif |
236 | | | 239 | |
237 | # Define configure target. We might not have any working Haskell | | 240 | # Define configure target. We might not have any working Haskell |
238 | # interpreter so compile Setup.?hs to a binary. Since dynamic linkage | | 241 | # interpreter so compile Setup.?hs to a binary. Since dynamic linkage |
239 | # is much faster, we try it and then fall back to static linkage if | | 242 | # is much faster, we try it and then fall back to static linkage if |
240 | # that didn't work. | | 243 | # that didn't work. |
241 | do-configure: | | 244 | do-configure: |
242 | # Cabal packages are expected to have either Setup.hs or Setup.lhs, | | 245 | # Cabal packages are expected to have either Setup.hs or Setup.lhs, |
243 | # but its existence is not mandatory these days because the standard | | 246 | # but its existence is not mandatory these days because the standard |
244 | # way to build a cabal package is to use the cabal-install command, | | 247 | # way to build a cabal package is to use the cabal-install command, |
245 | # which is not always available to us. As a result some packages | | 248 | # which is not always available to us. As a result some packages |
246 | # actually lack it. The problem is that its expected content depends | | 249 | # actually lack it. The problem is that its expected content depends |
247 | # on the build-type field in *.cabal so we have to read it. | | 250 | # on the build-type field in *.cabal so we have to read it. |
248 | ${RUN} if ! ${TEST} -f ${WRKSRC}/Setup.hs -o -f ${WRKSRC}/Setup.lhs; then \ | | 251 | ${RUN} if ! ${TEST} -f ${WRKSRC}/Setup.hs -o -f ${WRKSRC}/Setup.lhs; then \ |
249 | buildType=`${AWK} -f ../../mk/haskell/build-type.awk ${WRKSRC}/*.cabal`; \ | | 252 | buildType=`${AWK} -f ../../mk/haskell/build-type.awk ${WRKSRC}/*.cabal`; \ |
250 | ${SH} ../../mk/haskell/gen-setup.sh "$$buildType" > ${WRKDIR}/.setup.hs; \ | | 253 | ${SH} ../../mk/haskell/gen-setup.sh "$$buildType" > ${WRKDIR}/.setup.hs; \ |
251 | ret=$$?; \ | | 254 | ret=$$?; \ |
252 | if ${TEST} $$ret -eq 0; then \ | | 255 | if ${TEST} $$ret -eq 0; then \ |
253 | ${MV} -f ${WRKDIR}/.setup.hs ${WRKSRC}/Setup.hs; \ | | 256 | ${MV} -f ${WRKDIR}/.setup.hs ${WRKSRC}/Setup.hs; \ |
254 | else \ | | 257 | else \ |
255 | exit $$ret; \ | | 258 | exit $$ret; \ |
256 | fi; \ | | 259 | fi; \ |
257 | fi | | 260 | fi |
258 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC} && \ | | 261 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC} && \ |
259 | ( ${_HASKELL_BIN:Q} ${_HASKELL_BUILD_SETUP_OPTS} --make Setup -dynamic || \ | | 262 | ( ${_HASKELL_BIN:Q} ${_HASKELL_BUILD_SETUP_OPTS} --make Setup -dynamic || \ |
260 | ${_HASKELL_BIN:Q} ${_HASKELL_BUILD_SETUP_OPTS} --make Setup -static ) | | 263 | ${_HASKELL_BIN:Q} ${_HASKELL_BUILD_SETUP_OPTS} --make Setup -static ) |
261 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC:Q} && \ | | 264 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC:Q} && \ |
262 | ${SETENV} ${CONFIGURE_ENV} \ | | 265 | ${SETENV} ${CONFIGURE_ENV} \ |
263 | ./Setup configure ${PKG_VERBOSE:D-v} ${CONFIGURE_ARGS} | | 266 | ./Setup configure ${PKG_VERBOSE:D-v} ${CONFIGURE_ARGS} |
264 | | | 267 | |
265 | # Define build target. _MAKE_JOBS_N is defined in build/build.mk | | 268 | # Define build target. _MAKE_JOBS_N is defined in build/build.mk |
266 | do-build: | | 269 | do-build: |
267 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC:Q} && \ | | 270 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC:Q} && \ |
268 | ${SETENV} ${MAKE_ENV} \ | | 271 | ${SETENV} ${MAKE_ENV} \ |
269 | ./Setup build ${PKG_VERBOSE:D-v} -j${_MAKE_JOBS_N} | | 272 | ./Setup build ${PKG_VERBOSE:D-v} -j${_MAKE_JOBS_N} |
270 | .if ${HASKELL_ENABLE_HADDOCK_DOCUMENTATION} == "yes" | | 273 | .if ${HASKELL_ENABLE_HADDOCK_DOCUMENTATION} == "yes" |
271 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC:Q} && \ | | 274 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC:Q} && \ |
272 | ${SETENV} ${MAKE_ENV} \ | | 275 | ${SETENV} ${MAKE_ENV} \ |
273 | ./Setup haddock ${PKG_VERBOSE:D-v} | | 276 | ./Setup haddock ${PKG_VERBOSE:D-v} |
274 | .endif | | 277 | .endif |
275 | | | 278 | |
276 | # Define install target. We need installed-pkg-config to be installed | | 279 | # Define install target. We need installed-pkg-config to be installed |
277 | # for package registration (if any). | | 280 | # for package registration (if any). |
278 | HASKELL_PKG_NAME?= ${DISTNAME} | | 281 | HASKELL_PKG_NAME?= ${DISTNAME} |
279 | _HASKELL_PKG_DESCR_DIR= ${PREFIX}/lib/${HASKELL_PKG_NAME}/${_HASKELL_VERSION} | | 282 | _HASKELL_PKG_DESCR_DIR= ${PREFIX}/lib/${HASKELL_PKG_NAME}/${_HASKELL_VERSION} |
280 | _HASKELL_PKG_DESCR_FILE= ${_HASKELL_PKG_DESCR_DIR}/package-description | | 283 | _HASKELL_PKG_DESCR_FILE= ${_HASKELL_PKG_DESCR_DIR}/package-description |
281 | _HASKELL_PKG_ID_FILE= ${_HASKELL_PKG_DESCR_DIR}/package-id | | 284 | _HASKELL_PKG_ID_FILE= ${_HASKELL_PKG_DESCR_DIR}/package-id |
282 | | | 285 | |
283 | INSTALLATION_DIRS+= ${_HASKELL_PKG_DESCR_DIR} | | 286 | INSTALLATION_DIRS+= ${_HASKELL_PKG_DESCR_DIR} |
284 | do-install: | | 287 | do-install: |
285 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC} && \ | | 288 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC} && \ |
286 | ./Setup register ${PKG_VERBOSE:D-v} \ | | 289 | ./Setup register ${PKG_VERBOSE:D-v} \ |
287 | --gen-pkg-config=dist/package-description \ | | 290 | --gen-pkg-config=dist/package-description \ |
288 | --print-ipid \ | | 291 | --print-ipid \ |
289 | > dist/package-id && \ | | 292 | > dist/package-id && \ |
290 | ./Setup copy ${PKG_VERBOSE:D-v} --destdir=${DESTDIR:Q} && \ | | 293 | ./Setup copy ${PKG_VERBOSE:D-v} --destdir=${DESTDIR:Q} && \ |
291 | if [ -f dist/package-description ]; then \ | | 294 | if [ -f dist/package-description ]; then \ |
292 | ${INSTALL_DATA} dist/package-description \ | | 295 | ${INSTALL_DATA} dist/package-description \ |
293 | ${DESTDIR:Q}${_HASKELL_PKG_DESCR_FILE:Q}; \ | | 296 | ${DESTDIR:Q}${_HASKELL_PKG_DESCR_FILE:Q}; \ |
294 | ${INSTALL_DATA} dist/package-id \ | | 297 | ${INSTALL_DATA} dist/package-id \ |
295 | ${DESTDIR:Q}${_HASKELL_PKG_ID_FILE:Q}; \ | | 298 | ${DESTDIR:Q}${_HASKELL_PKG_ID_FILE:Q}; \ |
296 | fi | | 299 | fi |
297 | # Executable-only packages tend to create an empty directory tree in | | 300 | # Executable-only packages tend to create an empty directory tree in |
298 | # lib/ which results in useless @pkgdir in PLIST. | | 301 | # lib/ which results in useless @pkgdir in PLIST. |
299 | ${RUN}${FIND} ${DESTDIR:Q}${PREFIX}/lib -type d | \ | | 302 | ${RUN}${FIND} ${DESTDIR:Q}${PREFIX}/lib -type d | \ |
300 | ${TAIL} -n 1 | \ | | 303 | ${TAIL} -n 1 | \ |
301 | ${XARGS} ${RMDIR} -p 2>/dev/null || ${TRUE} | | 304 | ${XARGS} ${RMDIR} -p 2>/dev/null || ${TRUE} |
302 | | | 305 | |
303 | # Define test target. | | 306 | # Define test target. |
304 | do-test: | | 307 | do-test: |
305 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC} && \ | | 308 | ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC} && \ |
306 | ./Setup test ${PKG_VERBOSE:D-v} | | 309 | ./Setup test ${PKG_VERBOSE:D-v} |
307 | | | 310 | |
308 | # Substitutions for INSTALL and DEINSTALL. | | 311 | # Substitutions for INSTALL and DEINSTALL. |
309 | FILES_SUBST+= HASKELL_PKG_BIN=${_HASKELL_PKG_BIN} | | 312 | FILES_SUBST+= HASKELL_PKG_BIN=${_HASKELL_PKG_BIN} |
310 | FILES_SUBST+= HASKELL_PKG_DESCR_FILE=${_HASKELL_PKG_DESCR_FILE} | | 313 | FILES_SUBST+= HASKELL_PKG_DESCR_FILE=${_HASKELL_PKG_DESCR_FILE} |
311 | FILES_SUBST+= HASKELL_PKG_ID_FILE=${_HASKELL_PKG_ID_FILE} | | 314 | FILES_SUBST+= HASKELL_PKG_ID_FILE=${_HASKELL_PKG_ID_FILE} |
312 | | | 315 | |
313 | INSTALL_TEMPLATES+= ../../mk/haskell/INSTALL.in | | 316 | INSTALL_TEMPLATES+= ../../mk/haskell/INSTALL.in |
314 | DEINSTALL_TEMPLATES+= ../../mk/haskell/DEINSTALL.in | | 317 | DEINSTALL_TEMPLATES+= ../../mk/haskell/DEINSTALL.in |
315 | | | 318 | |
316 | # Only present these variables if the definitions can be extracted | | 319 | # Only present these variables if the definitions can be extracted |
317 | # from the files in DESTDIR. | | 320 | # from the files in DESTDIR. |
318 | _DEF_VARS.haskell+= _HS_PLIST.platform | | 321 | _DEF_VARS.haskell+= _HS_PLIST.platform |
319 | _DEF_VARS.haskell+= _HS_PLIST.short-ver | | 322 | _DEF_VARS.haskell+= _HS_PLIST.short-ver |
320 | _DEF_VARS.haskell+= ${!empty(_HS_PLIST.lib.pkg-id):?_HS_PLIST.lib.pkg-id:} | | 323 | _DEF_VARS.haskell+= ${!empty(_HS_PLIST.lib.pkg-id):?_HS_PLIST.lib.pkg-id:} |
321 | | | 324 | |
322 | .endif # HASKELL_MK | | 325 | .endif # HASKELL_MK |