gen.rb
gen.rb is a Ruby script that is a combination of the two scripts dstepgen.rb and dgen.rb. The script first invokes the dstepgen.rb script and then dgen.rb on the result of the first script.
What's needed to run the script?
You basically need two things: Ruby and gem. All other needed libraries are available through gem. If you run Mac OS X 10.5 (Leopard) then you should already have Ruby and gem.
- Ruby
- Gem
- xml-simple
- Builder
Usage
If you run the script with the "-h" option the help is displayed:
Usage: gen.rb [options] <frameworks...>
Options:
-u, --umbrella FRAMEWORK Link against the given umbrella framework.
--64-bit Write 64-bit annotations.
-p, --private Include private frameworks.
-o, --output DIRECTORY Place the output file(s) in this directory.
-c, --code CODE Inject CODE in the type file.
-d, --dependencies Write dependencies to stdout and exit.
-h, --help Show this message and exit.
-v, --version Show version and exit.
Use the `-h' flag or for help.
- -u
- This will link against the given umbrella framework instead of the framework currently generating bindings for. This is useful if you generate bindings for a sub framework that is a part of an umbrella framework.
- --64-bit
- Also generates 64bit specific metadata, for example the type "NSInteger" will be 32 bits long on 32bit operating systems and 64 bits long on 64bit systems.
- -p
- Includes private frameworks.
- -o
- An existing directory to place all the generated D files in. Required option.
- -c
- Inject the give code in the file used to find all the types. This can be used to include type definitions or include other headers.
- -d
- Collects all the dependencies of the given framework and prints them to stdout.
Examples:
Generate D bindings to the Foundation framework and place the output in bindings:
mkdir bindings ./gen.rb -o bindings Foundation
