summaryrefslogtreecommitdiffstats
path: root/puppet/modules/mingw/manifests/windows.pp
blob: bb20b926e53aa9bf55bdcc46609ffe8273ac49d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Downloads the given version of mingw from sourceforge.net and installs to the specified $path.
# If a different mingw version is already installed there, it is uninstalled first.
class mingw::windows(
    $version = '4.7.2',
    $path = 'C:\mingw',

    # Additional options for installed MinGW version, See also: http://qt-project.org/wiki/MinGW-64-bit
    # Note: Changing any of these won't trigger MinGW re-installation.
    #
    # either 'posix' or 'win32', we use 'posix' since it is more popular
    $threading = 'posix',

    # either 'sjlj' or 'dwarf', we use 'sjlj' since it is more popular
    $exceptions = 'sjlj',

    # installed revision
    $revision = 'rev8'
) {
    $bits = $::architecture ? {
        x64 => "64",
        default => "32"
    }

    # Match revision, match with both 'r8' and 'rev8' style patterns.
    # Just for checking if correct revision is already installed.
    $match_revision = regsubst($revision, 'rev', 'r(ev)?')

    # installer file URL
    $url = "http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/${version}/${bits}-bit/threads-${threading}/${exceptions}/x${bits}-${version}-release-${threading}-${exceptions}-${revision}.7z"

    windows::zip_package { "mingw":
        url => $url,
        version => $version,
        version_flags => "-print-search-dirs",
        version_expression => "x${bits}-${version}(-release)?-${threading}-${exceptions}-${match_revision}",
        path => $path,
        binary => "$path\\mingw\\bin\\g++.exe"
    }
}