Dartをインストールしてみよう!
まず、作業用ディレクトリを作成し、Google Chromeのオープンソース版のビルドに利用するツール群(depot_tools)をインストールします。
mkdir dart cd dart svn co http://src.chromium.org/svn/trunk/tools/depot_tools export PATH="$PATH":`pwd`/depot_tools
次に、Dartのソースコードをチェックアウトします。
gclient config http://dart.googlecode.com/svn/trunk/deps/all.deps gclient sync
sync処理には10分ほどかかります。初回実行時には、Google Strageにコンソールからアクセスするためのgsutilの設定をしていないので、以下のようなワーニングが出て処理が止まります。
******************************************************************************* * WARNING: Can't download DumpRenderTree! This is required to test client apps. * You need to do a one-time configuration step to access Google Storage. * Please run this command and follow the instructions: * third_party/gsutil/20110627/gsutil config * * NOTE: When prompted you can leave "project-id" blank. Just hit enter. ******************************************************************************* Error: Command /usr/bin/python dart/tools/get_drt.py runhooks returned non-zero exit status 1 in /Users/daisuke/dart
gsutilの設定をするために、下記のコマンドを実行します。
dart/third_party/gsutil/20110627/gsutil config
以下のようなメッセージが表示されたら、文章中のURLをコピーしブラウザでアクセスします。
Please navigate your browser to the following URL: https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdevstorage.full_control&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=XXXXXXXXXXXX.apps.googleusercontent.com In your browser you should see a page that requests you to authorize gsutil to access Google Storage on your behalf. After you approve, an authorization code will be displayed. Enter the authorization code:
ブラウザでアクセスすると、以下のようなページが表示されるので、[アクセスを許可]ボタンを押してください。

次のページで以下のようにコードが表示されたら、ターミナルにコピーし[Enter]キーを押します。

再度、同じようにProject IDの入力を促されるので、本文中のURLをコピーしブラウザでアクセスします。
Please navigate your browser to http://code.google.com/apis/console, then click "Services" on the left side panel and ensure you have Storage activated, then click "Storage" on the left side panel and find the "x-goog-project-id" on that page. What is your project-id?
ブラウザでアクセスし、[Service]から「Google Strage」を選択します。
次のページで表示される「x-goog-project-id」の数字を、先ほどと同じようにターミナルにコピーして、[Enter]キーを押します。
これでgsuilの設定は終了です。1回目のsync処理が途中で停止したので、もう一度sync処理を実行します。先ほど終了している処理はスキップするため、今回はすぐに終了します。
gclient sync
現在のXcodeの最新バージョンは4.1ですが、Dartのビルド環境としては3.2の利用が強く推奨されています。
iPhoneやLion用のアプリ開発をしているなどの理由から3.2を利用できない場合は、dart/tools/build.pyの108行目に'-sdk'、'macosx10.6'と追加することでDartをビルドできるようになります。Xcode3.2を利用している人はこの修正は不要です。
args = ['xcodebuild',
'-sdk',
'macosx10.6',
'-project',
project_file,
'-target',
target,
'-parallelizeTargets',
'-configuration',
build_config,
ここまでで、ビルドの準備ができました。以下のコマンドでDartをビルドします。
cd dart/ ./tools/build.py --arch=x64 --mode=release
ビルドされたバイナリ一式はxcodebuild/Release_x64/以下に生成されるので、好きな場所(ここでは/usr/local/dart/)にコピーしてパスを通します。
mkdir /usr/local/dart/ cp -R xcodebuild/Release_x64/ /usr/local/dart/ export PATH=/usr/local/dart/:$PATH
これでDartのビルドが完了しました。


