ruby.mk 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ################################################################################
  2. #
  3. # ruby
  4. #
  5. ################################################################################
  6. RUBY_VERSION_MAJOR = 2.2
  7. RUBY_VERSION = $(RUBY_VERSION_MAJOR).3
  8. RUBY_VERSION_EXT = 2.2.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-2c, BSD-3c, 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)$(BR2_sh64),y)
  26. RUBY_CFLAGS += -O2
  27. endif
  28. RUBY_CONF_ENV = CFLAGS="$(RUBY_CFLAGS)"
  29. ifeq ($(BR2_bfin),y)
  30. RUBY_CONF_ENV += ac_cv_func_dl_iterate_phdr=no
  31. # Blackfin doesn't have FFI closure support, needed by the fiddle
  32. # extension.
  33. RUBY_CONF_OPTS += --with-out-ext=fiddle
  34. endif
  35. ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
  36. RUBY_CONF_ENV += stack_protector=no
  37. endif
  38. # Force optionals to build before we do
  39. ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
  40. RUBY_DEPENDENCIES += berkeleydb
  41. endif
  42. ifeq ($(BR2_PACKAGE_GDBM),y)
  43. RUBY_DEPENDENCIES += gdbm
  44. endif
  45. ifeq ($(BR2_PACKAGE_LIBYAML),y)
  46. RUBY_DEPENDENCIES += libyaml
  47. endif
  48. ifeq ($(BR2_PACKAGE_NCURSES),y)
  49. RUBY_DEPENDENCIES += ncurses
  50. endif
  51. ifeq ($(BR2_PACKAGE_OPENSSL),y)
  52. RUBY_DEPENDENCIES += openssl
  53. endif
  54. ifeq ($(BR2_PACKAGE_READLINE),y)
  55. RUBY_DEPENDENCIES += readline
  56. endif
  57. ifeq ($(BR2_PACKAGE_ZLIB),y)
  58. RUBY_DEPENDENCIES += zlib
  59. endif
  60. ifeq ($(BR2_PACKAGE_GMP),y)
  61. RUBY_DEPENDENCIES += gmp
  62. RUBY_CONF_OPTS += --with-gmp
  63. else
  64. RUBY_CONF_OPTS += --without-gmp
  65. endif
  66. # workaround for amazing build failure, see
  67. # http://lists.busybox.net/pipermail/buildroot/2014-December/114273.html
  68. define RUBY_REMOVE_VERCONF_H
  69. rm -f $(@D)/verconf.h
  70. endef
  71. RUBY_POST_CONFIGURE_HOOKS += RUBY_REMOVE_VERCONF_H
  72. # Remove rubygems and friends, as they need extensions that aren't
  73. # built and a target compiler.
  74. RUBY_EXTENSIONS_REMOVE = rake* rdoc* rubygems*
  75. define RUBY_REMOVE_RUBYGEMS
  76. rm -f $(addprefix $(TARGET_DIR)/usr/bin/, gem rdoc ri rake)
  77. rm -rf $(TARGET_DIR)/usr/lib/ruby/gems
  78. rm -rf $(addprefix $(TARGET_DIR)/usr/lib/ruby/$(RUBY_VERSION_EXT)/, \
  79. $(RUBY_EXTENSIONS_REMOVE))
  80. endef
  81. RUBY_POST_INSTALL_TARGET_HOOKS += RUBY_REMOVE_RUBYGEMS
  82. $(eval $(autotools-package))
  83. $(eval $(host-autotools-package))