552da072383eab582fc1e939c0e7a3d371ffcd72
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / ruby / ruby.mk
1 ################################################################################
2 #
3 # ruby
4 #
5 ################################################################################
6
7 RUBY_VERSION_MAJOR = 2.2
8 RUBY_VERSION = $(RUBY_VERSION_MAJOR).2
9 RUBY_VERSION_EXT = 2.2.0
10 RUBY_SITE = http://cache.ruby-lang.org/pub/ruby/$(RUBY_VERSION_MAJOR)
11 RUBY_SOURCE = ruby-$(RUBY_VERSION).tar.xz
12 RUBY_DEPENDENCIES = host-pkgconf host-ruby
13 HOST_RUBY_DEPENDENCIES = host-pkgconf
14 RUBY_MAKE_ENV = $(TARGET_MAKE_ENV)
15 RUBY_MAKE = $(MAKE1)
16 RUBY_CONF_OPTS = --disable-install-doc --disable-rpath --disable-rubygems
17 HOST_RUBY_CONF_OPTS = \
18         --disable-install-doc \
19         --with-out-ext=curses,openssl,readline \
20         --without-gmp
21 RUBY_LICENSE = Ruby or BSD-2c, BSD-3c, others
22 RUBY_LICENSE_FILES = LEGAL COPYING BSDL
23
24 RUBY_CFLAGS = $(TARGET_CFLAGS)
25 # With some SuperH toolchains (like Sourcery CodeBench 2012.09), ruby fails to
26 # build with 'pcrel too far'. This seems to be caused by the -Os option we pass
27 # by default. To fix the problem, use standard -O2 optimization instead.
28 ifeq ($(BR2_sh)$(BR2_sh64),y)
29 RUBY_CFLAGS += -O2
30 endif
31 RUBY_CONF_ENV = CFLAGS="$(RUBY_CFLAGS)"
32
33 ifeq ($(BR2_bfin),y)
34 RUBY_CONF_ENV = ac_cv_func_dl_iterate_phdr=no
35 # Blackfin doesn't have FFI closure support, needed by the fiddle
36 # extension.
37 RUBY_CONF_OPTS += --with-out-ext=fiddle
38 endif
39
40 # Force optionals to build before we do
41 ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
42 RUBY_DEPENDENCIES += berkeleydb
43 endif
44 ifeq ($(BR2_PACKAGE_GDBM),y)
45 RUBY_DEPENDENCIES += gdbm
46 endif
47 ifeq ($(BR2_PACKAGE_LIBYAML),y)
48 RUBY_DEPENDENCIES += libyaml
49 endif
50 ifeq ($(BR2_PACKAGE_NCURSES),y)
51 RUBY_DEPENDENCIES += ncurses
52 endif
53 ifeq ($(BR2_PACKAGE_OPENSSL),y)
54 RUBY_DEPENDENCIES += openssl
55 endif
56 ifeq ($(BR2_PACKAGE_READLINE),y)
57 RUBY_DEPENDENCIES += readline
58 endif
59 ifeq ($(BR2_PACKAGE_ZLIB),y)
60 RUBY_DEPENDENCIES += zlib
61 endif
62 ifeq ($(BR2_PACKAGE_GMP),y)
63 RUBY_DEPENDENCIES += gmp
64 RUBY_CONF_OPTS += --with-gmp
65 else
66 RUBY_CONF_OPTS += --without-gmp
67 endif
68
69 # workaround for amazing build failure, see
70 # http://lists.busybox.net/pipermail/buildroot/2014-December/114273.html
71 define RUBY_REMOVE_VERCONF_H
72         rm -f $(@D)/verconf.h
73 endef
74 RUBY_POST_CONFIGURE_HOOKS += RUBY_REMOVE_VERCONF_H
75
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
87 $(eval $(autotools-package))
88 $(eval $(host-autotools-package))