Alexander Pyhalov
2016-12-01 1e5ead7336fdc80635cc450140f7d5d8de743b52
Prepare oi-userland makefiles for ruby-23 migration
1 files added
7 files modified
140 ■■■■■ changed files
components/ruby/ruby-common/Makefile 2 ●●● patch | view | raw | blame | history
components/ruby/ruby-common/ruby.p5m 2 ●●● patch | view | raw | blame | history
make-rules/gem.mk 60 ●●●● patch | view | raw | blame | history
make-rules/prep-unpack.mk 3 ●●●●● patch | view | raw | blame | history
make-rules/ruby.mk 43 ●●●●● patch | view | raw | blame | history
make-rules/shared-macros.mk 25 ●●●● patch | view | raw | blame | history
tools/userland-unpack 3 ●●●● patch | view | raw | blame | history
transforms/defaults 2 ●●● patch | view | raw | blame | history
components/ruby/ruby-common/Makefile
@@ -24,7 +24,7 @@
COMPONENT_NAME=        ruby-meta
# the latest version of Ruby
COMPONENT_VERSION=    1.9
COMPONENT_VERSION=    2.3
COMPONENT_PROJECT_URL=    http://www.ruby-lang.org/
COMPONENT_BUGDB=    utility/ruby
components/ruby/ruby-common/ruby.p5m
@@ -33,4 +33,4 @@
license ruby.license license=Oracle
# Any version of Ruby currently available
depend type=require-any fmri=runtime/ruby-19 fmri=runtime/ruby-18
depend type=require-any fmri=runtime/ruby-22 fmri=runtime/ruby-23
make-rules/gem.mk
@@ -18,7 +18,9 @@
#
# CDDL HEADER END
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
#
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
#
GEM=/usr/ruby/$(RUBY_VERSION)/bin/gem
@@ -32,16 +34,27 @@
# Some gems projects have to be built using rake
# Allow GEM build/install commands to be overwritten
# to account for possible differences
GEM_BUILD_ACTION=(cd $(@D); $(GEM) build $(GEMSPEC))
GEM_BUILD_ACTION=(cd $(@D); $(GEM) build $(GEM_BUILD_ARGS) $(GEMSPEC))
GEM_INSTALL_ACTION=\
    $(GEM) install -V --local --install-dir $(PROTO_DIR)/$(VENDOR_GEM_DIR) \
         --bindir $(PROTO_DIR)/$(VENDOR_GEM_DIR)/bin --force \
         $(@D)/$(COMPONENT_ARCHIVE)
# Build install args in a more readable fashion
ifeq ($(firstword $(subst .,$(space),$(RUBY_VERSION))),2)
# gem install 2.x does docs differently. Continue to generate both types
GEM_INSTALL_ARGS += --document rdoc,ri
endif
GEM_INSTALL_ARGS += -V --local --force
GEM_INSTALL_ARGS += --install-dir $(PROTO_DIR)/$(VENDOR_GEM_DIR)
GEM_INSTALL_ARGS += --bindir $(PROTO_DIR)/$(VENDOR_GEM_DIR)/bin
# cd into build directory
# gem 2.2.3 uses .gem from the cwd ignoring command line .gem file
# gem 1.8.23.2 uses command line .gem file OR .gem from cwd
GEM_INSTALL_ACTION= (cd $(@D); $(GEM) install $(GEM_INSTALL_ARGS) $(COMPONENT_NAME))
$(BUILD_DIR)/%/.built:  $(SOURCE_DIR)/.prep
    $(RM) -r $(@D) ; $(MKDIR) $(@D)
    $(CLONEY) $(SOURCE_DIR) $(@D)
    $(GTAR) -C $(SOURCE_DIR) -cpf - . | $(GTAR) -C $(@D) -xpf -
    $(COMPONENT_PRE_BUILD_ACTION)
    # Build the gem and cause the generation of a new gem spec
    # file in $(COMPONENT_SRC)
@@ -57,5 +70,38 @@
    $(COMPONENT_POST_INSTALL_ACTION)
    $(TOUCH) $@
COMPONENT_TEST_TARGETS =
# Test the built source.  If the output file shows up in the environment or
# arguments, don't redirect stdout/stderr to it.
$(BUILD_DIR)/%/.tested-and-compared:    $(BUILD_DIR)/%/.built
    $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
    $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
    $(COMPONENT_PRE_TEST_ACTION)
    -(cd $(COMPONENT_TEST_DIR) ; \
        $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
        $(COMPONENT_TEST_CMD) \
        $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
        $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
    $(COMPONENT_POST_TEST_ACTION)
    $(COMPONENT_TEST_CREATE_TRANSFORMS)
    $(COMPONENT_TEST_PERFORM_TRANSFORM)
    $(COMPONENT_TEST_COMPARE)
    $(COMPONENT_TEST_CLEANUP)
    $(TOUCH) $@
$(BUILD_DIR)/%/.tested:    $(COMPONENT_TEST_DEP)
    $(COMPONENT_PRE_TEST_ACTION)
    (cd $(COMPONENT_TEST_DIR) ; \
        $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
        $(COMPONENT_TEST_CMD) \
        $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
    $(COMPONENT_POST_TEST_ACTION)
    $(COMPONENT_TEST_CLEANUP)
    $(TOUCH) $@
clean::
    $(RM) -r $(SOURCE_DIR) $(BUILD_DIR)
REQUIRED_PACKAGES += runtime/ruby
make-rules/prep-unpack.mk
@@ -40,8 +40,11 @@
UNPACK_STAMP$(1) =    $$(SOURCE_DIR$(1))/.unpacked
# RUBY_VERSION is passed on to ensure userland-unpack uses the
# correct gem command for the ruby version specified
$$(UNPACK_STAMP$(1)):    $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)) download
    $$(RM) -r $$(SOURCE_DIR$(1))
    $(ENV) RUBY_VERSION=$(RUBY_VERSION) \
    $$(UNPACK) $$(UNPACK_ARGS$(1)) $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
    $$(COMPONENT_POST_UNPACK_ACTION$(1))
    $$(TOUCH) $$@
make-rules/ruby.mk
New file
@@ -0,0 +1,43 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
#
# This is only useful for a single ruby version substtution NOT using
# -RUBYVER and -GENFRAG manifests
# Transform file paths for ruby version without creating version specific
# packages
PKG_MACROS += RUBY_VERSION=$(RUBY_VERSION)
PKG_MACROS += RUBY_LIB_VERSION=$(RUBY_LIB_VERSION)
PKG_MACROS += RUBYV=$(subst .,,$(RUBY_VERSION))
VENDOR_RUBY = /usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/$(RUBY_LIB_VERSION)
VENDOR_RUBY_ARCH = /usr/ruby/$(RUBY_VERSION)/lib/ruby/vendor_ruby/$(RUBY_LIB_VERSION)/$(MACH64)-solaris$(SOLARIS_VERSION)
# Modify ruby scripts in the ruby-version-specific path of the proto area,
# under usr/ruby/$(RUBY_VERSION), containing "#!/usr/bin/env ruby" to
# use the version-specific ruby path, defined by the $(RUBY_VERSION) macro.
# Without this change, the mediated ruby version in /usr/bin/ruby
# will probably be used, which may not match the ruby
# version supported by the component.
COMPONENT_POST_INSTALL_ACTION += \
    cd $(PROTO_DIR)/usr/ruby/$(RUBY_VERSION); \
    $(RUBY_SCRIPT_FIX_FUNC);
make-rules/shared-macros.mk
@@ -78,6 +78,12 @@
PUBLISHER ?=    $(CONSOLIDATION)
PUBLISHER_LOCALIZABLE ?=    $(CONSOLIDATION)-localizable
# Defines $(space) as a single blank space, so we can use it to convert
# space-separated paths to colon-separated paths in variables with
# $(subst $(space),:,$(strip $(SPATHS)))
empty :=
space := $(empty) $(empty)
ROOT =            /
# Native OS version
@@ -566,10 +572,22 @@
F77 =        $(F77.$(COMPILER).$(BITS))
FC =        $(FC.$(COMPILER).$(BITS))
RUBY_VERSION =  1.9
RUBY_LIB_VERSION =      1.9.1
RUBY.1.9 =      /usr/ruby/1.9/bin/ruby
RUBY_VERSION =  2.3
RUBY_LIB_VERSION.2.2 = 2.2.0
RUBY_LIB_VERSION.2.3 = 2.3.0
RUBY.2.2 =    /usr/ruby/2.2/bin/ruby
RUBY.2.3 =    /usr/ruby/2.3/bin/ruby
RUBY =          $(RUBY.$(RUBY_VERSION))
RUBY_LIB_VERSION = $(RUBY_LIB_VERSION.$(RUBY_VERSION))
# Transform Ruby scripts to call the supported
# version-specific ruby; used in multiple *.mk files
RUBY_SCRIPT_FIX_FUNC = \
    $(GNU_GREP) -Rl '^\#! */usr/bin/env ruby' | \
        /usr/bin/xargs -I\{\} $(GSED) -i -e \
        '1s%^\#! */usr/bin/env ruby%\#!/usr/ruby/$(RUBY_VERSION)/bin/ruby%' \
        \{\}
# Use the ruby lib versions to represent the RUBY_VERSIONS that
# need to get built.  This is done because during package transformations
# both the ruby version and the ruby library version are needed.
@@ -744,6 +762,7 @@
ENV =        /usr/bin/env
FIND =        /usr/bin/find
INSTALL =    /usr/bin/ginstall
GNU_GREP =    /usr/gnu/bin/grep
CHMOD =        /usr/bin/chmod
NAWK =        /usr/bin/nawk
TEE =        /usr/bin/tee
tools/userland-unpack
@@ -51,7 +51,8 @@
    elif (re.search("(\.oxt)$", filename) != None):
        uncompress = "/usr/bin/unzip -qo"
    elif (re.search("(\.gem)$", filename) != None):
        uncompress = "/usr/bin/gem unpack"
        ruby_ver = os.getenv('RUBY_VERSION', '')
        uncompress = "/usr/ruby/" + ruby_ver + "/bin/gem unpack"
    unpack = " | gtar -xf -"
transforms/defaults
@@ -148,7 +148,7 @@
#
# Set the default Ruby for mediated links
#
<transform link mediator=ruby mediator-version=1.9 -> default mediator-priority vendor>
<transform link mediator=ruby mediator-version=2.3 -> default mediator-priority vendor>
#
# Set the default Java for mediated links