shoes 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. data/.gitignore +12 -0
  2. data/CHANGELOG +29 -0
  3. data/COPYING +30 -0
  4. data/README.md +76 -0
  5. data/README.old +117 -0
  6. data/Rakefile +130 -0
  7. data/Rakefile.bk +651 -0
  8. data/app.yaml +7 -0
  9. data/bin/main.skel +104 -0
  10. data/bugs/issue-012e9468ddc7b0cb7e1503413a8a11c4f8707b67.yaml +21 -0
  11. data/bugs/issue-0711ff8b67baa63586f11d0096fee9dd4436bf58.yaml +23 -0
  12. data/bugs/issue-07f87998d93eb401e22395c11085676389b935c4.yaml +22 -0
  13. data/bugs/issue-0bff2d80008803cbc7efbcdacdc60ef2163664d2.yaml +22 -0
  14. data/bugs/issue-0c66f223d19efbca7b692f3b91961f407ad7abec.yaml +24 -0
  15. data/bugs/issue-183bc3c7a8f575aff2b24e0bf22aa0dfcc8e4fc2.yaml +29 -0
  16. data/bugs/issue-1bad1e60a04cb3adb6a8f3ded128af2e16b56ffe.yaml +18 -0
  17. data/bugs/issue-1f1d43f76bf4de79d7f94adbae6dd506a9d81633.yaml +41 -0
  18. data/bugs/issue-320924117cadb045cc91f2a6fca922b4d81d4bb5.yaml +20 -0
  19. data/bugs/issue-33e5c8355fbf65252ea9e939714651df8bd8cb3b.yaml +25 -0
  20. data/bugs/issue-36f7c8262a72bcd5e28cfa4ed29328b8237ea79b.yaml +20 -0
  21. data/bugs/issue-39bf04ee50c3bef67b89b8e9beb28657805587ce.yaml +18 -0
  22. data/bugs/issue-3e28ba7754f73d02ef416eef989af707a8c00f01.yaml +23 -0
  23. data/bugs/issue-3f638cc03f41f9c3fdf217355321f1563f8fee45.yaml +22 -0
  24. data/bugs/issue-41e48e14f1ef4f6deb69be68165d7dd3ffd99156.yaml +22 -0
  25. data/bugs/issue-4c9408166a2aa5dd333bbb05520deebf4ded08e0.yaml +22 -0
  26. data/bugs/issue-55c687e108ecd5aeb8e0d0aeb4294984f84acd3e.yaml +18 -0
  27. data/bugs/issue-5811d34692cc292717a58ec1df1f8948cf30d826.yaml +28 -0
  28. data/bugs/issue-5a7c1f59a0526f9cea7fb366867cf1e6ed8ef69d.yaml +22 -0
  29. data/bugs/issue-688a2c2566bef6a03efa57a4ae1f7cfa8fc74444.yaml +21 -0
  30. data/bugs/issue-78b16c7988ade2ef96e716fa8cb9a004bd4ced65.yaml +33 -0
  31. data/bugs/issue-804ee49f9800154eddf0650690c7a9bb5626253f.yaml +27 -0
  32. data/bugs/issue-807dd1c610b2e941a5d454e26b2eac27e89a0ab4.yaml +22 -0
  33. data/bugs/issue-822ee33ec11ebd25f90ea86e8438de7891e63aee.yaml +18 -0
  34. data/bugs/issue-82ff7152cebb8a1cb065b864cb4fe22de2328146.yaml +29 -0
  35. data/bugs/issue-856afbdcdd4970ad54b8ce4a6c017fbaab45f49d.yaml +31 -0
  36. data/bugs/issue-8d49e32fb21522651c67490adb4d80076dbb14e1.yaml +24 -0
  37. data/bugs/issue-91583359653a9d530c1e32be72d874d847a306e7.yaml +21 -0
  38. data/bugs/issue-af41a5229613172764e7d3c98431172db337053d.yaml +20 -0
  39. data/bugs/issue-bd9856b3788dd429c998a5af1b2aae8221cb80b7.yaml +28 -0
  40. data/bugs/issue-be22aef5c564fb7b5e9938343136a9cd6a2edb7b.yaml +22 -0
  41. data/bugs/issue-bf8697523c77c326e7e35fc82cf3dd739ae92310.yaml +27 -0
  42. data/bugs/issue-cdd4b4795f34d6ff46e56ece10f8216a4a5456b2.yaml +25 -0
  43. data/bugs/issue-d9bfb5581d745ef9deb3b9b2e08ef74d1cd43082.yaml +20 -0
  44. data/bugs/issue-e0ce2f687cc096f35715d28b0af88589f4ab6cc6.yaml +18 -0
  45. data/bugs/issue-e4b0aca4a10a574b333aeaecaaf221dbc5ed22c6.yaml +38 -0
  46. data/bugs/issue-f263746594b95ba778455730478ee8df60ee639d.yaml +22 -0
  47. data/bugs/project.yaml +72 -0
  48. data/builddeps.sh +102 -0
  49. data/fonts/Coolvetica.ttf +0 -0
  50. data/fonts/Lacuna.ttf +0 -0
  51. data/gemlib/shoes.rb +1 -0
  52. data/lib/shoes.rb +548 -0
  53. data/lib/shoes/cache.rb +54 -0
  54. data/lib/shoes/chipmunk.rb +35 -0
  55. data/lib/shoes/data.rb +39 -0
  56. data/lib/shoes/help.rb +468 -0
  57. data/lib/shoes/image.rb +25 -0
  58. data/lib/shoes/inspect.rb +128 -0
  59. data/lib/shoes/log.rb +48 -0
  60. data/lib/shoes/minitar.rb +986 -0
  61. data/lib/shoes/override.rb +38 -0
  62. data/lib/shoes/pack.rb +543 -0
  63. data/lib/shoes/search.rb +46 -0
  64. data/lib/shoes/setup.rb +329 -0
  65. data/lib/shoes/shy.rb +131 -0
  66. data/lib/shoes/shybuilder.rb +44 -0
  67. data/lib/shoes/version.rb +3 -0
  68. data/make/darwin/deps.vlc +12 -0
  69. data/make/darwin/dylibs.shoes +22 -0
  70. data/make/darwin/dylibs.video +11 -0
  71. data/make/darwin/env.rb +81 -0
  72. data/make/darwin/tasks.rb +105 -0
  73. data/make/linux/env.rb +65 -0
  74. data/make/linux/tasks.rb +61 -0
  75. data/make/make.rb +85 -0
  76. data/make/mingw/dlls +19 -0
  77. data/make/mingw/env.rb +69 -0
  78. data/make/mingw/tasks.rb +70 -0
  79. data/make/rakefile_common.rb +8 -0
  80. data/manual-snapshots/class-book.png +0 -0
  81. data/manual-snapshots/expert-definr.png +0 -0
  82. data/manual-snapshots/expert-funnies.png +0 -0
  83. data/manual-snapshots/expert-irb.png +0 -0
  84. data/manual-snapshots/expert-minesweeper.png +0 -0
  85. data/manual-snapshots/expert-othello.png +0 -0
  86. data/manual-snapshots/expert-pong.png +0 -0
  87. data/manual-snapshots/expert-tankspank.png +0 -0
  88. data/manual-snapshots/good-arc.png +0 -0
  89. data/manual-snapshots/good-clock.png +0 -0
  90. data/manual-snapshots/good-follow.png +0 -0
  91. data/manual-snapshots/good-reminder.png +0 -0
  92. data/manual-snapshots/good-vjot.png +0 -0
  93. data/manual-snapshots/simple-accordion.png +0 -0
  94. data/manual-snapshots/simple-anim-shapes.png +0 -0
  95. data/manual-snapshots/simple-anim-text.png +0 -0
  96. data/manual-snapshots/simple-arc.png +0 -0
  97. data/manual-snapshots/simple-bounce.png +0 -0
  98. data/manual-snapshots/simple-calc.png +0 -0
  99. data/manual-snapshots/simple-chipmunk.png +0 -0
  100. data/manual-snapshots/simple-control-sizes.png +0 -0
  101. data/manual-snapshots/simple-curve.png +0 -0
  102. data/manual-snapshots/simple-dialogs.png +0 -0
  103. data/manual-snapshots/simple-downloader.png +0 -0
  104. data/manual-snapshots/simple-draw.png +0 -0
  105. data/manual-snapshots/simple-editor.png +0 -0
  106. data/manual-snapshots/simple-form.png +0 -0
  107. data/manual-snapshots/simple-mask.png +0 -0
  108. data/manual-snapshots/simple-menu.png +0 -0
  109. data/manual-snapshots/simple-menu1.png +0 -0
  110. data/manual-snapshots/simple-rubygems.png +0 -0
  111. data/manual-snapshots/simple-slide.png +0 -0
  112. data/manual-snapshots/simple-sphere.png +0 -0
  113. data/manual-snapshots/simple-sqlite3.png +0 -0
  114. data/manual-snapshots/simple-timer.png +0 -0
  115. data/manual-snapshots/simple-video.png +0 -0
  116. data/platform/mac/Info.plist +55 -0
  117. data/platform/mac/build-deps.sh +658 -0
  118. data/platform/mac/command-manual.rb +1 -0
  119. data/platform/mac/deps-osx.patch +159 -0
  120. data/platform/mac/dmg_ds_store +0 -0
  121. data/platform/mac/pangorc +2 -0
  122. data/platform/mac/pkg-dmg +1447 -0
  123. data/platform/mac/shoes +31 -0
  124. data/platform/mac/shoes-launch +7 -0
  125. data/platform/mac/stub.m +178 -0
  126. data/platform/mac/version.plist +14 -0
  127. data/platform/msw/base.nsi +644 -0
  128. data/platform/msw/installer-1.bmp +0 -0
  129. data/platform/msw/installer-2.bmp +0 -0
  130. data/platform/msw/shoes.exe.manifest +17 -0
  131. data/platform/msw/shoes.ico +0 -0
  132. data/platform/msw/stub-inject.c +59 -0
  133. data/platform/msw/stub.c +271 -0
  134. data/platform/msw/stub32.h +14 -0
  135. data/platform/msw/stub32.rc +16 -0
  136. data/platform/nix/INSTALL +56 -0
  137. data/platform/nix/Makefile +144 -0
  138. data/platform/nix/shoes.launch +20 -0
  139. data/platform/skel.rb +27 -0
  140. data/rakefile_darwin.rb +7 -0
  141. data/rakefile_linux.rb +3 -0
  142. data/rakefile_mingw.rb +7 -0
  143. data/samples/class-book.rb +43 -0
  144. data/samples/class-book.yaml +387 -0
  145. data/samples/expert-definr.rb +23 -0
  146. data/samples/expert-funnies.rb +51 -0
  147. data/samples/expert-irb.rb +112 -0
  148. data/samples/expert-minesweeper.rb +267 -0
  149. data/samples/expert-othello.rb +319 -0
  150. data/samples/expert-pong.rb +62 -0
  151. data/samples/expert-tankspank.rb +385 -0
  152. data/samples/good-arc.rb +37 -0
  153. data/samples/good-clock.rb +51 -0
  154. data/samples/good-follow.rb +26 -0
  155. data/samples/good-reminder.rb +174 -0
  156. data/samples/good-vjot.rb +56 -0
  157. data/samples/simple-accordion.rb +75 -0
  158. data/samples/simple-anim-shapes.rb +17 -0
  159. data/samples/simple-anim-text.rb +13 -0
  160. data/samples/simple-arc.rb +23 -0
  161. data/samples/simple-bounce.rb +24 -0
  162. data/samples/simple-calc.rb +70 -0
  163. data/samples/simple-chipmunk.rb +26 -0
  164. data/samples/simple-control-sizes.rb +24 -0
  165. data/samples/simple-curve.rb +26 -0
  166. data/samples/simple-dialogs.rb +29 -0
  167. data/samples/simple-downloader.rb +27 -0
  168. data/samples/simple-draw.rb +13 -0
  169. data/samples/simple-editor.rb +28 -0
  170. data/samples/simple-form.rb +28 -0
  171. data/samples/simple-form.shy +0 -0
  172. data/samples/simple-mask.rb +21 -0
  173. data/samples/simple-menu.rb +31 -0
  174. data/samples/simple-menu1.rb +35 -0
  175. data/samples/simple-rubygems.rb +29 -0
  176. data/samples/simple-slide.rb +45 -0
  177. data/samples/simple-sphere.rb +28 -0
  178. data/samples/simple-sqlite3.rb +13 -0
  179. data/samples/simple-timer.rb +13 -0
  180. data/samples/simple-video.rb +13 -0
  181. data/shoes.gemspec +21 -0
  182. data/shoes/app.c +591 -0
  183. data/shoes/app.h +110 -0
  184. data/shoes/appwin32.h +13 -0
  185. data/shoes/appwin32.rc +28 -0
  186. data/shoes/canvas.c +2202 -0
  187. data/shoes/canvas.h +682 -0
  188. data/shoes/code.h +14 -0
  189. data/shoes/config.h +232 -0
  190. data/shoes/effects.c +243 -0
  191. data/shoes/effects.h +7 -0
  192. data/shoes/http.h +44 -0
  193. data/shoes/http/common.h +86 -0
  194. data/shoes/http/curl.c +259 -0
  195. data/shoes/http/nsurl.m +274 -0
  196. data/shoes/http/windownload.c +114 -0
  197. data/shoes/http/winhttp.c +216 -0
  198. data/shoes/http/winhttp.h +19 -0
  199. data/shoes/image.c +1020 -0
  200. data/shoes/internal.c +46 -0
  201. data/shoes/internal.h +63 -0
  202. data/shoes/native.h +110 -0
  203. data/shoes/native/cocoa.h +105 -0
  204. data/shoes/native/cocoa.m +1557 -0
  205. data/shoes/native/gtk.c +1257 -0
  206. data/shoes/native/windows.c +2392 -0
  207. data/shoes/ruby.c +5221 -0
  208. data/shoes/ruby.h +299 -0
  209. data/shoes/world.c +243 -0
  210. data/shoes/world.h +63 -0
  211. data/static/Shoes.icns +0 -0
  212. data/static/avatar.png +0 -0
  213. data/static/code_highlighter.js +188 -0
  214. data/static/code_highlighter_ruby.js +26 -0
  215. data/static/icon-debug.png +0 -0
  216. data/static/icon-error.png +0 -0
  217. data/static/icon-info.png +0 -0
  218. data/static/icon-warn.png +0 -0
  219. data/static/listbox_button1.png +0 -0
  220. data/static/listbox_button2.png +0 -0
  221. data/static/man-app.png +0 -0
  222. data/static/man-builds.png +0 -0
  223. data/static/man-builds1.png +0 -0
  224. data/static/man-editor-notepad.png +0 -0
  225. data/static/man-editor-osx.png +0 -0
  226. data/static/man-ele-background.png +0 -0
  227. data/static/man-ele-border.png +0 -0
  228. data/static/man-ele-button.png +0 -0
  229. data/static/man-ele-check.png +0 -0
  230. data/static/man-ele-editbox.png +0 -0
  231. data/static/man-ele-editline.png +0 -0
  232. data/static/man-ele-image.png +0 -0
  233. data/static/man-ele-listbox.png +0 -0
  234. data/static/man-ele-progress.png +0 -0
  235. data/static/man-ele-radio.png +0 -0
  236. data/static/man-ele-shape.png +0 -0
  237. data/static/man-ele-textblock.png +0 -0
  238. data/static/man-ele-video.png +0 -0
  239. data/static/man-intro-dmg.png +0 -0
  240. data/static/man-intro-exe.png +0 -0
  241. data/static/man-look-tiger.png +0 -0
  242. data/static/man-look-ubuntu.png +0 -0
  243. data/static/man-look-vista.png +0 -0
  244. data/static/man-run-osx.png +0 -0
  245. data/static/man-run-vista.png +0 -0
  246. data/static/man-run-xp.png +0 -0
  247. data/static/man-shot1.png +0 -0
  248. data/static/manual-en.txt +3531 -0
  249. data/static/manual-ja.txt +2825 -0
  250. data/static/manual.css +167 -0
  251. data/static/menu-corner1.png +0 -0
  252. data/static/menu-corner2.png +0 -0
  253. data/static/menu-gray.png +0 -0
  254. data/static/menu-left.png +0 -0
  255. data/static/menu-right.png +0 -0
  256. data/static/menu-top.png +0 -0
  257. data/static/shoes-dmg.jpg +0 -0
  258. data/static/shoes-icon-blue.png +0 -0
  259. data/static/shoes-icon.png +0 -0
  260. data/static/shoes-manual-apps.gif +0 -0
  261. data/static/shoes_main_window.png +0 -0
  262. data/static/stripe.png +0 -0
  263. data/static/stubs/blank.exe +0 -0
  264. data/static/stubs/blank.hfz +0 -0
  265. data/static/stubs/blank.run +375 -0
  266. data/static/stubs/cocoa-install +0 -0
  267. data/static/stubs/sh-install +49 -0
  268. data/static/stubs/shoes-stub-inject.exe +0 -0
  269. data/static/stubs/shoes-stub.exe +0 -0
  270. data/static/tutor-back.png +0 -0
  271. data/test/shoes_test.rb +8 -0
  272. data/test/test_helper.rb +25 -0
  273. data/use-deps +12 -0
  274. data/use-tmp-dep +8 -0
  275. metadata +509 -0
