ruby.mk 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. ################################################################################
  2. #
  3. # ruby
  4. #
  5. ################################################################################
  6. RUBY_VERSION_MAJOR = 2.4
  7. RUBY_VERSION = $(RUBY_VERSION_MAJOR).1
  8. RUBY_VERSION_EXT = 2.4.0
  9. RUBY_SITE = http://cache.ruby-lang.org/pub/ruby/$(RUBY_VERSION_MAJOR)
  10. RUBY_SOURCE = ruby-$(RUBY_VERSION).tar.xz
  11. RUBY_DEPENDENCIES = host-pkgconf host-ruby
  12. HOST_RUBY_DEPENDENCIES = host-pkgconf
  13. RUBY_MAKE_ENV = $(TARGET_MAKE_ENV)
  14. RUBY_CONF_OPTS = --disable-install-doc --disable-rpath --disable-rubygems
  15. HOST_RUBY_CONF_OPTS = \
  16. --disable-install-doc \
  17. --with-out-ext=curses,openssl,readline \
  18. --without-gmp
  19. RUBY_LICENSE = Ruby or BSD-2-Clause, BSD-3-Clause, others
  20. RUBY_LICENSE_FILES = LEGAL COPYING BSDL
  21. RUBY_CFLAGS = $(TARGET_CFLAGS)
  22. # With some SuperH toolchains (like Sourcery CodeBench 2012.09), ruby fails to
  23. # build with 'pcrel too far'. This seems to be caused by the -Os option we pass
  24. # by default. To fix the problem, use standard -O2 optimization instead.
  25. ifeq ($(BR2_sh),y)
  26. RUBY_CFLAGS += -O2
  27. endif
  28. RUBY_CONF_ENV = CFLAGS="$(RUBY_CFLAGS)"
  29. ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
  30. # On uClibc, finite, isinf and isnan are not directly implemented as
  31. # functions. Instead math.h #define's these to __finite, __isinf and
  32. # __isnan, confusing the Ruby configure script. Tell it that they
  33. # really are available.
  34. RUBY_CONF_ENV += \
  35. ac_cv_func_finite=yes \
  36. ac_cv_func_isinf=yes \
  37. ac_cv_func_isnan=yes
  38. endif
  39. ifeq ($(BR2_bfin),y)
  40. RUBY_CONF_ENV += ac_cv_func_dl_iterate_phdr=no
  41. # Blackfin doesn't have FFI closure support, needed by the fiddle
  42. # extension.
  43. RUBY_CONF_OPTS += --with-out-ext=fiddle
  44. endif
  45. ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
  46. RUBY_CONF_ENV += stack_protector=no
  47. endif
  48. # Force optionals to build before we do
  49. ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
  50. RUBY_DEPENDENCIES += berkeleydb
  51. endif
  52. ifeq ($(BR2_PACKAGE_GDBM),y)
  53. RUBY_DEPENDENCIES += gdbm
  54. endif
  55. ifeq ($(BR2_PACKAGE_LIBYAML),y)
  56. RUBY_DEPENDENCIES += libyaml
  57. endif
  58. ifeq ($(BR2_PACKAGE_NCURSES),y)
  59. RUBY_DEPENDENCIES += ncurses
  60. endif
  61. ifeq ($(BR2_PACKAGE_OPENSSL),y)
  62. RUBY_DEPENDENCIES += openssl
  63. endif
  64. ifeq ($(BR2_PACKAGE_READLINE),y)
  65. RUBY_DEPENDENCIES += readline
  66. endif
  67. ifeq ($(BR2_PACKAGE_ZLIB),y)
  68. RUBY_DEPENDENCIES += zlib
  69. endif
  70. ifeq ($(BR2_PACKAGE_GMP),y)
  71. RUBY_DEPENDENCIES += gmp
  72. RUBY_CONF_OPTS += --with-gmp
  73. else
  74. RUBY_CONF_OPTS += --without-gmp
  75. endif
  76. # workaround for amazing build failure, see
  77. # http://lists.busybox.net/pipermail/buildroot/2014-December/114273.html
  78. define RUBY_REMOVE_VERCONF_H
  79. rm -f $(@D)/verconf.h
  80. endef
  81. RUBY_POST_CONFIGURE_HOOKS += RUBY_REMOVE_VERCONF_H
  82. # Remove rubygems and friends, as they need extensions that aren't
  83. # built and a target compiler.
  84. RUBY_EXTENSIONS_REMOVE = rake* rdoc* rubygems*
  85. define RUBY_REMOVE_RUBYGEMS
  86. rm -f $(addprefix $(TARGET_DIR)/usr/bin/, gem rdoc ri rake)
  87. rm -rf $(TARGET_DIR)/usr/lib/ruby/gems
  88. rm -rf $(addprefix $(TARGET_DIR)/usr/lib/ruby/$(RUBY_VERSION_EXT)/, \
  89. $(RUBY_EXTENSIONS_REMOVE))
  90. endef
  91. RUBY_POST_INSTALL_TARGET_HOOKS += RUBY_REMOVE_RUBYGEMS
  92. $(eval $(autotools-package))
  93. $(eval $(host-autotools-package))