| @@ -1,229 +1,230 @@ | | | @@ -1,229 +1,230 @@ |
1 | # $NetBSD: module.mk,v 1.61 2010/01/16 15:02:14 sno Exp $ | | 1 | # $NetBSD: module.mk,v 1.62 2010/05/09 18:46:34 morr Exp $ |
2 | # | | 2 | # |
3 | # This Makefile fragment is intended to be included by packages that build | | 3 | # This Makefile fragment is intended to be included by packages that build |
4 | # and install perl5 modules. | | 4 | # and install perl5 modules. |
5 | # | | 5 | # |
6 | # The following targets are provided by this file: | | 6 | # The following targets are provided by this file: |
7 | # | | 7 | # |
8 | # perl5-configure runs the standard perl configuration in | | 8 | # perl5-configure runs the standard perl configuration in |
9 | # each of the directories specified in | | 9 | # each of the directories specified in |
10 | # ${PERL5_CONFIGURE_DIRS}. | | 10 | # ${PERL5_CONFIGURE_DIRS}. |
11 | # | | 11 | # |
12 | # do-configure runs the perl5-configure target; if PERL5_CONFIGURE | | 12 | # do-configure runs the perl5-configure target; if PERL5_CONFIGURE |
13 | # is set to "YES", then this target overrides the | | 13 | # is set to "YES", then this target overrides the |
14 | # default do-configure provided by bsd.pkg.mk. | | 14 | # default do-configure provided by bsd.pkg.mk. |
15 | # | | 15 | # |
16 | # The following variables may be set prior to including this file: | | 16 | # The following variables may be set prior to including this file: |
17 | # | | 17 | # |
18 | # PERL5_CONFIGURE if "YES", then for do-configure, run the standard | | 18 | # PERL5_CONFIGURE if "YES", then for do-configure, run the standard |
19 | # perl configuration assuming Makefile.PL exists; | | 19 | # perl configuration assuming Makefile.PL exists; |
20 | # defaults to "YES". | | 20 | # defaults to "YES". |
21 | # | | 21 | # |
22 | # PERL5_CONFIGURE_DIRS list of directories in which to run the | | 22 | # PERL5_CONFIGURE_DIRS list of directories in which to run the |
23 | # standard perl configuration; defaults to | | 23 | # standard perl configuration; defaults to |
24 | # ${CONFIGURE_DIRS}. | | 24 | # ${CONFIGURE_DIRS}. |
25 | # | | 25 | # |
26 | # PERL5_LDFLAGS extra linker flags to pass on to the build | | 26 | # PERL5_LDFLAGS extra linker flags to pass on to the build |
27 | # process. | | 27 | # process. |
28 | # | | 28 | # |
29 | # PERL5_MODULE_TYPE "MakeMaker", "Module::Build" or "Module::Install" | | 29 | # PERL5_MODULE_TYPE "MakeMaker", "Module::Build" or "Module::Install" |
30 | # depending on which framework is used to build/install | | 30 | # depending on which framework is used to build/install |
31 | # the module. | | 31 | # the module. |
32 | | | 32 | |
33 | .include "../../lang/perl5/license.mk" | | 33 | .include "../../lang/perl5/license.mk" |
34 | | | 34 | |
35 | .if !defined(_PERL5_MODULE_MK) | | 35 | .if !defined(_PERL5_MODULE_MK) |
36 | _PERL5_MODULE_MK= # defined | | 36 | _PERL5_MODULE_MK= # defined |
37 | | | 37 | |
38 | .include "../../mk/bsd.prefs.mk" | | 38 | .include "../../mk/bsd.prefs.mk" |
39 | | | 39 | |
40 | PERL5_MODULE_TYPE?= MakeMaker | | 40 | PERL5_MODULE_TYPE?= MakeMaker |
41 | | | 41 | |
42 | .if (${PERL5_MODULE_TYPE} != "MakeMaker") && \ | | 42 | .if (${PERL5_MODULE_TYPE} != "MakeMaker") && \ |
43 | (${PERL5_MODULE_TYPE} != "Module::Build") && \ | | 43 | (${PERL5_MODULE_TYPE} != "Module::Build") && \ |
44 | (${PERL5_MODULE_TYPE} != "Module::Install") && \ | | 44 | (${PERL5_MODULE_TYPE} != "Module::Install") && \ |
45 | (${PERL5_MODULE_TYPE} != "Module::Install::Bundled") | | 45 | (${PERL5_MODULE_TYPE} != "Module::Install::Bundled") |
46 | PKG_FAIL_REASON+= "\`\`${PERL5_MODULE_TYPE}'' is not a supported PERL5_MODULE_TYPE." | | 46 | PKG_FAIL_REASON+= "\`\`${PERL5_MODULE_TYPE}'' is not a supported PERL5_MODULE_TYPE." |
47 | .endif | | 47 | .endif |
48 | | | 48 | |
49 | # Default test target for Perl modules | | 49 | # Default test target for Perl modules |
50 | TEST_TARGET?= test | | 50 | TEST_TARGET?= test |
51 | | | 51 | |
52 | .include "../../mk/compiler.mk" | | 52 | .include "../../mk/compiler.mk" |
53 | | | 53 | |
54 | .if ${PERL5_MODULE_TYPE} == "Module::Build" | | 54 | .if ${PERL5_MODULE_TYPE} == "Module::Build" |
55 | _PERL5_MODTYPE= modbuild | | 55 | _PERL5_MODTYPE= modbuild |
56 | . if ${_USE_DESTDIR} != "no" | | 56 | . if ${_USE_DESTDIR} != "no" |
57 | _PERL5_MODBUILD_DESTDIR_OPTION=--destdir ${DESTDIR:Q} | | 57 | _PERL5_MODBUILD_DESTDIR_OPTION=--destdir ${DESTDIR:Q} |
58 | . else | | 58 | . else |
59 | _PERL5_MODBUILD_DESTDIR_OPTION= | | 59 | _PERL5_MODBUILD_DESTDIR_OPTION= |
60 | . endif | | 60 | . endif |
61 | .elif ${PERL5_MODULE_TYPE} == "Module::Install" | | 61 | .elif ${PERL5_MODULE_TYPE} == "Module::Install" |
62 | _PERL5_MODTYPE= modinst | | 62 | _PERL5_MODTYPE= modinst |
63 | .elif ${PERL5_MODULE_TYPE} == "Module::Install::Bundled" | | 63 | .elif ${PERL5_MODULE_TYPE} == "Module::Install::Bundled" |
64 | _PERL5_MODTYPE= modinst | | 64 | _PERL5_MODTYPE= modinst |
65 | .elif ${PERL5_MODULE_TYPE} == "MakeMaker" | | 65 | .elif ${PERL5_MODULE_TYPE} == "MakeMaker" |
66 | _PERL5_MODTYPE= makemaker | | 66 | _PERL5_MODTYPE= makemaker |
67 | .endif | | 67 | .endif |
68 | | | 68 | |
69 | | | 69 | |
70 | ########################################################################### | | 70 | ########################################################################### |
71 | ### | | 71 | ### |
72 | ### Add the proper dependencies for using the specified module build | | 72 | ### Add the proper dependencies for using the specified module build |
73 | ### system. | | 73 | ### system. |
74 | ### | | 74 | ### |
75 | | | 75 | |
76 | BUILDLINK_DEPMETHOD.perl+= full | | 76 | BUILDLINK_DEPMETHOD.perl+= full |
77 | .include "../../lang/perl5/buildlink3.mk" | | 77 | .include "../../lang/perl5/buildlink3.mk" |
78 | | | 78 | |
79 | .if empty(PKGPATH:Mdevel/p5-Module-Build) && \ | | 79 | .if empty(PKGPATH:Mdevel/p5-Module-Build) && \ |
80 | (${PERL5_MODULE_TYPE} == "Module::Build") | | 80 | (${PERL5_MODULE_TYPE} == "Module::Build") |
81 | BUILD_DEPENDS+= {perl>=5.10,p5-Module-Build>=0.2608nb1}:../../devel/p5-Module-Build | | 81 | BUILD_DEPENDS+= {perl>=5.10,p5-Module-Build>=0.2608nb1}:../../devel/p5-Module-Build |
82 | .endif | | 82 | .endif |
83 | | | 83 | |
84 | .if empty(PKGPATH:Mdevel/p5-Module-Install) && \ | | 84 | .if empty(PKGPATH:Mdevel/p5-Module-Install) && \ |
85 | (${PERL5_MODULE_TYPE} == "Module::Install") | | 85 | (${PERL5_MODULE_TYPE} == "Module::Install") |
86 | BUILD_DEPENDS+= p5-Module-Install>=0.91:../../devel/p5-Module-Install | | 86 | BUILD_DEPENDS+= p5-Module-Install>=0.91:../../devel/p5-Module-Install |
87 | .endif | | 87 | .endif |
88 | | | 88 | |
89 | | | 89 | |
90 | ########################################################################### | | 90 | ########################################################################### |
91 | ### | | 91 | ### |
92 | ### Target definitions (configure, build, install, etc.) | | 92 | ### Target definitions (configure, build, install, etc.) |
93 | ### | | 93 | ### |
94 | | | 94 | |
95 | PERL5_CONFIGURE?= yes | | 95 | PERL5_CONFIGURE?= yes |
96 | PERL5_CONFIGURE_DIRS?= ${CONFIGURE_DIRS} | | 96 | PERL5_CONFIGURE_DIRS?= ${CONFIGURE_DIRS} |
97 | | | 97 | |
98 | MAKE_ENV+= LC_ALL=C | | 98 | MAKE_ENV+= LC_ALL=C |
99 | | | 99 | |
100 | # All pkgsrc-installed Perl modules are installed into the "vendor" | | 100 | # All pkgsrc-installed Perl modules are installed into the "vendor" |
101 | # directories. | | 101 | # directories. |
102 | # | | 102 | # |
103 | MAKE_PARAMS.makemaker+= INSTALLDIRS=vendor | | 103 | MAKE_PARAMS.makemaker+= INSTALLDIRS=vendor |
104 | MAKE_PARAMS.modbuild+= installdirs=vendor | | 104 | MAKE_PARAMS.modbuild+= installdirs=vendor |
105 | MAKE_PARAMS.modinst+= installdirs=vendor | | 105 | MAKE_PARAMS.modinst+= installdirs=vendor |
106 | | | 106 | |
107 | MAKE_PARAMS+= ${MAKE_PARAMS.${_PERL5_MODTYPE}} | | 107 | MAKE_PARAMS+= ${MAKE_PARAMS.${_PERL5_MODTYPE}} |
108 | | | 108 | |
109 | .PHONY: do-makemaker-configure | | 109 | .PHONY: do-makemaker-configure |
110 | do-makemaker-configure: | | 110 | do-makemaker-configure: |
111 | ${RUN} \ | | 111 | ${RUN} \ |
112 | for dir in ${PERL5_CONFIGURE_DIRS}; do \ | | 112 | for dir in ${PERL5_CONFIGURE_DIRS}; do \ |
113 | cd ${WRKSRC}; \ | | 113 | cd ${WRKSRC}; \ |
114 | if ${TEST} -f "$$dir"/Makefile.PL; then \ | | 114 | if ${TEST} -f "$$dir"/Makefile.PL; then \ |
115 | cd "$$dir"; \ | | 115 | cd "$$dir"; \ |
116 | ${SETENV} ${MAKE_ENV} \ | | 116 | ${SETENV} ${MAKE_ENV} \ |
117 | ${BUILDLINK_PREFIX.perl}/bin/perl Makefile.PL ${MAKE_PARAMS}; \ | | 117 | ${BUILDLINK_PREFIX.perl}/bin/perl Makefile.PL ${MAKE_PARAMS}; \ |
118 | fi; \ | | 118 | fi; \ |
119 | done | | 119 | done |
120 | | | 120 | |
121 | .PHONY: do-modbuild-configure | | 121 | .PHONY: do-modbuild-configure |
122 | do-modbuild-configure: | | 122 | do-modbuild-configure: |
123 | ${RUN} \ | | 123 | ${RUN} \ |
124 | for dir in ${PERL5_CONFIGURE_DIRS}; do \ | | 124 | for dir in ${PERL5_CONFIGURE_DIRS}; do \ |
125 | cd ${WRKSRC}; \ | | 125 | cd ${WRKSRC}; \ |
126 | if ${TEST} -f "$$dir"/Build.PL; then \ | | 126 | if ${TEST} -f "$$dir"/Build.PL; then \ |
127 | cd "$$dir"; \ | | 127 | cd "$$dir"; \ |
128 | ${SETENV} ${MAKE_ENV} \ | | 128 | ${SETENV} ${MAKE_ENV} \ |
129 | ${BUILDLINK_PREFIX.perl}/bin/perl Build.PL ${MAKE_PARAMS}; \ | | 129 | ${BUILDLINK_PREFIX.perl}/bin/perl Build.PL ${MAKE_PARAMS}; \ |
130 | fi; \ | | 130 | fi; \ |
131 | done | | 131 | done |
132 | | | 132 | |
133 | .PHONY: do-modinst-configure | | 133 | .PHONY: do-modinst-configure |
134 | do-modinst-configure: | | 134 | do-modinst-configure: |
135 | .if ${PERL5_MODULE_TYPE} == "Module::Install" | | 135 | .if ${PERL5_MODULE_TYPE} == "Module::Install" |
136 | ${RUN} \ | | 136 | ${RUN} \ |
137 | for dir in ${PERL5_CONFIGURE_DIRS}; do \ | | 137 | for dir in ${PERL5_CONFIGURE_DIRS}; do \ |
138 | cd ${WRKSRC}; \ | | 138 | cd ${WRKSRC}; \ |
139 | if ${TEST} -d "$$dir"/inc/Module; then \ | | 139 | if ${TEST} -d "$$dir"/inc/Module; then \ |
140 | ${RM} -rf "$$dir"/inc/Module; \ | | 140 | ${RM} -rf "$$dir"/inc/Module; \ |
141 | fi; \ | | 141 | fi; \ |
142 | if ${TEST} -f "$$dir"/Makefile.PL; then \ | | 142 | if ${TEST} -f "$$dir"/Makefile.PL; then \ |
143 | cd "$$dir"; \ | | 143 | cd "$$dir"; \ |
144 | ${SETENV} ${MAKE_ENV} \ | | 144 | ${SETENV} ${MAKE_ENV} \ |
145 | ${BUILDLINK_PREFIX.perl}/bin/perl Makefile.PL --skipdeps ${MAKE_PARAMS}; \ | | 145 | ${BUILDLINK_PREFIX.perl}/bin/perl Makefile.PL --skipdeps ${MAKE_PARAMS}; \ |
146 | fi; \ | | 146 | fi; \ |
147 | done | | 147 | done |
148 | .else | | 148 | .else |
149 | ${RUN} \ | | 149 | ${RUN} \ |
150 | for dir in ${PERL5_CONFIGURE_DIRS}; do \ | | 150 | for dir in ${PERL5_CONFIGURE_DIRS}; do \ |
151 | cd ${WRKSRC}; \ | | 151 | cd ${WRKSRC}; \ |
152 | if ${TEST} -f "$$dir"/Makefile.PL; then \ | | 152 | if ${TEST} -f "$$dir"/Makefile.PL; then \ |
153 | cd "$$dir"; \ | | 153 | cd "$$dir"; \ |
154 | ${SETENV} ${MAKE_ENV} \ | | 154 | ${SETENV} ${MAKE_ENV} \ |
155 | ${BUILDLINK_PREFIX.perl}/bin/perl Makefile.PL --skipdeps ${MAKE_PARAMS}; \ | | 155 | ${BUILDLINK_PREFIX.perl}/bin/perl Makefile.PL --skipdeps ${MAKE_PARAMS}; \ |
156 | fi; \ | | 156 | fi; \ |
157 | done | | 157 | done |
158 | .endif | | 158 | .endif |
159 | | | 159 | |
160 | .PHONY: perl5-configure | | 160 | .PHONY: perl5-configure |
161 | perl5-configure: do-${_PERL5_MODTYPE}-configure | | 161 | perl5-configure: do-${_PERL5_MODTYPE}-configure |
162 | | | 162 | |
163 | .if !empty(PERL5_CONFIGURE:M[yY][eE][sS]) | | 163 | .if !empty(PERL5_CONFIGURE:M[yY][eE][sS]) |
164 | do-configure: perl5-configure | | 164 | do-configure: perl5-configure |
165 | .endif | | 165 | .endif |
166 | | | 166 | |
167 | .PHONY: do-modbuild-build | | 167 | .PHONY: do-modbuild-build |
168 | do-modbuild-build: | | 168 | do-modbuild-build: |
169 | @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build | | 169 | @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build |
170 | | | 170 | |
171 | .PHONY: do-modbuild-test | | 171 | .PHONY: do-modbuild-test |
172 | do-modbuild-test: | | 172 | do-modbuild-test: |
173 | @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build test | | 173 | @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build test |
174 | | | 174 | |
175 | .PHONY: do-modbuild-install | | 175 | .PHONY: do-modbuild-install |
176 | do-modbuild-install: | | 176 | do-modbuild-install: |
177 | @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build install ${_PERL5_MODBUILD_DESTDIR_OPTION} | | 177 | @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./Build install ${_PERL5_MODBUILD_DESTDIR_OPTION} |
178 | | | 178 | |
179 | .if target(do-${_PERL5_MODTYPE}-build) && !defined(NO_BUILD) | | 179 | .if target(do-${_PERL5_MODTYPE}-build) && !defined(NO_BUILD) |
180 | do-build: do-${_PERL5_MODTYPE}-build | | 180 | do-build: do-${_PERL5_MODTYPE}-build |
181 | do-test: do-${_PERL5_MODTYPE}-test | | 181 | do-test: do-${_PERL5_MODTYPE}-test |
182 | .endif | | 182 | .endif |
183 | .if target(do-${_PERL5_MODTYPE}-install) | | 183 | .if target(do-${_PERL5_MODTYPE}-install) |
184 | do-install: do-${_PERL5_MODTYPE}-install | | 184 | do-install: do-${_PERL5_MODTYPE}-install |
185 | .endif | | 185 | .endif |
186 | | | 186 | |
187 | | | 187 | |
188 | ########################################################################### | | 188 | ########################################################################### |
189 | ### | | 189 | ### |
190 | ### Make variable overrides | | 190 | ### Make variable overrides |
191 | ### | | 191 | ### |
192 | | | 192 | |
193 | # MakeMaker provides two hooks, OPTIMIZE and OTHERLDFLAGS, to | | 193 | # MakeMaker provides two hooks, OPTIMIZE and OTHERLDFLAGS, to |
194 | # customize the arguments passed to the preprocessor and linker, | | 194 | # customize the arguments passed to the preprocessor and linker, |
195 | # respectively. | | 195 | # respectively. |
196 | # | | 196 | # |
197 | PERL5_MAKE_FLAGS.makemaker+= OPTIMIZE=${CFLAGS:Q}" "${CPPFLAGS:Q} | | 197 | PERL5_MAKE_FLAGS.makemaker+= OPTIMIZE=${CFLAGS:Q}" "${CPPFLAGS:Q} |
198 | .if ${OBJECT_FMT} == "a.out" | | 198 | .if ${OBJECT_FMT} == "a.out" |
199 | PERL5_MAKE_FLAGS.makemaker+= OTHERLDFLAGS=${LDFLAGS:S/-Wl,//g:Q} | | 199 | PERL5_MAKE_FLAGS.makemaker+= OTHERLDFLAGS=${LDFLAGS:S/-Wl,//g:Q} |
200 | .else | | 200 | .else |
201 | PERL5_MAKE_FLAGS.makemaker+= OTHERLDFLAGS=${LDFLAGS:Q} | | 201 | PERL5_MAKE_FLAGS.makemaker+= OTHERLDFLAGS=${LDFLAGS:Q} |
202 | .endif | | 202 | .endif |
203 | | | 203 | |
204 | # Repoint all of the vendor-specific variables to be under the perl5 | | 204 | # Repoint all of the vendor-specific variables to be under the perl5 |
205 | # module's ${PREFIX}. | | 205 | # module's ${PREFIX}. |
206 | # | | 206 | # |
207 | .include "../../lang/perl5/vars.mk" | | 207 | .include "../../lang/perl5/vars.mk" |
208 | .for _var_ in ${_PERL5_VARS} | | 208 | .for _var_ in ${_PERL5_VARS} |
209 | PERL5_MAKE_FLAGS.makemaker+= ${_var_}=${PERL5_${_var_}:Q} | | 209 | PERL5_MAKE_FLAGS.makemaker+= ${_var_}=${PERL5_${_var_}:Q} |
210 | .endfor | | 210 | .endfor |
211 | # | | 211 | # |
212 | # The PREFIX in the generated Makefile will point to ${_PERL5_PREFIX}, | | 212 | # The PREFIX in the generated Makefile will point to ${_PERL5_PREFIX}, |
213 | # so override its value to the module's ${PREFIX}. | | 213 | # so override its value to the module's ${PREFIX}. |
| | | 214 | # Also, set VENDORARCHEXP, so existing .packlist won't be read. |
214 | # | | 215 | # |
215 | PERL5_MAKE_FLAGS.makemaker+= PREFIX=${PREFIX:Q} | | 216 | PERL5_MAKE_FLAGS.makemaker+= PREFIX=${PREFIX:Q} VENDORARCHEXP=${DESTDIR}${PERL5_INSTALLVENDORARCH} |
216 | | | 217 | |
217 | PERL5_MAKE_FLAGS+= ${PERL5_MAKE_FLAGS.${_PERL5_MODTYPE}} | | 218 | PERL5_MAKE_FLAGS+= ${PERL5_MAKE_FLAGS.${_PERL5_MODTYPE}} |
218 | MAKE_FLAGS+= ${PERL5_MAKE_FLAGS} | | 219 | MAKE_FLAGS+= ${PERL5_MAKE_FLAGS} |
219 | | | 220 | |
220 | .if defined(PERL5_LDFLAGS) && !empty(PERL5_LDFLAGS) | | 221 | .if defined(PERL5_LDFLAGS) && !empty(PERL5_LDFLAGS) |
221 | FIX_RPATH+= PERL5_LDFLAGS | | 222 | FIX_RPATH+= PERL5_LDFLAGS |
222 | LDFLAGS+= ${PERL5_LDFLAGS} | | 223 | LDFLAGS+= ${PERL5_LDFLAGS} |
223 | .endif | | 224 | .endif |
224 | | | 225 | |
225 | .include "../../lang/perl5/packlist.mk" | | 226 | .include "../../lang/perl5/packlist.mk" |
226 | | | 227 | |
227 | .include "../../mk/pthread.buildlink3.mk" | | 228 | .include "../../mk/pthread.buildlink3.mk" |
228 | | | 229 | |
229 | .endif # _PERL5_MODULE_MK | | 230 | .endif # _PERL5_MODULE_MK |