Fix various minor issues in ruby.port.mk:

* No longer remove ruby-* from PKGNAME when building FULLPKGNAME for
  the gem and extconf ports
* Correctly remove ruby18 FLAVOR
* Use extract/build/install cookies
* Fix installing of certain gems as root without systrace, by working
  around a bug in devel/ruby-gems
* Remove MODRUBY_REV from SUBST_VARS

OK landry@
This commit is contained in:
jeremy 2010-11-16 18:30:38 +00:00
parent 39fa88db7e
commit aa826b5062

View File

@ -1,4 +1,4 @@
# $OpenBSD: ruby.port.mk,v 1.34 2010/11/10 09:00:10 landry Exp $
# $OpenBSD: ruby.port.mk,v 1.35 2010/11/16 18:30:38 jeremy Exp $
# ruby module
@ -25,7 +25,7 @@ FLAVORS+= jruby
# ruby19-* and jruby uses jruby-*. In most cases, PKGNAME in the port
# should be set to the same as DISTNAME, and this will insert the
# correct package prefix.
FULLPKGNAME?= ${MODRUBY_PKG_PREFIX}-${PKGNAME:S/^ruby-//}
FULLPKGNAME?= ${MODRUBY_PKG_PREFIX}-${PKGNAME}
# If the port can work on both ruby 1.9 and another version of ruby,
# and gem installs binaries for it, the binaries on ruby 1.9 are installed
@ -46,7 +46,7 @@ MODRUBY_REV= 1.8
. if ${FLAVOR:L:Mruby19} || ${FLAVOR:L:Mjruby}
ERRORS+= "Fatal: Conflicting flavors used: ${FLAVOR}"
. endif
FLAVOR=
FLAVOR= ${FLAVOR:L:Nruby18}
MODRUBY_REV= 1.8
. elif ${FLAVOR:L:Mruby19}
. if ${FLAVOR:L:Mruby18} || ${FLAVOR:L:Mjruby}
@ -193,6 +193,10 @@ pre-configure:
. endif
.endif
MODRUBY_EXTRACT_COOKIE = ${WRKDIR}/.modruby_extract_done
MODRUBY_BUILD_COOKIE = ${WRKBUILD}/.modruby_build_done
MODRUBY_INSTALL_COOKIE = ${WRKINST}/.modruby_install_done
.if ${CONFIGURE_STYLE:L:Mext} || ${CONFIGURE_STYLE:L:Mextconf}
# Ruby C exensions are specific to an arch and are loaded as
# shared libraries (not compiled into ruby), so set SHARED_ONLY
@ -275,36 +279,31 @@ GEM_FLAGS+= --format-executable
# under WRKDIST so it can be patched easily to remove or change dependencies.
# Remove any signing of packages, as patching the gem could then break the
# signatures.
. if !target(do-extract)
do-extract:
${MODRUBY_EXTRACT_COOKIE}:
mkdir -p ${WRKDIST} ${_GEM_CONTENT}
cd ${_GEM_CONTENT} && tar -xf ${FULLDISTDIR}/${DISTNAME}${EXTRACT_SUFX}
cd ${WRKDIST} && tar -xzf ${_GEM_DATAFILE} && rm ${_GEM_DATAFILE}
cd ${_GEM_CONTENT} && gunzip metadata.gz && \
mv metadata ${WRKDIST}/.metadata
rm -f ${_GEM_CONTENT}/*.gz.sig
. endif
# Rebuild the gem manually after possible patching, then install it to a
# temporary directory (not the final directory under fake, since that would
# require root access and building C extensions as root).
. if !target(do-build)
do-build:
${MODRUBY_BUILD_COOKIE}:
cd ${WRKDIST} && gzip .metadata && \
mv .metadata.gz ${_GEM_CONTENT}/metadata.gz
cd ${WRKDIST} && find . -type f \! -name '*.orig' -print | \
pax -wz -s '/^\.\///' -f ${_GEM_DATAFILE}
cd ${_GEM_CONTENT} && tar -cf ${WRKDIR}/${_GEM_PATCHED} *.gz
mkdir -p ${GEM_BASE}
env -i ${MAKE_ENV} HOME=${GEM_BASE}/.. ${GEM} install \
${GEM_FLAGS} ${WRKDIR}/${_GEM_PATCHED}
. endif
env -i ${MAKE_ENV} HOME=${GEM_BASE}/.. GEM_HOME=${GEM_BASE} \
${GEM} install ${GEM_FLAGS} ${WRKDIR}/${_GEM_PATCHED}
# Take the temporary gem directory, install the binary stub files to
# the appropriate directory, and move and fix ownership the gem library
# files.
. if !target(do-install)
do-install:
${MODRUBY_INSTALL_COOKIE}:
if [ -d ${GEM_BASE_BIN} ]; then \
${INSTALL_DATA_DIR} ${PREFIX}/${GEM_BIN}; \
for f in ${GEM_BASE_BIN}/*; do \
@ -315,31 +314,40 @@ do-install:
${INSTALL_DATA_DIR} ${GEM_ABS_PATH}
cd ${GEM_BASE_LIB} && mv * ${GEM_ABS_PATH}
chown -R ${SHAREOWN}:${SHAREGRP} ${GEM_ABS_PATH}
. if !target(do-extract)
do-extract: ${MODRUBY_EXTRACT_COOKIE}
. endif
. if !target(do-build)
do-build: ${MODRUBY_BUILD_COOKIE}
. endif
. if !target(do-install)
do-install: ${MODRUBY_INSTALL_COOKIE}
. endif
.elif ${CONFIGURE_STYLE:L:Msetup}
MODRUBY_configure= \
cd ${WRKSRC}; ${SETENV} ${CONFIGURE_ENV} ${RUBY} setup.rb config \
--prefix=${PREFIX} ${CONFIGURE_ARGS};
. if !target(do-build)
do-build:
${MODRUBY_BUILD_COOKIE}:
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${RUBY} setup.rb setup
. endif
. if !target(do-install)
do-install:
${MODRUBY_INSTALL_COOKIE}:
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${RUBY} setup.rb install \
--prefix=${DESTDIR}
. if !target(do-build)
do-build: ${MODRUBY_BUILD_COOKIE}
. endif
. if !target(do-install)
do-install: ${MODRUBY_INSTALL_COOKIE}
. endif
.endif
# These are mostly used by the non-gem ports.
SUBST_VARS+= MODRUBY_BIN_REV MODRUBY_LIBREV MODRUBY_ARCH
# This is only for backwards compatibility with old PLISTs. New
# PLISTs should only use MODRUBY_LIBREV.
.if ${MODRUBY_REV} == 1.8
SUBST_VARS+= MODRUBY_REV
.endif
# regression stuff
.if !target(do-regress)