components/ruby/ruby-23/Makefile
changeset 7469 422c29c822ab
parent 6615 c59de4872b2d
child 7687 1093e2a9adbd
equal deleted inserted replaced
7468:1dec92bd1dbd 7469:422c29c822ab
       
     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) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
       
    24 #
       
    25 BUILD_BITS= 64
       
    26 COMPILER= gcc
       
    27 include ../../../make-rules/shared-macros.mk
       
    28 
       
    29 COMPONENT_NAME=		ruby
       
    30 COMPONENT_VERSION=	2.3.1
       
    31 COMPONENT_PROJECT_URL=	http://www.ruby-lang.org/
       
    32 COMPONENT_ARCHIVE_HASH=	\
       
    33     sha256:b87c738cb2032bf4920fef8e3864dc5cf8eae9d89d8d523ce0236945c5797dcd
       
    34 COMPONENT_ARCHIVE_URL=	\
       
    35 	http://cache.ruby-lang.org/pub/ruby/2.3/$(COMPONENT_ARCHIVE)
       
    36 
       
    37 TPNO=			31235
       
    38 
       
    39 include $(WS_MAKE_RULES)/common.mk
       
    40 
       
    41 # COMPONENT_VERSION <major>.<minor>.<teeny>
       
    42 # is transformed into <major>.<minor> for RUBY_VER.
       
    43 # First change the separator '.' to ' ', so we can use "word" to pull the 
       
    44 # first two space-separated words from the string.
       
    45 RUBY_VER_WORDS=	$(subst ., ,$(COMPONENT_VERSION))
       
    46 RUBY_VER=$(word 1,$(RUBY_VER_WORDS)).$(word 2,$(RUBY_VER_WORDS))
       
    47 # RUBY_VER_NO_DOT is just <major><minor>, like RUBY_VER but no
       
    48 # '.' separating <major> and <minor>.  Used when editing manpages (see below).
       
    49 RUBY_VER_NO_DOT=$(subst .,,$(RUBY_VER))
       
    50 # the library-compatible version
       
    51 RUBY_LIB_VER=2.3.0
       
    52 
       
    53 PROTORUBYDIR=$(PROTOUSRDIR)/ruby/$(RUBY_VER)
       
    54 PROTO_RBCONFIG_FILE=$(PROTORUBYDIR)/lib/ruby/$(RUBY_LIB_VER)/$(MACH64)-solaris$(SOLARIS_VERSION)/rbconfig.rb
       
    55 
       
    56 # these macros are used in the package manifest
       
    57 PKG_MACROS+=	RUBY_VER=$(RUBY_VER) RUBY_LIB_VER=$(RUBY_LIB_VER) RUBY_VER_NO_DOT=$(RUBY_VER_NO_DOT)
       
    58 
       
    59 # Prevent re-compile of ripper.so during install, which would result in
       
    60 # an erroneous full build directory in its RUNPATH.  The below change to 
       
    61 # ext/ripper/Makefile is identical to what occurs during install
       
    62 # and prevents its regeneration. 
       
    63 COMPONENT_PRE_INSTALL_ACTION += \
       
    64 	$(GSED) -i -e "s/^static: check/static: all/" $(BUILD_DIR_64)/ext/ripper/Makefile ; \
       
    65 	$(TOUCH) -r $(BUILD_DIR_64)/ext/ripper/ripper.o $(BUILD_DIR_64)/ext/ripper/Makefile
       
    66 
       
    67 # Apply some of the edits here--including to the sed scripts themselves.
       
    68 # These modifications of ruby.1 must occur after ruby
       
    69 # is installed, not before.  Although there are some other patches
       
    70 # to ruby.1 that occur before, the ruby installation does some 
       
    71 # formatting of ruby.1 that won't occur if the below changes
       
    72 # are applied.
       
    73 # Fix generated rbconfig.rb using /usr/bin/sed; gsed doesn't 
       
    74 # work for some of the commands in rbconfig.sedscript.
       
    75 COMPONENT_POST_INSTALL_ACTION += \
       
    76 	$(GSED) -e "s/RUBY_VER_NO_DOT/$(RUBY_VER_NO_DOT)/g" \
       
    77 	    -e "s/RUBY_VER/$(RUBY_VER)/g" \
       
    78 	    -e "s/RUBY_LIB_VER/$(RUBY_LIB_VER)/g" Solaris/gem.1-generic \
       
    79 	    > Solaris/gem.1 ; \
       
    80 	$(GSED) -e "s/RUBY_VER_NO_DOT/$(RUBY_VER_NO_DOT)/g" \
       
    81 	    -e "s/RUBY_VER/$(RUBY_VER)/g" \
       
    82 	    -e "s/RUBY_LIB_VER/$(RUBY_LIB_VER)/g" Solaris/ruby.1.sedscript \
       
    83 	    > Solaris/ruby.1.sedscript.mod ; \
       
    84 	$(GSED) -e  "s/RUBY_VER/$(RUBY_VER)/g" \
       
    85 	    -e "s/RUBY_LIB_VER/$(RUBY_LIB_VER)/g" Solaris/rbconfig.sedscript \
       
    86 	    > Solaris/rbconfig.sedscript.mod ; \
       
    87 	$(GSED) -i -f Solaris/ruby.1.sedscript.mod \
       
    88 	    $(PROTORUBYDIR)/share/man/man1/ruby.1 ; \
       
    89 	/usr/bin/sed -f Solaris/rbconfig.sedscript.mod \
       
    90 	$(PROTO_RBCONFIG_FILE) > rbconfig.rb.mod ; \
       
    91 	$(MV) rbconfig.rb.mod $(PROTO_RBCONFIG_FILE)
       
    92 
       
    93 # default LD_OPTION $(LD_B_DIRECT) causes problems--
       
    94 # during install of ruby, ruby is executed and will core dump
       
    95 # after compiling with this option
       
    96 LD_B_DIRECT=
       
    97 
       
    98 # don't use LD_Z_IGNORE: causes ruby linker problems with 
       
    99 # unreferenced symbol tgetent in libreadline, similar to bug #15617172
       
   100 LD_Z_IGNORE=
       
   101 
       
   102 # sparc build sometimes fails with studio 12.3 because of 17537968;
       
   103 # -xO3 worked around the problem. Also, iropt optimizer has a 
       
   104 # an assertion failure when compiling ext/socket/raddrinfo.c,
       
   105 # (CR 20704428); dropping down to -xO2 works around the bug.
       
   106 studio_OPT.sparc.64 = -xO2
       
   107 
       
   108 # without this define, config fails frequently on i386 when including 
       
   109 # /usr/include/sys/isa_defs.h with error: "ISA not supported";
       
   110 # many extensions don't get built and at least one error causes 
       
   111 # the build to fail
       
   112 studio_XBITS.i386.64 += -D__amd64
       
   113 
       
   114 CONFIGURE_PREFIX =	$(USRDIR)/$(COMPONENT_NAME)/$(RUBY_VER)
       
   115 
       
   116 # we are building 64-bit, but most of the ruby libraries (*.rb files)
       
   117 # are non-bit-specfic text files, so don't put them under lib/$(MACH64).
       
   118 # The 64-bit *.so libraries will be in the $(MACH64)-solaris$(SOLARIS_VERSION)
       
   119 # arch directories under lib
       
   120 
       
   121 CONFIGURE_OPTIONS +=	--with-rubylibprefix=$(CONFIGURE_LIBDIR.32)/ruby
       
   122 CONFIGURE_OPTIONS +=	--enable-shared
       
   123 CONFIGURE_OPTIONS +=	--enable-rpath
       
   124 # Don't need docs for ruby C source files
       
   125 CONFIGURE_OPTIONS +=	--disable-install-capi
       
   126 CONFIGURE_OPTIONS +=	--disable-option-checking
       
   127 CONFIGURE_OPTIONS +=	--with-openssl
       
   128 # If Ruby is configured with __builtin_setjmp, may cause
       
   129 # problems with gems compiled with gcc.  Studio compiler doesn't 
       
   130 # report an error for __builtin_setjmp, but gcc would.
       
   131 CONFIGURE_OPTIONS +=	--with-setjmp-type=_setjmp
       
   132 CONFIGURE_OPTIONS +=	DTRACE="$(USRSBINDIR)/dtrace"
       
   133 # ensure we use the 64-bit configuration file, not the 32-bit one
       
   134 CONFIGURE_OPTIONS +=	--with-tclConfig-file=$(USRLIBDIR)/64/tclConfig.sh
       
   135 	# set mantype to "man" so tool/mdoc2man.rb is used to convert
       
   136 	# the manpages from doc to man format; otherwise mantype is "doc" and
       
   137 	# headers we add to the manpages will not work properly
       
   138 CONFIGURE_OPTIONS +=	--with-mantype=man
       
   139 
       
   140 # fiddle.so (ext/fiddle) links to libffi, which does not define
       
   141 # ffi_raw_size(), although its prototype is in libffi's 
       
   142 # /usr/lib/libffi-3.0/include/ffi.h header file.  
       
   143 # Defining FFI_NO_RAW_API avoids use of ffi_raw_size().
       
   144 # This is a workaround to bug
       
   145 # 17349280 - libffi is missing ffi_raw_size()
       
   146 CFLAGS +=		-DFFI_NO_RAW_API
       
   147 
       
   148 # keep ASLR disabled; 
       
   149 # miniruby may core dump on sparc during build
       
   150 ASLR_MODE =		$(ASLR_DISABLE)
       
   151 
       
   152 CLEAN_PATHS +=		Solaris/gem.1 Solaris/rbconfig.sedscript.mod \
       
   153 			Solaris/ruby.1.sedscript.mod
       
   154 
       
   155 # Some tests produce warnings if HTTP_PROXY is set
       
   156 COMPONENT_TEST_ENV += "--unset=HTTP_PROXY"
       
   157 
       
   158 # This set of tests goes through thousands of entries in the passwd
       
   159 # and group table, taking hours to run; move it aside so we skip it.
       
   160 # There may also be spurious errors if group memberships are modified
       
   161 # during testing.
       
   162 COMPONENT_PRE_TEST_ACTION += \
       
   163 	( if test -e $(SOURCE_DIR)/test/etc/test_etc.rb ; then \
       
   164 	    $(MV) $(SOURCE_DIR)/test/etc/test_etc.rb \
       
   165 	    $(SOURCE_DIR)/test/etc/test_etc.rb-save ; fi )
       
   166 
       
   167 COMPONENT_TEST_TRANSFORMS += \
       
   168 	'-e "/^linking shared-object ripper.so$$/d" ' \
       
   169 	'-e "s|^20[0-9][0-9]-[01][1-9]-[0-3][0-9].*|XXX_DATE_TIME_XXX|" ' \
       
   170 	'-e "s|\(^[[:space:]]*CC = \).*|\1|" ' \
       
   171 	'-e "s|\(^[[:space:]]*LD = \).*|\1|" ' \
       
   172 	'-e "s|\(^[[:space:]]*LDSHARED = \).*|\1|" ' \
       
   173 	'-e "s|\(^[[:space:]]*CFLAGS = \).*|\1|" ' \
       
   174 	'-e "s|\(^[[:space:]]*XCFLAGS = \).*|\1|" ' \
       
   175 	'-e "s|\(^[[:space:]]*CPPFLAGS = \).*|\1|" ' \
       
   176 	'-e "s|\(^[[:space:]]*DLDFLAGS = \).*|\1|" ' \
       
   177 	'-e "s|\(^[[:space:]]*SOLIBS = \).*|\1|" ' \
       
   178 	'-e "s|\(^COLLECT_GCC=\).*|\1|" ' \
       
   179 	'-e "s|\(^COLLECT_LTO_WRAPPER=\).*|\1|" ' \
       
   180 	'-e "s|\(^Target: \).*|\1|" ' \
       
   181 	'-e "s|\(^Configured with: \).*|\1|" ' \
       
   182 	'-e "s|\(^gcc version \).*|\1|" ' \
       
   183 	'-e "s|\(^pid \)[1-9][0-9]*|\1NUM|" ' \
       
   184 	'-e "s|^\.[\.FES]\+|XXX_DOTS_XXX|" ' \
       
   185 	'-e "s|\(Insecure world writable dir \).*\( in PATH, mode \)[0-7].*|\1XXX_DIR_XXX\2XXX_MODE_XXX|g" ' \
       
   186 	'-e "s|\(^Driver is \).*|\1XXX_RUBY_VERSION_XXX|" ' \
       
   187 	'-e "s|\(^Target is \).*|\1XXX_RUBY_VERSION_XXX|" ' \
       
   188 	'-e "s|\(^Finished tests in \).*|\1|" ' \
       
   189         '-e "s|^[[:space:]]*[0-9]\+) \([FSE][a-z]\+:$$\)|NUM) \1|" ' \
       
   190 	'-e "s|URI::HTTP:[0-9a-fx]\+ |URI::HTTP:0xXXX |" ' \
       
   191 	'-e "s|\(.*\#test_no_memory_leak \).*:$$|\1XXX_RUBY_FILE_XXX:|" ' \
       
   192 	'-e "s|/tmp/.*:[0-9]\+: |XXX_TMPFILE_XXX: |" ' \
       
   193 	'-e "s|[0-9]\+\( tests, \)[0-9]\+\( assertions, \)[0-9]\+\( failures, \)[0-9]\+\( errors, \)[0-9]\+\( skips\)|XXX_NUM_XXX\1XXX_NUM_XXX\2XXX_NUM_XXX\3XXX_NUM_XXX\4XXX_NUM_XXX\5|" ' \
       
   194 	'-e "s|\(^ruby -v: \).*|\1XXX_RUBY_VERSION_XXX|" ' \
       
   195 	'-e "s|\(\[yes-test-all\] Error \)[0-9]\+$$|\1NUM|"'
       
   196 
       
   197 # master test results are not entirely clean, so not
       
   198 # appropriate to run at top level
       
   199 $(SKIP_TEST_AT_TOP_LEVEL)
       
   200 
       
   201 REQUIRED_PACKAGES += library/database/gdbm
       
   202 REQUIRED_PACKAGES += library/libffi
       
   203 REQUIRED_PACKAGES += library/ncurses
       
   204 REQUIRED_PACKAGES += library/readline
       
   205 REQUIRED_PACKAGES += library/security/openssl
       
   206 REQUIRED_PACKAGES += library/security/openssl/openssl-fips-140
       
   207 REQUIRED_PACKAGES += library/zlib
       
   208 REQUIRED_PACKAGES += runtime/tcl-8
       
   209 REQUIRED_PACKAGES += runtime/tk-8
       
   210 REQUIRED_PACKAGES += shell/bash
       
   211 REQUIRED_PACKAGES += system/core-os
       
   212 REQUIRED_PACKAGES += system/library/gcc/gcc-c-runtime
       
   213 REQUIRED_PACKAGES += system/library/math
       
   214 REQUIRED_PACKAGES += system/linker
       
   215 REQUIRED_PACKAGES += x11/library/libx11