aboutsummaryrefslogtreecommitdiffstats
path: root/.jenkins/Jenkinsfile-OpenSSL-1.1
blob: 2ce1446dcbc8be47352d3dc5fb81bb09c2016831 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
def configs = [
    [
        label: "windows2012-openssl", arch: "x86", "vsversion": 2010
    ],
    [
        label: "windows2012-openssl", arch: "x86_64", "vsversion": 2010
    ],
    [
        label: "windows2012-openssl", arch: "x86", "vsversion": 2015
    ],
    [
        label: "windows2012-openssl", arch: "x86_64", "vsversion": 2015
    ],
]

script = """
    wmic qfe
    powershell "[Net.ServicePointManager]::SecurityProtocol = 'tls12'; wget 'https://www.openssl.org/source/openssl-1.1.0-latest.tar.gz' -OutFile 'openssl-latest.tar.gz'"
    REM Next decompress the tarball using winrar. INUL disables error msgs, which are GUI prompts and therefore undesirable
    "C:\\Program Files\\WinRAR\\WinRAR.exe" -INUL x openssl-latest.tar.gz
    cd openssl-1*
    REM The next line determines the name of the current directory. Batch is great.
    FOR %%I IN (.) DO @SET CURRENTDIR=%%~nI%%~xI
    if "%BUILDARCH%" == "x86" (
        @SET BUILDARCHFLAG=x86
        @SET OPENSSLARCHFLAG="VC-WIN32"
    ) else (
        @SET BUILDARCHFLAG=amd64
        @SET OPENSSLARCHFLAG="VC-WIN64A"
    )
    if "%BUILDVSVERSION%" == "2010" (
        call "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat" %BUILDARCHFLAG%
        echo "Building with VS 2010"
    ) else (
        call "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat" %BUILDARCHFLAG%
        echo "Building with VS 2015"
    )
    SET
    perl Configure no-comp no-shared %OPENSSLARCHFLAG%
    nmake
    nmake test

    if "%BUILDARCH%" == "x86" (
        @SET FINALDIR="openssl-win32-%BUILDVSVERSION%"
    ) else (
        @SET FINALDIR="openssl-win64-%BUILDVSVERSION%"
    )
    mkdir %FINALDIR%
    mkdir %FINALDIR%\\lib
    move include %FINALDIR%\\include
    move libcrypto.lib %FINALDIR%\\lib\\
    move libssl.lib %FINALDIR%\\lib\\
    "C:\\Program Files\\WinRAR\\WinRAR.exe" -INUL a %CURRENTDIR%-%BUILDVSVERSION%-%BUILDARCH%.zip %FINALDIR%\\include %FINALDIR%\\lib\\libcrypto.lib %FINALDIR%\\lib\\libssl.lib
"""

def build(label, vsversion, arch) {
    node(label) {
        try {
            timeout(time: 30, unit: 'MINUTES') {
                stage("Compile") {
                    withEnv(["BUILDARCH=$arch", "BUILDVSVERSION=$vsversion"]) {
                        bat script
                    }
                }
                stage("Archive") {
                    archiveArtifacts artifacts: "**/openssl-*.zip"
                }
            }
        } finally {
            deleteDir()
        }
    }
}

def builders = [:]

for (config in configs) {
    def vsversion = config["vsversion"]
    def arch = config["arch"]
    def label = config["label"]
    builders["${vsversion}-${arch}"] = {
        build(label, vsversion, arch)
    }
}

parallel builders