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