# $NetBSD: Makefile.common,v 1.15 2003/12/19 11:59:39 sketch Exp $ # FreeBSD: ports/Mk/bsd.ruby.mk,v 1.11 2000/11/16 17:59:40 knu Exp # Makefile.common: ruby common makefile, based on FreeBSD's bsd.ruby.mk. # # [variables that each package can define] # # RUBY_PKGNAMEPREFIX - Common PKGNAMEPREFIX for ruby packages. # (default: ruby${RUBY_SUFFIX}-) # RUBY_VER - Set to the alternative short version of ruby in the # form of `x.y' (see below for current value). # RUBY_REQD - Set to required version of ruby in the form of # `x.y.z'. # USE_RUBY - Says that the package uses ruby for building and # running. # RUBY_BUILD_DEPENDS - Says that the package should build-depend on ruby. # RUBY_DEPENDS - Says that the package should depend on ruby. # USE_RUBY_EXTCONF - Says that the package uses extconf.rb to configure. # Implies USE_RUBY. # RUBY_EXTCONF - Set to the alternative name of extconf.rb (default: # extconf.rb). # RUBY_EXTCONF_SUBDIRS - Set to list of subdirectories, if multiple modules # are included. # USE_RUBY_SETUP - Says that the package uses setup.rb to configure and # build. Implies USE_RUBY_AMSTD. # RUBY_SETUP - Set to the alternative name of setup.rb (default: # setup.rb). # REPLACE_RUBY - Specify the files whose first line be replaced. # # [variables that each package should not define] # # RUBY - Full path of ruby executable. # RUBY_ARCH - Directory name of architecture dependent libraries. # RUBY_NAME - Ruby's name with trailing suffix. # RUBY_VERSION - Full version of ruby without preview/beta suffix in # the form of `x.y.z' (see below for current value). # RUBY_SUFFIX - Suffix for ruby binaries and directories. # _RUBY_SUFFIX - String to be used as RUBY_SUFFIX. Always # ${RUBY_VER:S/.//}. # RUBY_DISTNAME - DISTNAME for the standard ruby ports, i.e. the # basename of the ruby distribution tarball. # RUBY_WRKSRC - WRKSRC for the ruby package. # RUBY_DISTINFO - DISTINFO file of base distribution. # RUBY_SHLIBVER - Major version of libruby (see below for current # value). # # RUBY_LIBDIR - Installation path for architecture independent # libraries. # RUBY_ARCHLIBDIR - Installation path for architecture dependent # libraries. # RUBY_SITELIBDIR - Installation path for site architecture independent # libraries. # RUBY_SITEARCHLIBDIR - Installation path for site architecture dependent # libraries. # RUBY_DOCDIR - Installation path for documents. # RUBY_EXAMPLESDIR - Installation path for examples. # .include "../../mk/bsd.prefs.mk" .ifndef RUBY_COMMON RUBY_COMMON= # defined RUBY_VER?= 1.6 RUBY?= ${LOCALBASE}/bin/${RUBY_NAME} .if ${RUBY_VER} < 1.7 RUBY_VERSION?= 1.6.8 RUBY_SUFFIX?= # empty .else RUBY_VERSION?= 1.7 # current, not tested. RUBY_SUFFIX?= ${_RUBY_SUFFIX} .endif RUBY_ARCH?= ${LOWER_ARCH}-${LOWER_OPSYS}${APPEND_ELF}${LOWER_OPSYS_VERSUFFIX} RUBY_NAME?= ruby${RUBY_SUFFIX} RUBY_DISTNAME?= ruby-${RUBY_VERSION} RUBY_WRKSRC?= ${WRKDIR}/${RUBY_DISTNAME} .if ${OPSYS} == "Linux" RUBY_NOEXT_CURSES= "@comment " RUBY_NOEXT_DBM= "@comment " _RUBY_SUFFIX= ${RUBY_VER} .else _RUBY_SUFFIX= ${RUBY_VER:S/.//} .endif .if ${OPSYS} == "SunOS" RUBY_NOSHLIBMAJOR= "@comment " .endif RUBY_PKGNAMEPREFIX?= ruby${RUBY_SUFFIX}- # could be rb${RUBY_SUFFIX}- .if ${OPSYS} == "NetBSD" RUBY_SHLIBVER?= ${RUBY_VERSION:S/.//} .else RUBY_SHLIBVER?= ${RUBY_VERSION} .endif .if ${OPSYS} == "IRIX" RUBY_NOSHLIBMAJOR= "@comment " .endif RUBY_SHLIBMAJOR?= ${_RUBY_SUFFIX} #CONFIGURE_TARGET?= ${RUBY_ARCH} # Directories RUBY_LIBDIR?= ${LOCALBASE}/lib/ruby/${RUBY_VER} RUBY_ARCHLIBDIR?= ${RUBY_LIBDIR}/${RUBY_ARCH} RUBY_SITELIBDIR?= ${LOCALBASE}/lib/ruby/site_ruby/${RUBY_VER} RUBY_SITEARCHLIBDIR?= ${RUBY_SITELIBDIR}/${RUBY_ARCH} RUBY_DOCDIR?= ${LOCALBASE}/share/doc/${RUBY_NAME} RUBY_EXAMPLESDIR?= ${LOCALBASE}/share/examples/${RUBY_NAME} # MAKE_ENV MAKEFLAGS+= RUBY_VER=${RUBY_VER} # PLIST PLIST_RUBY_DIRS= RUBY_LIBDIR="${RUBY_LIBDIR}" \ RUBY_ARCHLIBDIR="${RUBY_ARCHLIBDIR}" \ RUBY_SITELIBDIR="${RUBY_SITELIBDIR}" \ RUBY_SITEARCHLIBDIR="${RUBY_SITEARCHLIBDIR}" \ RUBY_DOCDIR="${RUBY_DOCDIR}" \ RUBY_EXAMPLESDIR="${RUBY_EXAMPLESDIR}" PLIST_SUBST+= RUBY_VERSION="${RUBY_VERSION}" \ RUBY_VER="${RUBY_VER}" \ RUBY_SHLIBVER="${RUBY_SHLIBVER}" \ RUBY_SHLIBMAJOR="${RUBY_SHLIBMAJOR}" \ RUBY_ARCH="${RUBY_ARCH}" \ _RUBY_SUFFIX="${_RUBY_SUFFIX}" \ RUBY_SUFFIX="${RUBY_SUFFIX}" \ RUBY_NAME="${RUBY_NAME}" \ RUBY_NOEXT_CURSES=${RUBY_NOEXT_CURSES} \ RUBY_NOEXT_DBM=${RUBY_NOEXT_DBM} \ RUBY_NOSHLIBMAJOR=${RUBY_NOSHLIBMAJOR} \ RUBY_COMMENT=${RUBY_COMMENT} \ ${PLIST_RUBY_DIRS:S,DIR="${LOCALBASE}/,DIR=",} # base digest checksum RUBY_DISTINFO?= ${.CURDIR}/../../lang/ruby${RUBY_SUFFIX}-base/distinfo # fix shebang lines .if defined(REPLACE_RUBY) && !empty(REPLACE_RUBY) pre-configure: replace-ruby replace-ruby: @for s in ${REPLACE_RUBY}; do \ case $${s} in \ /*) f=$${s};; \ *) f=${WRKSRC}/$${s};; \ esac; \ ${ECHO_MSG} "===> Fixing the #! line of $${s}"; \ ${SED} -e '1s| *[a-z0-9_/\.-][a-z0-9_/\.-]*/env *||g' \ -e '1s| *[a-z0-9_/\.-]*ruby|${RUBY}|' $$f > $$f.tmp; \ if ${CMP} -s $$f $$f.tmp; then \ ${RM} $$f.tmp; \ else \ ${MV} $$f.tmp $$f; \ fi; \ done .endif # extconf.rb .if defined(USE_RUBY_EXTCONF) USE_RUBY?= yes RUBY_EXTCONF?= extconf.rb CONFIGURE_ARGS+= --with-opt-dir="${LOCALBASE}" do-configure: ruby-extconf-configure .if defined(RUBY_EXTCONF_SUBDIRS) ruby-extconf-configure: .for d in ${RUBY_EXTCONF_SUBDIRS} @${ECHO_MSG} "===> Running ${RUBY_EXTCONF} in ${d} to configure" @cd ${WRKSRC}/${d}; \ ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_EXTCONF} ${CONFIGURE_ARGS} .endfor .if !target(do-build) do-build: ruby-extconf-build ruby-extconf-build: .for d in ${RUBY_EXTCONF_SUBDIRS} @${ECHO_MSG} "===> Building ${d}" @cd ${WRKSRC}/${d}; ${SETENV} ${MAKE_ENV} ${MAKE} ${ALL_TARGET} .endfor .endif .if !target(do-install) do-install: ruby-extconf-install ruby-extconf-install: .for d in ${RUBY_EXTCONF_SUBDIRS} @${ECHO_MSG} "===> Installing ${d}" @cd ${WRKSRC}/${d}; ${SETENV} ${MAKE_ENV} ${MAKE} ${INSTALL_TARGET} .endfor .endif .else ruby-extconf-configure: @${ECHO_MSG} "===> Running ${RUBY_EXTCONF} to configure" @cd ${WRKSRC}; \ ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_EXTCONF} ${CONFIGURE_ARGS} .endif .endif # setup.rb .if defined(USE_RUBY_SETUP) USE_RUBY?= yes RUBY_SETUP?= setup.rb .if !target(do-configure) do-configure: ruby-setup-configure ruby-setup-configure: @${ECHO_MSG} "===> Running ${RUBY_SETUP} to configure" @cd ${WRKSRC}; \ ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_SETUP} config ${CONFIGURE_ARGS} .endif .if !target(do-build) do-build: ruby-setup-build ruby-setup-build: @${ECHO_MSG} "===> Running ${RUBY_SETUP} to build" @cd ${WRKSRC}; \ ${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_SETUP} setup .endif .if !target(do-install) do-install: ruby-setup-install ruby-setup-install: @${ECHO_MSG} "===> Running ${RUBY_SETUP} to ${INSTALL_TARGET}" cd ${WRKSRC}; \ ${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_SETUP} ${INSTALL_TARGET} .endif .endif # RUBY_REQD .if defined(RUBY_REQD) _RUBY_REQD= ${RUBY_REQD:S/.//} _RUBY_REQMAJOR= ${_RUBY_REQD:C/\.[0-9]+//} .if ${_RUBY_REQD:M[0-9]*.[0-9]*} == "" _RUBY_REQMINOR= 0 .else _RUBY_REQMINOR= ${_RUBY_REQD:C/[0-9]+\.//} .endif _RUBY_VERSION= ${RUBY_VERSION:S/.//} _RUBY_VERMAJOR= ${_RUBY_VERSION:C/\.[0-9]+//} .if ${_RUBY_VERSION:M[0-9]*.[0-9]*} == "" _RUBY_VERMINOR= 0 .else _RUBY_VERMINOR= ${_RUBY_VERSION:C/[0-9]+\.//} .endif _RUBY_PROVIDED!= case `expr ${_RUBY_VERMAJOR} ">" ${_RUBY_REQMAJOR}` in \ 1) ${ECHO} "ok"; exit 0;; \ esac ; \ case `expr ${_RUBY_VERMAJOR} "=" ${_RUBY_REQMAJOR}` in \ 1) case `expr ${_RUBY_VERMINOR} ">=" ${_RUBY_REQMINOR}` in \ 1) ${ECHO} "ok"; exit 0;; \ esac ;; \ esac; ${ECHO} "no" .if ${_RUBY_PROVIDED} == "no" PKG_FAIL_REASON+= "This package requires ruby ${RUBY_REQD} or later." .endif .else RUBY_REQD?= ${RUBY_VERSION} .endif # USE_RUBY .if defined(USE_RUBY) RUBY_DEPENDS?= yes .if ${RUBY_DEPENDS} != "no" DEPENDS+= ${RUBY_PKGNAMEPREFIX}base>=${RUBY_REQD}:../../lang/ruby${RUBY_SUFFIX}-base .else RUBY_BUILD_DEPENDS?= yes .if ${RUBY_BUILD_DEPENDS} != "no" BUILD_DEPENDS+= ${RUBY_PKGNAMEPREFIX}base>=${RUBY_REQD}:../../lang/ruby${RUBY_SUFFIX}-base .endif .endif .endif .if defined(USE_RUBY_AMSTD) .include "../../devel/ruby-amstd/Makefile.common" .endif MASTER_SITE_RUBY?= \ ftp://ftp.ruby-lang.org/pub/ruby/${RUBY_VER}/ \ ftp://ftp.zetabits.com/pub/lang/ruby/${RUBY_VER}/ \ ftp://ftp.fu-berlin.de/unix/languages/ruby/${RUBY_VER}/ \ ftp://ftp.chg.ru/pub/lang/ruby/${RUBY_VER}/ \ ftp://ftp.TokyoNet.AD.JP/pub/misc/ruby/${RUBY_VER}/ \ ftp://ftp.iij.ad.jp/pub/lang/ruby/${RUBY_VER}/ \ ftp://ftp.krnet.ne.jp/pub/ruby/${RUBY_VER}/ \ ftp://ftp.nctu.edu.tw/computer-languages/ruby/${RUBY_VER}/ \ ftp://mirror.nucba.ac.jp/mirror/ruby/${RUBY_VER}/ .endif