92214406513f9335f9fe58df5a63e107c4c4655c
[packages.git] / lang / ruby / Makefile
1 #
2 # Copyright (C) 2006-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 #
9 # To Do:
10 #  - split up encodings
11 #  - allow selection of either native or pure version of a library where supported
12 #  +-> some native libraries are probably only supported if ruby-dl is enabled
13 # anything else?
14
15 include $(TOPDIR)/rules.mk
16
17 PKG_NAME:=ruby
18 PKG_VERSION:=1.9.1-p376
19 PKG_RELEASE:=3
20
21 PKG_LIBVER:=1.9
22
23 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
24 PKG_SOURCE_URL:=ftp://ftp.ruby-lang.org/pub/ruby/$(PKG_LIBVER)/
25 PKG_MD5SUM:=e019ae9c643c5efe91be49e29781fb94
26
27 PKG_BUILD_DEPENDS:=ruby/host
28 PKG_INSTALL:=1
29 PKG_BUILD_PARALLEL:=1
30
31 include $(INCLUDE_DIR)/host-build.mk
32 include $(INCLUDE_DIR)/package.mk
33
34 define Package/ruby/Default
35   SUBMENU:=Ruby
36   SECTION:=lang
37   CATEGORY:=Languages
38   TITLE:=Ruby scripting language
39   URL:=http://www.ruby-lang.org/
40 endef
41
42 define Package/ruby/Default/description
43  Ruby is the interpreted scripting language for quick and  easy 
44  object-oriented programming.  It has many features to process text files 
45  and to do system management tasks (as in perl).  It is simple, 
46  straight-forward, and extensible.
47 endef
48
49 define Package/ruby
50 $(call Package/ruby/Default)
51   TITLE+= (interpreter)
52   DEPENDS:=+libruby
53 endef
54
55 define Package/ruby/description
56 $(call Package/ruby/Default/description)
57 endef
58
59 define Package/libruby
60 $(call Package/ruby/Default)
61   SUBMENU:=
62   SECTION:=libs
63   CATEGORY:=Libraries
64   TITLE+= (shared library)
65   DEPENDS+= +libpthread
66 endef
67
68 # Ongoing work to break up ruby's standard library into coherent pieces
69 # with minimal dependencies between them
70
71 define Package/ruby-core
72 $(call Package/ruby/Default)
73   TITLE:=Ruby standard libraries
74   DEPENDS:=ruby
75 endef
76
77 define Package/ruby-cgi
78 $(call Package/ruby/Default)
79   TITLE:=Ruby CGI support toolkit
80   DEPENDS:=ruby
81 endef
82
83 define Package/ruby-dl
84 $(call Package/ruby/Default)
85   TITLE+= (dynamic linker support) (adds 5MB+)
86   DEPENDS:=ruby
87 endef
88
89 define Package/ruby-enc
90 $(call Package/ruby/Default)
91   TITLE+= (character re-coding library) (adds 2MB+)
92   DEPENDS:=ruby
93 endef
94
95 define Package/ruby-erb
96 $(call Package/ruby/Default)
97   TITLE+= (embedded interpreter)
98   DEPENDS:=ruby
99 endef
100
101 define Package/ruby-gdbm
102 $(call Package/ruby/Default)
103   TITLE:=Ruby support for gdbm
104   DEPENDS:=ruby +libgdbm
105 endef
106
107 define Package/ruby-gems
108 $(call Package/ruby/Default)
109   TITLE:=Ruby gems packet management
110   DEPENDS:=ruby +ruby-yaml +ruby-zlib +ruby-openssl +ruby-webrick +ruby-erb
111 endef
112
113 define Package/ruby-irb
114 $(call Package/ruby/Default)
115   TITLE+= (interactive shell)
116   DEPENDS:=ruby +ruby-core
117 endef
118
119 define Package/ruby-json
120 $(call Package/ruby/Default)
121   TITLE:=Ruby support for JSON
122   DEPENDS:=ruby
123 endef
124
125 define Package/ruby-ncurses
126 $(call Package/ruby/Default)
127   TITLE:=Ruby support for ncurses
128   DEPENDS:=ruby +libncurses
129 endef
130
131 define Package/ruby-nkf
132 $(call Package/ruby/Default)
133   TITLE:=Ruby Network Kanji Filter
134   DEPENDS:=ruby
135 endef
136
137 define Package/ruby-openssl
138 $(call Package/ruby/Default)
139   TITLE:=Ruby support for openssl
140   DEPENDS:=ruby +libopenssl
141 endef
142
143 define Package/ruby-rdoc
144 $(call Package/ruby/Default)
145   TITLE+= (documentation generator)
146   DEPENDS:=ruby
147 endef
148
149 define Package/ruby-rake
150 $(call Package/ruby/Default)
151   TITLE+=Ruby Rake (make replacement)
152   DEPENDS:=ruby
153 endef
154
155 define Package/ruby-readline
156 $(call Package/ruby/Default)
157   TITLE:=Ruby support for readline
158   DEPENDS:=ruby +libncurses +libreadline
159 endef
160
161 define Package/ruby-rexml
162 $(call Package/ruby/Default)
163   TITLE:=Ruby XML toolkit
164   DEPENDS:=ruby
165 endef
166
167 define Package/ruby-rss
168 $(call Package/ruby/Default)
169   TITLE:=Ruby RSS toolkit
170   DEPENDS:=ruby
171 endef
172
173 define Package/ruby-unit
174 $(call Package/ruby/Default)
175   TITLE:=Ruby unit testing toolkit
176   DEPENDS:=ruby
177 endef
178
179 define Package/ruby-webrick
180 $(call Package/ruby/Default)
181   TITLE:=Ruby Web server toolkit
182   DEPENDS:=ruby
183 endef
184
185 define Package/ruby-xmlrpc
186 $(call Package/ruby/Default)
187   TITLE:=Ruby XML-RPC toolkit
188   DEPENDS:=ruby
189 endef
190
191 define Package/ruby-yaml
192 $(call Package/ruby/Default)
193   TITLE:=Ruby YAML toolkit
194   DEPENDS:=ruby
195 endef
196
197 define Package/ruby-zlib
198 $(call Package/ruby/Default)
199   TITLE:=Ruby support for zlib
200   DEPENDS:=ruby +zlib
201 endef
202
203
204 CONFIGURE_ARGS += \
205         --enable-shared \
206         --enable-static \
207         --disable-rpath \
208         --enable-ipv6 \
209         --enable-wide-getaddrinfo \
210         --with-ruby-version=minor \
211
212 TARGET_LDFLAGS += -L$(PKG_BUILD_DIR)
213
214 MAKE_FLAGS += \
215         DESTDIR="$(PKG_INSTALL_DIR)" \
216         SHELL="/bin/bash"
217
218 define Build/Prepare
219 $(call Build/Prepare/Default)
220         ( cd $(PKG_BUILD_DIR) ; \
221                 autoconf ; \
222         )
223 endef
224
225 define Package/ruby/install
226         $(INSTALL_DIR) $(1)/usr/bin
227         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ruby $(1)/usr/bin/
228 endef
229
230 define Package/libruby/install
231         $(INSTALL_DIR) $(1)/usr/lib
232         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libruby.so.* $(1)/usr/lib/
233 endef
234
235 define Package/ruby-core/install
236         $(INSTALL_DIR) $(1)/usr/lib
237         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby $(1)/usr/lib/
238         rm -rf  \
239                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/curses.so \
240                 \
241                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/gdbm.so \
242                 \
243                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/kconv.rb \
244                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/nkf.so \
245                 \
246                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/digest \
247                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/digest.rb \
248                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/digest \
249                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/digest.so \
250                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/openssl \
251                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/openssl.rb \
252                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/openssl.so \
253                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/drb/ssl.rb \
254                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/net/https.rb \
255                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/webrick/ssl.rb \
256                 \
257                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/dl.so \
258                 \
259                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/enc \
260                 \
261                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/readline.so \
262                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/irb/completion.rb \
263                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/irb/ext/save-history.rb \
264                 \
265                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/zlib.so \
266                 \
267                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/erb.rb \
268                 \
269                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/json.rb \
270                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/json \
271                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/json \
272                 \
273                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/irb.rb \
274                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/irb \
275                 \
276                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/rdoc \
277                 \
278                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/rake.rb \
279                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/rake \
280                 \
281                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/rubygems.rb \
282                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/rubygems \
283                 \
284                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/cgi.rb \
285                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/cgi \
286                 \
287                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/rexml \
288                 \
289                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/rss \
290                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/rss.rb \
291                 \
292                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/test \
293                 \
294                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/webrick \
295                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/webrick.rb \
296                 \
297                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/xmlrpc \
298                 \
299                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/yaml \
300                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/yaml.rb \
301                 $(1)/usr/lib/ruby/$(PKG_LIBVER)/*/syck.so \
302         
303         find $(1) -name '*.h' | xargs rm -f
304 endef
305
306 define Package/ruby-cgi/install
307         $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
308         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/cgi $(1)/usr/lib/ruby/$(PKG_LIBVER)/
309         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/cgi.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
310 endef
311
312 define Package/ruby-dl/install
313         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
314                 usr/lib/ruby/$(PKG_LIBVER)/*/dl.so \
315         ) | ( cd $(1); $(TAR) -xf - )
316 endef
317
318 define Package/ruby-enc/install
319         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
320                 usr/lib/ruby/$(PKG_LIBVER)/*/enc \
321         ) | ( cd $(1); $(TAR) -xf - )
322 endef
323
324 define Package/ruby-erb/install
325         $(INSTALL_DIR) $(1)/usr/bin
326         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/erb $(1)/usr/bin/
327         $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)/
328         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/erb.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
329 endef
330
331 define Package/ruby-gdbm/install
332         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
333                 usr/lib/ruby/$(PKG_LIBVER)/*/gdbm.so \
334         ) | ( cd $(1); $(TAR) -xf - )
335 endef
336
337 define Package/ruby-gems/install
338         $(INSTALL_DIR) $(1)/usr/bin
339         $(CP) $(PKG_INSTALL_DIR)/usr/bin/gem $(1)/usr/bin/
340         $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
341         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rubygems.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
342         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rubygems $(1)/usr/lib/ruby/$(PKG_LIBVER)/
343 endef
344
345 define Package/ruby-irb/install
346         $(INSTALL_DIR) $(1)/usr/bin
347         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/irb $(1)/usr/bin/
348         $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
349         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/irb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
350         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/irb.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
351 endef
352
353 define Package/ruby-json/install
354         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
355                 usr/lib/ruby/$(PKG_LIBVER)/json.rb \
356                 usr/lib/ruby/$(PKG_LIBVER)/json \
357                 usr/lib/ruby/$(PKG_LIBVER)/*/json \
358         ) | ( cd $(1); $(TAR) -xf - )
359 endef
360
361 define Package/ruby-ncurses/install
362         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
363                 usr/lib/ruby/$(PKG_LIBVER)/*/curses.so \
364         ) | ( cd $(1); $(TAR) -xf - )
365 endef
366
367 define Package/ruby-nkf/install
368         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
369                 usr/lib/ruby/$(PKG_LIBVER)/kconv.rb \
370                 usr/lib/ruby/$(PKG_LIBVER)/*/nkf.so \
371         ) | ( cd $(1); $(TAR) -xf - )
372 endef
373
374 define Package/ruby-openssl/install
375         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
376                 usr/lib/ruby/$(PKG_LIBVER)/digest \
377                 usr/lib/ruby/$(PKG_LIBVER)/digest.rb \
378                 usr/lib/ruby/$(PKG_LIBVER)/*/digest.so \
379                 usr/lib/ruby/$(PKG_LIBVER)/*/digest/*.so \
380                 usr/lib/ruby/$(PKG_LIBVER)/openssl \
381                 usr/lib/ruby/$(PKG_LIBVER)/openssl.rb \
382                 usr/lib/ruby/$(PKG_LIBVER)/*/openssl.so \
383                 usr/lib/ruby/$(PKG_LIBVER)/drb/ssl.rb \
384                 usr/lib/ruby/$(PKG_LIBVER)/net/https.rb \
385                 usr/lib/ruby/$(PKG_LIBVER)/webrick/ssl.rb \
386         ) | ( cd $(1); $(TAR) -xf - )
387 endef
388
389 define Package/ruby-rdoc/install
390         $(INSTALL_DIR) $(1)/usr/bin
391         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rdoc $(1)/usr/bin/
392         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ri $(1)/usr/bin/
393         $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
394         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rdoc $(1)/usr/lib/ruby/$(PKG_LIBVER)/
395 endef
396
397 define Package/ruby-rake/install
398         $(INSTALL_DIR) $(1)/usr/bin
399         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rake $(1)/usr/bin/
400         $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
401         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rake.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
402         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rake $(1)/usr/lib/ruby/$(PKG_LIBVER)/
403 endef
404
405 define Package/ruby-readline/install
406         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
407                 usr/lib/ruby/$(PKG_LIBVER)/*/readline.so \
408                 usr/lib/ruby/$(PKG_LIBVER)/irb/completion.rb \
409                 usr/lib/ruby/$(PKG_LIBVER)/irb/ext/save-history.rb \
410         ) | ( cd $(1); $(TAR) -xf - )
411 endef
412
413 define Package/ruby-rexml/install
414         $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
415         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rexml $(1)/usr/lib/ruby/$(PKG_LIBVER)/
416 endef
417
418
419 define Package/ruby-rss/install
420         $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
421         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rss $(1)/usr/lib/ruby/$(PKG_LIBVER)/
422         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/rss.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
423 endef
424
425 define Package/ruby-unit/install
426         $(INSTALL_DIR) $(1)/usr/bin
427         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/testrb $(1)/usr/bin/
428         $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
429         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/test $(1)/usr/lib/ruby/$(PKG_LIBVER)/
430 endef
431
432 define Package/ruby-webrick/install
433         $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
434         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/webrick $(1)/usr/lib/ruby/$(PKG_LIBVER)/
435         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/webrick.rb $(1)/usr/lib/ruby/$(PKG_LIBVER)/
436 endef
437
438 define Package/ruby-xmlrpc/install
439         $(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
440         $(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/$(PKG_LIBVER)/xmlrpc $(1)/usr/lib/ruby/$(PKG_LIBVER)/
441 endef
442
443 define Package/ruby-yaml/install
444         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
445                 usr/lib/ruby/$(PKG_LIBVER)/yaml \
446                 usr/lib/ruby/$(PKG_LIBVER)/yaml.rb \
447                 usr/lib/ruby/$(PKG_LIBVER)/*/syck.so \
448         ) | ( cd $(1); $(TAR) -xf - )
449 endef
450
451 define Package/ruby-zlib/install
452         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
453                 usr/lib/ruby/$(PKG_LIBVER)/*/zlib.so \
454         ) | ( cd $(1); $(TAR) -xf - )
455 endef
456
457 define Build/InstallDev
458         ( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
459                 . \
460         ) | ( cd $(1); $(TAR) -xf - )
461 endef
462
463 $(eval $(call BuildPackage,ruby))
464 $(eval $(call BuildPackage,libruby))
465 $(eval $(call BuildPackage,ruby-core))
466 $(eval $(call BuildPackage,ruby-cgi))
467 $(eval $(call BuildPackage,ruby-dl))
468 $(eval $(call BuildPackage,ruby-enc))
469 $(eval $(call BuildPackage,ruby-erb))
470 $(eval $(call BuildPackage,ruby-gdbm))
471 $(eval $(call BuildPackage,ruby-gems))
472 $(eval $(call BuildPackage,ruby-json))
473 $(eval $(call BuildPackage,ruby-irb))
474 $(eval $(call BuildPackage,ruby-ncurses))
475 $(eval $(call BuildPackage,ruby-nkf))
476 $(eval $(call BuildPackage,ruby-openssl))
477 $(eval $(call BuildPackage,ruby-rake))
478 $(eval $(call BuildPackage,ruby-rdoc))
479 $(eval $(call BuildPackage,ruby-readline))
480 $(eval $(call BuildPackage,ruby-rexml))
481 $(eval $(call BuildPackage,ruby-rss))
482 $(eval $(call BuildPackage,ruby-unit))
483 $(eval $(call BuildPackage,ruby-webrick))
484 $(eval $(call BuildPackage,ruby-xmlrpc))
485 $(eval $(call BuildPackage,ruby-yaml))
486 $(eval $(call BuildPackage,ruby-zlib))
487 $(eval $(call HostBuild))