Alexander Pyhalov
2014-10-06 1757a2a795779307407ce7560dd26db0b83df408
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#
# 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) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
#
 
include ../../../make-rules/shared-macros.mk
 
COMPONENT_NAME=        ruby
COMPONENT_VERSION=    1.8.7
COMPONENT_REVISION=    2
COMPONENT_PATCH_VERSION=    374
COMPONENT_PROJECT_URL=    http://www.ruby-lang.org/
COMPONENT_SRC=        $(COMPONENT_NAME)-$(COMPONENT_VERSION)-p$(COMPONENT_PATCH_VERSION)
COMPONENT_ARCHIVE=    $(COMPONENT_SRC).tar.bz2
COMPONENT_ARCHIVE_HASH=    \
    sha256:b4e34703137f7bfb8761c4ea474f7438d6ccf440b3d35f39cc5e4d4e239c07e3
COMPONENT_ARCHIVE_URL=    http://ftp.ruby-lang.org/pub/ruby/1.8/$(COMPONENT_ARCHIVE)
IPS_COMPONENT_VERSION=    $(COMPONENT_VERSION).$(COMPONENT_PATCH_VERSION)
COMPONENT_BUGDB=    utility/ruby
 
# rubygems 
COMPONENT_SRC_1=    rubygems-1.3.5
COMPONENT_ARCHIVE_1=    $(COMPONENT_SRC_1).tgz
COMPONENT_ARCHIVE_HASH_1=    \
    sha256:c0928cc1ae54dedfb5f57ad3829882c1f90e42bc17bf50491aa6f93a937546ac
COMPONENT_ARCHIVE_URL_1=    http://production.cf.rubygems.org/rubygems/$(COMPONENT_ARCHIVE_1)
 
SOURCE_DIR_1=$(COMPONENT_DIR)/$(COMPONENT_SRC_1)
CLEAN_PATHS += $(SOURCE_DIR_1)
 
include $(WS_TOP)/make-rules/prep.mk
include $(WS_TOP)/make-rules/ips.mk
include $(WS_TOP)/make-rules/configure.mk
 
# COMPONENT_VERSION <major>.<minor>.<teeny>
# is transformed into <major>.<minor> for RUBY_VER.
# First change the separator '.' to ' ', so we can use "word" to pull the 
# first two space-separated words from the string.
RUBY_VER_WORDS=    $(subst ., ,$(COMPONENT_VERSION))
RUBY_VER=$(word 1,$(RUBY_VER_WORDS)).$(word 2,$(RUBY_VER_WORDS))
 
GEMHOME=/var/ruby/$(RUBY_VER)/gem_home
PROTORUBYDIR=$(PROTO_DIR)/usr/ruby/$(RUBY_VER)
PROTOGEMHOME=$(PROTO_DIR)$(GEMHOME)
RUBYGEMS_INSTALL_TARGET=$(PROTORUBYDIR)/bin/gem
 
PROTO_RBCONFIG_FILE=$(PROTORUBYDIR)/lib/ruby/$(RUBY_VER)/$(MACH)-solaris$(SOLARIS_VERSION)/rbconfig.rb
 
# these macros are used in the package manifest
PKG_MACROS+=    RUBY_VER=$(RUBY_VER)
 
# patches to rubygems are in a separate directory from the ruby patches
PATCH_DIR_1 = rubygems-patches
PATCHES_1 = $(shell find $(PATCH_DIR_1) -type f -name $(PATCH_PATTERN) \
    2>/dev/null | sort)
 
# Since configure.in is patched, we need to autoconf after the patch.
# Also, unpack the 2nd archive for rubygems.
# Rubygems has patches, but it does not use configure nor make.
COMPONENT_PREP_ACTION = (cd $(@D) ; autoconf); \
    $(RM) -r $(SOURCE_DIR_1); \
    $(UNPACK) $(UNPACK_ARGS) $(USERLAND_ARCHIVES)$(COMPONENT_ARCHIVE_1); \
    $(foreach patch,$(PATCHES_1), \
    $(GPATCH) -d $(SOURCE_DIR_1) $(GPATCH_FLAGS) < $(patch); )
 
# These modifications of ruby.1 must occur after ruby
# is installed, not before.  Although there are some other patches
# to ruby.1 that occur before, the ruby installation does some 
# formatting of ruby.1 that won't occur if the below changes
# are applied.
COMPONENT_POST_INSTALL_ACTION += \
    /bin/sed -f Solaris/ruby.1.sedscript \
    $(PROTORUBYDIR)/share/man/man1/ruby.1 > ruby.1.mod ; \
    $(MV) ruby.1.mod $(PROTORUBYDIR)/share/man/man1/ruby.1
 
