| @@ -1,377 +1,387 @@ | | | @@ -1,377 +1,387 @@ |
1 | # $NetBSD: gem.mk,v 1.43 2020/12/19 14:41:16 taca Exp $ | | 1 | # $NetBSD: gem.mk,v 1.44 2021/01/11 06:51:27 taca 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 Ruby gems. | | 4 | # and install Ruby gems. |
5 | # | | 5 | # |
| | | 6 | # === User-settable variables === |
| | | 7 | # |
| | | 8 | # RUBYGEM_VERBOSE |
| | | 9 | # Execute gem with verbose option. |
| | | 10 | # Possible values: Yes No |
| | | 11 | # Default: No |
| | | 12 | # |
6 | # Package-settable variables: | | 13 | # Package-settable variables: |
7 | # | | 14 | # |
8 | # OVERRIDE_GEMSPEC | | 15 | # OVERRIDE_GEMSPEC |
9 | # Fix version of depending gem or modify files in gemspec. | | 16 | # Fix version of depending gem or modify files in gemspec. |
10 | # | | 17 | # |
11 | # (1) Specify as gem and dependency pattern as usual pkgsrc's one. | | 18 | # (1) Specify as gem and dependency pattern as usual pkgsrc's one. |
12 | # | | 19 | # |
13 | # Example: | | 20 | # Example: |
14 | # When gemspec contains "json~>1.4.7" as runtime dependency | | 21 | # When gemspec contains "json~>1.4.7" as runtime dependency |
15 | # (i.e. json>=1.4.7<1.5) and if you want to relax it to | | 22 | # (i.e. json>=1.4.7<1.5) and if you want to relax it to |
16 | # "json>=1.4.6" then use: | | 23 | # "json>=1.4.6" then use: |
17 | # | | 24 | # |
18 | # OVERRIDE_GEMSPEC+= json>=1.4.6 | | 25 | # OVERRIDE_GEMSPEC+= json>=1.4.6 |
19 | # | | 26 | # |
20 | # If you want to change depending gem to "json_pure>=1.4.6" | | 27 | # If you want to change depending gem to "json_pure>=1.4.6" |
21 | # then use: | | 28 | # then use: |
22 | # | | 29 | # |
23 | # OVERRIDE_GEMSPEC+= json:json_pure>=1.4.6 | | 30 | # OVERRIDE_GEMSPEC+= json:json_pure>=1.4.6 |
24 | # | | 31 | # |
25 | # You can also remove dependency: | | 32 | # You can also remove dependency: |
26 | # | | 33 | # |
27 | # OVERRIDE_GEMSPEC+= json: | | 34 | # OVERRIDE_GEMSPEC+= json: |
28 | # | | 35 | # |
29 | # (2) Modify instance of gemspec. | | 36 | # (2) Modify instance of gemspec. |
30 | # | | 37 | # |
31 | # Example: | | 38 | # Example: |
32 | # Rename gem's name to "foo" (setting instance @name): | | 39 | # Rename gem's name to "foo" (setting instance @name): |
33 | # | | 40 | # |
34 | # OVERRIDE_GEMSPEC+= :name=foo | | 41 | # OVERRIDE_GEMSPEC+= :name=foo |
35 | # | | 42 | # |
36 | # Example: | | 43 | # Example: |
37 | # Remove files (a.rb and b.rb) from 'files': | | 44 | # Remove files (a.rb and b.rb) from 'files': |
38 | # | | 45 | # |
39 | # OVERRIDE_GEMSPEC+= :files a.rb= b.rb= | | 46 | # OVERRIDE_GEMSPEC+= :files a.rb= b.rb= |
40 | # | | 47 | # |
41 | # Example: | | 48 | # Example: |
42 | # Add a file (exec.rb) to 'executables': | | 49 | # Add a file (exec.rb) to 'executables': |
43 | # | | 50 | # |
44 | # OVERRIDE_GEMSPEC+= :executables exec.rb | | 51 | # OVERRIDE_GEMSPEC+= :executables exec.rb |
45 | # | | 52 | # |
46 | # Example: | | 53 | # Example: |
47 | # Rename a file (from 'ruby' to 'ruby193') in 'files': | | 54 | # Rename a file (from 'ruby' to 'ruby193') in 'files': |
48 | # | | 55 | # |
49 | # OVERRIDE_GEMSPEC+= :files ruby=ruby193 | | 56 | # OVERRIDE_GEMSPEC+= :files ruby=ruby193 |
50 | # | | 57 | # |
51 | # Note: Because of limited parser, argumetns for (1) must preceed to (2). | | 58 | # Note: Because of limited parser, argumetns for (1) must preceed to (2). |
52 | # | | 59 | # |
53 | # Default: (empty) | | 60 | # Default: (empty) |
54 | # | | 61 | # |
55 | # GEM_PATH | | 62 | # GEM_PATH |
56 | # Set GEM_PATH; search path for rubygems | | 63 | # Set GEM_PATH; search path for rubygems |
57 | # | | 64 | # |
58 | # Default: ${PREFIX}/${GEM_HOME} | | 65 | # Default: ${PREFIX}/${GEM_HOME} |
59 | # | | 66 | # |
60 | # BUILD_TARGET | | 67 | # BUILD_TARGET |
61 | # The Rakefile target that creates a local gem if using the | | 68 | # The Rakefile target that creates a local gem if using the |
62 | # ``rake'' GEM_BUILD method. | | 69 | # ``rake'' GEM_BUILD method. |
63 | # | | 70 | # |
64 | # Default: gem | | 71 | # Default: gem |
65 | # | | 72 | # |
66 | # GEM_BUILD | | 73 | # GEM_BUILD |
67 | # The method used to build the local gem. | | 74 | # The method used to build the local gem. |
68 | # | | 75 | # |
69 | # Possible: gemspec, rake | | 76 | # Possible: gemspec, rake |
70 | # Default: gemspec | | 77 | # Default: gemspec |
71 | # | | 78 | # |
72 | # GEM_CLEANBUILD | | 79 | # GEM_CLEANBUILD |
73 | # A list of shell globs representing files to remove from the | | 80 | # A list of shell globs representing files to remove from the |
74 | # gem installed in the installation root. The file is removed | | 81 | # gem installed in the installation root. The file is removed |
75 | # if the path matches the glob and is not in ${WRKSRC}. The | | 82 | # if the path matches the glob and is not in ${WRKSRC}. The |
76 | # default is "ext/*" | | 83 | # default is "ext/*" |
77 | # | | 84 | # |
78 | # Example: | | 85 | # Example: |
79 | # | | 86 | # |
80 | # GEM_CLEANBUILD= *.o *.${RUBY_DLEXT} mkmf.log | | 87 | # GEM_CLEANBUILD= *.o *.${RUBY_DLEXT} mkmf.log |
81 | # | | 88 | # |
82 | # GEM_CLEANBUILD_EXTENSIONS | | 89 | # GEM_CLEANBUILD_EXTENSIONS |
83 | # A list of shell globs representing files under ${RUBY_EXTSDIR}. | | 90 | # A list of shell globs representing files under ${RUBY_EXTSDIR}. |
84 | # These files will be additionaly removed from the gem installed in | | 91 | # These files will be additionaly removed from the gem installed in |
85 | # the installation root. | | 92 | # the installation root. |
86 | # | | 93 | # |
87 | # GEM_KEEPBUILD | | 94 | # GEM_KEEPBUILD |
88 | # A list of shell globs representing files not to remove even it match | | 95 | # A list of shell globs representing files not to remove even it match |
89 | # with GEM_CLEANBUILD or GEM_CLEANBUILD_EXTENSIONS. | | 96 | # with GEM_CLEANBUILD or GEM_CLEANBUILD_EXTENSIONS. |
90 | # | | 97 | # |
91 | # Default: (empty) | | 98 | # Default: (empty) |
92 | # | | 99 | # |
93 | # GEM_NAME | | 100 | # GEM_NAME |
94 | # The name of the gem to install. The default value is ${DISTNAME}. | | 101 | # The name of the gem to install. The default value is ${DISTNAME}. |
95 | # gem installed in the installation root. | | 102 | # gem installed in the installation root. |
96 | # | | 103 | # |
97 | # GEM_SPECFILE | | 104 | # GEM_SPECFILE |
98 | # The path to the gemspec file to use when building a gem using | | 105 | # The path to the gemspec file to use when building a gem using |
99 | # the ``gemspec'' GEM_BUILD method. It defaults to | | 106 | # the ``gemspec'' GEM_BUILD method. It defaults to |
100 | # ${WRKDIR}/${DISTNAME}.gemspec. | | 107 | # ${WRKDIR}/${DISTNAME}.gemspec. |
101 | # | | 108 | # |
102 | # RUBYGEM_OPTIONS | | 109 | # RUBYGEM_OPTIONS |
103 | # Optional parameter to pass to gem on install stage. | | 110 | # Optional parameter to pass to gem on install stage. |
104 | # | | 111 | # |
105 | # | | 112 | # |
106 | # Variables defined in this file: | | 113 | # Variables defined in this file: |
107 | # | | 114 | # |
108 | # GEM_DOCDIR | | 115 | # GEM_DOCDIR |
109 | # The relative path from PREFIX to the directory in the local gem | | 116 | # The relative path from PREFIX to the directory in the local gem |
110 | # repository that holds the documentation for the installed gem. | | 117 | # repository that holds the documentation for the installed gem. |
111 | # | | 118 | # |
112 | # GEM_LIBDIR | | 119 | # GEM_LIBDIR |
113 | # The relative path from PREFIX to the directory in the local gem | | 120 | # The relative path from PREFIX to the directory in the local gem |
114 | # repository that holds the contents of the installed gem. | | 121 | # repository that holds the contents of the installed gem. |
115 | # | | 122 | # |
116 | # GEM_EXTSDIR | | 123 | # GEM_EXTSDIR |
117 | # "extensions" directory under ${GEM_HOME}. It is generated by | | 124 | # "extensions" directory under ${GEM_HOME}. It is generated by |
118 | # rubygems 2.2 and later. | | 125 | # rubygems 2.2 and later. |
119 | # In PLIST file, it will be replace to "${GEM_HOME}/extensions" or | | 126 | # In PLIST file, it will be replace to "${GEM_HOME}/extensions" or |
120 | # "@comment ..." depends on the version of rubygems. | | 127 | # "@comment ..." depends on the version of rubygems. |
121 | # | | 128 | # |
122 | # RUBYGEM | | 129 | # RUBYGEM |
123 | # The path to the rubygems ``gem'' script. | | 130 | # The path to the rubygems ``gem'' script. |
124 | # | | 131 | # |
125 | .if !defined(_RUBYGEM_MK) | | 132 | .if !defined(_RUBYGEM_MK) |
126 | _RUBYGEM_MK= # defined | | 133 | _RUBYGEM_MK= # defined |
127 | | | 134 | |
128 | # replace interpeter bin default | | 135 | # replace interpeter bin default |
129 | REPLACE_RUBY_DIRS?= bin | | 136 | REPLACE_RUBY_DIRS?= bin |
130 | REPLACE_RUBY_PAT?= * | | 137 | REPLACE_RUBY_PAT?= * |
131 | | | 138 | |
132 | # Default to using rake to build the local gem from the unpacked files. | | 139 | # Default to using rake to build the local gem from the unpacked files. |
133 | GEM_BUILD?= gemspec | | 140 | GEM_BUILD?= gemspec |
134 | | | 141 | |
135 | OVERRIDE_GEMSPEC?= # default is empty | | 142 | OVERRIDE_GEMSPEC?= # default is empty |
136 | | | 143 | |
137 | # Include this early in case some of its target are needed | | 144 | # Include this early in case some of its target are needed |
138 | .include "../../lang/ruby/modules.mk" | | 145 | .include "../../lang/ruby/modules.mk" |
139 | | | 146 | |
140 | # Build and run-time dependencies for Ruby prior to 1.9. | | 147 | # Build and run-time dependencies for Ruby prior to 1.9. |
141 | # | | 148 | # |
142 | # We need rubygems>=1.1.0 to actually build the package, but the | | 149 | # We need rubygems>=1.1.0 to actually build the package, but the |
143 | # resulting installed gem can run with older versions of rubygems. | | 150 | # resulting installed gem can run with older versions of rubygems. |
144 | # | | 151 | # |
145 | # If we're using rake to build the local gem, then include it as a | | 152 | # If we're using rake to build the local gem, then include it as a |
146 | # build tool. | | 153 | # build tool. |
147 | # | | 154 | # |
148 | .include "../../lang/ruby/gem-vars.mk" | | 155 | .include "../../lang/ruby/gem-vars.mk" |
149 | | | 156 | |
150 | CATEGORIES+= ruby | | 157 | CATEGORIES+= ruby |
151 | MASTER_SITES?= ${MASTER_SITE_RUBYGEMS} | | 158 | MASTER_SITES?= ${MASTER_SITE_RUBYGEMS} |
152 | | | 159 | |
153 | EXTRACT_SUFX?= .gem | | 160 | EXTRACT_SUFX?= .gem |
154 | DISTFILES?= ${DISTNAME}${EXTRACT_SUFX} | | 161 | DISTFILES?= ${DISTNAME}${EXTRACT_SUFX} |
155 | | | 162 | |
156 | # If any of the DISTFILES are gems, then skip the normal do-extract actions | | 163 | # If any of the DISTFILES are gems, then skip the normal do-extract actions |
157 | # and extract them ourselves in gem-extract. | | 164 | # and extract them ourselves in gem-extract. |
158 | # | | 165 | # |
159 | .if !empty(DISTFILES:M*.gem) | | 166 | .if !empty(DISTFILES:M*.gem) |
160 | EXTRACT_ONLY?= # empty | | 167 | EXTRACT_ONLY?= # empty |
161 | .endif | | 168 | .endif |
162 | | | 169 | |
163 | # Directory for the Gem to install | | 170 | # Directory for the Gem to install |
164 | GEM_NAME?= ${DISTNAME} | | 171 | GEM_NAME?= ${DISTNAME} |
165 | GEM_CACHEDIR= ${GEM_HOME}/cache | | 172 | GEM_CACHEDIR= ${GEM_HOME}/cache |
166 | GEM_DOCDIR= ${GEM_HOME}/doc/${GEM_NAME} | | 173 | GEM_DOCDIR= ${GEM_HOME}/doc/${GEM_NAME} |
167 | GEM_LIBDIR= ${GEM_HOME}/gems/${GEM_NAME} | | 174 | GEM_LIBDIR= ${GEM_HOME}/gems/${GEM_NAME} |
168 | | | 175 | |
169 | GEM_BUILDINFO_DIR= ${GEM_HOME}/build_info | | 176 | GEM_BUILDINFO_DIR= ${GEM_HOME}/build_info |
170 | | | 177 | |
171 | # Installed gems have wrapper scripts that call the right interpreter, | | 178 | # Installed gems have wrapper scripts that call the right interpreter, |
172 | # regardless of the #! line at the head of a script, so we can skip | | 179 | # regardless of the #! line at the head of a script, so we can skip |
173 | # the interpreter path check for gems. ANd it is also true for files' | | 180 | # the interpreter path check for gems. ANd it is also true for files' |
174 | # permission. | | 181 | # permission. |
175 | # | | 182 | # |
176 | CHECK_INTERPRETER_SKIP+= ${GEM_LIBDIR}/* | | 183 | CHECK_INTERPRETER_SKIP+= ${GEM_LIBDIR}/* |
177 | CHECK_PERMS_SKIP+= ${GEM_LIBDIR}/* | | 184 | CHECK_PERMS_SKIP+= ${GEM_LIBDIR}/* |
178 | | | 185 | |
179 | # PLIST support | | 186 | # PLIST support |
180 | PLIST_SUBST+= GEM_NAME=${GEM_NAME} | | 187 | PLIST_SUBST+= GEM_NAME=${GEM_NAME} |
181 | PLIST_SUBST+= GEM_LIBDIR=${GEM_LIBDIR} | | 188 | PLIST_SUBST+= GEM_LIBDIR=${GEM_LIBDIR} |
182 | PLIST_SUBST+= GEM_DOCDIR=${GEM_DOCDIR} | | 189 | PLIST_SUBST+= GEM_DOCDIR=${GEM_DOCDIR} |
183 | | | 190 | |
184 | # Add indirect support for print-PLIST | | 191 | # Add indirect support for print-PLIST |
185 | _RUBY_PRINT_PLIST_GEM= /${GEM_NAME}\.info$$/ \ | | 192 | _RUBY_PRINT_PLIST_GEM= /${GEM_NAME}\.info$$/ \ |
186 | { gsub(/${GEM_NAME}\.info/, "$${GEM_NAME}.info"); } | | 193 | { gsub(/${GEM_NAME}\.info/, "$${GEM_NAME}.info"); } |
187 | _RUBY_PRINT_PLIST_GEM+= /${GEM_NAME}\.(gem|gemspec)$$/ \ | | 194 | _RUBY_PRINT_PLIST_GEM+= /${GEM_NAME}\.(gem|gemspec)$$/ \ |
188 | { gsub(/${GEM_NAME}\.gem/, "$${GEM_NAME}.gem"); } | | 195 | { gsub(/${GEM_NAME}\.gem/, "$${GEM_NAME}.gem"); } |
189 | _RUBY_PRINT_PLIST_GEM+= /${GEM_NAME:S/./[.]/g}[.](gem|gemspec)$$/ \ | | 196 | _RUBY_PRINT_PLIST_GEM+= /${GEM_NAME:S/./[.]/g}[.](gem|gemspec)$$/ \ |
190 | { gsub(/${PKGVERSION_NOREV:S|/|\\/|g}[.]gem/, "$${PKGVERSION}.gem"); } | | 197 | { gsub(/${PKGVERSION_NOREV:S|/|\\/|g}[.]gem/, "$${PKGVERSION}.gem"); } |
191 | .if !empty(GEM_EXTSDIR) | | 198 | .if !empty(GEM_EXTSDIR) |
192 | _RUBY_PRINT_PLIST_GEM+= /^${GEM_EXTSDIR:S|/|\\/|g}/ \ | | 199 | _RUBY_PRINT_PLIST_GEM+= /^${GEM_EXTSDIR:S|/|\\/|g}/ \ |
193 | { gsub(/${GEM_EXTSDIR:S|/|\\/|g}/, "$${GEM_EXTSDIR}"); \ | | 200 | { gsub(/${GEM_EXTSDIR:S|/|\\/|g}/, "$${GEM_EXTSDIR}"); \ |
194 | print; next; } | | 201 | print; next; } |
195 | .endif | | 202 | .endif |
196 | _RUBY_PRINT_PLIST_GEM+= /^${GEM_LIBDIR:S|/|\\/|g}/ \ | | 203 | _RUBY_PRINT_PLIST_GEM+= /^${GEM_LIBDIR:S|/|\\/|g}/ \ |
197 | { gsub(/${GEM_LIBDIR:S|/|\\/|g}/, "$${GEM_LIBDIR}"); print; next; } | | 204 | { gsub(/${GEM_LIBDIR:S|/|\\/|g}/, "$${GEM_LIBDIR}"); print; next; } |
198 | _RUBY_PRINT_PLIST_GEM+= /^${GEM_DOCDIR:S|/|\\/|g}/ \ | | 205 | _RUBY_PRINT_PLIST_GEM+= /^${GEM_DOCDIR:S|/|\\/|g}/ \ |
199 | { next; } | | 206 | { next; } |
200 | _RUBY_PRINT_PLIST_GEM+= /^${GEM_HOME:S|/|\\/|g}/ \ | | 207 | _RUBY_PRINT_PLIST_GEM+= /^${GEM_HOME:S|/|\\/|g}/ \ |
201 | { gsub(/${GEM_HOME:S|/|\\/|g}/, "$${GEM_HOME}"); \ | | 208 | { gsub(/${GEM_HOME:S|/|\\/|g}/, "$${GEM_HOME}"); \ |
202 | print; next; } | | 209 | print; next; } |
203 | _RUBY_PRINT_PLIST_GEM+= /^${RUBY_GEM_BASE:S|/|\\/|g}/ \ | | 210 | _RUBY_PRINT_PLIST_GEM+= /^${RUBY_GEM_BASE:S|/|\\/|g}/ \ |
204 | { gsub(/${RUBY_GEM_BASE:S|/|\\/|g}/, "$${RUBY_GEM_BASE}"); \ | | 211 | { gsub(/${RUBY_GEM_BASE:S|/|\\/|g}/, "$${RUBY_GEM_BASE}"); \ |
205 | print; next; } | | 212 | print; next; } |
206 | | | 213 | |
207 | .include "../../lang/ruby/gem-extract.mk" | | 214 | .include "../../lang/ruby/gem-extract.mk" |
208 | | | 215 | |
209 | ### | | 216 | ### |
210 | ### gem-build | | 217 | ### gem-build |
211 | ### | | 218 | ### |
212 | ### The gem-build target builds a new local gem from the extracted gem's | | 219 | ### The gem-build target builds a new local gem from the extracted gem's |
213 | ### contents. The new gem as created as ${WRKSRC}/${GEM_NAME}.gem. | | 220 | ### contents. The new gem as created as ${WRKSRC}/${GEM_NAME}.gem. |
214 | ### The local gem is then installed into a special build root under | | 221 | ### The local gem is then installed into a special build root under |
215 | ### ${WRKDIR} (${RUBYGEM_INSTALL_ROOT}), possibly compiling any extensions. | | 222 | ### ${WRKDIR} (${RUBYGEM_INSTALL_ROOT}), possibly compiling any extensions. |
216 | ### | | 223 | ### |
217 | GEM_SPECFILE?= ${WRKDIR}/${DISTNAME}.gemspec | | 224 | GEM_SPECFILE?= ${WRKDIR}/${DISTNAME}.gemspec |
218 | GEM_CLEANBUILD?= ext/* | | 225 | GEM_CLEANBUILD?= ext/* |
219 | GEM_CLEANBUILD_EXTENSIONS+= *.out *.log | | 226 | GEM_CLEANBUILD_EXTENSIONS+= *.out *.log |
220 | GEM_KEEPBUILD?= # empty | | 227 | GEM_KEEPBUILD?= # empty |
221 | | | 228 | |
222 | .if !empty(GEM_CLEANBUILD:M/*) || !empty(GEM_CLEANBUILD:M*../*) | | 229 | .if !empty(GEM_CLEANBUILD:M/*) || !empty(GEM_CLEANBUILD:M*../*) |
223 | PKG_FAIL_REASON+= "GEM_CLEANBUILD must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"." | | 230 | PKG_FAIL_REASON+= "GEM_CLEANBUILD must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"." |
224 | .endif | | 231 | .endif |
225 | | | 232 | |
226 | .if !empty(GEM_CLEANBUILD_EXTENSIONS:M/*) || !empty(GEM_CLEANBUILD_EXTENSIONS:M*../*) | | 233 | .if !empty(GEM_CLEANBUILD_EXTENSIONS:M/*) || !empty(GEM_CLEANBUILD_EXTENSIONS:M*../*) |
227 | PKG_FAIL_REASON+= "GEM_CLEANBUILD_EXTENSIONS must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"." | | 234 | PKG_FAIL_REASON+= "GEM_CLEANBUILD_EXTENSIONS must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"." |
228 | .endif | | 235 | .endif |
229 | | | 236 | |
230 | .if !empty(GEM_KEEPBUILD:M/*) || !empty(GEM_KEEPBUILD:M*../*) | | 237 | .if !empty(GEM_KEEPBUILD:M/*) || !empty(GEM_KEEPBUILD:M*../*) |
231 | PKG_FAIL_REASON+= "GEM_KEEPBUILD must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"." | | 238 | PKG_FAIL_REASON+= "GEM_KEEPBUILD must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"." |
232 | .endif | | 239 | .endif |
233 | | | 240 | |
234 | .PHONY: gem-build | | 241 | .PHONY: gem-build |
235 | do-build: _gem-pre-build gem-build | | 242 | do-build: _gem-pre-build gem-build |
236 | | | 243 | |
237 | _gem-pre-build: | | 244 | _gem-pre-build: |
238 | .if !empty(OVERRIDE_GEMSPEC) | | 245 | .if !empty(OVERRIDE_GEMSPEC) |
239 | @${STEP_MSG} Override gemspec | | 246 | @${STEP_MSG} Override gemspec |
240 | @${RUBY} ${.CURDIR}/${UPDATE_GEMSPEC} ${WRKDIR}/${GEM_NAME}.gemspec \ | | 247 | @${RUBY} ${.CURDIR}/${UPDATE_GEMSPEC} ${WRKDIR}/${GEM_NAME}.gemspec \ |
241 | ${OVERRIDE_GEMSPEC:Q} | | 248 | ${OVERRIDE_GEMSPEC:Q} |
242 | .endif | | 249 | .endif |
243 | @${STEP_MSG} "Removing backup files of patch before build" | | 250 | @${STEP_MSG} "Removing backup files of patch before build" |
244 | @find ${WRKSRC} -name \*.orig -exec rm {} \; | | 251 | @find ${WRKSRC} -name \*.orig -exec rm {} \; |
245 | | | 252 | |
246 | gem-build: _gem-${GEM_BUILD}-build | | 253 | gem-build: _gem-${GEM_BUILD}-build |
247 | | | 254 | |
248 | .PHONY: _gem-gemspec-build | | 255 | .PHONY: _gem-gemspec-build |
249 | _gem-gemspec-build: | | 256 | _gem-gemspec-build: |
250 | ${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${RUBYGEM_ENV} \ | | 257 | ${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${RUBYGEM_ENV} \ |
251 | ${RUBYGEM} build ${GEM_SPECFILE} | | 258 | ${RUBYGEM} build ${GEM_SPECFILE} |
252 | ${RUN} ${TEST} -f ${WRKSRC}/${GEM_NAME}.gem || \ | | 259 | ${RUN} ${TEST} -f ${WRKSRC}/${GEM_NAME}.gem || \ |
253 | ${FAIL_MSG} "Build of ${GEM_NAME}.gem failed." | | 260 | ${FAIL_MSG} "Build of ${GEM_NAME}.gem failed." |
254 | | | 261 | |
255 | BUILD_TARGET?= gem | | 262 | BUILD_TARGET?= gem |
256 | | | 263 | |
257 | .PHONY: _gem-rake-build | | 264 | .PHONY: _gem-rake-build |
258 | _gem-rake-build: | | 265 | _gem-rake-build: |
259 | ${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${RAKE} ${BUILD_TARGET} | | 266 | ${RUN} cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${RAKE} ${BUILD_TARGET} |
260 | ${RUN} cd ${WRKSRC} && rm -f ${GEM_NAME}.gem | | 267 | ${RUN} cd ${WRKSRC} && rm -f ${GEM_NAME}.gem |
261 | ${RUN} cd ${WRKSRC} && find . -name ${GEM_NAME}.gem -print | \ | | 268 | ${RUN} cd ${WRKSRC} && find . -name ${GEM_NAME}.gem -print | \ |
262 | while read file; do \ | | 269 | while read file; do \ |
263 | ln -fs "$$file" ${GEM_NAME}.gem; \ | | 270 | ln -fs "$$file" ${GEM_NAME}.gem; \ |
264 | exit 0; \ | | 271 | exit 0; \ |
265 | done | | 272 | done |
266 | | | 273 | |
267 | RUBYGEM_INSTALL_ROOT= ${WRKDIR}/.inst | | 274 | RUBYGEM_INSTALL_ROOT= ${WRKDIR}/.inst |
268 | _RUBYGEM_OPTIONS= --no-update-sources # don't cache the gem index | | 275 | _RUBYGEM_OPTIONS= --no-update-sources # don't cache the gem index |
269 | _RUBYGEM_OPTIONS+= --install-dir ${PREFIX}/${GEM_HOME} | | 276 | _RUBYGEM_OPTIONS+= --install-dir ${PREFIX}/${GEM_HOME} |
270 | _RUBYGEM_OPTIONS+= ${RUBYGEM_INSTALL_ROOT_OPTION} | | 277 | _RUBYGEM_OPTIONS+= ${RUBYGEM_INSTALL_ROOT_OPTION} |
271 | _RUBYGEM_OPTIONS+= --ignore-dependencies | | 278 | _RUBYGEM_OPTIONS+= --ignore-dependencies |
272 | _RUBYGEM_OPTIONS+= --local ${WRKSRC}/${GEM_NAME}.gem | | 279 | _RUBYGEM_OPTIONS+= --local ${WRKSRC}/${GEM_NAME}.gem |
| | | 280 | .if !empty(RUBYGEM_VERBOSE:M[Yy][Ee][Ss]) |
| | | 281 | _RUBYGEM_OPTIONS+= -V |
| | | 282 | .endif |
273 | .if !empty(RUBY_BUILD_DOCUMENT:M[nN][oO]) | | 283 | .if !empty(RUBY_BUILD_DOCUMENT:M[nN][oO]) |
274 | _RUBYGEM_OPTIONS+= --no-document | | 284 | _RUBYGEM_OPTIONS+= --no-document |
275 | .endif | | 285 | .endif |
276 | .if !empty(CONFIGURE_ARGS) || !empty(RUBY_EXTCONF_ARGS) | | 286 | .if !empty(CONFIGURE_ARGS) || !empty(RUBY_EXTCONF_ARGS) |
277 | _RUBYGEM_OPTIONS+= -- | | 287 | _RUBYGEM_OPTIONS+= -- |
278 | . if !empty(RUBY_EXTCONF_ARGS) | | 288 | . if !empty(RUBY_EXTCONF_ARGS) |
279 | _RUBYGEM_OPTIONS+= ${RUBY_EXTCONF_ARGS} | | 289 | _RUBYGEM_OPTIONS+= ${RUBY_EXTCONF_ARGS} |
280 | . endif | | 290 | . endif |
281 | . if !empty(CONFIGURE_ARGS) | | 291 | . if !empty(CONFIGURE_ARGS) |
282 | _RUBYGEM_OPTIONS+= --build-args ${CONFIGURE_ARGS} | | 292 | _RUBYGEM_OPTIONS+= --build-args ${CONFIGURE_ARGS} |
283 | . endif | | 293 | . endif |
284 | .endif | | 294 | .endif |
285 | | | 295 | |
286 | RUBYGEM_INSTALL_ROOT_OPTION= --install-root ${RUBYGEM_INSTALL_ROOT} | | 296 | RUBYGEM_INSTALL_ROOT_OPTION= --install-root ${RUBYGEM_INSTALL_ROOT} |
287 | | | 297 | |
288 | .PHONY: _gem-build-install-root | | 298 | .PHONY: _gem-build-install-root |
289 | _gem-build-install-root: | | 299 | _gem-build-install-root: |
290 | @${STEP_MSG} "Installing gem into installation root" | | 300 | @${STEP_MSG} "Installing gem into installation root" |
291 | ${RUN} ${SETENV} ${MAKE_ENV} ${RUBYGEM_ENV} \ | | 301 | ${RUN} ${SETENV} ${MAKE_ENV} ${RUBYGEM_ENV} \ |
292 | ${RUBYGEM} install --backtrace ${RUBYGEM_OPTIONS} ${_RUBYGEM_OPTIONS} | | 302 | ${RUBYGEM} install --backtrace ${RUBYGEM_OPTIONS} ${_RUBYGEM_OPTIONS} |
293 | | | 303 | |
294 | # The ``gem'' command doesn't exit with a non-zero result even if the | | 304 | # The ``gem'' command doesn't exit with a non-zero result even if the |
295 | # install of the gem failed, so we do the check and return the proper exit | | 305 | # install of the gem failed, so we do the check and return the proper exit |
296 | # code ourselves. | | 306 | # code ourselves. |
297 | # | | 307 | # |
298 | .PHONY: _gem-build-install-root-check | | 308 | .PHONY: _gem-build-install-root-check |
299 | _gem-build-install-root-check: | | 309 | _gem-build-install-root-check: |
300 | ${RUN} ${TEST} -f ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_CACHEDIR}/${GEM_NAME}.gem || \ | | 310 | ${RUN} ${TEST} -f ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_CACHEDIR}/${GEM_NAME}.gem || \ |
301 | ${FAIL_MSG} "Installing ${GEM_NAME}.gem into installation root failed." | | 311 | ${FAIL_MSG} "Installing ${GEM_NAME}.gem into installation root failed." |
302 | | | 312 | |
303 | .if !empty(GEM_CLEANBUILD) || !empty(GEM_CLEANBUILD_EXTENSIONS) | | 313 | .if !empty(GEM_CLEANBUILD) || !empty(GEM_CLEANBUILD_EXTENSIONS) |
304 | .PHONY: _gem-build-cleanbuild | | 314 | .PHONY: _gem-build-cleanbuild |
305 | _gem-build-cleanbuild: | | 315 | _gem-build-cleanbuild: |
306 | @${STEP_MSG} "Cleaning intermediate gem build files" | | 316 | @${STEP_MSG} "Cleaning intermediate gem build files" |
307 | . if !empty(GEM_CLEANBUILD) | | 317 | . if !empty(GEM_CLEANBUILD) |
308 | ${RUN} cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_LIBDIR} && \ | | 318 | ${RUN} cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_LIBDIR} && \ |
309 | find . -print | sort -r | \ | | 319 | find . -print | sort -r | \ |
310 | while read file; do \ | | 320 | while read file; do \ |
311 | case $$file in \ | | 321 | case $$file in \ |
312 | ${GEM_KEEPBUILD:@.p.@./${.p.}) continue ;;@} \ | | 322 | ${GEM_KEEPBUILD:@.p.@./${.p.}) continue ;;@} \ |
313 | ${GEM_CLEANBUILD:@.p.@./${.p.}) ;;@} \ | | 323 | ${GEM_CLEANBUILD:@.p.@./${.p.}) ;;@} \ |
314 | *) continue ;; \ | | 324 | *) continue ;; \ |
315 | esac; \ | | 325 | esac; \ |
316 | if [ -e ${WRKSRC:Q}"/$$file" ]; then \ | | 326 | if [ -e ${WRKSRC:Q}"/$$file" ]; then \ |
317 | continue; \ | | 327 | continue; \ |
318 | elif [ -d "$$file" ]; then \ | | 328 | elif [ -d "$$file" ]; then \ |
319 | rfile=`echo $$file | ${SED} -e 's|^\./||'`; \ | | 329 | rfile=`echo $$file | ${SED} -e 's|^\./||'`; \ |
320 | ${ECHO} "rmdir "${GEM_NAME}"/$$rfile"; \ | | 330 | ${ECHO} "rmdir "${GEM_NAME}"/$$rfile"; \ |
321 | rmdir $$file; \ | | 331 | rmdir $$file; \ |
322 | elif [ -f "$$file" ]; then \ | | 332 | elif [ -f "$$file" ]; then \ |
323 | rfile=`echo $$file | ${SED} -e 's|^\./||'`; \ | | 333 | rfile=`echo $$file | ${SED} -e 's|^\./||'`; \ |
324 | ${ECHO} "rm "${GEM_NAME}"/$$rfile"; \ | | 334 | ${ECHO} "rm "${GEM_NAME}"/$$rfile"; \ |
325 | rm -f $$file; \ | | 335 | rm -f $$file; \ |
326 | fi; \ | | 336 | fi; \ |
327 | done | | 337 | done |
328 | . endif | | 338 | . endif |
329 | @${RMDIR} ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_BUILDINFO_DIR} \ | | 339 | @${RMDIR} ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_BUILDINFO_DIR} \ |
330 | ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSBASE} \ | | 340 | ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSBASE} \ |
331 | >/dev/null 2>&1 || true | | 341 | >/dev/null 2>&1 || true |
332 | . if !empty(GEM_EXTSDIR) && !empty(GEM_CLEANBUILD_EXTENSIONS) | | 342 | . if !empty(GEM_EXTSDIR) && !empty(GEM_CLEANBUILD_EXTENSIONS) |
333 | ${RUN} \ | | 343 | ${RUN} \ |
334 | if test ! -d ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR}; then \ | | 344 | if test ! -d ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR}; then \ |
335 | :; \ | | 345 | :; \ |
336 | else \ | | 346 | else \ |
337 | cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR} && \ | | 347 | cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR} && \ |
338 | for f in ${GEM_CLEANBUILD_EXTENSIONS}; do \ | | 348 | for f in ${GEM_CLEANBUILD_EXTENSIONS}; do \ |
339 | echo "rm -f $$f"; \ | | 349 | echo "rm -f $$f"; \ |
340 | rm -f $$f; \ | | 350 | rm -f $$f; \ |
341 | done; \ | | 351 | done; \ |
342 | fi | | 352 | fi |
343 | . endif | | 353 | . endif |
344 | .endif | | 354 | .endif |
345 | | | 355 | |
346 | ### | | 356 | ### |
347 | ### gem-install | | 357 | ### gem-install |
348 | ### | | 358 | ### |
349 | ### The gem-install target installs the gem in ${_RUBY_INSTALL_ROOT} into | | 359 | ### The gem-install target installs the gem in ${_RUBY_INSTALL_ROOT} into |
350 | ### the actual gem repository. | | 360 | ### the actual gem repository. |
351 | ### | | 361 | ### |
352 | GENERATE_PLIST+= ${RUBYGEM_GENERATE_PLIST} | | 362 | GENERATE_PLIST+= ${RUBYGEM_GENERATE_PLIST} |
353 | RUBYGEM_GENERATE_PLIST= \ | | 363 | RUBYGEM_GENERATE_PLIST= \ |
354 | ${ECHO} "@comment The following lines are automatically generated." && \ | | 364 | ${ECHO} "@comment The following lines are automatically generated." && \ |
355 | ( cd ${RUBYGEM_INSTALL_ROOT}${PREFIX} && test -d ${GEM_DOCDIR} && \ | | 365 | ( cd ${RUBYGEM_INSTALL_ROOT}${PREFIX} && test -d ${GEM_DOCDIR} && \ |
356 | ${FIND} ${GEM_DOCDIR} \! -type d -print | ${SORT} ) || true; | | 366 | ${FIND} ${GEM_DOCDIR} \! -type d -print | ${SORT} ) || true; |
357 | | | 367 | |
358 | _GEM_INSTALL_TARGETS= _gem-build-install-root | | 368 | _GEM_INSTALL_TARGETS= _gem-build-install-root |
359 | _GEM_INSTALL_TARGETS+= _gem-build-install-root-check | | 369 | _GEM_INSTALL_TARGETS+= _gem-build-install-root-check |
360 | .if !empty(GEM_CLEANBUILD) | | 370 | .if !empty(GEM_CLEANBUILD) |
361 | _GEM_INSTALL_TARGETS+= _gem-build-cleanbuild | | 371 | _GEM_INSTALL_TARGETS+= _gem-build-cleanbuild |
362 | .endif | | 372 | .endif |
363 | _GEM_INSTALL_TARGETS+= _gem-install | | 373 | _GEM_INSTALL_TARGETS+= _gem-install |
364 | | | 374 | |
365 | .ORDER: ${_GEM_INSTALL_TARGETS} | | 375 | .ORDER: ${_GEM_INSTALL_TARGETS} |
366 | | | 376 | |
367 | USE_TOOLS+= pax | | 377 | USE_TOOLS+= pax |
368 | | | 378 | |
369 | do-install: ${_GEM_INSTALL_TARGETS} | | 379 | do-install: ${_GEM_INSTALL_TARGETS} |
370 | | | 380 | |
371 | .PHONY: _gem-install | | 381 | .PHONY: _gem-install |
372 | _gem-install: | | 382 | _gem-install: |
373 | @${STEP_MSG} "gem install" | | 383 | @${STEP_MSG} "gem install" |
374 | ${RUN} cd ${RUBYGEM_INSTALL_ROOT}${PREFIX} && \ | | 384 | ${RUN} cd ${RUBYGEM_INSTALL_ROOT}${PREFIX} && \ |
375 | pax -rwpp . ${DESTDIR}${PREFIX} | | 385 | pax -rwpp . ${DESTDIR}${PREFIX} |
376 | | | 386 | |
377 | .endif | | 387 | .endif |