ruby.mk 2.8 KB

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