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