1################################################################################
2#
3# ruby
4#
5################################################################################
6
7RUBY_VERSION_MAJOR = 3.3
8RUBY_VERSION = $(RUBY_VERSION_MAJOR).1
9RUBY_VERSION_EXT = 3.3.0
10RUBY_SITE = http://cache.ruby-lang.org/pub/ruby/$(RUBY_VERSION_MAJOR)
11RUBY_SOURCE = ruby-$(RUBY_VERSION).tar.xz
12
13RUBY_LICENSE = \
14	Ruby or BSD-2-Clause, \
15	BSD-3-Clause, \
16	MIT, \
17	others
18RUBY_LICENSE_FILES = LEGAL COPYING BSDL
19
20RUBY_CPE_ID_VENDOR = ruby-lang
21
22RUBY_DEPENDENCIES = host-pkgconf host-ruby
23HOST_RUBY_DEPENDENCIES = host-libyaml host-pkgconf host-openssl
24RUBY_MAKE_ENV = $(TARGET_MAKE_ENV)
25RUBY_CONF_OPTS = \
26	--disable-install-doc \
27	--disable-rpath \
28	--disable-rubygems \
29	--disable-yjit
30HOST_RUBY_CONF_OPTS = \
31	--disable-install-doc \
32	--disable-yjit \
33	--with-out-ext=curses,readline \
34	--without-gmp
35
36ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
37RUBY_CONF_ENV += LIBS=-latomic
38endif
39
40ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
41# On uClibc, finite, isinf and isnan are not directly implemented as
42# functions.  Instead math.h #define's these to __finite, __isinf and
43# __isnan, confusing the Ruby configure script. Tell it that they
44# really are available.
45RUBY_CONF_ENV += \
46	ac_cv_func_finite=yes \
47	ac_cv_func_isinf=yes \
48	ac_cv_func_isnan=yes
49endif
50
51ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
52RUBY_CONF_ENV += stack_protector=no
53endif
54
55# Force optionals to build before we do
56ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
57RUBY_DEPENDENCIES += berkeleydb
58endif
59ifeq ($(BR2_PACKAGE_LIBFFI),y)
60RUBY_DEPENDENCIES += libffi
61else
62# Disable fiddle to avoid a build failure with bundled-libffi on MIPS
63RUBY_CONF_OPTS += --with-out-ext=fiddle
64endif
65ifeq ($(BR2_PACKAGE_GDBM),y)
66RUBY_DEPENDENCIES += gdbm
67endif
68ifeq ($(BR2_PACKAGE_LIBYAML),y)
69RUBY_DEPENDENCIES += libyaml
70endif
71ifeq ($(BR2_PACKAGE_NCURSES),y)
72RUBY_DEPENDENCIES += ncurses
73endif
74ifeq ($(BR2_PACKAGE_OPENSSL),y)
75RUBY_DEPENDENCIES += openssl
76endif
77ifeq ($(BR2_PACKAGE_READLINE),y)
78RUBY_DEPENDENCIES += readline
79endif
80ifeq ($(BR2_PACKAGE_ZLIB),y)
81RUBY_DEPENDENCIES += zlib
82endif
83ifeq ($(BR2_PACKAGE_GMP),y)
84RUBY_DEPENDENCIES += gmp
85RUBY_CONF_OPTS += --with-gmp
86else
87RUBY_CONF_OPTS += --without-gmp
88endif
89
90RUBY_CFLAGS = $(TARGET_CFLAGS)
91
92ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_83143),y)
93RUBY_CFLAGS += -freorder-blocks-algorithm=simple
94endif
95
96RUBY_CONF_OPTS += CFLAGS="$(RUBY_CFLAGS)"
97
98# Remove rubygems and friends, as they need extensions that aren't
99# built and a target compiler.
100RUBY_EXTENSIONS_REMOVE = rake* rdoc* rubygems*
101define RUBY_REMOVE_RUBYGEMS
102	rm -f $(addprefix $(TARGET_DIR)/usr/bin/, gem rdoc ri rake)
103	rm -rf $(TARGET_DIR)/usr/lib/ruby/gems
104	rm -rf $(addprefix $(TARGET_DIR)/usr/lib/ruby/$(RUBY_VERSION_EXT)/, \
105		$(RUBY_EXTENSIONS_REMOVE))
106endef
107RUBY_POST_INSTALL_TARGET_HOOKS += RUBY_REMOVE_RUBYGEMS
108
109$(eval $(autotools-package))
110$(eval $(host-autotools-package))
111