diff options
author | Akinori MUSHA <knu@FreeBSD.org> | 2000-10-20 19:43:58 +0000 |
---|---|---|
committer | Akinori MUSHA <knu@FreeBSD.org> | 2000-10-20 19:43:58 +0000 |
commit | 8abf5f57545391f9bfe893c8f6bfad87e618ddda (patch) | |
tree | 5a57de998d60f312938d11869becce8c9b48029b /Mk | |
parent | Update to 0.9.1 (diff) |
Allow users to define RUBY variable to utilize ruby ports with
custom-installed Ruby. :)
For instance, if you have built Ruby from the latest snapshot and
installed, you can install ruby modules from ports only by typing
"make RUBY=/usr/local/bin/ruby install". bsd.ruby.mk will take care
of everything including RUBY_VER, RUBY_LIBDIR, CONFIGURE_TARGET, etc.
Introduce version requirement checking mechanism. You can set
RUBY_REQUIRE to any ruby expression(s) to check Ruby's version (or
other modules' versions, in future). The result will be set in
RUBY_PROVIDED.
Define RUBY_VERSION_CODE which holds full integer version of Ruby.
Define RUBY_PORTVERSION, RUBY_DISTNAME and RUBY_WRKSRC for the
standard ruby ports so as not to change PORTVERSION, DISTNAME and
RUBY_WRKSRC of ruby, ruby-gdbm, ruby-tcltklib, ruby-tk, etc. everytime
Ruby is updated.
Rename RUBY_DEPENDS to DEPEND_RUBY, etc. for a cosmetic reason.
Notes
Notes:
svn path=/head/; revision=34039
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/bsd.ruby.mk | 104 |
1 files changed, 78 insertions, 26 deletions
diff --git a/Mk/bsd.ruby.mk b/Mk/bsd.ruby.mk index 3908f7759fc8..785e470c5fd1 100644 --- a/Mk/bsd.ruby.mk +++ b/Mk/bsd.ruby.mk @@ -14,7 +14,8 @@ Ruby_Include_MAINTAINER= knu@FreeBSD.org # # [variables that each port can define] # -# RUBY_VER - Set to the alternative short version of ruby (see below for current value). +# RUBY - Set to full path of ruby. If you set this, the values of the following variables are automatically obtained from the ruby executable: RUBY_VER, RUBY_VERSION, RUBY_NAME, RUBY_ARCH, RUBY_LIBDIR, RUBY_ARCHLIBDIR, RUBY_SITELIBDIR, and RUBY_SITEARCHLIBDIR. +# RUBY_VER - Set to the alternative short version of ruby in the form of `x.y' (see below for current value). # USE_RUBY - Says that the port uses ruby for building and running. # RUBY_NO_BUILD_DEPENDS - Says that the port should not build-depend on ruby. # RUBY_NO_RUN_DEPENDS - Says that the port should not run-depend on ruby. @@ -26,29 +27,34 @@ Ruby_Include_MAINTAINER= knu@FreeBSD.org # RUBY_SETUP - Set to the alternative name of setup.rb (default: setup.rb). # USE_RUBY_AMSTD - Says that the port uses amstd for building and running. # USE_RUBY_RD - Says that the port uses rd to generate documents. +# RUBY_REQUIRE - Set to a Ruby expression to evaluate before building the port. The constant "Ruby" is set to the integer version number of ruby, and the result of the expression will be set to RUBY_PROVIDED, which is left undefined if the result is nil, false or a zero-length string. Implies USE_RUBY. # RUBY_SHEBANG_FILES - Specify the files which shebang lines you want to fix. # # [variables that each port should not define] # # RUBY_PKGNAMEPREFIX - Common PKGNAMEPREFIX for ruby ports (default: ruby${RUBY_SUFFIX}-) -# RUBY_VERSION - Full version of ruby (see below for current value). +# RUBY_VERSION - Full version of ruby without preview/beta suffix in the form of `x.y.z' (see below for current value). +# RUBY_VERSION_CODE - Full integer version of ruby without preview/beta suffix in the form of `xyz'. +# RUBY_PORTVERSION - PORTVERSION for the standard ruby ports (ruby, ruby-gdbm, etc.). +# RUBY_DISTNAME - DISTNAME for the standard ruby ports, i.e. the basename of the ruby distribution tarball. +# RUBY_WRKSRC - WRKSRC for the ruby port. +# # RUBY_SHLIBVER - Major version of libruby (see below for current value). # RUBY_ARCH - Directory name of architecture dependent libraries. # RUBY_SUFFIX - Suffix for ruby binaries and directories. # _RUBY_SUFFIX - String to be used as RUBY_SUFFIX. Always ${RUBY_VER:S/.//}. # RUBY_NAME - Ruby's name with trailing suffix. # -# RUBY - Set to full path of ruby. # RUBY_RD - Set to full path of rd. # # RUBY_PORT - Set to port path of ruby without PORTSDIR. # RUBY_AMSTD_PORT - Set to port path of ruby-amstd without PORTSDIR. # RUBY_RD_PORT - Set to port path of rd without PORTSDIR. # -# RUBY_LIB_DEPENDS - Set to LIB_DEPENDS entry for libruby. -# RUBY_DEPENDS - Set to BUILD_DEPENDS/RUN_DEPENDS entry for ruby. -# RUBY_AMSTD_DEPENDS - Set to BUILD_DEPENDS/RUN_DEPENDS entry for ruby-amstd. -# RUBY_RD2_DEPENDS - Set to BUILD_DEPENDS entry for rd. +# DEPEND_LIBRUBY - Set to LIB_DEPENDS entry for libruby. +# DEPEND_RUBY - Set to BUILD_DEPENDS/RUN_DEPENDS entry for ruby. +# DEPEND_RUBY_AMSTD - Set to BUILD_DEPENDS/RUN_DEPENDS entry for ruby-amstd. +# DEPEND_RUBY_RD2 - Set to BUILD_DEPENDS entry for rd. # # RUBY_LIBDIR - Installation path for architecture independent libraries. # RUBY_ARCHLIBDIR - Installation path for architecture dependent libraries. @@ -58,10 +64,30 @@ Ruby_Include_MAINTAINER= knu@FreeBSD.org # RUBY_EXAMPLESDIR - Installation path for examples. # -RUBY_VER?= 1.6 -_RUBY_SUFFIX= ${RUBY_VER:S/.//} +.if defined(RUBY) +.if !exists(${RUBY}) +.error You set the variable RUBY to "${RUBY}", but it does not seem to exist. Please specify an already installed ruby executable. +.endif -.if ${RUBY_VER} == 1.4 +_RUBY_TEST!= ${RUBY} -e 'begin; require "rbconfig"; rescue LoadError; puts "error"; end' +.if !empty(_RUBY_TEST) +.error You set the variable RUBY to "${RUBY}", but it failed to include rbconfig. Please specify a properly installed ruby executable. +.endif + +_RUBY_CONFIG= ${RUBY} -r rbconfig -e 'C = Config::CONFIG' -e + +RUBY_VERSION!= ${_RUBY_CONFIG} 'puts VERSION' +RUBY_SUFFIX?= # empty + +RUBY_ARCH!= ${_RUBY_CONFIG} 'puts C["target"]' +RUBY_NAME!= ${_RUBY_CONFIG} 'puts C["ruby_install_name"]' + +_RUBY_SYSLIBDIR!= ${_RUBY_CONFIG} 'puts C["libdir"]' +_RUBY_SITEDIR!= ${_RUBY_CONFIG} 'puts C["sitedir"]' +.else +RUBY?= ${LOCALBASE}/bin/${RUBY_NAME} + +.if defined(RUBY_VER) && ${RUBY_VER} == 1.4 RUBY_VERSION?= 1.4.6 RUBY_SUFFIX?= ${_RUBY_SUFFIX} .else @@ -69,14 +95,27 @@ RUBY_VERSION?= 1.6.1 RUBY_SUFFIX?= # empty .endif +RUBY_PORTVERSION?= ${RUBY_VERSION} +RUBY_DISTNAME?= ruby-${RUBY_VERSION} +RUBY_WRKSRC?= ${WRKDIR}/${RUBY_DISTNAME} + +RUBY_ARCH?= ${ARCH}-freebsd${OSREL} +RUBY_NAME?= ruby${RUBY_SUFFIX} + +_RUBY_SYSLIBDIR?= ${LOCALBASE}/lib +_RUBY_SITEDIR?= ${_RUBY_SYSLIBDIR}/ruby/site_ruby +.endif + +RUBY_VERSION_CODE?= ${RUBY_VERSION:S/.//g} +RUBY_VER= ${RUBY_VERSION:R} +_RUBY_SUFFIX= ${RUBY_VER:S/.//} + RUBY_PKGNAMEPREFIX?= ruby${RUBY_SUFFIX}- # could be rb${RUBY_SUFFIX}- -RUBY_VER= ${RUBY_VERSION:R} RUBY_SHLIBVER?= ${_RUBY_SUFFIX} -RUBY_ARCH?= ${ARCH}-freebsd${OSREL} -RUBY_NAME?= ruby${RUBY_SUFFIX} + +CONFIGURE_TARGET?= ${RUBY_ARCH} # Commands -RUBY?= ${LOCALBASE}/bin/${RUBY_NAME} RUBY_RD?= ${LOCALBASE}/bin/rd2 # Ports @@ -85,15 +124,15 @@ RUBY_AMSTD_PORT?= devel/ruby-amstd RUBY_RD_PORT?= textproc/ruby-rdtool # Depends -RUBY_LIB_DEPENDS?= ${RUBY_NAME}.${RUBY_SHLIBVER}:${PORTSDIR}/${RUBY_PORT} -RUBY_DEPENDS?= ${RUBY}:${PORTSDIR}/${RUBY_PORT} -RUBY_AMSTD_DEPENDS?= ${RUBY_SITELIBDIR}/amstd/info.rb:${PORTSDIR}/${RUBY_AMSTD_PORT} -RUBY_RD2_DEPENDS?= ${RUBY_RD}:${PORTSDIR}/${RUBY_RD_PORT} +DEPEND_LIBRUBY?= ${RUBY_NAME}.${RUBY_SHLIBVER}:${PORTSDIR}/${RUBY_PORT} +DEPEND_RUBY?= ${RUBY}:${PORTSDIR}/${RUBY_PORT} +DEPEND_RUBY_AMSTD?= ${RUBY_SITELIBDIR}/amstd/info.rb:${PORTSDIR}/${RUBY_AMSTD_PORT} +DEPEND_RUBY_RD2?= ${RUBY_RD}:${PORTSDIR}/${RUBY_RD_PORT} # Directories -RUBY_LIBDIR?= ${LOCALBASE}/lib/ruby/${RUBY_VER} +RUBY_LIBDIR?= ${_RUBY_SYSLIBDIR}/ruby/${RUBY_VER} RUBY_ARCHLIBDIR?= ${RUBY_LIBDIR}/${RUBY_ARCH} -RUBY_SITELIBDIR?= ${LOCALBASE}/lib/ruby/site_ruby/${RUBY_VER} +RUBY_SITELIBDIR?= ${_RUBY_SITEDIR}/${RUBY_VER} RUBY_SITEARCHLIBDIR?= ${RUBY_SITELIBDIR}/${RUBY_ARCH} RUBY_DOCDIR?= ${LOCALBASE}/share/doc/${RUBY_NAME} RUBY_EXAMPLESDIR?= ${LOCALBASE}/share/examples/${RUBY_NAME} @@ -115,6 +154,19 @@ PLIST_SUB+= RUBY_VERSION="${RUBY_VERSION}" \ RUBY_NAME="${RUBY_NAME}" \ ${PLIST_RUBY_DIRS:S,DIR="${LOCALBASE}/,DIR=",} +# require check +.if defined(RUBY_REQUIRE) +USE_RUBY= yes + +RUBY_PROVIDED!= ${RUBY} -e '\ + Ruby = ${RUBY_VERSION_CODE}; \ + value = begin; ${RUBY_REQUIRE}; end and puts value' + +.if empty(RUBY_PROVIDED) +.undef RUBY_PROVIDED +.endif +.endif + # fix shebang lines .if defined(RUBY_SHEBANG_FILES) && !empty(RUBY_SHEBANG_FILES) USE_RUBY= yes @@ -180,25 +232,25 @@ ruby-setup-install: .endif .if defined(USE_LIBRUBY) -LIB_DEPENDS+= ${RUBY_LIB_DEPENDS} +LIB_DEPENDS+= ${DEPEND_LIBRUBY} .endif .if defined(USE_RUBY) .if !defined(RUBY_NO_BUILD_DEPENDS) -BUILD_DEPENDS+= ${RUBY_DEPENDS} +BUILD_DEPENDS+= ${DEPEND_RUBY} .endif .if !defined(RUBY_NO_RUN_DEPENDS) -RUN_DEPENDS+= ${RUBY_DEPENDS} +RUN_DEPENDS+= ${DEPEND_RUBY} .endif .endif .if defined(USE_RUBY_AMSTD) -BUILD_DEPENDS+= ${RUBY_AMSTD_DEPENDS} -RUN_DEPENDS+= ${RUBY_AMSTD_DEPENDS} +BUILD_DEPENDS+= ${DEPEND_RUBY_AMSTD} +RUN_DEPENDS+= ${DEPEND_RUBY_AMSTD} .endif .if defined(USE_RUBY_RD) && !defined(NOPORTDOCS) -BUILD_DEPENDS+= ${RUBY_RD2_DEPENDS} +BUILD_DEPENDS+= ${DEPEND_RUBY_RD2} .endif .endif |