ruby.mk 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ################################################################################
  2. #
  3. # ruby
  4. #
  5. ################################################################################
  6. RUBY_VERSION_MAJOR = 2.2
  7. RUBY_VERSION = $(RUBY_VERSION_MAJOR).1
  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_MAKE = $(MAKE1)
  15. RUBY_CONF_OPTS = --disable-install-doc --disable-rpath --disable-rubygems
  16. HOST_RUBY_CONF_OPTS = --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. # Force optionals to build before we do
  36. ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
  37. RUBY_DEPENDENCIES += berkeleydb
  38. endif
  39. ifeq ($(BR2_PACKAGE_GDBM),y)
  40. RUBY_DEPENDENCIES += gdbm
  41. endif
  42. ifeq ($(BR2_PACKAGE_LIBYAML),y)
  43. RUBY_DEPENDENCIES += libyaml
  44. endif
  45. ifeq ($(BR2_PACKAGE_NCURSES),y)
  46. RUBY_DEPENDENCIES += ncurses
  47. endif
  48. ifeq ($(BR2_PACKAGE_OPENSSL),y)
  49. RUBY_DEPENDENCIES += openssl
  50. endif
  51. ifeq ($(BR2_PACKAGE_READLINE),y)
  52. RUBY_DEPENDENCIES += readline
  53. endif
  54. ifeq ($(BR2_PACKAGE_ZLIB),y)
  55. RUBY_DEPENDENCIES += zlib
  56. endif
  57. ifeq ($(BR2_PACKAGE_GMP),y)
  58. RUBY_DEPENDENCIES += gmp
  59. RUBY_CONF_OPTS += --with-gmp
  60. else
  61. RUBY_CONF_OPTS += --without-gmp
  62. endif
  63. # workaround for amazing build failure, see
  64. # http://lists.busybox.net/pipermail/buildroot/2014-December/114273.html
  65. define RUBY_REMOVE_VERCONF_H
  66. rm -f $(@D)/verconf.h
  67. endef
  68. RUBY_POST_CONFIGURE_HOOKS += RUBY_REMOVE_VERCONF_H
  69. # Remove rubygems and friends, as they need extensions that aren't
  70. # built and a target compiler.
  71. RUBY_EXTENSIONS_REMOVE = rake* rdoc* rubygems*
  72. define RUBY_REMOVE_RUBYGEMS
  73. rm -f $(addprefix $(TARGET_DIR)/usr/bin/, gem rdoc ri rake)
  74. rm -rf $(TARGET_DIR)/usr/lib/ruby/gems
  75. rm -rf $(addprefix $(TARGET_DIR)/usr/lib/ruby/$(RUBY_VERSION_EXT)/, \
  76. $(RUBY_EXTENSIONS_REMOVE))
  77. endef
  78. RUBY_POST_INSTALL_TARGET_HOOKS += RUBY_REMOVE_RUBYGEMS
  79. $(eval $(autotools-package))
  80. $(eval $(host-autotools-package))