Andreas Wacknitz
2023-10-06 9b19b2d8aa59d7fa0f6ab77aec313cb151679a5c
commit | author | age
e9212b 1 #
F 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) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
24 # Copyright 2023, Friedrich Kink
25 #
26
27 BUILD_BITS=        64
28 OPENSSL_VERSION=    3.1
29
30 include ../../../make-rules/shared-macros.mk
31
32 COMPONENT_NAME=        ruby
33 COMPONENT_VERSION=    3.2.2
34 COMPONENT_SUMMARY=    Ruby, RubyGems, and Rake
35 COMPONENT_PROJECT_URL=    https://www.ruby-lang.org/
36 COMPONENT_SRC=        $(COMPONENT_NAME)-$(COMPONENT_VERSION)
37 COMPONENT_ARCHIVE=    $(COMPONENT_SRC).tar.xz
38 COMPONENT_ARCHIVE_URL=    https://cache.ruby-lang.org/pub/ruby/3.2/$(COMPONENT_ARCHIVE)
39 COMPONENT_ARCHIVE_HASH= sha256:4b352d0f7ec384e332e3e44cdbfdcd5ff2d594af3c8296b5636c710975149e23
9b19b2 40 COMPONENT_FMRI=        runtime/ruby-32
e9212b 41 COMPONENT_CLASSIFICATION= Development/Ruby
F 42 COMPONENT_LICENSE=    Ruby License
43 COMPONENT_LICENSE_FILE=    COPYING
44
45 include $(WS_MAKE_RULES)/common.mk
46
9b19b2 47 PATH= $(PATH.gnu)
e9212b 48
F 49 # COMPONENT_VERSION <major>.<minor>.<teeny>
50 # is transformed into <major>.<minor> for RUBY_VER.
51 # First change the separator '.' to ' ', so we can use "word" to pull the
52 # first two space-separated words from the string.
53 RUBY_VER_WORDS=    $(subst ., ,$(COMPONENT_VERSION))
9b19b2 54 RUBY_VER= $(word 1,$(RUBY_VER_WORDS)).$(word 2,$(RUBY_VER_WORDS))
e9212b 55 # the library-compatible version
9b19b2 56 RUBY_LIB_VER= $(RUBY_VER)
e9212b 57
9b19b2 58 PROTORUBYDIR= $(PROTO_DIR)/usr/ruby/$(RUBY_VER)
AW 59 PROTO_RBCONFIG_FILE= $(PROTORUBYDIR)/lib/ruby/$(RUBY_LIB_VER)/x86_64-solaris$(SOLARIS_VERSION)/rbconfig.rb
e9212b 60
F 61 # these macros are used in the package manifest
9b19b2 62 PKG_MACROS += RUBY_VER=$(RUBY_VER) RUBY_LIB_VER=$(RUBY_LIB_VER)
e9212b 63
F 64 # Apply some of the edits here--including to the sed scripts themselves.
65 # These modifications of ruby.1 must occur after ruby
66 # is installed, not before.  Although there are some other patches
67 # to ruby.1 that occur before, the ruby installation does some
68 # formatting of ruby.1 that won't occur if the below changes
69 # are applied.
70 # Fix generated rbconfig.rb using /usr/bin/sed; gsed doesn't
71 # work for some of the commands in rbconfig.sedscript.
72 COMPONENT_POST_INSTALL_ACTION += \
73     $(GSED) -e "s/RUBY_VER/$(RUBY_VER)/" \
74         -e "s/RUBY_LIB_VER/$(RUBY_LIB_VER)/" Solaris/gem.1-generic \
75         > Solaris/gem.1 ; \
76     $(GSED) -e "s/RUBY_VER/$(RUBY_VER)/" \
77         -e "s/RUBY_LIB_VER/$(RUBY_LIB_VER)/" Solaris/ruby.1.sedscript \
78         > Solaris/ruby.1.sedscript.mod ; \
79     $(GSED) -e  "s/RUBY_VER/$(RUBY_VER)/" \
80         -e "s/RUBY_LIB_VER/$(RUBY_LIB_VER)/" \
81         -e "s,%%CC%%,$(CC)," \
82         -e "s,%%CXX%%,$(CXX)," \
83         Solaris/rbconfig.sedscript \
84         > Solaris/rbconfig.sedscript.mod ; \
85     $(GSED) -i -f Solaris/ruby.1.sedscript.mod \
86         $(PROTORUBYDIR)/share/man/man1/ruby.1 ; \
87     /usr/bin/sed -f Solaris/rbconfig.sedscript.mod \
88     $(PROTO_RBCONFIG_FILE) > rbconfig.rb.mod ; \
89     $(MV) rbconfig.rb.mod $(PROTO_RBCONFIG_FILE) ;
90
91 COMPONENT_POST_INSTALL_ACTION += \
92     encdir="$(PROTORUBYDIR)/lib/ruby/$(RUBY_LIB_VER)/x86_64-solaris$(SOLARIS_VERSION)/enc"; \
93     filelist=`ls -1I trans $$encdir`; \
94     subdirlist=`ls -1 $$encdir/trans`; \
95         for f in $$filelist; \
96     do \
97           /usr/bin/elfedit -e 'dyn:runpath "$(USRDIR)/$(COMPONENT_NAME)/$(RUBY_VER)/lib/$(MACH64)"' $$encdir/$$f; \
98     done; \
99         for f in $$subdirlist; \
100     do \
101           /usr/bin/elfedit -e 'dyn:runpath "$(USRDIR)/$(COMPONENT_NAME)/$(RUBY_VER)/lib/$(MACH64)"' $$encdir/trans/$$f; \
102     done;
103
104 # Set the locale to generate documentation correctly
105 COMPONENT_BUILD_ENV += LC_ALL=en_US.UTF-8
106 COMPONENT_INSTALL_ENV += LC_ALL=en_US.UTF-8
107
108 CONFIGURE_PREFIX =    $(USRDIR)/$(COMPONENT_NAME)/$(RUBY_VER)
109
110 CONFIGURE_OPTIONS +=    --with-rubylibprefix=$(CONFIGURE_LIBDIR.32)/ruby
111 CONFIGURE_OPTIONS +=    --enable-shared
112 CONFIGURE_OPTIONS +=    --enable-rpath
113 CONFIGURE_OPTIONS +=    --enable-dtrace
114 # does not build
115 #CONFIGURE_OPTIONS +=    --enable-yjit
116 CONFIGURE_OPTIONS +=    --enable-debug-env
117 CONFIGURE_OPTIONS +=    --with-thread=pthread
118 CONFIGURE_OPTIONS +=    --with-rdoc=ri,html
119 CONFIGURE_OPTIONS +=    --with-ruby-version=$(RUBY_VER)
120 # Don't need docs for ruby C source files
121 CONFIGURE_OPTIONS +=    --disable-install-capi
122 CONFIGURE_OPTIONS +=    --disable-option-checking
123 CONFIGURE_OPTIONS +=    --with-openssl-dir=$(OPENSSL_PREFIX)
124 CONFIGURE_OPTIONS +=    CFLAGS="$(CFLAGS)"
125
126 CLEAN_PATHS +=        Solaris/gem.1 Solaris/rbconfig.sedscript.mod \
127             Solaris/ruby.1.sedscript.mod
128
129 COMPONENT_TEST_TRANSFORMS += \
130     '-n' \
131     '-e "s/Finished tests in .*s, .* tests\/s, .* assertions/Finished tests in Xs, X tests\/s, X assertions/"' \
132     '-e "s/\(.*\) tests, .* assertions, \(.*\) failures, \(.*\) errors, .* skips/\1 tests, X assertions, \2 failures, \3 errors, X skips/"' \
133     '-e "/^make/d"' \
134     '-e "/fatal/Ip"' \
135     '-e "/test succeeded/p"' \
136     '-e "/Running tests/p"' \
137     '-e "/Finished tests in Xs, X tests\/s, X assertions/p"' \
138     '-e "/.* tests, X assertions, .* failures, .* errors, X skips/p"'
139
140 # Auto-generated dependencies
141 REQUIRED_PACKAGES += SUNWcs
142 REQUIRED_PACKAGES += library/gmp
143 REQUIRED_PACKAGES += library/libffi
144 REQUIRED_PACKAGES += library/libyaml
145 REQUIRED_PACKAGES += library/readline
146 REQUIRED_PACKAGES += library/security/openssl-31
147 REQUIRED_PACKAGES += library/zlib
148 REQUIRED_PACKAGES += system/library
149 REQUIRED_PACKAGES += system/library/math