Skip to content

Latest commit

 

History

History
162 lines (119 loc) · 5.95 KB

File metadata and controls

162 lines (119 loc) · 5.95 KB

Hacking CompilerKit

Status

Getting started

  1. Install the dependencies for your platform.
  2. Fork the project here.
  3. Learn how to contribute.
  4. Build CompilerKit.
  5. Read Documentation.

How to contribute

  1. Find something to work on:
  2. Add your improvements to a branch named for the issue.
  3. Send in a pull request.
  4. Profit!

Or, file a bug report.

Getting your branch merged checklist

Use topic branches for your work

Topic branches isolate chunks of work so that it's easier for others to merge in.

  1. Create a new branch: git checkout -b issueXYZ
  2. Hack away, making commits along the way.
  3. Push your issue branch to github: git push origin issueXYZ
  4. Switch to that branch in github, and send in a pull request for feedback.

Sometimes, it's necessary to switch between branches. Your work will always be saved.

  • To switch back to master: git checkout master
  • To see the branches: git branch

Test your changes

I will not merge code into my master branch until it has passing test cases in the test suite. If the changes include documentation, then ensure the documentation looks as expected. If the changes include code, ensure it works.

If the code is a demo

  1. Ensure the project builds successfully.
  2. Ensure the demo works.

If the code is not a demo

  1. Write test cases for your code.
  2. Add test cases to the test suite.
  3. Ensure the project builds successfully.
  4. Ensure the test suite passes.

What to install on Windows

You will need to download and install everything manually. Therefore, verify everything is working first before building CompilerKit.

How do I know it's working?

Open Git Bash to the CompilerKit folder. Type in the first line. Did you see the rest? You should.

pkg-config --list-all
gio-2.0               GIO - glib I/O library
gmodule-2.0           GModule - Dynamic module loader for GLib
glib-2.0              GLib - C Utility Library
gmodule-no-export-2.0 GModule - Dynamic module loader for GLib
gthread-2.0           GThread - Thread support for GLib
gobject-2.0           GObject - GLib Type, Object, Parameter and Signal Library

Did you see command not found after typing these into Git Bash? You should not.

  • doxygen
  • cmake

What to install on Linux

In the terminal, paste this in for your distribution:

Red Hat:

sudo yum install git cmake doxygen glib-devel pkgconfig

Debian, Ubuntu:

sudo apt-get install git cmake doxygen libglib2.0-dev pkg-config

What to install on Mac

If you do not already have it, install:

In the terminal, paste this in:

/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

Once installed, paste this into the Terminal:

brew install git cmake doxygen glib pkg-config

How do I build CompilerKit?

CompilerKit builds with CMake.

The first time you build, do this:

mkdir build && cd build
cmake ..
cmake --build .

For subsequent builds, in the build folder, just run cmake --build .

Where is the documentation?

After building CompilerKit, look inside the docs/html folder.

Also, read up on GLib and GObject.

How do I use GLib?

GLib is a C utility library similar to the Standard Template Library in C++. It provides data structures as well as GObject.

To use it, read these first:

What do the GObject macros mean?

Let's compare with some examples.

GObject                                Java/C#
(prefix everything with COMPILERKIT)   package CompilerKit;
COMPILERKIT_IS_ALTERNATION(obj)        (obj instanceof Alternation)
COMPILERKIT_ALTERNATION (obj)          (Alternation) obj
COMPILERKIT_TYPE_ALTERNATION           Alternation.class
G_OBJECT_TYPE (obj)                    obj.getClass()

How do I use GObject?

GObject may seem intimidating. Learn how it works, and realize that OOP languages provide a lot of shortcuts that C exposes to the programmer.

To use GObject, read these first:

How do I write GObject classes?

Run ./generate.sh, and follow the instructions.