dstepgen.rb
dstepgen.rb is a Ruby script that generates metadata as an XML representation of the Objective-C/C headers. The script is a modified version of BridgeSupport to better suite the needs to generate D files. The files generated by dstepgen.rb are called dstep files and have the file extension .dstep. Just like with BridgeSupport these files can be used to create bindings for other languages than D.
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
- Builder
Usage
If you run the script with the "-h" option the help is displayed:
Usage: dstepgen.rb [options] <headers...> Options: -f, --framework FRAMEWORK Generate metadata for the given framework. -u, --umbrella FRAMEWORK Link againts the given umbrella framework. --64-bit Write 64-bit annotations. -o, --output FILE Write output to the given file. -c, --code FILE The path to a file with code to inject -d, --dependencies Write framework dependencies and exit -s, --option OPTION Pass OPTION to the compiler -e, --extra Included extra headers -x, --exclude HEADER Exclude the given header file -h, --help Show this message. -v, --version Show version. Use the `-h' flag or for help.
- -f
- Specifies a framework to generate metadata from. This can either be a name of a system framework like "Foundation" or a path to a custom framework like "/path/to/my/custom/Framework.framework".
- -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.
- -o
- Where to place the output, defaults to stdout
- -c
- A path to a file with code to inject. 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.
- -s
- Pass the given option to the compiler that is used to get the types.
- -e
- Include extra headers in the file that is used to get the types.
- -x
- Exclude the given header from the file that is used to get the types.
Examples:
Generate metadata of the Foundation framework and place the output in Foundation.dstep:
./dstepgen.rb -f Foundation -o Foundation.dstep
Generate metadata of two C header files:
./dstepgen.rb -o Headers.dstep HeaderA.h HeaderB.h
License
Revised BSD license also known as three clause BSD license. (L)GPL compatible.