ruby: add and rework patch from candlerb adding ruby libs as suboptions, addresses...
[packages.git] / lang / ruby / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=ruby
12 PKG_VERSION:=1.8.6
13 PKG_RELEASE:=3
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=ftp://ftp.ruby-lang.org/pub/ruby/1.8/
17 PKG_MD5SUM:=e558a0e00ae318d43bf6ff9af452bad2
18
19 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
20 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/ruby/Default
25   SECTION:=lang
26   CATEGORY:=Languages
27   TITLE:=Ruby object-oriented scripting language interpreter
28   DESCRIPTION:=\
29         Ruby is the interpreted scripting language for quick and \\\
30         easy object-oriented programming.  It has many features to \\\
31         process text files and to do system management tasks (as in \\\
32         perl).  It is simple, straight-forward, and extensible.
33   URL:=http://www.ruby-lang.org/
34 endef
35
36 define Package/ruby
37   $(call Package/ruby/Default)
38   DEPENDS:=+libruby
39   DESCRIPTION+=\\\
40                 \\\
41                 The ruby master.
42   MENU:=1
43 endef
44
45 define Package/libruby
46   SECTION:=libs
47   CATEGORY:=Libraries
48   TITLE:=Libraries necessary to run Ruby
49   URL:=http://www.ruby-lang.org/
50 endef
51
52 # NOTE: it would be a *lot* of work to attempt to break down Ruby's
53 # standard library bundle into coherent pieces, and work out the dependencies
54 # between them. This could be useful, e.g. if you don't want to do any XML or
55 # YAML handling, why carry all that code? However, squashfs does a good
56 # job of fitting it all into flash.
57 define Package/rubylibs
58   $(call Package/ruby/Default)
59   DEPENDS:=ruby
60   TITLE:=Ruby standard libraries
61   URL:=http://www.ruby-lang.org/
62 endef
63
64 # But this one is a quarter of a meg by itself
65 define Package/rubylib-nkf
66   $(call Package/ruby/Default)
67   DEPENDS:=ruby
68   TITLE:=Ruby Network Kanji Filter
69   URL:=http://www.ruby-lang.org/
70 endef
71
72 # erb appears to depend only on strscan.so. Separate it?
73 define Package/ruby-erb
74   $(call Package/ruby/Default)
75   DEPENDS:=ruby +libruby +rubylibs
76   TITLE:=Embedded Ruby interpreter
77   URL:=http://www.ruby-lang.org/
78 endef
79
80 define Package/ruby-irb
81   $(call Package/ruby/Default)
82   DEPENDS:=ruby +libruby +rubylibs
83   TITLE:=Interactive Ruby shell
84   URL:=http://www.ruby-lang.org/
85 endef
86
87 define Package/ruby-rdoc
88   $(call Package/ruby/Default)
89   DEPENDS:=ruby +libruby +rubylibs
90   TITLE:=Ruby documentation generator
91   URL:=http://www.ruby-lang.org/
92 endef
93
94 define Package/ruby-testrb
95   $(call Package/ruby/Default)
96   DEPENDS:=ruby +libruby +rubylibs
97   TITLE:=Ruby unit testing
98   URL:=http://www.ruby-lang.org/
99 endef
100
101 CONFIGURE_ARGS += \
102         --enable-shared \
103         --disable-ipv6 \
104         , \
105         ac_cv_func_setpgrp_void=yes
106
107 MAKE_FLAGS += \
108         DESTDIR="$(PKG_INSTALL_DIR)" \
109         SHELL="/bin/bash" \
110         all install
111
112 define Package/ruby/install
113         $(INSTALL_DIR) $(1)/usr/bin
114         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ruby $(1)/usr/bin/
115 endef
116
117 define Package/libruby/install
118         $(INSTALL_DIR) $(1)/usr/lib
119         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libruby.so* $(1)/usr/lib/
120 endef
121
122 define Package/rubylibs/install
123         $(INSTALL_DIR) $(1)/usr/lib
124         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby $(1)/usr/lib/
125         rm -f $(1)/usr/lib/ruby/1.8/erb.rb
126         rm -f $(1)/usr/lib/ruby/1.8/irb.rb
127         rm -rf $(1)/usr/lib/ruby/1.8/irb
128         rm -rf $(1)/usr/lib/ruby/1.8/rdoc
129         rm -rf $(1)/usr/lib/ruby/1.8/test
130         rm -rf $(1)/usr/lib/ruby/1.8/runit
131         rm -f $(1)/usr/lib/ruby/1.8/irb.rb
132         find $(1) -name '*.h' | xargs rm -f
133         find $(1) -name 'nkf.so' | xargs rm -f
134 endef
135
136 define Package/rubylib-nkf/install
137         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - usr/lib/ruby/1.8/*/nkf.so ) | \
138         ( cd $(1); $(TAR) -xf - )
139 endef
140
141 define Package/ruby-erb/install
142         $(INSTALL_DIR) $(1)/usr/bin
143         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/erb $(1)/usr/bin/
144         $(INSTALL_DIR) $(1)/usr/lib/ruby/1.8/
145         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/1.8/erb.rb $(1)/usr/lib/ruby/1.8/
146 endef
147
148 define Package/ruby-irb/install
149         $(INSTALL_DIR) $(1)/usr/bin
150         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/irb $(1)/usr/bin/
151         $(INSTALL_DIR) $(1)/usr/lib/ruby/1.8
152         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/1.8/irb.rb $(1)/usr/lib/ruby/1.8/
153         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/1.8/irb $(1)/usr/lib/ruby/1.8/
154 endef
155
156 define Package/ruby-rdoc/install
157         $(INSTALL_DIR) $(1)/usr/bin
158         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rdoc $(1)/usr/bin/
159         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ri $(1)/usr/bin/
160         $(INSTALL_DIR) $(1)/usr/lib/ruby/1.8
161         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/1.8/rdoc $(1)/usr/lib/ruby/1.8/
162 endef
163
164 define Package/ruby-testrb/install
165         $(INSTALL_DIR) $(1)/usr/bin
166         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/testrb $(1)/usr/bin/
167         $(INSTALL_DIR) $(1)/usr/lib/ruby/1.8
168         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/1.8/test $(1)/usr/lib/ruby/1.8/
169         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/1.8/runit $(1)/usr/lib/ruby/1.8/
170 endef
171
172 $(eval $(call BuildPackage,ruby))
173 $(eval $(call BuildPackage,libruby))
174 $(eval $(call BuildPackage,rubylibs))
175 $(eval $(call BuildPackage,rubylib-nkf))
176 $(eval $(call BuildPackage,ruby-erb))
177 $(eval $(call BuildPackage,ruby-irb))
178 $(eval $(call BuildPackage,ruby-rdoc))
179 $(eval $(call BuildPackage,ruby-testrb))
180
181 $(eval $(call RequireCommand,ruby, \
182         $(PKG_NAME) requires ruby installed on the host-system. \
183 ))