Advertisement
Guest User

Untitled

a guest
May 24th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.53 KB | None | 0 0
  1. Hello, Dart!
  2. ============
  3.  
  4. Instructions for building Dart on 64-bit Debian testing and running a hello-world style program.
  5.  
  6. This was tested on a minimal Debian install, so it should word practically everywhere.
  7. You will probably have a lot of dependencies already installed.
  8.  
  9. Thanks to all commenters on wiki page http://code.google.com/p/dart/wiki/Building
  10.  
  11. Prepare
  12. -------
  13.  
  14. # do as root or use sudo
  15. #
  16. # multilib and ia32-libs are needed if you want to build 32-bit version
  17. aptitude install vim build-essential subversion python
  18. aptitude install gcc-multilib g++-multilib
  19. aptitude install libssl-dev ia32-libs-dev
  20.  
  21. svn checkout http://src.chromium.org/svn/trunk/tools/depot_tools
  22.  
  23. # I recommend putting this to ~/.bashrc too
  24. export PATH=~/depot_tools:$PATH
  25.  
  26. Building standalone Dart VM from bleeding edge branch
  27. -----------------------------------------------------
  28.  
  29. Dart is being developed in bleeding_edge branch, not in trunk. Let''s stay up to date!
  30.  
  31. cd
  32.  
  33. mkdir dart-vm-only
  34. cd dart-vm-only
  35. gclient config http://dart.googlecode.com/svn/branches/bleeding_edge/deps/standalone.deps
  36. gclient sync
  37.  
  38. # while I'm a big fan of static analysis, it makes no sense to abort
  39. # compilation because of some warnings that developers never saw,
  40. # as they are using an older version of the compiler
  41. #
  42. # so, if you have troubles compiling, like I'm having them in last days,
  43. # just remove the -Werror flag and enjoy
  44. vim tools/gyp/configurations_make.gypi
  45.  
  46. --- gyp/configurations_make.gypi (revision 1873)
  47. +++ gyp/configurations_make.gypi (working copy)
  48. @@ -10,7 +10,6 @@
  49. 'configurations': {
  50. 'Dart_Base': {
  51. 'cflags': [
  52. - '-Werror',
  53. '<@(common_gcc_warning_flags)',
  54. '-Wnon-virtual-dtor',
  55. '-Wvla',
  56.  
  57.  
  58. cd runtime
  59.  
  60. # if the compiler can't find "asm/errno.h", check that /usr/include/asm
  61. # is a symlink to /usr/include/x86_64-linux-gnu/asm
  62. # (I had this problem on an old Debian installation, but it was OK on a fresh one)
  63. ../tools/build.py --arch=ia32
  64.  
  65. ../tools/test.py --arch=ia32
  66.  
  67. vim ~/hello.dart
  68. ---
  69. main() {
  70. print("Hello, Dart!");
  71. }
  72. ---
  73.  
  74. out/Debug_ia32/dart ~/hello.dart
  75.  
  76. # or for 64-bit version (32-bit is default, actually)
  77. # WARN: 64-bit version currently can't run much more than hello world!
  78. ../tools/build.py --arch=x64
  79. ../tools/test.py --arch=x64
  80. out/Debug_x64/dart ~/hello.dart
  81.  
  82.  
  83. Building standalone Dart VM using cmake (from Peter Kümmel''s git mirror)
  84. -------------------------------------------------------------------------
  85.  
  86. aptitude install git cmake
  87.  
  88. git clone git://github.com/syntheticpp/dartruntime.git
  89. cd dartruntime
  90. git checkout -b cmake origin/cmake
  91. mkdir build
  92. cd build
  93. cmake ../cmake/
  94. make -j4
  95.  
  96. bin/dart ~/hello.dart
  97.  
  98.  
  99. Building everything
  100. -------------------
  101.  
  102. Make sure you were able to build the standalone VM.
  103.  
  104. # unzip is needed for downloading DumpRenderTree
  105. aptitude install unzip
  106. # Java is needed for Dart->JavaScript compiler (dartc) and for Dart Eclipse plugin
  107. aptitude install sun-java6-jdk
  108. # GTK, Glib, Gconf, NSS and some fonts are only needed for browser-based tests
  109. # also, Debian puts indic fonts somewhere else than DumpRenderTree expects them (it's built for Ubuntu)
  110. # you can skip this if you don't care about browser-based tests
  111. aptitude install libglib2.0-0 libgtk2.0-0 libnss3-1d libgconf2-4
  112. aptitude install msttcorefonts ttf-dejavu-core ttf-kochi-gothic ttf-kochi-mincho ttf-thai-tlwg ttf-indic-fonts
  113.  
  114. cd /usr/share/fonts/truetype
  115. mkdir ttf-indic-fonts-core
  116. cp ttf-devanagari-fonts/* ttf-tamil-fonts/* ttf-bengali-fonts/* ttf-indic-fonts-core
  117.  
  118. mkdir dart-all
  119. cd dart-all
  120.  
  121. gclient config http://dart.googlecode.com/svn/branches/bleeding_edge/deps/all.deps
  122. gclient sync
  123.  
  124. # you will get this for the first time at the end of syncing
  125. # WARNING: Can't download DumpRenderTree!
  126. # ...
  127. # run
  128. dart/third_party/gsutil/20110627/gsutil config
  129. # open the provided URL in the browser, login with your Google account, allow access,
  130. # copy the code and enter it as the "authorization code"
  131. #
  132. # ignore the instructions for obtaining project-id, leave it empty
  133. #
  134. # and finally
  135. dart/tools/get_drt.py runhooks
  136. # again, this is only needed for the first time
  137.  
  138. cd dart
  139.  
  140. # if you want to build debug binaries only
  141. tools/build.py --arch=ia32
  142. # if you want to build debug and release binaries
  143. tools/build.py --arch=ia32 --mode=all
  144.  
  145. # if you want to run all tests and have full-blown X server installed
  146. # (note that this can run for quite a long time)
  147. tools/test.py --arch=ia32 --component=vm,dartc,chromium
  148. # if you don't have X server installed or don't care about browser-based tests
  149. tools/test.py --arch=ia32 --component=vm,dartc
  150. # you can also run browser-based tests in a minimal, Xvfb-based environment
  151. aptitude install xvfb
  152. xvfb-run tools/test.py --arch=ia32 --component=chromium
  153. # you can also add --mode argument like for tools/build.py
  154. # (this takes even more time!)
  155. tools/test.py --arch=ia32 --mode=all --component=vm,dartc,chromium
  156.  
  157. # again, use x64 instead of ia32 for 64-bit version
  158.  
  159. out/Debug_ia32/dart ~/hello.dart
  160.  
  161. # those famous 17566 lines and 548 kBytes
  162. out/Debug_ia32/dartc --out ~/hello.js ~/hello.dart
  163.  
  164. # but Dartc is an optimizing compiler
  165. # 1706 lines and 102 kB
  166. out/Debug_ia32/dartc --optimize --human-readable-output --out ~/hello.js ~/hello.dart
  167.  
  168. # 26 lines and 20 kB of highly obfuscated JavaScript
  169. out/Debug_ia32/dartc --optimize --out ~/hello.js ~/hello.dart
  170.  
  171. # then, there is Frog, Dart to JS compiler written in Dart
  172. # results in 30 lines and 1kB of nicely readable JavaScript
  173. out/Debug_ia32/frog/bin/frog --out=/home/ladicek/hello.js ~/hello.dart
  174.  
  175. # not bad for a tech preview, huh?!
  176. # and remember it will get a hell lot better in the future!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement