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.
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.
- 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.
- 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.
- Includes private frameworks.
- An existing directory to place all the generated D files in. Required option.
- 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.
- Collects all the dependencies of the given framework and prints them to stdout.
Generate D bindings to the Foundation framework and place the output in bindings:
mkdir bindings ./gen.rb -o bindings Foundation