components/ruby/Makefile
changeset 199 b87534be1a76
child 609 775168282b2f
child 2248 c2beb07524a9
equal deleted inserted replaced
198:172fc01ce997 199:b87534be1a76
       
     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, 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=	334
       
    31 COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)-p$(COMPONENT_PATCH_VERSION)
       
    32 COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.bz2
       
    33 COMPONENT_ARCHIVE_HASH=	sha1:4311ce257f2e54f247bfe07b48e799d293d041f2
       
    34 COMPONENT_ARCHIVE_URL=	http://ftp.ruby-lang.org/pub/ruby/1.8/$(COMPONENT_ARCHIVE)
       
    35 IPS_COMPONENT_VERSION=	$(COMPONENT_VERSION).$(COMPONENT_PATCH_VERSION)
       
    36 
       
    37 # rubygems 
       
    38 COMPONENT_SRC_1=	rubygems-1.3.5
       
    39 COMPONENT_ARCHIVE_1=	$(COMPONENT_SRC_1).tgz
       
    40 COMPONENT_ARCHIVE_HASH_1=	sha1:8545f25d00c757a310b879a2580e56d6012fc981
       
    41 COMPONENT_ARCHIVE_URL_1=	http://production.cf.rubygems.org/rubygems/$(COMPONENT_ARCHIVE_1)
       
    42 
       
    43 SOURCE_DIR_1=$(COMPONENT_DIR)/$(COMPONENT_SRC_1)
       
    44 CLEAN_PATHS += $(SOURCE_DIR_1)
       
    45 
       
    46 include $(WS_TOP)/make-rules/prep.mk
       
    47 include $(WS_TOP)/make-rules/ips.mk
       
    48 include $(WS_TOP)/make-rules/configure.mk
       
    49 
       
    50 # COMPONENT_VERSION <major>.<minor>.<teeny>
       
    51 # is transformed into <major>.<minor> for RUBY_VER.
       
    52 # First change the separator '.' to ' ', so we can use "word" to pull the 
       
    53 # first two space-separated words from the string.
       
    54 RUBY_VER_WORDS=	$(subst ., ,$(COMPONENT_VERSION))
       
    55 RUBY_VER=$(word 1,$(RUBY_VER_WORDS)).$(word 2,$(RUBY_VER_WORDS))
       
    56 
       
    57 GEMHOME=/var/ruby/$(RUBY_VER)/gem_home
       
    58 PROTORUBYDIR=$(PROTO_DIR)/usr/ruby/$(RUBY_VER)
       
    59 PROTOGEMHOME=$(PROTO_DIR)$(GEMHOME)
       
    60 RUBYGEMS_INSTALL_TARGET=$(PROTORUBYDIR)/bin/gem
       
    61 
       
    62 PROTO_RBCONFIG_FILE=$(PROTORUBYDIR)/lib/ruby/$(RUBY_VER)/$(MACH)-solaris$(SOLARIS_VERSION)/rbconfig.rb
       
    63 
       
    64 # these macros are used in the package manifest
       
    65 PKG_MACROS+=	RUBY_VER=$(RUBY_VER)
       
    66 
       
    67 # Since configure.in is patched, we need to autoconf after the patch.
       
    68 # Also, unpack the 2nd archive for rubygems.
       
    69 # Rubygems does not have patches, nor does it use configure nor make.
       
    70 COMPONENT_PREP_ACTION = (cd $(@D) ; autoconf); \
       
    71 	$(RM) -r $(SOURCE_DIR_1); \
       
    72 	$(UNPACK) $(UNPACK_ARGS) $(USERLAND_ARCHIVES)$(COMPONENT_ARCHIVE_1)
       
    73 
       
    74 # These modifications of ruby.1 must occur after ruby
       
    75 # is installed, not before.  Although there are some other patches
       
    76 # to ruby.1 that occur before, the ruby installation does some 
       
    77 # formatting of ruby.1 that won't occur if the below changes
       
    78 # are applied.
       
    79 COMPONENT_POST_INSTALL_ACTION += \
       
    80 	/bin/sed -f Solaris/ruby.1.sedscript \
       
    81 	$(PROTORUBYDIR)/share/man/man1/ruby.1 > ruby.1.mod ; \
       
    82 	$(MV) ruby.1.mod $(PROTORUBYDIR)/share/man/man1/ruby.1
       
    83 
       
    84 # Fix generated rbconfig.rb.
       
    85 # This should NOT occur until AFTER rubygems installs;
       
    86 # otherwise the GEM_HOME setting added to rbconfig.rb will cause setup.rb
       
    87 # to attempt (and fail) to install rubygems docs on the build system,
       
    88 # rather than in the proto area.
       
    89 # Also fix magic line of gem script.
       
    90 POST_RUBYGEMS_INSTALL_ACTION += \
       
    91 	/bin/sed -f Solaris/rbconfig.sedscript $(PROTO_RBCONFIG_FILE) \
       
    92 	> rbconfig.rb.mod ; \
       
    93 	$(MV) rbconfig.rb.mod $(PROTO_RBCONFIG_FILE) ; \
       
    94 	/bin/sed -e '1s;^\#!/.*;\#!/usr/bin/ruby;' $(PROTORUBYDIR)/bin/gem \
       
    95 	> gem.mod ; \
       
    96 	$(MV) gem.mod $(PROTORUBYDIR)/bin/gem
       
    97 
       
    98 # dtrace only available for i386 at this time;
       
    99 # on sparc, a compiler bug (CR #6659110) prevents use of dtrace
       
   100 DTRACE_FLAG_i386 =	--enable-dtrace
       
   101 DTRACE_FLAG =		$(DTRACE_FLAG_$(MACH))
       
   102 
       
   103 # dtrace.d, created in source dir during patch for dtrace,
       
   104 # is needed for building
       
   105 DTRACE_PRE_BUILD_i386 =	$(CP) $(SOURCE_DIR)/dtrace.d $(BUILD_DIR_32) 
       
   106 DTRACE_PRE_BUILD =	$(DTRACE_PRE_BUILD_$(MACH))
       
   107 COMPONENT_PRE_BUILD_ACTION =	$(DTRACE_PRE_BUILD)
       
   108 
       
   109 # default LD_OPTION $(LD_B_DIRECT) causes problems--
       
   110 # during install of ruby, ruby is executed and will core dump
       
   111 # after compiling with this option
       
   112 LD_B_DIRECT=
       
   113 
       
   114 # don't use LD_Z_IGNORE: causes ruby linker problems with 
       
   115 # unreferenced symbol tgetent in libreadline, similar to CR #6919344
       
   116 LD_Z_IGNORE=
       
   117 
       
   118 CONFIGURE_PREFIX =	$(USRDIR)/$(COMPONENT_NAME)/$(RUBY_VER)
       
   119 CONFIGURE_OPTIONS += $(DTRACE_FLAG)
       
   120 CONFIGURE_OPTIONS += --enable-shared
       
   121 CONFIGURE_OPTIONS += --enable-install-doc
       
   122 CONFIGURE_OPTIONS += --disable-option-checking
       
   123 CONFIGURE_OPTIONS += --with-openssl
       
   124 CONFIGURE_OPTIONS += --with-tk-dir=/usr
       
   125 CONFIGURE_OPTIONS += --with-curses-dir=/usr
       
   126 CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
       
   127 
       
   128 include $(WS_TOP)/make-rules/shared-targets.mk
       
   129 
       
   130 # common targets
       
   131 
       
   132 build:		$(BUILD_32)
       
   133 
       
   134 install:	build $(INSTALL_32) $(RUBYGEMS_INSTALL_TARGET)
       
   135 
       
   136 # one expected failure in TestHTTP::HTTPConnectionTest
       
   137 test:	$(TEST_32)
       
   138 
       
   139 # install rubygems using ruby installed in proto area
       
   140 $(RUBYGEMS_INSTALL_TARGET):	$(INSTALL_32)
       
   141 	(cd $(COMPONENT_SRC_1); $(ENV) - \
       
   142 	"DESTDIR=$(PROTO_DIR)" \
       
   143 	LD_LIBRARY_PATH=$(PROTORUBYDIR)/lib \
       
   144 	GEM_HOME=$(PROTOGEMHOME) \
       
   145 	$(PROTORUBYDIR)/bin/ruby \
       
   146 	-I$(PROTORUBYDIR)/lib/ruby/1.8 \
       
   147 	-I$(PROTORUBYDIR)/lib/ruby/1.8/$(MACH)-solaris$(SOLARIS_VERSION) \
       
   148 	setup.rb --vendor --destdir=$(PROTO_DIR) )
       
   149 	$(POST_RUBYGEMS_INSTALL_ACTION)
       
   150 
       
   151 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
       
   152 
       
   153 include $(WS_TOP)/make-rules/depend.mk