backbone.ws

The article currently is obsolete. I think pacman is better (but requires >= win6.0) https://msys2.github.io/.

MSYS installation steps

pacman -Syu
pacman -Su
 
# 64-bit
pacman -S mingw-w64-x86_64-toolchain
pacman -S mingw-w64-x86_64-glib2
pacman -S mingw-w64-x86_64-gtk3
pacman -S mingw-w64-x86_64-vala
pacman -S mingw-w64-x86_64-libgee
pacman -S mingw-w64-x86_64-perl
pacman -S make mingw-w64-x86_64-cmake
 
# 32-bit
pacman -S mingw-w64-i686-toolchain
pacman -S mingw-w64-i686-glib2
pacman -S mingw-w64-i686-gtk3
pacman -S mingw-w64-i686-vala
pacman -S mingw-w64-i686-libgee
pacman -S make mingw-w64-i686-cmake
pacman -S mingw-w64-i686-perl
 
# examples
valac -C --pkg gtk+-3.0 hello.vala
gcc `pkg-config --cflags gtk+-3.0` hello.c `pkg-config --libs gtk+-3.0`

Create shortcuts c:\msys64\msys2_shell.cmd -mingw64 for 64bit environment, c:\msys64\msys2_shell.cmd -mingw32 for 32bit environment under 64bit system and c:\msys32\msys2_shell.cmd -mingw32 for 32bit environment under 32bit system only.

I've just found Nice Manual Page how to install latest MinGW/GTK+3.0/Vala-git instruments under windows.

I'll make a copy-paste of the page to prevent deletion.

  1. Run “mingw-w64-install.exe”, select “x32” or “i686” as Architecture, “win32” as Threads and “sjlj” as Exception:
  2. Continue installation, I placed my to “C:\mingw-w64”.
  3. Download the latest “external-binary-packages” from http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/ and copy the “msys” directory to “C:\mingw-w64\mingw32”.
  4. Open “‪C:\mingw-w64\mingw32\msys\etc\fstab” with Notepad++ and add the line “C:\mingw-w64\mingw32 /mingw”.
  5. Download the Win32 GTK+ “all-in-one bundle” from http://win32builder.gnome.org/ and extract it's content to “C:\mingw-w64\mingw32”.
  6. Create a new shortcut, e.g. on the Desktop and set the location to “C:\mingw-w64\mingw32\msys\bin\mintty.exe /bin/bash -l” in order to get a nice shell.
  7. Download the latest source tarball from https://wiki.gnome.org/Projects/Vala/Release and extract it to “C:\mingw-w64\mingw32\msys\home\{Your Username}”.
  8. Run the Mintty shortcut you created in step 7 and switch with “cd” to the vala source directory.
  9. Run “ln -s /mingw/bin/gcc /mingw/bin/cc” since valac requires cc command instead of gcc;
  10. Run “rm $SYSTEMROOT/system32/zlib1.dll because of it is incompatible with the toolchain;
  11. Now you should be able to run the fallowing three commands without any issues:

    Building and installing Vala

    ./configure --prefix=/mingw --host=i686-w64-mingw32
    make
    make install
  12. Run “valac” to see if it works:

    Test Vala

    $ valac --version
    Vala 0.22.1
  13. Go to “Control Panel\System and Security\System” → “Advanced system settings” → “Environment Variables” and add this to your “Path” system variable:

    $PATH

    C:\mingw-w64\mingw32\bin
  14. Create somewhere a file called “hello.vala” and paste in this:

    Hello world!

    using Gtk;
     
    int main (string[] args) {
        Gtk.init (ref args);
     
        var window = new Window ();
        window.title = "First GTK+ Program";
        window.border_width = 10;
        window.window_position = WindowPosition.CENTER;
        window.set_default_size (350, 70);
        window.destroy.connect (Gtk.main_quit);
     
        var button = new Button.with_label ("Click me!");
        button.clicked.connect (() => {
            button.label = "Thank you";
        });
     
        window.add (button);
        window.show_all ();
     
        Gtk.main ();
        return 0;
    }
  15. Open a normal Windows CMD, cd to the location of the file and run “valac –pkg gtk+-3.0 -X -mwindows hello.vala”
  16. Execute the compiled “hello.exe”, you should see your first Vala GTK+ window, congratulation :

A lot of thanks to Hendrik! :)