# Fix generated rbconfig.rb.
# This should NOT occur until AFTER rubygems installs;
# otherwise the GEM_HOME setting added to rbconfig.rb will cause setup.rb
# to attempt (and fail) to install rubygems docs on the build system,
# rather than in the proto area.
# Also fix magic line of gem script.
POST_RUBYGEMS_INSTALL_ACTION += \
    /bin/sed -f Solaris/rbconfig.sedscript $(PROTO_RBCONFIG_FILE) \
    > rbconfig.rb.mod ; \
    $(MV) rbconfig.rb.mod $(PROTO_RBCONFIG_FILE) ; \
    /bin/sed -e '1s;^\#!/.*;\#!/usr/ruby/$(RUBY_VER)/bin/ruby;' $(PROTORUBYDIR)/bin/gem \
    > gem.mod ; \
    $(MV) gem.mod $(PROTORUBYDIR)/bin/gem
 
# dtrace only available for i386 at this time;
# on sparc, a compiler bug (CR #6659110) prevents use of dtrace
DTRACE_FLAG_i386 =    --enable-dtrace
DTRACE_FLAG =        $(DTRACE_FLAG_$(MACH))
 
# dtrace.d, created in source dir during patch for dtrace,
# is needed for building
DTRACE_PRE_BUILD_i386 =    $(CP) $(SOURCE_DIR)/dtrace.d $(BUILD_DIR_32) 
DTRACE_PRE_BUILD =    $(DTRACE_PRE_BUILD_$(MACH))
COMPONENT_PRE_BUILD_ACTION =    $(DTRACE_PRE_BUILD)
 
# default LD_OPTION $(LD_B_DIRECT) causes problems--
# during install of ruby, ruby is executed and will core dump
# after compiling with this option
LD_B_DIRECT=
 
# don't use LD_Z_IGNORE: causes ruby linker problems with 
# unreferenced symbol tgetent in libreadline, similar to CR #6919344
LD_Z_IGNORE=
 
# keep ASLR disabled:
# when building ruby, miniruby (used for boot-strapping ruby) may
# core dump on sparc with ASLR enabled
ASLR_MODE = $(ASLR_DISABLE)
 
# Several of the drb tests will leave stray ruby processes behind;
# move these tests aside so they won't be run by the test target.
# They aren't needed by the build or packages, so we keep them 
# renamed.
COMPONENT_PRE_TEST_ACTION += \
    if [ -e $(SOURCE_DIR)/test/drb/test_drbssl.rb ]; then \
        $(MV) $(SOURCE_DIR)/test/drb/test_drbssl.rb $(SOURCE_DIR)/test/drb/test_drbssl.rb-save; \
    fi
 
CONFIGURE_PREFIX =    $(USRDIR)/$(COMPONENT_NAME)/$(RUBY_VER)
CONFIGURE_OPTIONS += $(DTRACE_FLAG)
CONFIGURE_OPTIONS += --enable-shared
CONFIGURE_OPTIONS += --enable-install-doc
CONFIGURE_OPTIONS += --disable-option-checking
CONFIGURE_OPTIONS += --with-openssl
CONFIGURE_OPTIONS += --with-tk-dir=/usr
CONFIGURE_OPTIONS += --with-curses-dir=/usr
 
 
include $(WS_TOP)/make-rules/shared-targets.mk
 
COMPONENT_BUILD_ARGS=
 
# common targets
 
build:        $(BUILD_32)
 
install:    build $(INSTALL_32) $(RUBYGEMS_INSTALL_TARGET)
 
# one expected failure in TestHTTP::HTTPConnectionTest
# also possibly test_endblockwarn(TestBeginEndBlock), 
# test_step_ruby_core_35753(TestRange)
test:    $(TEST_32)
 
# install rubygems using ruby installed in proto area
$(RUBYGEMS_INSTALL_TARGET):    $(INSTALL_32)
    (cd $(COMPONENT_SRC_1); $(ENV) - \
    "DESTDIR=$(PROTO_DIR)" \
    LD_LIBRARY_PATH=$(PROTORUBYDIR)/lib \
    GEM_HOME=$(PROTOGEMHOME) \
    $(PROTORUBYDIR)/bin/ruby \
    -I$(PROTORUBYDIR)/lib/ruby/1.8 \
    -I$(PROTORUBYDIR)/lib/ruby/1.8/$(MACH)-solaris$(SOLARIS_VERSION) \
    setup.rb --vendor --destdir=$(PROTO_DIR) )
    $(POST_RUBYGEMS_INSTALL_ACTION)
 
BUILD_PKG_DEPENDENCIES =    $(BUILD_TOOLS)
 
include $(WS_TOP)/make-rules/depend.mk