[ruby-gnome2-doc-cvs] [Hiki] update - インストールガイド Windows編

Zurück zum Archiv-Index

ruby-****@lists***** ruby-****@lists*****
2003年 6月 14日 (土) 01:38:51 JST


-------------------------
REMOTE_ADDR = 220.54.144.1
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/?%A5%A4%A5%F3%A5%B9%A5%C8%A1%BC%A5%EB%A5%AC%A5%A4%A5%C9+Windows%CA%D4
-------------------------
=インストールガイド

== Windows編(Ruby-1.8.0/MinGW32)

=== はじめに

* The installation should be quick and easy. The minimum packages are ((<Ruby|URL:http://www.ruby-lang.org>)), ((<"Ruby/GTK2"|URL:http://ruby-gnome2.sf.net>)) and GTK2 binaries for Windows from ((<Dropline|URL:http://www.dropline.net>)).
* The entire Ruby-GNOME2 package isn't supported on Windows yet, and may never be, as it requires GNOME 2.
* The versions of Windows are categorized in Win9X/ME and WinNT/2000/XP/2003.
* This installation process was tested with Ruby 1.8, but it should work with version 1.6 as well.

* ともかく簡単に説明しとくよ。悪いこと言わないから、PragProgの Rubyパッケージと ruby-gnome2.sf.net の Windowsパッケージ、Droplineの GTK2 Runtimeパッケージにしてね。
* 現在(0.0.4の時。0.0.5は?)Windowsはサポートしてないからね。だって GNOME 2が必要なんだし。
* Windowsの種類としては、Win9x系(95,98,Me)と NT系(NT4,2000,XP,2003)とに分かれるからね。
* Rubyのバージョンは 1.8で試したからね。たぶん 1.6でも大丈夫だけど。(パッケージ的にはその通りだけど、1.6はお勧めしない)

=== 手順

==== その一

* Download ((<Ruby packaged by the Pragmatic Programmers|URL:http://rubyinstaller.sourceforge.net/>)). 
* ((<ruby180-9.exe|URL:http://prdownloads.sourceforge.net/rubyinstaller/ruby180-9.exe?download>)) is recommended for this example. 
* Install it in any directory (Ex: c:\Ruby).

Win9x系(実際に確認したのはWinME)では、インストーラが autoexec.batに C:\ruby\bin を
追加してくれた。

 C:\>type \autoexec.bat
 SET windir=C:\WINDOWS
 SET winbootdir=C:\WINDOWS
 SET COMSPEC=C:\WINDOWS\COMMAND.COM
 SET PROMPT=$p$g
 SET TEMP=C:\WINDOWS\TEMP
 SET TMP=C:\WINDOWS\TEMP
 SET TCL_LIBRARY=c:\ruby\tcl\lib\tcl8.3
 SET RUBY_TCL_DLL=c:\ruby\bin\tcl83.dll
 SET RUBY_TK_DLL=c:\ruby\bin\tk83.dll
 SET PATH=c:\ruby\bin;C:\WINDOWS;C:\WINDOWS\COMMAND

よって、ここで一度再起動。 

NT系でもレジストリに追加されてるので、ここで一度再起動して反映しておく。

==== その二

* Download ((<"Ruby/GTK2 binaries for Windows"|URL:http://sourceforge.net/project/showfiles.php?group_id=53614>)).
* ((<ruby-gtk2-0.4.0-1-i386-msvcrt-1.8.zip|URL:http://prdownloads.sourceforge.net/ruby-gnome2/ruby-gtk2-0.4.0-1-i386-msvcrt-1.8.zip?download>)) is recommended for this example.
* Unzip it in ruby-install-dir (Ex: c:\Ruby).

ruby-gtk2-0.4.0-1-i386-msvcrt-1.8.zip を適当な場所で解凍すると lib という
ディレクトリが出来るので、これを C:\ruby 以下にコピーする。すでに同じ名前の
lib ディレクトリが存在するので、上書きでコピーをすること。

==== その三

* Download ((<GTK+2 Runtime Environment binaries for Windows from Dropline|URL:http://www.dropline.net/gtk/download.php>)).
* ((<GTK-Runtime-Environment-2.2.1.2.exe|URL:http://prdownloads.sourceforge.net/gtk-win/GTK-Runtime-Environment-2.2.1.2.exe?download>)) is recommended for this example.
* Install it in any directory (Ex: c:\Gtk).

License Agreementの画面では、「I accept the agreement」のラジオボタンを選択しないと
「Next」が押せなくなっている。
GPL LICENSEに関しては、
  * ((<GPL日本語訳|URL:http://www.gnu.org/japan/gpl-2j-plain.txt>))
  * ((<@IT::Linux用語辞典::GPL|URL:http://www.atmarkit.co.jp/aig/03linux/gpl.html>))
などを参照されたし。

==== その四

* Enough downloads. Time to configure it. Basically, there is only one Environment Variable that needs to hold the directories where the important binaries that need to be shared are located.
* Conventions:
  * ruby-install-dir is the directory where Ruby was installed. Ex: c:\Ruby
  * gtk-install-dir is the directory where GTK+2 was installed. Ex: c:\Gtk
* On Win9X/ME
  * Edit the c:\autoexec.bat file. Append a line (Yes, it should be the last one to be safer) that reads ((*SET PATH=%PATH%;ruby-install-dir\bin;gtk-install-dir\bin;gtk-install-dir\lib*)) . Reboot for the changes to take effect.
* On WinNT/2000/XP/2003
  * Open Panel Control>System>Advanced>Environment Variables. If there is a System Variable called PATH, just append to it ((*ruby-install-dir\bin;gtk-install-dir\bin;gtk-install-dir\lib*)). If there isn't one, add PATH and set its value to ((*ruby-install-dir\bin;gtk-install-dir\bin;gtk-install-dir\lib*)).

環境変数PATHに追加する作業。ただし後述の gtk2.rbに追加する方法もある。(registry.rbを持つ 1.8.0専用だけど)

==== その五

* Time to test it. Don't worry if something didn't go well, as there is a trouble shooting area below.
* The following commands should be typed on the "Prompt for DOS". To open the Prompt for DOS on:
    * Win9X/ME click on the Start Button and Run(Execute ?). Type ((*command*)) and hit the <ENTER> key.
    * WinNT/2000/XP/2003 click on the Start Button and Run(Execute ?). Type ((*cmd*)) and hit the <ENTER> key.
    C:\>ruby -v
    ruby 1.8.0 (2003-05-26) [i386-mswin32]

    C:\>ruby -e "require 'gtk2'"

    C:\>ruby -e "require 'gtk2';include Gtk;Gtk.init;w=Window.new;w.title='Hello Ruby-GNOME2 World!';w.set_size_request(500,400);w.signal_connect('delete_event'){Gtk.main_quit};w.show_all;Gtk.main"
* Don't worry about the warnings that were shown, as they are fixed on the current release, and as soon as Masahiro Sakai releases the new binaries for Windows, they will disappear.
* If it didn't return any error, it's done. From here you can follow to the ((<tutorial|URL:http://ruby-gnome2.sourceforge.net/tut/toc.htm>)).

たむらは、GTK2-Runtimeインストール直後にコマンドプロンプトから、
 SET PATH="C:\Program Files\Common Files\GTK\2.0\bin";"C:\Program Files\Common Files\GTK\2.0\lib";%PATH%
してから試してみた。gtk2.rbをいじったなら、この設定も必要ない。

((* ruby -e "require 'gtk2'" *))で大量に以下のwarning出るが気にしない。
 (eval):3: warning: instance_methods parameter will default to 'true' after 1.8.1

以上で無事 GtkなWindowが表示される。

{{attach_view('rbgtk2hello.png')}}

=== うまくいかない時は
--- PATH Environment Variable
    Check if the PATH Environment Variable is set correctly. Type SET PATH on the "Prompt for DOS" and check if it contains ((*ruby-install-dir\bin;gtk-install-dir\bin;gtk-install-dir\lib*)) as explained above. Redo the above configuration if needed. Close and Reopen the "Prompt for DOS" for it to load the new value on WinNT/2000/XP/2003, or Reboot the machine on Win9X/ME.

    The PATH Env. Var. on my system reads:
      C:\>SET PATH
      Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\dev\python;C:\j2sdk1.4.2\bin;C:\ruby\bin;C:\Gtk\bin;C:\Gtk\lib

    Be careful with directories that have spaces in their names, as that could cause breaks in the spaces, provoking errors. Try to enclose them with quotes (Ex: "c:\my spaced directory name") if you get errors with the PATH Env. Var. .
--- ruby -v
    If this command doesn't work, check if ruby-install-dir\bin is set correcly in the PATH Env. Var. .
--- ruby -e "require 'gtk2'"
    If this command doesn't work, check if gtk-install-dir\bin and gtk-install-dir\lib are set correcly in the PATH Env. Var. .

    If it still doesn't work after that, then tell us more about what kind of error you are getting on the ((<mailling lists|URL:http://sourceforge.net/mail/?group_id=53614>)).

--- レジストリから GTK2 Runtimeへの PATHを自動追加

((* 日本語版追加 *))

Dropline の GTK2 Runtimeはセットアッププログラムがインストール先をレジストリに記録するので
gtk2.rb に PATH追加ルーチンを入れてみる。

 # for dropline GTK2-Runtime DLL
 require 'win32/registry'
 GTK2Dir =
   Win32::Registry::HKEY_CURRENT_USER.open('Software\GTK\2.0')['Path']
  
 ENV['PATH'] = %w(bin lib).collect{|dir|
   "#{GTK2Dir}\\#{dir};"}.join + ENV['PATH']
  
 require 'glib2'     # ここ以降はオリジナルと一緒
 require 'pango.so'
 require 'gtk2.so'
 require 'gdk_pixbuf2.so'

このルーチンは次のパッケージに取り込まれるかも知れない。

=== 書いた人
* ((<原著|URL:http://ruby-gnome2.sourceforge.jp/hiki.cgi?Install+Guide+for+Windows>)) Joao Pedrosa - joaopedrosa at yahoo dot com

* 訳 たむら けんいち - sgs02516 at nifty dot com

=== Changelog
:2003-06-14 tamura
 gtk2.rbへの PATH追加ルーチンの説明を追記(あくまで暫定なもの)

:2003-06-13 むとう
 本インストールガイド自体のファイル名を変更しました。
:2003-06-12 tamura
 just start

-------------------------
=インストールガイド

== Windows編(Ruby-1.8.0/MinGW32)

=== はじめに

* The installation should be quick and easy. The minimum packages are ((<Ruby|URL:http://www.ruby-lang.org>)), ((<"Ruby/GTK2"|URL:http://ruby-gnome2.sf.net>)) and GTK2 binaries for Windows from ((<Dropline|URL:http://www.dropline.net>)).
* The entire Ruby-GNOME2 package isn't supported on Windows yet, and may never be, as it requires GNOME 2.
* The versions of Windows are categorized in Win9X/ME and WinNT/2000/XP/2003.
* This installation process was tested with Ruby 1.8, but it should work with version 1.6 as well.

* ともかく簡単に説明しとくよ。悪いこと言わないから、PragProgの Rubyパッケージと ruby-gnome2.sf.net の Windowsパッケージ、Droplineの GTK2 Runtimeパッケージにしてね。
* 現在(0.0.4の時。0.0.5は?)Windowsはサポートしてないからね。だって GNOME 2が必要なんだし。
* Windowsの種類としては、Win9x系(95,98,Me)と NT系(NT4,2000,XP,2003)とに分かれるからね。
* Rubyのバージョンは 1.8で試したからね。たぶん 1.6でも大丈夫だけど。(パッケージ的にはその通りだけど、1.6はお勧めしない)

=== 手順

==== その一

* Download ((<Ruby packaged by the Pragmatic Programmers|URL:http://rubyinstaller.sourceforge.net/>)). 
* ((<ruby180-9.exe|URL:http://prdownloads.sourceforge.net/rubyinstaller/ruby180-9.exe?download>)) is recommended for this example. 
* Install it in any directory (Ex: c:\Ruby).

Win9x系(実際に確認したのはWinME)では、インストーラが autoexec.batに C:\ruby\bin を
追加してくれた。

 C:\>type \autoexec.bat
 SET windir=C:\WINDOWS
 SET winbootdir=C:\WINDOWS
 SET COMSPEC=C:\WINDOWS\COMMAND.COM
 SET PROMPT=$p$g
 SET TEMP=C:\WINDOWS\TEMP
 SET TMP=C:\WINDOWS\TEMP
 SET TCL_LIBRARY=c:\ruby\tcl\lib\tcl8.3
 SET RUBY_TCL_DLL=c:\ruby\bin\tcl83.dll
 SET RUBY_TK_DLL=c:\ruby\bin\tk83.dll
 SET PATH=c:\ruby\bin;C:\WINDOWS;C:\WINDOWS\COMMAND

よって、ここで一度再起動。 

NT系でもレジストリに追加されてるので、ここで一度再起動して反映しておく。

==== その二

* Download ((<"Ruby/GTK2 binaries for Windows"|URL:http://sourceforge.net/project/showfiles.php?group_id=53614>)).
* ((<ruby-gtk2-0.4.0-1-i386-msvcrt-1.8.zip|URL:http://prdownloads.sourceforge.net/ruby-gnome2/ruby-gtk2-0.4.0-1-i386-msvcrt-1.8.zip?download>)) is recommended for this example.
* Unzip it in ruby-install-dir (Ex: c:\Ruby).

ruby-gtk2-0.4.0-1-i386-msvcrt-1.8.zip を適当な場所で解凍すると lib という
ディレクトリが出来るので、これを C:\ruby 以下にコピーする。すでに同じ名前の
lib ディレクトリが存在するので、上書きでコピーをすること。

==== その三

* Download ((<GTK+2 Runtime Environment binaries for Windows from Dropline|URL:http://www.dropline.net/gtk/download.php>)).
* ((<GTK-Runtime-Environment-2.2.1.2.exe|URL:http://prdownloads.sourceforge.net/gtk-win/GTK-Runtime-Environment-2.2.1.2.exe?download>)) is recommended for this example.
* Install it in any directory (Ex: c:\Gtk).

License Agreementの画面では、「I accept the agreement」のラジオボタンを選択しないと
「Next」が押せなくなっている。
GPL LICENSEに関しては、
  * ((<GPL日本語訳|URL:http://www.gnu.org/japan/gpl-2j-plain.txt>))
  * ((<@IT::Linux用語辞典::GPL|URL:http://www.atmarkit.co.jp/aig/03linux/gpl.html>))
などを参照されたし。

==== その四

* Enough downloads. Time to configure it. Basically, there is only one Environment Variable that needs to hold the directories where the important binaries that need to be shared are located.
* Conventions:
  * ruby-install-dir is the directory where Ruby was installed. Ex: c:\Ruby
  * gtk-install-dir is the directory where GTK+2 was installed. Ex: c:\Gtk
* On Win9X/ME
  * Edit the c:\autoexec.bat file. Append a line (Yes, it should be the last one to be safer) that reads ((*SET PATH=%PATH%;ruby-install-dir\bin;gtk-install-dir\bin;gtk-install-dir\lib*)) . Reboot for the changes to take effect.
* On WinNT/2000/XP/2003
  * Open Panel Control>System>Advanced>Environment Variables. If there is a System Variable called PATH, just append to it ((*ruby-install-dir\bin;gtk-install-dir\bin;gtk-install-dir\lib*)). If there isn't one, add PATH and set its value to ((*ruby-install-dir\bin;gtk-install-dir\bin;gtk-install-dir\lib*)).

環境変数PATHに追加する作業。ただし後述の gtk2.rbに追加する方法もある。(registry.rbを持つ 1.8.0専用だけど)

==== その五

* Time to test it. Don't worry if something didn't go well, as there is a trouble shooting area below.
* The following commands should be typed on the "Prompt for DOS". To open the Prompt for DOS on:
    * Win9X/ME click on the Start Button and Run(Execute ?). Type ((*command*)) and hit the <ENTER> key.
    * WinNT/2000/XP/2003 click on the Start Button and Run(Execute ?). Type ((*cmd*)) and hit the <ENTER> key.
    C:\>ruby -v
    ruby 1.8.0 (2003-05-26) [i386-mswin32]

    C:\>ruby -e "require 'gtk2'"

    C:\>ruby -e "require 'gtk2';include Gtk;Gtk.init;w=Window.new;w.title='Hello Ruby-GNOME2 World!';w.set_size_request(500,400);w.signal_connect('delete_event'){Gtk.main_quit};w.show_all;Gtk.main"
* Don't worry about the warnings that were shown, as they are fixed on the current release, and as soon as Masahiro Sakai releases the new binaries for Windows, they will disappear.
* If it didn't return any error, it's done. From here you can follow to the ((<tutorial|URL:http://ruby-gnome2.sourceforge.net/tut/toc.htm>)).

たむらは、GTK2-Runtimeインストール直後にコマンドプロンプトから、
 SET PATH="C:\Program Files\Common Files\GTK\2.0\bin";"C:\Program Files\Common Files\GTK\2.0\lib";%PATH%
してから試してみた。gtk2.rbをいじったなら、この設定も必要ない。

((* ruby -e "require 'gtk2'" *))で大量に以下のwarning出るが気にしない。
 (eval):3: warning: instance_methods parameter will default to 'true' after 1.8.1

以上で無事 GtkなWindowが表示される。

{{attach_view('rbgtk2hello.png')}}

=== うまくいかない時は
--- PATH Environment Variable
    Check if the PATH Environment Variable is set correctly. Type SET PATH on the "Prompt for DOS" and check if it contains ((*ruby-install-dir\bin;gtk-install-dir\bin;gtk-install-dir\lib*)) as explained above. Redo the above configuration if needed. Close and Reopen the "Prompt for DOS" for it to load the new value on WinNT/2000/XP/2003, or Reboot the machine on Win9X/ME.

    The PATH Env. Var. on my system reads:
      C:\>SET PATH
      Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\dev\python;C:\j2sdk1.4.2\bin;C:\ruby\bin;C:\Gtk\bin;C:\Gtk\lib

    Be careful with directories that have spaces in their names, as that could cause breaks in the spaces, provoking errors. Try to enclose them with quotes (Ex: "c:\my spaced directory name") if you get errors with the PATH Env. Var. .
--- ruby -v
    If this command doesn't work, check if ruby-install-dir\bin is set correcly in the PATH Env. Var. .
--- ruby -e "require 'gtk2'"
    If this command doesn't work, check if gtk-install-dir\bin and gtk-install-dir\lib are set correcly in the PATH Env. Var. .

    If it still doesn't work after that, then tell us more about what kind of error you are getting on the ((<mailling lists|URL:http://sourceforge.net/mail/?group_id=53614>)).

--- レジストリから GTK2 Runtimeへの PATHを自動追加

((* 日本語版追加 *))

Dropline の GTK2 Runtimeはセットアッププログラムがインストール先をレジストリに記録するので
gtk2.rb に PATH追加ルーチンを入れてみる。

 # for dropline GTK2-Runtime DLL
 require 'win32/registry'
 GTK2Dir =
   Win32::Registry::HKEY_CURRENT_USER.open('Software\GTK\2.0')['Path']
  
 ENV['PATH'] = %w(bin lib).collect{|dir|
   "#{GTK2Dir}\\#{dir};"}.join + ENV['PATH']
  
 require 'glib2'     # same as original
 require 'pango.so'
 require 'gtk2.so'
 require 'gdk_pixbuf2.so'

このルーチンは次のパッケージに取り込まれるかも知れない。

=== 書いた人
* ((<原著|URL:http://ruby-gnome2.sourceforge.jp/hiki.cgi?Install+Guide+for+Windows>)) Joao Pedrosa - joaopedrosa at yahoo dot com

* 訳 たむら けんいち - sgs02516 at nifty dot com

=== Changelog
:2003-06-14 tamura
 日本語での説明を若干追加
 gtk2.rbへの PATH追加ルーチンの説明を追記(あくまで暫定なもの)

:2003-06-13 むとう
 本インストールガイド自体のファイル名を変更しました。
:2003-06-12 tamura
 just start





ruby-gnome2-cvs メーリングリストの案内
Zurück zum Archiv-Index