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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta http-equiv="Content-Language" content="en">
<title>Creating Packages with setup.rb</title>
</head>
<body>
<h1>Creating Packages with setup.rb</h1>
<h2>Creating Single Package Archive</h2>
<p>
"Single Package Archive" means the archive which includes
only one PACKAGE. "package" means one set of ruby scripts,
ruby extentions, commands, and data files.
</p>
<p>
setup.rb requires that the archive is structured like this:
</p>
<pre>
PackageTop/
setup.rb
lib/
(ruby scripts)
ext/
(ruby extentions)
bin/
(commands)
data/
(data files)
conf/
(configuration files)
man/
(manual pages)
test/
(tests)
</pre>
<p>
Each file/directories acts as below:
</p>
<dl>
<dt>setup.rb</dt>
<dd><p>
The installer. This file is included in this archive.
Just copy it to your package.
</p>
</dd>
<dt>lib/, bin/, data/, conf/, man/</dt>
<dd><p>
These directories includes files which are to be installed.
This directory tree is mirrored to the target directory, from 'lib/'
to 'RUBYLIB/', from 'bin/' to 'BINDIR/', from 'data/' to 'DATADIR/' ....
</p>
<p>
Use 'lib/' for ruby scripts, 'bin/' for commands, 'data/' for any
other data files, 'conf/' for configuration files, 'man/' for
manual pages.
</p>
</dd>
<dt>ext/</dt>
<dd><p>
'ext/' directory includes source code of ruby extentions.
If you want to install 'RUBYLIB/ARCH/someext.so', create
a directory 'ext/someext/' and put source files into it.
</p>
<p>
[WARNING] All extention source directories MUST include
extconf.rb or MANIFEST.
</p>
</dd>
<dt>test/</dt>
<dd><p>
'test/' directory contains test scripts. You must write
test scripts which run on test/unit library.
</p>
</dd>
</dl>
<h2>Creating Multi-Package Archive</h2>
<p>
setup.rb can handle an archive which includes multiple PACKAGEs.
</p>
<p>
setup.rb requires the archive is structured as below:
</p>
<pre>
PackageTop/
setup.rb
packages/ <--- fixed name
tmail/ <--- tmail package
bin/
lib/
ext/
data/
conf/
man/
test/
raccrt/ <--- raccrt package
bin/
lib/
ext/
data/
conf/
man/
test/
strscan/ <--- strscan package
bin/
lib/
ext/
data/
conf/
man/
test/
amstd/ <--- amstd package
bin/
lib/
ext/
data/
conf/
man/
test/
</pre>
<h2>Hooking Tasks</h2>
<p>
You can hook any tasks, such as "config" "setup".
For example, you want to make some files in 'lib/tmail/' when setup.
Then create file 'lib/tmail/pre-setup.rb' and put this:
</p>
<pre>
# pre-setup.rb
# process grammer file
system "racc #{srcdir_root + '/src/mp.y'} -o mailp.rb"
# require all ruby scripts in this directory from _loadlib.rb.
list = Dir.glob(curr_srcdir + '/*.rb').collect {|n| File.basename(n) }
File.open( '_loadlib.rb', 'w' ) {|f|
f.puts list.collect {|n| "require 'tmail/" + n + "'" }
}
File.open( '../tmail.rb', 'w' ) {|f|
f.puts "require 'tmail/_loadlib'"
}
</pre>
<p>
This file is evaluated on task "setup" in the directory,
before processing any other thing. Acceptable hook file names are:
</p>
<pre>
{pre,post}-{config,setup,install,test,clean,distclean}.rb
</pre>
<p>
[NOTE] You can also put hook files in the top directory of archive
and/or the type-root directory ('bin/', 'lib/',...).
</p>
<h2>srcdir/objdir support</h2>
<p>
setup.rb supports srcdir/objdir separation. In other words,
you can compile everything out of the source directory.
</p>
<p>
If you write hooks, you should supports srcdir/objdir system.
When you read source code, read it from srcdir. When you write
anything, write it to the current directory. There's also some
APIs to help your work. see
,<a href="hookapi.html">Hook Script APIs Reference Manual</a>
</p>
<h2>metaconfig</h2>
<p>
You can add new config options by writing file "metaconfig".
metaconfig must be placed in the package-root directory.
</p>
<p>
Here is a simple example of metaconfig.
</p>
<pre>
add_path_config 'libc', '/lib/libc.so', 'path to the C standard library'
add_bool_config 'win32', false, 'compile with Win32 support'
</pre>
<p>
This script defined new config option --libc and --win32.
</p>
<p>
In 'metaconfig', you can use some APIs described in
,<a href="metaconfapi.html">metaconfig API Reference Manual</a>
</p>
<h2>Backward Compatibility</h2>
<p>
I do not assure any backward compatibility for the setup.rb.
If you'd like old behavior, just use old version.
</p>
<h2>License</h2>
<p>
GNU LGPL, Lesser General Public License version 2.1.
For details, see file "COPYING".
</p>
<p>
NOTE: You CAN distribute your program under the any licenses
you like. LGPL does not force you to make your programs LGPL
while the installer is LGPL'ed one.
</p>
<h2>Installation Manual</h2>
<p>
You can freely copy/edit and/or distribute Usage_*.txt files
which are included in this archive. I do not claim any rights
on them. Removing my copyright is also OK.
</p>
</body>
</html>
|