summaryrefslogtreecommitdiffstats
path: root/qtruby/INSTALL
blob: 94fc7787fc62fbddbaae61f4d8fd02f4df9c78f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
Dependencies
------------

- ruby 1.8 or greater
- automake 1.7 or greater
- Qt 3.1 or greater 
- KDE 3.1 or greater (for korundum)

CVS Snapshot
------------

If building from a CVS snapshot, this initial make command in needed:

$ make -f Makefile.cvs

Configure flags needed
----------------------

In order to build korundum: (this is the default in fact, so you can just use ./configure)
   ./configure --with-smoke="qt kde"
in order to build just qtruby: 
   ./configure --with-smoke="qt"

Building the Qt extension without KDE build process
---------------------------------------------------

To build the Qt.so extension, provide 'extconf.rb' with the directories where
the Qt and Smoke libraries are installed:

$ cd qtruby/rubylib/qtruby
$ ruby extconf.rb --with-smoke-dir=/opt/trinity \
      --with-qt-dir=/home/duke/src/kde/HEAD/qt-copy
$ make
$ make install

Building on Mac OS X
--------------------

Automake/autoconf don't work very well on Mac OS X, and so qmake and
exconf.rb must be used instead. You can use the native Aqua/Quartz Qt/Mac 
version of Qt - QtRuby doesn't require X11.

Build Qt/Mac and install in /Developer/qt. These configure flags work well:

./configure -system-zlib -qt-gif -plugin-imgfmt-mng -thread -no-stl 
-no-exceptions -fast

Configure QtRuby and build the Smoke library:
$ ./configure '--with-qt-dir=/Developer/qt'  '--enable-mac'
$ cd smoke/tqt
# Generate the Smoke library sources:
$ perl generate.pl
# Overwrite the automake generated Makefile:
$ qmake -makefile
# Build the Smoke library and install into /usr/lib
$ sudo make
...

# Build the 'Qt' extension:
$ cd qtruby/rubylib/qtruby
$ ruby extconf.rb --with-qt-dir=/Developer/qt --with-smoke-dir=/usr \
      --with-smoke-include=../../../smoke
$ make
$ sudo make install
...

# Build the rbuic tool and install into /usr/bin
$ cd qtruby/rubylib/designer/rbuic
$ qmake -makefile
$ sudo make
...

# Build the 'tqui' TQWidgetFactory extension
$ cd qtruby/rubylib/designer/uilib
$ ruby extconf.rb --with-qtruby-include=../../qtruby --with-qt-dir=/Developer/qt
$ make
$ sudo make install

To get Mac menus to appear, when a QtRuby program is run from the command line,
link ruby against the carbon resource lib and call it 'rubyw', see:

http://www.rubygarden.org/ruby?RubyTkOnOSX

"Create rubyw executable for MacOS?: the Win32 distribution of ruby includes a 
'rubyw.exe' so I decided to attempt creating a 'rubyw' executable:

On my machine, ruby is installed at /usr/local/bin/ruby, so I did sudo 
cp /usr/local/bin/ruby /usr/local/bin/rubyw 
Using the suggestion directly above (on this page), I then ran 
sudo /Developer/Tools/Rez -t APPL Carbon.r -o rubyw 
I was then able to successfully run an example RubyTk app by 
running /usr/local/bin/rubyw ruby-1.8.0/ext/tk/sample/tkmenubutton.rb 
Everything worked as expected, and I was able to interact with the UI without 
any SetFrontProcess errors. "

Ryutaro Amano wrote this about creating a double clickable bundle:

"Thanks all, I have succeeded make rubyw.
sample script is launched in foreground.
And I have known the following steps to launch qt-ruby script by double clicking
from Finder.

As an example, I  take qtruby-1.0.11/qtruby/rubylib/tutorial/t14

cd qtruby-1.0.11/qtruby/rubylib/tutorial/t14
chmod 755 t14.rb
replace first line of t14.rb with "#!/usr/local/bin/rubyw"
mkdir -p Shoot.app/Contents/MacOS
mv t14.rb Shoot.app/Contents/MacOS/Shoot
cp {cannon.rb,gamebrd.rb,lcdrange.rb} Shoot.app/Contents/MacOS
cp  Info.plist Shoot.app/Contents

Info.plist is

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
        <key>CFBundleExecutable</key>
        <string>Shoot</string>
        <key>CFBundleIdentifier</key>
        <string>jp.co.ryutaro.qtquit</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleSignature</key>
        <string>????</string>
</dict>
</plist>

echo -n "APPL????" > Shoot.app/Contents/PkgInfo

Double click Shoot.app, Qt-Window appears in foreground."

TQScintilla text editing widget support
--------------------------------------

TQScintilla is a text editing widget with syntax highlighting for a
number of languages including ruby. It can be downloaded from here:

http://www.riverbankcomputing.co.uk/qscintilla/download.php

Use the '--enable-qscintilla=yes' configure option to build QtRuby with
TQScintilla support. The classes in a 'Qext::' module, with names such as 
Qext::Scintilla.