@@ -0,0 +1,12 @@
1
+ *.o
2
+ *.obj
3
+ *.res
4
+ bin/main.c
5
+ shoes/version.h
6
+ deps
7
+ dist
8
+ pkg
9
+ *.app
10
+ req/*
11
+ *~
12
+ *.swp
@@ -0,0 +1,29 @@
1
+ = Policeman
2
+ == 17th August, 2010
3
+ * Move to Ruby 1.9.1
4
+ * General stability improvements
5
+ * Updated all dependancies
6
+ * Ported OSX to Cocoa
7
+ * Now works with Windows Vista and Windows 7
8
+
9
+ = Raisins (0.r1134)
10
+ == 5th December, 2008
11
+ <http://shoooes.net/about/raisins>
12
+ * Built-in Shoes manual. (Alt-?)
13
+ * Error console. (Alt-/)
14
+ * In-memory and on-disk image cache.
15
+ * Asynchronous download method.
16
+ * External font support.
17
+ * Packager for building EXE, DMG, RUN and SHY.
18
+ * Effects (blurs, shadows, glows).
19
+ * Arbitrary shape method.
20
+ * Image blocks.
21
+ * Switched from Carbon to Cocoa.
22
+ * RubyGems integration.
23
+
24
+ = Curious (0.r396)
25
+ == 8th January, 2008
26
+ * First official release of Shoes.
27
+ * Support for OS X, Win32 and GTK+.
28
+ * Scrolling stacks newly added.
29
+ * VLC embedded for Video.
data/COPYING ADDED
@@ -0,0 +1,30 @@
1
+ Copyright (c) 2008 why the lucky stiff
2
+ Except:
3
+ fonts/Coolvetica.ttf (c) 1999 Ray Larabie
4
+ fonts/Lacuna.ttf (c) 2003 Glashaus, designed by Peter Hoffman
5
+ samples/expert-minesweeper.rb (c) 2008 que
6
+ samples/expert-othello.rb (c) 2008 Tieg Zaharia
7
+ samples/expert-tankspank.rb (c) 2008 Kevin C.
8
+ samples/good-clock.rb (c) 2008 Thomas Bell
9
+ samples/good-reminder.rb (c) 2008 Oliver Smith
10
+
11
+ Permission is hereby granted, free of charge, to any person
12
+ obtaining a copy of this software and associated documentation
13
+ files (the "Software"), to deal in the Software without restriction,
14
+ including without limitation the rights to use, copy, modify, merge,
15
+ publish, distribute, sublicense, and/or sell copies of the Software,
16
+ and to permit persons to whom the Software is furnished to do so,
17
+ subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be
20
+ included in all copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
23
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
24
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
25
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
26
+ SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
28
+ OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
@@ -0,0 +1,76 @@
1
+ <pre>
2
+ ((( |||_| ///\ [[[_ (((
3
+ ))) || | \\/ [[_ )))
4
+ an artsy any-platform app kit
5
+ http://shoesrb.com
6
+ </pre>
7
+
8
+ # About Shoes
9
+
10
+ Shoes is the best little DSL for cross-platform GUI programming there is. It feels like real Ruby, rather than just another C++ library wrapper. If Gtk or wxWidgets is Rails, Shoes is Sinatra.
11
+
12
+ # Let me tell you a story about Shoes
13
+
14
+ Way way back in the day, there was a guy named \_why. He created a project known as [Hackety Hack](http://hackety-hack.com) to teach programming to everyone. In order to reach all corners of the earth, \_why decided to make Hackety Hack work on Windows, Mac OS X, and Linux. This was a lot of work, and so \_why decided to share his toolkit with the world. Thus, Shoes was born.
15
+
16
+ Everybody loved Shoes. Many apps were made, and put into [The Shoebox](http://the-shoebox.org/). But, one day, \_why left. In his memory, Team Shoes assembled, and carried on making Shoes. They released Shoes 3 in late summer 2010.
17
+
18
+ # So what do these Shoes look like?
19
+
20
+ Here's a little Shoes app. It's a stopwatch!
21
+
22
+ Shoes.app :height => 150, :width => 250 do
23
+ background rgb(240, 250, 208)
24
+ stack :margin => 10 do
25
+ button "Start" do
26
+ @time = Time.now
27
+ @label.replace "Stop watch started at #@time"
28
+ end
29
+ button "Stop" do
30
+ @label.replace "Stopped, ", strong("#{Time.now - @time}"), " seconds elapsed."
31
+ end
32
+ @label = para "Press ", strong("start"), " to begin timing."
33
+ end
34
+ end
35
+
36
+ Here's what it looks like:
37
+
38
+ ![shoes timer](https://github.com/shoes/shoes/raw/develop/manual-snapshots/simple-timer.png)
39
+
40
+ Pretty simple! For more samples, the manual, and a free book, check out [the Shoes website](http://shoesrb.com/).
41
+
42
+ # Using Shoes
43
+
44
+ If you'd like to use Shoes to develop some apps... awesome! It's super easy: Just go to the [downloads page on the Shoes website](http://shoesrb.com/downloads) and download a copy of Shoes for your platform. Mac OSX, Windows, and Linux supported!
45
+
46
+ After you install Shoes, run it! You'll get a window like this:
47
+
48
+ ![shoes main window](https://github.com/shoes/shoes/raw/develop/static/shoes_main_window.png)
49
+
50
+ You can then open any .rb file with Shoes code inside by choosing "Open an App." It'll open it up and run it, right away.
51
+
52
+ Once you're happy with your app, you can choose "Package an App" to wrap up your app as a .exe, .app, or a .run. Then you can share it with someone without a pair of Shoes to call their own.
53
+
54
+ # Making your own Shoes
55
+
56
+ You can make your own pair of Shoes with a little bit of elbow grease. Since there are different instructions on each platform, we've got a page up on the [Shoes development wiki](http://github.com/shoes/shoes/wiki) about it. It's [right here](https://github.com/shoes/shoes/wiki/Building-Shoes).
57
+
58
+ # Shoes Around the Web
59
+
60
+ If you want to keep up to date with what's going on with Shoes, you can find us in various places:
61
+
62
+ * [Official Shoes Site](http://shoesrb.com/)
63
+ * [Source Code @ GitHub](http://github.com/shoes/shoes)
64
+ * [Issue tracker @ GitHub](http://github.com/shoes/shoes/issues)
65
+ * [Mailing List](http://librelist.com/browser/shoes/) (send an email to shoes@librelist.com to join)
66
+ * [Twitter account](http://twitter.com/shoooesrb)
67
+ * [Facebook page](http://www.facebook.com/pages/Shoes/132605040125019)
68
+ * IRC room on Freenode, #shoes
69
+
70
+ # Helping out with Shoes
71
+
72
+ So you'd like to lend a helping hand, eh? Great! We'd love to have you. To submit a patch to Shoes, just fork us, and send a pull request.
73
+
74
+ If you don't have any ideas yourself, take a look at the [Issue tracker](http://github.com/shoes/shoes/issues) and see if anything strikes your fancy. If you need help working on something, don't be afraid to post to the mailing list about it!
75
+
76
+ If you're not a programmer, you can help Shoes by talking about it! Blog posts, tweets, tell your neighbors, call your grandma, whatever! Share Shoes with everyone!
@@ -0,0 +1,117 @@
1
+
2
+ ((( |||_| ///\ [[[_ (((
3
+ ))) || | \\/ [[_ )))
4
+ an artsy any-platform app kit <http://github.com/shoes/shoes>
5
+
6
+ //////////////////////////////////////////////////////////////////////////
7
+
8
+ Hi, guys, thankyou for taking Shoes.
9
+
10
+ Shoes is for writing plain old windowing software. But it borrows a
11
+ few things I like from the web:
12
+
13
+ * Hyperlinks and URLs within Shoes and to the web.
14
+ * Simple text layout -- though Shoes eschews floats.
15
+ * Images and colors in the layout and in the background.
16
+ * Margin and padding.
17
+ * Resizable layouts.
18
+
19
+ However, layouts can be tough on the web. Like a two-column layout.
20
+ So rather than using floating divs, Shoes uses two layout types:
21
+ stacks and flows. More on that later.
22
+
23
+ Shoes does keep a few things from traditional windowing toolkits:
24
+
25
+ * Buttons.
26
+ * Text edit (single-line and multi-line).
27
+ * Progress bars.
28
+ * Scroll bars.
29
+ * Dialogs.
30
+
31
+ And, last of all, Shoes gets some inspiration from NodeBox and
32
+ Processing:
33
+
34
+ * The whole window is a canvas.
35
+ * Shapes, paths, curves and transformations.
36
+ * Animation.
37
+ * Easy event-handling for mouse and keyboard.
38
+
39
+ Lastly, Shoes uses Ruby as its interface language.
40
+
41
+ That's really about all that's in Shoes. It's supposed to be light.
42
+ Not much code and not too much ambition.
43
+
44
+ //////////////////////////////////////////////////////////////////////////
45
+
46
+ WHY NOT WXWINDOWS? WHY NOT THE FOX TOOLKIT? OR QT??
47
+
48
+ Shoes is strictly inspired by stuff like REBOL/View, HyperCard,
49
+ the web itself and, of course, Processing and NodeBox.
50
+
51
+ I don't like the bulkiness and the layers and layers of wxWindows,
52
+ FOX, QT, GNOME. They are big, big libraries and all the apps look
53
+ identical, devoid of spirit.
54
+
55
+ The unique thing about the web is that it gives you very few
56
+ controls, but people are able to build wildly different pages
57
+ with it that are still immediately accessible to people.
58
+
59
+ //////////////////////////////////////////////////////////////////////////
60
+
61
+ THE INSIDE OF SHOES
62
+
63
+ So, to save a bit of work, Shoes relies on a few libraries:
64
+
65
+ * Cairo, for drawing. (http://cairographics.org)
66
+ * Pango, for text.
67
+ * Ruby, for programming.
68
+
69
+ All native widgets use the OS APIs directly. Half of Shoes is platform
70
+ specific code. The targets are: OSX, Windows and GTK.
71
+
72
+ //////////////////////////////////////////////////////////////////////////
73
+
74
+ STAYING CURRENT WITH SHOES
75
+
76
+ Shoes development happens at Github. You can download a current
77
+ tarball of the very latest Shoes from here:
78
+
79
+ http://github.com/shoes/shoes
80
+
81
+ Or, if you have git installed, you can clone the repo like so:
82
+
83
+ git clone git://github.com/shoes/shoes.git
84
+
85
+ Once you have your compiler and dependencies set up, building Shoes
86
+ is as simple as:
87
+
88
+ rake
89
+
90
+ Your Shoes build will then appear in the `dist` directory.
91
+
92
+ For instructions on how to set up your compiler and acquire deps for
93
+ Windows, OS X, and Linux, see the Shoes wiki:
94
+ <http://wiki.github.com/shoes/shoes/BuildingShoes>
95
+
96
+ //////////////////////////////////////////////////////////////////////////
97
+
98
+ LICENSE
99
+
100
+ Copyright (c) 2008 why the lucky stiff
101
+
102
+ Permission is hereby granted, free of charge, to any person obtaining a copy
103
+ of this software and associated documentation files (the "Software"), to
104
+ deal in the Software without restriction, including without limitation the
105
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
106
+ sell copies of the Software, and to permit persons to whom the Software is
107
+ furnished to do so, subject to the following conditions:
108
+
109
+ The above copyright notice and this permission notice shall be included in
110
+ all copies or substantial portions of the Software.
111
+
112
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
113
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
114
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
115
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
116
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
117
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,130 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ if RUBY_VERSION != '1.8.7'
5
+ require_relative 'platform/skel'
6
+ else
7
+ require File.join(File.dirname(__FILE__), 'platform/skel')
8
+ end
9
+ require 'fileutils'
10
+ require 'find'
11
+ require 'yaml'
12
+ include FileUtils
13
+
14
+ APP = YAML.load_file(File.join(ENV['APP'] || ".", "app.yaml"))
15
+ APPNAME = APP['name']
16
+ RELEASE_ID, RELEASE_NAME = APP['version'], APP['release']
17
+ NAME = APP['shortname'] || APP['name'].downcase.gsub(/\W+/, '')
18
+ SONAME = 'shoes'
19
+
20
+ require 'rake/testtask'
21
+ Rake::TestTask.new do |t|
22
+ t.pattern = "test/*_test.rb"
23
+ end
24
+
25
+ require 'bundler'
26
+ Bundler::GemHelper.install_tasks
27
+
28
+ GIT = ENV['GIT'] || "git"
29
+ REVISION = (`#{GIT} rev-list HEAD`.split.length + 1).to_s
30
+ VERS = ENV['VERSION'] || "0.r#{REVISION}"
31
+ PKG = "#{NAME}-#{VERS}"
32
+ APPARGS = APP['run']
33
+ FLAGS = %w[DEBUG VIDEO]
34
+ VLC_VERSION = (RUBY_PLATFORM =~ /win32/ ? "0.8": `vlc --version 2>/dev/null`.split[2])
35
+ VLC_0_8 = VLC_VERSION !~ /^0\.9/
36
+
37
+ BIN = "*.{bundle,jar,o,so,obj,pdb,pch,res,lib,def,exp,exe,ilk}"
38
+ CLEAN.include ["{bin,shoes}/#{BIN}", "req/**/#{BIN}", "dist"]
39
+
40
+ RUBY_SO = Config::CONFIG['RUBY_SO_NAME']
41
+ RUBY_V = Config::CONFIG['ruby_version']
42
+ RUBY_1_9 = (RUBY_V =~ /^1\.9/)
43
+ if RUBY_1_9
44
+ $: << "."
45
+ end
46
+
47
+ if ENV['APP']
48
+ %w[dmg icons].each do |subk|
49
+ APP[subk].keys.each do |name|
50
+ APP[subk][name] = File.join(ENV['APP'], APP[subk][name])
51
+ end
52
+ end
53
+ end
54
+
55
+ if File.exists? ".git/refs/tags/#{RELEASE_ID}/#{RELEASE_NAME}"
56
+ abort "** Rename this release (and add to lib/shoes.rb) #{RELEASE_NAME} has already been tagged."
57
+ end
58
+
59
+ case RUBY_PLATFORM
60
+ when /mingw/
61
+ require File.expand_path('rakefile_mingw')
62
+ Builder = MakeMinGW
63
+ when /darwin/
64
+ require File.expand_path('rakefile_darwin')
65
+ Builder = MakeDarwin
66
+ when /linux/
67
+ require File.expand_path('rakefile_linux')
68
+ Builder = MakeLinux
69
+ else
70
+ puts "Sorry, your platform [#{RUBY_PLATFORM}] is not supported..."
71
+ end
72
+
73
+ # --------------------------
74
+ # common platform tasks
75
+
76
+ desc "Same as `rake build'"
77
+ task :default => [:build]
78
+
79
+ desc "Does a full compile, with installer"
80
+ task :package => [:build, :installer]
81
+
82
+ task "shoes/version.h" do |t|
83
+ File.open(t.name, 'w') do |f|
84
+ f << %{#define SHOES_RELEASE_ID #{RELEASE_ID}\n#define SHOES_RELEASE_NAME "#{RELEASE_NAME}"\n#define SHOES_REVISION #{REVISION}\n#define SHOES_BUILD_DATE #{Time.now.strftime("%Y%m%d")}\n#define SHOES_PLATFORM "#{RUBY_PLATFORM}"\n}
85
+ end
86
+ end
87
+
88
+ task "dist/VERSION.txt" do |t|
89
+ File.open(t.name, 'w') do |f|
90
+ f << %{shoes #{RELEASE_NAME.downcase} (0.r#{REVISION}) [#{RUBY_PLATFORM} Ruby#{RUBY_V}]}
91
+ %w[VIDEO DEBUG].each { |x| f << " +#{x.downcase}" if ENV[x] }
92
+ f << "\n"
93
+ end
94
+ end
95
+
96
+ # shoes is small, if any include changes, go ahead and build from scratch.
97
+ SRC.zip(OBJ).each do |c, o|
98
+ file o => [c] + Dir["shoes/*.h"]
99
+ end
100
+
101
+ # --------------------------
102
+ # tasks depending on Builder = MakeLinux|MakeDarwin|MakeMinGW
103
+
104
+ desc "Does a full compile, for the OS you're running on"
105
+ task :build => [:build_os, "dist/VERSION.txt"] do
106
+ Builder.common_build
107
+ Builder.copy_deps_to_dist
108
+ Builder.copy_files_to_dist
109
+ Builder.setup_system_resources
110
+ end
111
+
112
+ task "dist/#{NAME}" => ["dist/lib#{SONAME}.#{DLEXT}", "bin/main.o"] + ADD_DLL do |t|
113
+ Builder.make_app t.name
114
+ end
115
+
116
+ task "dist/lib#{SONAME}.#{DLEXT}" => ['shoes/version.h'] + OBJ do |t|
117
+ Builder.make_so t.name
118
+ end
119
+
120
+ rule ".o" => ".m" do |t|
121
+ Builder.cc t
122
+ end
123
+
124
+ rule ".o" => ".c" do |t|
125
+ Builder.cc t
126
+ end
127
+
128
+ task :installer do
129
+ Builder.make_installer
130
+ end
@@ -0,0 +1,651 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require_relative 'platform/skel'
5
+ require 'fileutils'
6
+ require 'find'
7
+ require 'yaml'
8
+ include FileUtils
9
+
10
+ APP = YAML.load_file(File.join(ENV['APP'] || ".", "app.yaml"))
11
+ APPNAME = APP['name']
12
+ RELEASE_ID, RELEASE_NAME = APP['version'], APP['release']
13
+ NAME = APP['shortname'] || APP['name'].downcase.gsub(/\W+/, '')
14
+ SONAME = 'shoes'
15
+ GIT = ENV['GIT'] || "git"
16
+ REVISION = (`#{GIT} rev-list HEAD`.split.length + 1).to_s
17
+ VERS = ENV['VERSION'] || "0.r#{REVISION}"
18
+ PKG = "#{NAME}-#{VERS}"
19
+ APPARGS = APP['run']
20
+ FLAGS = %w[DEBUG VIDEO]
21
+ VLC_VERSION = (RUBY_PLATFORM =~ /win32|mingw/ ? "0.8": `vlc --version 2>/dev/null`.split[2])
22
+ VLC_0_8 = VLC_VERSION !~ /^0\.9/
23
+
24
+ if ENV['APP']
25
+ %w[dmg icons].each do |subk|
26
+ APP[subk].keys.each do |name|
27
+ APP[subk][name] = File.join(ENV['APP'], APP[subk][name])
28
+ end
29
+ end
30
+ end
31
+
32
+ if File.exists? ".git/refs/tags/#{RELEASE_ID}/#{RELEASE_NAME}"
33
+ abort "** Rename this release (and add to lib/shoes.rb) #{RELEASE_NAME} has already been tagged."
34
+ end
35
+
36
+ BIN = "*.{bundle,jar,o,so,obj,pdb,pch,res,lib,def,exp,exe,ilk}"
37
+ CLEAN.include ["{bin,shoes}/#{BIN}", "req/**/#{BIN}", "dist"]
38
+
39
+ # Guess the environment
40
+ unless ENV['MSVC'] or ENV['DDKBUILDENV']
41
+ if ENV['MSVCDir']
42
+ ENV['MSVC'] = ENV['MSVCDir']
43
+ elsif ENV['VS71COMNTOOLS']
44
+ ENV['MSVC'] = File.expand_path("../../Vc7", ENV['VS71COMNTOOLS'])
45
+ elsif ENV['VCToolkitInstallDir']
46
+ ENV['MSVC'] = ENV['VCToolkitInstallDir']
47
+ end
48
+ end
49
+
50
+ # Check the environment
51
+ def env(x)
52
+ unless ENV[x]
53
+ abort "Your #{x} environment variable is not set!"
54
+ end
55
+ ENV[x]
56
+ end
57
+
58
+ # Execute shell calls through bash if we are compiling with mingw. This breaks us
59
+ # out of the windows command shell if we are compiling from there.
60
+ if RUBY_PLATFORM =~ /mingw/
61
+ def sh(*args)
62
+ cmd = args.join(' ')
63
+ super "bash.exe --login -i -c \"#{cmd}\""
64
+ end
65
+ end
66
+
67
+ # Subs in special variables
68
+ def rewrite before, after, reg = /\#\{(\w+)\}/, reg2 = '\1'
69
+ File.open(after, 'w') do |a|
70
+ File.open(before) do |b|
71
+ b.each do |line|
72
+ a << line.gsub(reg) do
73
+ if reg2.include? '\1'
74
+ reg2.gsub(%r!\\1!, Object.const_get($1))
75
+ else
76
+ reg2
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+
84
+ def copy_files glob, dir
85
+ FileList[glob].each { |f| cp_r f, dir }
86
+ end
87
+
88
+ def copy_ext xdir, libdir
89
+ case RUBY_PLATFORM when /win32/
90
+ dxdir = xdir.gsub %r!^req/\w+/!, 'deps/'
91
+ copy_files "#{dxdir}/*.so", libdir
92
+ when /darwin/
93
+ Dir.chdir(xdir) do
94
+ `ruby extconf.rb; make`
95
+ end
96
+ copy_files "#{xdir}/*.bundle", libdir
97
+ when /mingw/
98
+ Dir.chdir(xdir) do
99
+ sh 'ruby extconf.rb; make'
100
+ end
101
+ copy_files "#{xdir}/*.so", libdir
102
+ else
103
+ Dir.chdir(xdir) do
104
+ unless system "ruby", "extconf.rb" and system "make"
105
+ raise "Extension build failed"
106
+ end
107
+ end
108
+ copy_files "#{xdir}/*.so", libdir
109
+ end
110
+ end
111
+
112
+ ruby_so = Config::CONFIG['RUBY_SO_NAME']
113
+ ruby_v = Config::CONFIG['ruby_version']
114
+ RUBY_1_9 = (ruby_v =~ /^1\.9/)
115
+
116
+ case RUBY_PLATFORM
117
+ when /mingw/
118
+ ext_ruby = "../mingw"
119
+ if ENV['VIDEO']
120
+ rm_rf "dist"
121
+ mkdir_p 'dist'
122
+ vlc_deps = '../deps_vlc_0.8'
123
+ copy_files vlc_deps + '/bin/plugins', 'dist'
124
+ cp_r vlc_deps + '/bin/libvlc.dll', ext_ruby + '/bin'
125
+ copy_files vlc_deps + '/include/vlc', ext_ruby + '/include'
126
+ copy_files vlc_deps + '/lib', ext_ruby
127
+ end
128
+ else
129
+ ext_ruby = "deps/ruby"
130
+ unless File.exists? ext_ruby
131
+ ext_ruby = Config::CONFIG['prefix']
132
+ end
133
+ end
134
+
135
+ desc "Same as `rake build'"
136
+ task :default => [:build]
137
+
138
+ desc "Does a full compile, with installer"
139
+ task :package => [:build, :installer]
140
+
141
+ task "shoes/version.h" do |t|
142
+ File.open(t.name, 'w') do |f|
143
+ f << %{#define SHOES_RELEASE_ID #{RELEASE_ID}\n#define SHOES_RELEASE_NAME "#{RELEASE_NAME}"\n#define SHOES_REVISION #{REVISION}\n#define SHOES_BUILD_DATE #{Time.now.strftime("%Y%m%d")}\n#define SHOES_PLATFORM "#{RUBY_PLATFORM}"\n}
144
+ end
145
+ end
146
+
147
+ task "dist/VERSION.txt" do |t|
148
+ File.open(t.name, 'w') do |f|
149
+ f << %{shoes #{RELEASE_NAME.downcase} (0.r#{REVISION}) [#{RUBY_PLATFORM} Ruby#{ruby_v}]}
150
+ %w[VIDEO DEBUG].each { |x| f << " +#{x.downcase}" if ENV[x] }
151
+ f << "\n"
152
+ end
153
+ end
154
+
155
+ desc "Does a full compile, for the OS you're running on"
156
+ task :build => [:build_os, "dist/VERSION.txt"] do
157
+ mkdir_p "dist/ruby"
158
+ cp_r "#{ext_ruby}/lib/ruby/#{ruby_v}", "dist/ruby/lib"
159
+ unless ENV['STANDARD']
160
+ %w[soap wsdl xsd].each do |libn|
161
+ rm_rf "dist/ruby/lib/#{libn}"
162
+ end
163
+ end
164
+ %w[req/ftsearch/lib/* req/rake/lib/*].each do |rdir|
165
+ FileList[rdir].each { |rlib| cp_r rlib, "dist/ruby/lib" }
166
+ end
167
+ %w[req/binject/ext/binject_c req/ftsearch/ext/ftsearchrt req/bloopsaphone/ext/bloops req/chipmunk/ext/chipmunk].
168
+ each { |xdir| copy_ext xdir, "dist/ruby/lib/#{RUBY_PLATFORM}" }
169
+
170
+ gdir = "dist/ruby/gems/#{ruby_v}"
171
+ {'hpricot' => 'lib', 'json' => 'lib/json/ext', 'sqlite3' => 'lib'}.each do |gemn, xdir|
172
+ spec = eval(File.read("req/#{gemn}/gemspec"))
173
+ mkdir_p "#{gdir}/specifications"
174
+ mkdir_p "#{gdir}/gems/#{spec.full_name}/lib"
175
+ FileList["req/#{gemn}/lib/*"].each { |rlib| cp_r rlib, "#{gdir}/gems/#{spec.full_name}/lib" }
176
+ mkdir_p "#{gdir}/gems/#{spec.full_name}/#{xdir}"
177
+ FileList["req/#{gemn}/ext/*"].each { |elib|
178
+ copy_ext elib, "#{gdir}/gems/#{spec.full_name}/#{xdir}" }
179
+ cp "req/#{gemn}/gemspec", "#{gdir}/specifications/#{spec.full_name}.gemspec"
180
+ end
181
+
182
+ case RUBY_PLATFORM when /win32/
183
+ copy_files "#{ext_ruby}/bin/*.dll", "dist/"
184
+ copy_files "deps/cairo/bin/*", "dist/"
185
+ copy_files "deps/pango/bin/*", "dist/"
186
+ copy_files "deps/ruby/lib/ruby/site_ruby/1.9.1/i386-msvcrt/*", "dist/ruby/lib/#{RUBY_PLATFORM}/"
187
+ cp_r "deps/ruby/lib/ruby/site_ruby/1.9.1/openssl", "dist/ruby/lib"
188
+ cp_r "deps/ruby/lib/ruby/site_ruby/1.9.1/openssl.rb", "dist/ruby/lib"
189
+ %w[gems specifications].each do |d|
190
+ Dir.glob("deps/ruby/lib/ruby/gems/1.9.1/#{d}/*").each do |file|
191
+ cp_r file, "dist/ruby/gems/1.9.1/#{d}"
192
+ end
193
+ end
194
+
195
+ if ENV['VIDEO']
196
+ copy_files "deps/vlc/bin/*", "dist/"
197
+ end
198
+ when /mingw/
199
+ dlls = [ruby_so]
200
+ dlls += %w{libungif4 libjpeg-8 libcairo-2 libglib-2.0-0 libgobject-2.0-0 libpango-1.0-0 libpangoft2-1.0-0 libgio-2.0-0 libgthread-2.0-0
201
+ libgmodule-2.0-0 libpangocairo-1.0-0 libpangowin32-1.0-0 libportaudio-2 sqlite3 libssl32 libeay32 zlib1 readline5 libiconv2}
202
+ dlls += %w{libvlc} if ENV['VIDEO']
203
+ dlls.each{|dll| cp "#{ext_ruby}/bin/#{dll}.dll", "dist/"}
204
+ cp "dist/zlib1.dll", "dist/zlib.dll"
205
+ Dir.glob("../deps_cairo*/*"){|file| cp file, "dist/"}
206
+ sh "strip -x dist/*.dll" unless ENV['DEBUG']
207
+ when /darwin/
208
+ if ENV['SHOES_DEPS_PATH']
209
+ dylibs = %w[lib/libiconv.2.dylib lib/libcairo.2.dylib lib/libpixman-1.0.dylib lib/libgmodule-2.0.0.dylib lib/libintl.8.dylib lib/libruby.dylib
210
+ lib/libglib-2.0.0.dylib lib/libgobject-2.0.0.dylib lib/libgthread-2.0.0.dylib lib/libpng14.14.dylib lib/libpango-1.0.0.dylib
211
+ lib/pango/1.6.0/modules/pango-basic-atsui.la lib/libpangocairo-1.0.0.dylib
212
+ lib/pango/1.6.0/modules/pango-basic-atsui.so etc/pango/pango.modules
213
+ lib/pango/1.6.0/modules/pango-arabic-lang.so lib/pango/1.6.0/modules/pango-arabic-lang.la
214
+ lib/pango/1.6.0/modules/pango-indic-lang.so lib/pango/1.6.0/modules/pango-indic-lang.la
215
+ lib/libjpeg.8.dylib lib/libgif.4.dylib lib/libportaudio.2.dylib]
216
+ if ENV['VIDEO']
217
+ dylibs.push *%w[lib/liba52.0.dylib lib/libfaac.0.dylib lib/libfaad.0.dylib lib/libmp3lame.0.dylib
218
+ lib/libvorbis.0.dylib lib/libogg.0.dylib
219
+ lib/libvorbisenc.2.dylib lib/libpostproc.dylib lib/libavformat.dylib lib/libavcodec.dylib lib/libavutil.dylib]
220
+ end
221
+ dylibs.each do |libn|
222
+ cp "#{ENV['SHOES_DEPS_PATH']}/#{libn}", "dist/"
223
+ end.each do |libn|
224
+ next unless libn =~ %r!^lib/(.+?\.dylib)$!
225
+ libf = $1
226
+ sh "install_name_tool -id /tmp/dep/#{libn} dist/#{libf}"
227
+ ["dist/#{NAME}-bin", *Dir['dist/*.dylib']].each do |lib2|
228
+ sh "install_name_tool -change /tmp/dep/#{libn} @executable_path/#{libf} #{lib2}"
229
+ end
230
+ end
231
+ if ENV['VIDEO']
232
+ mkdir_p "dist/plugins"
233
+ sh "cp -r deps/lib/vlc/**/*.dylib dist/plugins"
234
+ sh "strip -x dist/*.dylib"
235
+ sh "strip -x dist/plugins/*.dylib"
236
+ sh "strip -x dist/ruby/lib/**/*.bundle"
237
+ end
238
+ end
239
+ else
240
+ cp "#{ext_ruby}/lib/lib#{ruby_so}.so", "dist/lib#{ruby_so}.so"
241
+ ln_s "lib#{ruby_so}.so", "dist/lib#{ruby_so}.so.#{ruby_v[/^\d+\.\d+/]}"
242
+ cp "/usr/lib/libgif.so", "dist/libgif.so.4"
243
+ ln_s "libgif.so.4", "dist/libungif.so.4"
244
+ cp "/usr/lib/libjpeg.so", "dist/libjpeg.so.8"
245
+ cp "/usr/lib/libcurl.so", "dist/libcurl.so.4"
246
+ cp "/usr/lib/libportaudio.so", "dist/libportaudio.so.2"
247
+ cp "/usr/lib/libsqlite3.so", "dist/libsqlite3.so.0"
248
+ if ENV['VIDEO']
249
+ cp "/usr/lib/libvlc.so", "dist"
250
+ ln_s "libvlc.so", "dist/libvlc.so.0"
251
+ end
252
+ sh "strip -x dist/*.so.*"
253
+ sh "strip -x dist/*.so"
254
+ end
255
+
256
+ if ENV['APP']
257
+ if APP['clone']
258
+ sh APP['clone'].gsub(/^git /, "#{GIT} --git-dir=#{ENV['APP']}/.git ")
259
+ else
260
+ cp_r ENV['APP'], "dist/app"
261
+ end
262
+ if APP['ignore']
263
+ APP['ignore'].each do |nn|
264
+ rm_rf "dist/app/#{nn}"
265
+ end
266
+ end
267
+ end
268
+ cp_r "fonts", "dist/fonts"
269
+ cp_r "lib", "dist/lib"
270
+ cp_r "samples", "dist/samples"
271
+ cp_r "static", "dist/static"
272
+ cp "README", "dist/README.txt"
273
+ cp "CHANGELOG", "dist/CHANGELOG.txt"
274
+ cp "COPYING", "dist/COPYING.txt"
275
+
276
+ case RUBY_PLATFORM when /darwin/
277
+ rm_rf "#{APPNAME}.app"
278
+ mkdir "#{APPNAME}.app"
279
+ mkdir "#{APPNAME}.app/Contents"
280
+ cp_r "dist", "#{APPNAME}.app/Contents/MacOS"
281
+ mkdir "#{APPNAME}.app/Contents/Resources"
282
+ mkdir "#{APPNAME}.app/Contents/Resources/English.lproj"
283
+ sh "ditto \"#{APP['icons']['osx']}\" \"#{APPNAME}.app/App.icns\""
284
+ sh "ditto \"#{APP['icons']['osx']}\" \"#{APPNAME}.app/Contents/Resources/App.icns\""
285
+ rewrite "platform/mac/Info.plist", "#{APPNAME}.app/Contents/Info.plist"
286
+ cp "platform/mac/version.plist", "#{APPNAME}.app/Contents/"
287
+ rewrite "platform/mac/pangorc", "#{APPNAME}.app/Contents/MacOS/pangorc"
288
+ cp "platform/mac/command-manual.rb", "#{APPNAME}.app/Contents/MacOS/"
289
+ rewrite "platform/mac/shoes-launch", "#{APPNAME}.app/Contents/MacOS/#{NAME}-launch"
290
+ chmod 0755, "#{APPNAME}.app/Contents/MacOS/#{NAME}-launch"
291
+ chmod 0755, "#{APPNAME}.app/Contents/MacOS/#{NAME}-bin"
292
+ rewrite "platform/mac/shoes", "#{APPNAME}.app/Contents/MacOS/#{NAME}"
293
+ chmod 0755, "#{APPNAME}.app/Contents/MacOS/#{NAME}"
294
+ # cp InfoPlist.strings YourApp.app/Contents/Resources/English.lproj/
295
+ `echo -n 'APPL????' > "#{APPNAME}.app/Contents/PkgInfo"`
296
+ when /win32/
297
+ cp "platform/msw/shoes.exe.manifest", "dist/#{NAME}.exe.manifest"
298
+ cp "dist/zlib1.dll", "dist/zlib.dll"
299
+ else
300
+ cp APP['icons']['gtk'], "dist/static/app-icon.png"
301
+ end
302
+ end
303
+
304
+ # use the platform Ruby claims
305
+ case RUBY_PLATFORM
306
+ when /win32/
307
+ SRC = FileList["shoes/*.c", "shoes/native/windows.c", "shoes/http/winhttp.c", "shoes/http/windownload.c"]
308
+ OBJ = SRC.map do |x|
309
+ x.gsub(/\.c$/, '.obj')
310
+ end
311
+
312
+ # MSVC build environment
313
+ MSVC_LIBS = %[msvcrt-ruby191.lib pango-1.0.lib pangocairo-1.0.lib gobject-2.0.lib glib-2.0.lib cairo.lib giflib.lib jpeg.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib advapi32.lib oleacc.lib winhttp.lib]
314
+ MSVC_LIBS << " libvlc.lib" if ENV['VIDEO']
315
+ MSVC_LIBS2 = ""
316
+ MSVC_LIBS2 << " bufferoverflowu.lib" if ENV['DDKBUILDENV']
317
+ MSVC_LIBS << MSVC_LIBS2
318
+
319
+ MSVC_CFLAGS = %[/MT /DWIN32 /DSHOES_WIN32 /DWIN32_LEAN_AND_MEAN /DCINTERFACE /DCOBJMACROS
320
+ /Ideps\\vlc\\include
321
+ /Ideps\\cairo\\include
322
+ /Ideps\\cairo\\include\\cairo
323
+ /Ideps\\pango\\include\\pango-1.0
324
+ /Ideps\\pango\\include\\glib-2.0
325
+ /Ideps\\pango\\lib\\glib-2.0\\include
326
+ /Ideps\\ruby\\lib\\ruby\\#{ruby_v}\\i386-mswin32
327
+ /Ideps\\ruby\\include\\ruby-1.9.1
328
+ /Ideps\\ruby\\include\\ruby-1.9.1\\i386-mswin32
329
+ /Ideps\\curl\\include
330
+ /Ideps\\winhttp\\include
331
+ /I. /DVLC_0_8 /DWINVER=0x0501 /D_WIN32_WINNT=0x0501
332
+ /O2 /GR /EHsc
333
+ ].gsub(/\n\s*/, ' ')
334
+
335
+ MSVC_LDFLAGS = "/NOLOGO"
336
+
337
+ FLAGS.each do |flag|
338
+ MSVC_CFLAGS << " /D#{flag}" if ENV[flag]
339
+ end
340
+ if ENV['DEBUG']
341
+ MSVC_CFLAGS << " /Zi"
342
+ MSVC_LDFLAGS << " /DEBUG"
343
+ end
344
+ MSVC_CFLAGS << " /DRUBY_1_9" if RUBY_1_9
345
+ MSVC_CFLAGS << " /I#{ENV['SDK_INC_PATH']}" if ENV['SDK_INC_PATH']
346
+ MSVC_CFLAGS << " /I#{ENV['CRT_INC_PATH']}" if ENV['CRT_INC_PATH']
347
+ MSVC_LDFLAGS << " /LIBPATH:#{ENV['SDK_LIB_PATH'][0..-2]}\i386" if ENV['SDK_LIB_PATH']
348
+ MSVC_LDFLAGS << " /LIBPATH:#{ENV['CRT_LIB_PATH'][0..-2]}\i386" if ENV['CRT_LIB_PATH']
349
+
350
+ # MSVC build tasks
351
+ task :build_os => [:buildenv_win32, :build_skel, "dist/#{NAME}.exe"]
352
+
353
+ task :buildenv_win32 do
354
+ unless ENV['DDKBUILDENV']
355
+ vcvars32_bat = File.join(env('MSVC'), "vcvars32.bat")
356
+ unless File.exists?(vcvars32_bat)
357
+ vcvars32_bat = File.join(env('MSVC'), "bin/vcvars32.bat")
358
+ end
359
+ `"#{vcvars32_bat}" x86 && set`.each do |line|
360
+ if line =~ /(\w+)=(.+)/
361
+ ENV[$1] = $2
362
+ end
363
+ end
364
+ end
365
+ cp APP['icons']['win32'], "shoes/appwin32.ico"
366
+ mkdir_p "dist/pkg"
367
+ end
368
+
369
+ task :stub => ["dist/pkg/shoes-stub.exe", "dist/pkg/shoes-stub-inject.exe"]
370
+
371
+ ['stub', 'stub-inject'].each do |s|
372
+ task "dist/pkg/shoes-#{s}.exe" => ["shoes/version.h", "shoes/http/winhttp.obj", "platform/msw/stub32.res", "platform/msw/#{s}.obj"] do |t|
373
+ rm_f t.name
374
+ sh "link #{MSVC_LDFLAGS} /OUT:#{t.name} /Ideps/winhttp/include /LIBPATH:deps/winhttp/lib /LIBPATH:dist " +
375
+ "/SUBSYSTEM:WINDOWS platform/msw/stub32.res shoes/http/winhttp.obj platform/msw/#{s}.obj shell32.lib user32.lib comctl32.lib winhttp.lib bufferoverflowu.lib advapi32.lib"
376
+ end
377
+ end
378
+
379
+ task "dist/#{NAME}.exe" => ["dist/lib#{SONAME}.dll", "bin/main.obj", "shoes/appwin32.res"] do |t|
380
+ rm_f t.name
381
+ sh "link #{MSVC_LDFLAGS} /OUT:#{t.name} /LIBPATH:dist " +
382
+ "/SUBSYSTEM:WINDOWS bin/main.obj shoes/appwin32.res lib#{SONAME}.lib #{MSVC_LIBS2}"
383
+ end
384
+
385
+ task "dist/lib#{SONAME}.dll" => ["shoes/version.h"] + OBJ do |t|
386
+ sh "link #{MSVC_LDFLAGS} /OUT:#{t.name} /dll " +
387
+ "/LIBPATH:#{ext_ruby}/lib " +
388
+ "/LIBPATH:deps/cairo/lib " +
389
+ "/LIBPATH:deps/pango/lib " +
390
+ "/LIBPATH:deps/winhttp/lib " +
391
+ "/LIBPATH:deps/vlc/lib #{OBJ.join(' ')} #{MSVC_LIBS}"
392
+ end
393
+
394
+ rule ".obj" => ".c" do |t|
395
+ sh "cl /c /nologo /TP /Fo#{t.name} #{MSVC_CFLAGS} #{t.source}"
396
+ end
397
+
398
+ rule ".res" => ".rc" do |t|
399
+ sh "rc /Fo#{t.name} #{t.source}"
400
+ end
401
+
402
+ task :installer do
403
+ mkdir_p "pkg"
404
+ rm_rf "dist/nsis"
405
+ cp_r "platform/msw", "dist/nsis"
406
+ cp APP['icons']['win32'], "dist/nsis/setup.ico"
407
+ rewrite "dist/nsis/base.nsi", "dist/nsis/#{NAME}.nsi"
408
+ Dir.chdir("dist/nsis") do
409
+ sh "\"#{env('NSIS')}\\makensis.exe\" #{NAME}.nsi"
410
+ end
411
+ mv "dist/nsis/#{PKG}.exe", "pkg"
412
+ end
413
+ else
414
+ require 'rbconfig'
415
+
416
+
417
+ CC = ENV['CC'] ? ENV['CC'] : "gcc"
418
+ file_list = ["shoes/*.c"] + case RUBY_PLATFORM
419
+ when /mingw/
420
+ %w{shoes/native/windows.c shoes/http/winhttp.c shoes/http/windownload.c}
421
+ when /darwin/
422
+ %w{shoes/native/cocoa.m shoes/http/nsurl.m}
423
+ else
424
+ %w{shoes/native/gtk.c shoes/http/curl.c}
425
+ end
426
+ SRC = FileList[*file_list]
427
+ OBJ = SRC.map do |x|
428
+ x.gsub(/\.\w+$/, '.o')
429
+ end
430
+
431
+ # Linux build environment
432
+ if RUBY_PLATFORM =~ /mingw/
433
+ CAIRO_CFLAGS = '-I/mingw/include/glib-2.0 -I/mingw/lib/glib-2.0/include -I/mingw/include/cairo'
434
+ CAIRO_LIB = '-lcairo'
435
+ PANGO_CFLAGS = '-I/mingw/include/pango-1.0'
436
+ PANGO_LIB = '-lpangocairo-1.0 -lpango-1.0 -lpangoft2-1.0 -lpangowin32-1.0'
437
+ if ENV['VIDEO']
438
+ VLC_CFLAGS = '-I/mingw/include/vlc'
439
+ VLC_LIB = '-llibvlc'
440
+ else
441
+ VLC_CFLAGS = VLC_LIB = ''
442
+ end
443
+ else
444
+ CAIRO_CFLAGS = ENV['CAIRO_CFLAGS'] || `pkg-config --cflags cairo`.strip
445
+ CAIRO_LIB = ENV['CAIRO_LIB'] ? "-L#{ENV['CAIRO_LIB']}" : `pkg-config --libs cairo`.strip
446
+ PANGO_CFLAGS = ENV['PANGO_CFLAGS'] || `pkg-config --cflags pango`.strip
447
+ PANGO_LIB = ENV['PANGO_LIB'] ? "-L#{ENV['PANGO_LIB']}" : `pkg-config --libs pango`.strip
448
+ png_lib = 'png'
449
+ end
450
+
451
+ LINUX_CFLAGS = %[-Wall -I#{ENV['SHOES_DEPS_PATH'] || "/usr"}/include #{CAIRO_CFLAGS} #{PANGO_CFLAGS} #{VLC_CFLAGS} -I#{Config::CONFIG['archdir']}]
452
+ if Config::CONFIG['rubyhdrdir']
453
+ LINUX_CFLAGS << " -I#{Config::CONFIG['rubyhdrdir']} -I#{Config::CONFIG['rubyhdrdir']}/#{RUBY_PLATFORM}"
454
+ end
455
+ if RUBY_PLATFORM =~ /darwin/
456
+ LINUX_LIB_NAMES = %W[#{ruby_so} cairo pangocairo-1.0 gif]
457
+ else
458
+ LINUX_LIB_NAMES = %W[#{ruby_so} cairo pangocairo-1.0 ungif]
459
+ end
460
+ FLAGS.each do |flag|
461
+ LINUX_CFLAGS << " -D#{flag}" if ENV[flag]
462
+ end
463
+ if ENV['DEBUG']
464
+ LINUX_CFLAGS << " -g -O0 "
465
+ else
466
+ LINUX_CFLAGS << " -O "
467
+ end
468
+ LINUX_CFLAGS << " -DRUBY_1_9" if RUBY_1_9
469
+
470
+ case RUBY_PLATFORM when /darwin/
471
+ DLEXT = "dylib"
472
+ LINUX_CFLAGS << " -DSHOES_QUARTZ -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -fpascal-strings #{Config::CONFIG["CFLAGS"]} -x objective-c -fobjc-exceptions"
473
+ LINUX_LDFLAGS = "-framework Cocoa -framework Carbon -dynamiclib -Wl,-single_module #{Config::CONFIG["LDFLAGS"]} INSTALL_NAME"
474
+ LINUX_LIB_NAMES << 'pixman-1' << 'jpeg.8'
475
+ if ENV['VIDEO']
476
+ if VLC_0_8
477
+ LINUX_CFLAGS << " -DVLC_0_8"
478
+ end
479
+ LINUX_LDFLAGS << " ./deps/lib/libvlc.a ./deps/lib/vlc/libmemcpymmx.a ./deps/lib/vlc/libi420_rgb_mmx.a ./deps/lib/vlc/libi422_yuy2_mmx.a ./deps/lib/vlc/libi420_ymga_mmx.a ./deps/lib/vlc/libi420_yuy2_mmx.a ./deps/lib/vlc/libmemcpymmxext.a ./deps/lib/vlc/libmemcpy3dn.a ./deps/lib/vlc/libffmpeg.a ./deps/lib/vlc/libstream_out_switcher.a ./deps/lib/vlc/libquicktime.a ./deps/lib/vlc/libauhal.a ./deps/lib/vlc/libmacosx.a -framework vecLib -lpthread -lm -liconv -lintl -liconv -lc -lpostproc -lavformat -lavcodec -lz -la52 -lfaac -lfaad -lmp3lame -lx264 -lxvidcore -lvorbisenc -lavutil -lvorbis -lm -logg -lm -lavformat -lavcodec -lz -la52 -lfaac -lfaad -lmp3lame -lx264 -lxvidcore -lvorbisenc -lavutil -lvorbis -lm -logg -framework QuickTime -lm -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework IOKit -lobjc -ObjC -framework OpenGL -framework AGL -read_only_relocs suppress"
480
+ end
481
+ if ENV['UNIVERSAL']
482
+ LINUX_CFLAGS << " -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
483
+ LINUX_LDFLAGS << " -arch i386 -arch ppc"
484
+ ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.4'
485
+ elsif ENV['PPC']
486
+ LINUX_CFLAGS << " -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc"
487
+ LINUX_LDFLAGS << " -arch ppc"
488
+ ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.4'
489
+ else
490
+ LINUX_CFLAGS << " -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64"
491
+ LINUX_LDFLAGS << " -arch x86_64"
492
+ ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
493
+ end
494
+ when /mingw/
495
+ DLEXT = 'dll'
496
+ LINUX_CFLAGS << ' -I. -I/mingw/include'
497
+ LINUX_CFLAGS << ' -I/mingw/include/ruby-1.9.1/ruby' if RUBY_1_9
498
+ LINUX_CFLAGS << " -DXMD_H -DHAVE_BOOLEAN -DSHOES_WIN32 -D_WIN32_IE=0x0500 -D_WIN32_WINNT=0x0500 -DWINVER=0x0500 -DCOBJMACROS"
499
+ LINUX_LDFLAGS = " -DBUILD_DLL -lungif -ljpeg -lglib-2.0 -lgobject-2.0 -lgio-2.0 -lgmodule-2.0 -lgthread-2.0 -fPIC -shared"
500
+ LINUX_LDFLAGS << ' -lshell32 -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lcomctl32 -lole32 -loleaut32 -ladvapi32 -loleacc -lwinhttp'
501
+ LINUX_CFLAGS << " -DVLC_0_8" if ENV['VIDEO'] and VLC_0_8
502
+ LINUX_CFLAGS << " -DNOLAYERED" if ENV['NOLAYERED']
503
+ cp APP['icons']['win32'], "shoes/appwin32.ico"
504
+ else
505
+ DLEXT = "so"
506
+ LINUX_CFLAGS << " -DSHOES_GTK -fPIC #{`pkg-config --cflags gtk+-2.0`.strip} #{`curl-config --cflags`.strip}"
507
+ LINUX_LDFLAGS =" #{`pkg-config --libs gtk+-2.0`.strip} #{`curl-config --libs`.strip} -fPIC -shared"
508
+ LINUX_LIB_NAMES << 'jpeg'
509
+ LINUX_LIB_NAMES << 'rt'
510
+ if ENV['VIDEO']
511
+ if VLC_0_8
512
+ LINUX_CFLAGS << " -DVLC_0_8"
513
+ else
514
+ LINUX_CFLAGS << " -I/usr/include/vlc/plugins"
515
+ end
516
+ LINUX_LIB_NAMES << "vlc"
517
+ end
518
+ end
519
+
520
+ LINUX_LIBS = LINUX_LIB_NAMES.map { |x| "-l#{x}" }.join(' ')
521
+
522
+ task :build_os => [:buildenv_linux, :build_skel, "dist/#{NAME}"]
523
+
524
+ task :buildenv_linux do
525
+ unless ENV['VIDEO']
526
+ rm_rf "dist"
527
+ mkdir_p "dist"
528
+ end
529
+ end
530
+
531
+ LINUX_LIBS << " -L#{Config::CONFIG['libdir']} #{CAIRO_LIB} #{PANGO_LIB} #{VLC_LIB}"
532
+
533
+ if RUBY_PLATFORM =~ /mingw/
534
+ task "dist/#{NAME}" => ["dist/lib#{SONAME}.#{DLEXT}", "bin/main.o", "shoes/appwin32.o"] do |t|
535
+ bin = t.name
536
+ rm_f bin
537
+ sh "#{CC} -Ldist -o #{bin} bin/main.o shoes/appwin32.o #{LINUX_LIBS} -lshoes #{Config::CONFIG['LDFLAGS']} -mwindows"
538
+ if RUBY_PLATFORM !~ /darwin/
539
+ rewrite "platform/nix/shoes.launch", t.name, %r!/shoes!, "/#{NAME}"
540
+ sh %{echo 'cd "$OLDPWD"'}
541
+ sh %{echo 'LD_LIBRARY_PATH=$APPPATH $APPPATH/#{File.basename(bin)} "$@"' >> #{t.name}}
542
+ chmod 0755, t.name
543
+ end
544
+ cp "platform/msw/shoes.exe.manifest", "dist/#{NAME}.exe.manifest"
545
+ end
546
+ else
547
+ task "dist/#{NAME}" => ["dist/lib#{SONAME}.#{DLEXT}", "bin/main.o"] do |t|
548
+ bin = "#{t.name}-bin"
549
+ rm_f t.name
550
+ rm_f bin
551
+ if RUBY_PLATFORM =~ /darwin/
552
+ sh "#{CC} -Ldist -o #{bin} bin/main.o #{LINUX_LIBS} -lshoes -arch x86_64"
553
+ else
554
+ sh "#{CC} -Ldist -o #{bin} bin/main.o #{LINUX_LIBS} -lshoes #{Config::CONFIG['LDFLAGS']}"
555
+ rewrite "platform/nix/shoes.launch", t.name, %r!/shoes-bin!, "/#{NAME}-bin"
556
+ sh %{echo 'cd "$OLDPWD"\nLD_LIBRARY_PATH=$APPPATH $APPPATH/#{File.basename(bin)} "$@"' >> #{t.name}}
557
+ chmod 0755, t.name
558
+ end
559
+ end
560
+ end
561
+
562
+ task "dist/lib#{SONAME}.#{DLEXT}" => ['shoes/version.h'] + OBJ do |t|
563
+ ldflags = LINUX_LDFLAGS.sub! /INSTALL_NAME/, "-install_name @executable_path/lib#{SONAME}.#{DLEXT}"
564
+ sh "#{CC} -o #{t.name} #{OBJ.join(' ')} #{LINUX_LDFLAGS} #{LINUX_LIBS}"
565
+ case RUBY_PLATFORM when /darwin/
566
+ %w[libpostproc.dylib libavformat.dylib libavcodec.dylib libavutil.dylib libruby.dylib].each do |libn|
567
+ sh "install_name_tool -change /tmp/dep/lib/#{libn} ./deps/lib/#{libn} #{t.name}"
568
+ end
569
+ end
570
+ end
571
+
572
+ if RUBY_PLATFORM =~ /mingw/
573
+ rule ".o" => ".rc" do |t|
574
+ sh "windres -I. #{t.source} #{t.name}"
575
+ end
576
+ end
577
+
578
+ rule ".o" => ".m" do |t|
579
+ sh "#{CC} -I. -c -o#{t.name} #{LINUX_CFLAGS} #{t.source}"
580
+ end
581
+
582
+ rule ".o" => ".c" do |t|
583
+ sh "#{CC} -I. -c -o#{t.name} #{LINUX_CFLAGS} #{t.source}"
584
+ end
585
+
586
+ case RUBY_PLATFORM when /darwin/
587
+ task :stub do
588
+ ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.4'
589
+ sh "gcc -O -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc -framework Cocoa -o stub platform/mac/stub.m -I."
590
+ end
591
+
592
+ task :installer do
593
+ dmg_ds, dmg_jpg = "platform/mac/dmg_ds_store", "static/shoes-dmg.jpg"
594
+ if APP['dmg']
595
+ dmg_ds, dmg_jpg = APP['dmg']['ds_store'], APP['dmg']['background']
596
+ end
597
+
598
+ mkdir_p "pkg"
599
+ rm_rf "dmg"
600
+ mkdir_p "dmg"
601
+ cp_r "#{APPNAME}.app", "dmg"
602
+ unless ENV['APP']
603
+ mv "dmg/#{APPNAME}.app/Contents/MacOS/samples", "dmg/samples"
604
+ end
605
+ ln_s "/Applications", "dmg/Applications"
606
+ sh "chmod +x dmg/\"#{APPNAME}.app\"/Contents/MacOS/#{NAME}"
607
+ sh "chmod +x dmg/\"#{APPNAME}.app\"/Contents/MacOS/#{NAME}-bin"
608
+ sh "chmod +x dmg/\"#{APPNAME}.app\"/Contents/MacOS/#{NAME}-launch"
609
+ sh "DYLD_LIBRARY_PATH= platform/mac/pkg-dmg --target pkg/#{PKG}.dmg --source dmg --volname '#{APPNAME}' --copy #{dmg_ds}:/.DS_Store --mkdir /.background --copy #{dmg_jpg}:/.background" # --format UDRW"
610
+ rm_rf "dmg"
611
+ end
612
+ else
613
+ task :installer do
614
+ mkdir_p "pkg"
615
+ sh "makeself dist pkg/#{PKG}.run '#{APPNAME}' ./#{NAME}"
616
+ end
617
+ end
618
+ end
619
+
620
+ task :tarball => ['bin/main.c', 'shoes/version.h'] do
621
+ mkdir_p "pkg"
622
+ rm_rf PKG
623
+ sh "#{GIT} checkout-index --prefix=#{PKG}/ -a"
624
+ rm "#{PKG}/bin/main.skel"
625
+ rm "#{PKG}/Rakefile"
626
+ rm "#{PKG}/.gitignore"
627
+ rm "#{PKG}/use-deps"
628
+ rm_rf "#{PKG}/bugs"
629
+ cp "bin/main.c", "#{PKG}/bin/main.c"
630
+ cp "shoes/version.h", "#{PKG}/shoes/version.h"
631
+ rewrite "README", "#{PKG}/README",
632
+ /^.+STAYING CURRENT/, File.read("platform/nix/INSTALL")
633
+ rewrite "platform/nix/Makefile", "#{PKG}/Makefile", /^(REVISION) = .+?$/, 'REVISION = \1'
634
+ sh "tar czvf pkg/#{PKG}.tar.gz #{PKG}"
635
+ rm_rf PKG
636
+ end
637
+
638
+ # shoes is small, if any include changes, go ahead and build from scratch.
639
+ SRC.zip(OBJ).each do |c, o|
640
+ file o => [c] + Dir["shoes/*.h"]
641
+ end
642
+
643
+ desc "build TAGS file for emacs hackers"
644
+ task :tags do
645
+ files = ""
646
+ Find.find(".") do |path|
647
+ next if path !~ /\.(c|h)$/
648
+ files += path + " "
649
+ end
650
+ system("etags #{files}")
651
+ end