Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hello, Dart!
- ============
- Instructions for building Dart on 64-bit Debian testing and running a hello-world style program.
- This was tested on a minimal Debian install, so it should word practically everywhere.
- You will probably have a lot of dependencies already installed.
- Thanks to all commenters on wiki page http://code.google.com/p/dart/wiki/Building
- Prepare
- -------
- # do as root or use sudo
- #
- # multilib and ia32-libs are needed if you want to build 32-bit version
- aptitude install vim build-essential subversion python
- aptitude install gcc-multilib g++-multilib
- aptitude install libssl-dev ia32-libs-dev
- svn checkout http://src.chromium.org/svn/trunk/tools/depot_tools
- # I recommend putting this to ~/.bashrc too
- export PATH=~/depot_tools:$PATH
- Building standalone Dart VM from bleeding edge branch
- -----------------------------------------------------
- Dart is being developed in bleeding_edge branch, not in trunk. Let''s stay up to date!
- cd
- mkdir dart-vm-only
- cd dart-vm-only
- gclient config http://dart.googlecode.com/svn/branches/bleeding_edge/deps/standalone.deps
- gclient sync
- # while I'm a big fan of static analysis, it makes no sense to abort
- # compilation because of some warnings that developers never saw,
- # as they are using an older version of the compiler
- #
- # so, if you have troubles compiling, like I'm having them in last days,
- # just remove the -Werror flag and enjoy
- vim tools/gyp/configurations_make.gypi
- --- gyp/configurations_make.gypi (revision 1873)
- +++ gyp/configurations_make.gypi (working copy)
- @@ -10,7 +10,6 @@
- 'configurations': {
- 'Dart_Base': {
- 'cflags': [
- - '-Werror',
- '<@(common_gcc_warning_flags)',
- '-Wnon-virtual-dtor',
- '-Wvla',
- cd runtime
- # if the compiler can't find "asm/errno.h", check that /usr/include/asm
- # is a symlink to /usr/include/x86_64-linux-gnu/asm
- # (I had this problem on an old Debian installation, but it was OK on a fresh one)
- ../tools/build.py --arch=ia32
- ../tools/test.py --arch=ia32
- vim ~/hello.dart
- ---
- main() {
- print("Hello, Dart!");
- }
- ---
- out/Debug_ia32/dart ~/hello.dart
- # or for 64-bit version (32-bit is default, actually)
- # WARN: 64-bit version currently can't run much more than hello world!
- ../tools/build.py --arch=x64
- ../tools/test.py --arch=x64
- out/Debug_x64/dart ~/hello.dart
- Building standalone Dart VM using cmake (from Peter Kümmel''s git mirror)
- -------------------------------------------------------------------------
- aptitude install git cmake
- git clone git://github.com/syntheticpp/dartruntime.git
- cd dartruntime
- git checkout -b cmake origin/cmake
- mkdir build
- cd build
- cmake ../cmake/
- make -j4
- bin/dart ~/hello.dart
- Building everything
- -------------------
- Make sure you were able to build the standalone VM.
- # unzip is needed for downloading DumpRenderTree
- aptitude install unzip
- # Java is needed for Dart->JavaScript compiler (dartc) and for Dart Eclipse plugin
- aptitude install sun-java6-jdk
- # GTK, Glib, Gconf, NSS and some fonts are only needed for browser-based tests
- # also, Debian puts indic fonts somewhere else than DumpRenderTree expects them (it's built for Ubuntu)
- # you can skip this if you don't care about browser-based tests
- aptitude install libglib2.0-0 libgtk2.0-0 libnss3-1d libgconf2-4
- aptitude install msttcorefonts ttf-dejavu-core ttf-kochi-gothic ttf-kochi-mincho ttf-thai-tlwg ttf-indic-fonts
- cd /usr/share/fonts/truetype
- mkdir ttf-indic-fonts-core
- cp ttf-devanagari-fonts/* ttf-tamil-fonts/* ttf-bengali-fonts/* ttf-indic-fonts-core
- mkdir dart-all
- cd dart-all
- gclient config http://dart.googlecode.com/svn/branches/bleeding_edge/deps/all.deps
- gclient sync
- # you will get this for the first time at the end of syncing
- # WARNING: Can't download DumpRenderTree!
- # ...
- # run
- dart/third_party/gsutil/20110627/gsutil config
- # open the provided URL in the browser, login with your Google account, allow access,
- # copy the code and enter it as the "authorization code"
- #
- # ignore the instructions for obtaining project-id, leave it empty
- #
- # and finally
- dart/tools/get_drt.py runhooks
- # again, this is only needed for the first time
- cd dart
- # if you want to build debug binaries only
- tools/build.py --arch=ia32
- # if you want to build debug and release binaries
- tools/build.py --arch=ia32 --mode=all
- # if you want to run all tests and have full-blown X server installed
- # (note that this can run for quite a long time)
- tools/test.py --arch=ia32 --component=vm,dartc,chromium
- # if you don't have X server installed or don't care about browser-based tests
- tools/test.py --arch=ia32 --component=vm,dartc
- # you can also run browser-based tests in a minimal, Xvfb-based environment
- aptitude install xvfb
- xvfb-run tools/test.py --arch=ia32 --component=chromium
- # you can also add --mode argument like for tools/build.py
- # (this takes even more time!)
- tools/test.py --arch=ia32 --mode=all --component=vm,dartc,chromium
- # again, use x64 instead of ia32 for 64-bit version
- out/Debug_ia32/dart ~/hello.dart
- # those famous 17566 lines and 548 kBytes
- out/Debug_ia32/dartc --out ~/hello.js ~/hello.dart
- # but Dartc is an optimizing compiler
- # 1706 lines and 102 kB
- out/Debug_ia32/dartc --optimize --human-readable-output --out ~/hello.js ~/hello.dart
- # 26 lines and 20 kB of highly obfuscated JavaScript
- out/Debug_ia32/dartc --optimize --out ~/hello.js ~/hello.dart
- # then, there is Frog, Dart to JS compiler written in Dart
- # results in 30 lines and 1kB of nicely readable JavaScript
- out/Debug_ia32/frog/bin/frog --out=/home/ladicek/hello.js ~/hello.dart
- # not bad for a tech preview, huh?!
- # and remember it will get a hell lot better in the future!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement