| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: gem.mk,v 1.32 2014/08/19 15:26:44 taca Exp $ | | 1 | # $NetBSD: gem.mk,v 1.33 2015/01/16 09:18:47 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 | # Package-settable variables: | | 6 | # Package-settable variables: |
7 | # | | 7 | # |
8 | # RUBYGEMS_REQD | | 8 | # RUBYGEMS_REQD |
9 | # Minimum version of required rubygems. Ruby base packages contain: | | 9 | # Minimum version of required rubygems. Ruby base packages contain: |
10 | # | | 10 | # |
11 | # ruby18-base: none | | 11 | # ruby18-base: none |
12 | # ruby193-base: 1.8.23 | | 12 | # ruby193-base: 1.8.23 |
13 | # ruby200-base: 2.0.3 | | 13 | # ruby200-base: 2.0.3 |
14 | # ruby210-base: 2.2.0 | | 14 | # ruby210-base: 2.2.0 |
| @@ -82,27 +82,27 @@ | | | @@ -82,27 +82,27 @@ |
82 | # Possible: gemspec, rake | | 82 | # Possible: gemspec, rake |
83 | # Default: gemspec | | 83 | # Default: gemspec |
84 | # | | 84 | # |
85 | # GEM_CLEANBUILD | | 85 | # GEM_CLEANBUILD |
86 | # A list of shell globs representing files to remove from the | | 86 | # A list of shell globs representing files to remove from the |
87 | # gem installed in the installation root. The file is removed | | 87 | # gem installed in the installation root. The file is removed |
88 | # if the path matches the glob and is not in ${WRKSRC}. The | | 88 | # if the path matches the glob and is not in ${WRKSRC}. The |
89 | # default is "ext/*" | | 89 | # default is "ext/*" |
90 | # | | 90 | # |
91 | # Example: | | 91 | # Example: |
92 | # | | 92 | # |
93 | # GEM_CLEANBUILD= *.o *.${RUBY_DLEXT} mkmf.log | | 93 | # GEM_CLEANBUILD= *.o *.${RUBY_DLEXT} mkmf.log |
94 | # | | 94 | # |
95 | # GEM_CLEANBUOLD_EXTENSIONS | | 95 | # GEM_CLEANBUILD_EXTENSIONS |
96 | # A list of shell globs representing files under ${RUBY_EXTSDIR}. | | 96 | # A list of shell globs representing files under ${RUBY_EXTSDIR}. |
97 | # These files will be additionaly removed from the gem installed in | | 97 | # These files will be additionaly removed from the gem installed in |
98 | # the installation root. | | 98 | # the installation root. |
99 | # | | 99 | # |
100 | # GEM_NAME | | 100 | # GEM_NAME |
101 | # 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}. |
102 | # | | 102 | # |
103 | # GEM_SPECFILE | | 103 | # GEM_SPECFILE |
104 | # The path to the gemspec file to use when building a gem using | | 104 | # The path to the gemspec file to use when building a gem using |
105 | # the ``gemspec'' GEM_BUILD method. It defaults to | | 105 | # the ``gemspec'' GEM_BUILD method. It defaults to |
106 | # ${WRKDIR}/${DISTNAME}.gemspec. | | 106 | # ${WRKDIR}/${DISTNAME}.gemspec. |
107 | # | | 107 | # |
108 | # RUBYGEM_OPTIONS | | 108 | # RUBYGEM_OPTIONS |
| @@ -293,34 +293,34 @@ gem-extract: fake-home | | | @@ -293,34 +293,34 @@ gem-extract: fake-home |
293 | ${RUBYGEM} spec --ruby ${_DISTDIR:Q}/${_gem_:Q} > ${_gem_}spec | | 293 | ${RUBYGEM} spec --ruby ${_DISTDIR:Q}/${_gem_:Q} > ${_gem_}spec |
294 | . endfor | | 294 | . endfor |
295 | .endif | | 295 | .endif |
296 | | | 296 | |
297 | ### | | 297 | ### |
298 | ### gem-build | | 298 | ### gem-build |
299 | ### | | 299 | ### |
300 | ### The gem-build target builds a new local gem from the extracted gem's | | 300 | ### The gem-build target builds a new local gem from the extracted gem's |
301 | ### contents. The new gem as created as ${WRKSRC}/${GEM_NAME}.gem. | | 301 | ### contents. The new gem as created as ${WRKSRC}/${GEM_NAME}.gem. |
302 | ### The local gem is then installed into a special build root under | | 302 | ### The local gem is then installed into a special build root under |
303 | ### ${WRKDIR} (${RUBYGEM_INSTALL_ROOT}), possibly compiling any extensions. | | 303 | ### ${WRKDIR} (${RUBYGEM_INSTALL_ROOT}), possibly compiling any extensions. |
304 | ### | | 304 | ### |
305 | GEM_CLEANBUILD?= ext/* | | 305 | GEM_CLEANBUILD?= ext/* |
306 | GEM_CLEANBUOLD_EXTENSIONS+= gem.build_complete *.out *.log | | 306 | GEM_CLEANBUILD_EXTENSIONS+= gem.build_complete *.out *.log |
307 | | | 307 | |
308 | .if !empty(GEM_CLEANBUILD:M/*) || !empty(GEM_CLEANBUILD:M*../*) | | 308 | .if !empty(GEM_CLEANBUILD:M/*) || !empty(GEM_CLEANBUILD:M*../*) |
309 | PKG_FAIL_REASON= "GEM_CLEANBUILD must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"." | | 309 | PKG_FAIL_REASON= "GEM_CLEANBUILD must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"." |
310 | .endif | | 310 | .endif |
311 | | | 311 | |
312 | .if !empty(GEM_CLEANBUOLD_EXTENSIONS:M/*) || !empty(GEM_CLEANBUOLD_EXTENSIONS:M*../*) | | 312 | .if !empty(GEM_CLEANBUILD_EXTENSIONS:M/*) || !empty(GEM_CLEANBUILD_EXTENSIONS:M*../*) |
313 | PKG_FAIL_REASON= "GEM_CLEANBUOLD_EXTENSIONS must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"." | | 313 | PKG_FAIL_REASON= "GEM_CLEANBUILD_EXTENSIONS must be relative to "${PREFIX}/${GEM_LIBDIR:Q}"." |
314 | .endif | | 314 | .endif |
315 | | | 315 | |
316 | .PHONY: gem-build | | 316 | .PHONY: gem-build |
317 | do-build: _gem-pre-build gem-build | | 317 | do-build: _gem-pre-build gem-build |
318 | | | 318 | |
319 | _gem-pre-build: | | 319 | _gem-pre-build: |
320 | .if !empty(OVERRIDE_GEMSPEC) | | 320 | .if !empty(OVERRIDE_GEMSPEC) |
321 | @${STEP_MSG} Override gemspec dependency | | 321 | @${STEP_MSG} Override gemspec dependency |
322 | @${RUBY} ${.CURDIR}/${UPDATE_GEMSPEC} ${WRKDIR}/${GEM_NAME}.gemspec \ | | 322 | @${RUBY} ${.CURDIR}/${UPDATE_GEMSPEC} ${WRKDIR}/${GEM_NAME}.gemspec \ |
323 | ${OVERRIDE_GEMSPEC:Q} | | 323 | ${OVERRIDE_GEMSPEC:Q} |
324 | .endif | | 324 | .endif |
325 | @${STEP_MSG} "Removing backup files of patch before build" | | 325 | @${STEP_MSG} "Removing backup files of patch before build" |
326 | @find ${WRKSRC} -name \*.orig -exec rm {} \; | | 326 | @find ${WRKSRC} -name \*.orig -exec rm {} \; |
| @@ -375,58 +375,58 @@ _gem-build-install-root: | | | @@ -375,58 +375,58 @@ _gem-build-install-root: |
375 | @${STEP_MSG} "Installing gem into installation root" | | 375 | @${STEP_MSG} "Installing gem into installation root" |
376 | ${RUN} ${SETENV} ${MAKE_ENV} ${RUBYGEM_ENV} \ | | 376 | ${RUN} ${SETENV} ${MAKE_ENV} ${RUBYGEM_ENV} \ |
377 | ${RUBYGEM} install --backtrace ${RUBYGEM_OPTIONS} ${_RUBYGEM_OPTIONS} | | 377 | ${RUBYGEM} install --backtrace ${RUBYGEM_OPTIONS} ${_RUBYGEM_OPTIONS} |
378 | | | 378 | |
379 | # The ``gem'' command doesn't exit with a non-zero result even if the | | 379 | # The ``gem'' command doesn't exit with a non-zero result even if the |
380 | # install of the gem failed, so we do the check and return the proper exit | | 380 | # install of the gem failed, so we do the check and return the proper exit |
381 | # code ourselves. | | 381 | # code ourselves. |
382 | # | | 382 | # |
383 | .PHONY: _gem-build-install-root-check | | 383 | .PHONY: _gem-build-install-root-check |
384 | _gem-build-install-root-check: | | 384 | _gem-build-install-root-check: |
385 | ${RUN} ${TEST} -f ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_CACHEDIR}/${GEM_NAME}.gem || \ | | 385 | ${RUN} ${TEST} -f ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_CACHEDIR}/${GEM_NAME}.gem || \ |
386 | ${FAIL_MSG} "Installing ${GEM_NAME}.gem into installation root failed." | | 386 | ${FAIL_MSG} "Installing ${GEM_NAME}.gem into installation root failed." |
387 | | | 387 | |
388 | .if !empty(GEM_CLEANBUILD) || !empty(GEM_CLEANBUOLD_EXTENSIONS) | | 388 | .if !empty(GEM_CLEANBUILD) || !empty(GEM_CLEANBUILD_EXTENSIONS) |
389 | .PHONY: _gem-build-cleanbuild | | 389 | .PHONY: _gem-build-cleanbuild |
390 | _gem-build-cleanbuild: | | 390 | _gem-build-cleanbuild: |
391 | @${STEP_MSG} "Cleaning intermediate gem build files" | | 391 | @${STEP_MSG} "Cleaning intermediate gem build files" |
392 | .if !empty(GEM_CLEANBUILD) | | 392 | .if !empty(GEM_CLEANBUILD) |
393 | ${RUN} cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_LIBDIR} && \ | | 393 | ${RUN} cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_LIBDIR} && \ |
394 | find . -print | sort -r | \ | | 394 | find . -print | sort -r | \ |
395 | while read file; do \ | | 395 | while read file; do \ |
396 | case $$file in \ | | 396 | case $$file in \ |
397 | ${GEM_CLEANBUILD:@.p.@./${.p.}) ;;@} \ | | 397 | ${GEM_CLEANBUILD:@.p.@./${.p.}) ;;@} \ |
398 | *) continue ;; \ | | 398 | *) continue ;; \ |
399 | esac; \ | | 399 | esac; \ |
400 | if [ -e ${WRKSRC:Q}"/$$file" ]; then \ | | 400 | if [ -e ${WRKSRC:Q}"/$$file" ]; then \ |
401 | continue; \ | | 401 | continue; \ |
402 | elif [ -d "$$file" ]; then \ | | 402 | elif [ -d "$$file" ]; then \ |
403 | rfile=`echo $$file | ${SED} -e 's|^\./||'`; \ | | 403 | rfile=`echo $$file | ${SED} -e 's|^\./||'`; \ |
404 | ${ECHO} "rmdir "${GEM_NAME}"/$$rfile"; \ | | 404 | ${ECHO} "rmdir "${GEM_NAME}"/$$rfile"; \ |
405 | rmdir $$file; \ | | 405 | rmdir $$file; \ |
406 | elif [ -f "$$file" ]; then \ | | 406 | elif [ -f "$$file" ]; then \ |
407 | rfile=`echo $$file | ${SED} -e 's|^\./||'`; \ | | 407 | rfile=`echo $$file | ${SED} -e 's|^\./||'`; \ |
408 | ${ECHO} "rm "${GEM_NAME}"/$$rfile"; \ | | 408 | ${ECHO} "rm "${GEM_NAME}"/$$rfile"; \ |
409 | rm -f $$file; \ | | 409 | rm -f $$file; \ |
410 | fi; \ | | 410 | fi; \ |
411 | done | | 411 | done |
412 | .endif | | 412 | .endif |
413 | .if !empty(GEM_EXTSDIR) && !empty(GEM_CLEANBUOLD_EXTENSIONS) | | 413 | .if !empty(GEM_EXTSDIR) && !empty(GEM_CLEANBUILD_EXTENSIONS) |
414 | ${RUN} \ | | 414 | ${RUN} \ |
415 | if test ! -d ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR}; then \ | | 415 | if test ! -d ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR}; then \ |
416 | :; \ | | 416 | :; \ |
417 | else \ | | 417 | else \ |
418 | cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR} && \ | | 418 | cd ${RUBYGEM_INSTALL_ROOT}${PREFIX}/${GEM_EXTSDIR} && \ |
419 | for f in ${GEM_CLEANBUOLD_EXTENSIONS}; do \ | | 419 | for f in ${GEM_CLEANBUILD_EXTENSIONS}; do \ |
420 | echo "rm -f $$f"; \ | | 420 | echo "rm -f $$f"; \ |
421 | rm -f $$f; \ | | 421 | rm -f $$f; \ |
422 | done; \ | | 422 | done; \ |
423 | fi | | 423 | fi |
424 | .endif | | 424 | .endif |
425 | .endif | | 425 | .endif |
426 | | | 426 | |
427 | ### | | 427 | ### |
428 | ### gem-install | | 428 | ### gem-install |
429 | ### | | 429 | ### |
430 | ### The gem-install target installs the gem in ${_RUBY_INSTALL_ROOT} into | | 430 | ### The gem-install target installs the gem in ${_RUBY_INSTALL_ROOT} into |
431 | ### the actual gem repository. | | 431 | ### the actual gem repository. |
432 | ### | | 432 | ### |