-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathopensslosx.gradle
More file actions
157 lines (122 loc) · 4.13 KB
/
opensslosx.gradle
File metadata and controls
157 lines (122 loc) · 4.13 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
task prepareOpenSSLDirectories {
mustRunAfter clean
doLast {
mkdir project.openssl_arm_build_dir
mkdir project.openssl_arm_install
mkdir project.openssl_intel_build_dir
mkdir project.openssl_intel_install
}
}
// Runs the configure step.
project.tasks.create("configureOpenSSLIntel", Exec) {
// OpenSSL is configured with Perl. We want to build static libraries and specify
// a custom installation location.
executable "perl"
def configureLocation = project.file("$project.openssl_dir/Configure")
args configureLocation, "no-shared", "--prefix=${project.openssl_intel_install}", "--libdir=lib"
workingDir project.openssl_intel_build_dir
// Add the arch specifier for Windows.
args "darwin64-x86_64-cc"
environment "ARCHFLAGS", "-arch x86_64"
dependsOn prepareOpenSSLDirectories
}
project.tasks.create("configureOpenSSLArm", Exec) {
// OpenSSL is configured with Perl. We want to build static libraries and specify
// a custom installation location.
executable "perl"
def configureLocation = project.file("$project.openssl_dir/Configure")
args configureLocation, "no-shared", "--prefix=${project.openssl_arm_install}", "--libdir=lib"
workingDir project.openssl_arm_build_dir
// Add the arch specifier for Windows.
args "darwin64-arm64-cc"
environment "ARCHFLAGS", "-arch arm64"
dependsOn prepareOpenSSLDirectories
}
def make = "make"
// Runs the build step.
project.tasks.create("buildOpenSSLIntel", Exec) {
// Make sure that we are configured.
dependsOn "configureOpenSSLIntel"
// OpenSSL is built with make on UNIX and nmake on Windows.
executable make
workingDir project.openssl_intel_build_dir
args "-j${project.processors}"
}
// Runs the build step.
project.tasks.create("buildOpenSSLArm", Exec) {
// Make sure that we are configured.
dependsOn "configureOpenSSLArm"
// OpenSSL is built with make on UNIX and nmake on Windows.
executable make
workingDir project.openssl_arm_build_dir
args "-j${project.processors}"
}
// Runs the install step.
project.tasks.create("installOpenSSLIntel", Exec) {
// Make sure that we have built.
dependsOn "buildOpenSSLIntel"
// OpenSSL is installed with make on UNIX and nmake on Windows.
executable make
args "install_sw"
workingDir project.openssl_intel_build_dir
// UNIX supports installing with multiple workers.
args "-j${project.processors}"
}
project.tasks.create("installOpenSSLArm", Exec) {
// Make sure that we have built.
dependsOn "buildOpenSSLArm"
// OpenSSL is installed with make on UNIX and nmake on Windows.
executable make
args "install_sw"
workingDir project.openssl_arm_build_dir
args "-j${project.processors}"
}
project.tasks.create("copyOpenSSLHeaders", Copy) {
dependsOn "installOpenSSLArm"
dependsOn "installOpenSSLIntel"
from "$project.openssl_arm_install/include"
into "$project.openssl_install/include"
}
project.tasks.create("mergeCryptoBinaries", Exec) {
dependsOn "installOpenSSLArm"
dependsOn "installOpenSSLIntel"
def output = project.file("$project.openssl_install/lib/libcrypto.a")
outputs.file output
def arm_input = project.file("$project.openssl_arm_install/lib/libcrypto.a")
def intel_input = project.file("$project.openssl_intel_install/lib/libcrypto.a")
inputs.file arm_input
inputs.file intel_input
executable 'lipo'
args = [
'-create',
arm_input,
intel_input,
'-output',
output
]
}
project.tasks.create("mergeSSLBinaries", Exec) {
dependsOn "installOpenSSLArm"
dependsOn "installOpenSSLIntel"
def output = project.file("$project.openssl_install/lib/libssl.a")
outputs.file output
def arm_input = project.file("$project.openssl_arm_install/lib/libssl.a")
def intel_input = project.file("$project.openssl_intel_install/lib/libssl.a")
inputs.file arm_input
inputs.file intel_input
executable 'lipo'
args = [
'-create',
arm_input,
intel_input,
'-output',
output
]
}
// Create a "mega-task" that builds everything.
project.tasks.create("openSSL") {
dependsOn "copyOpenSSLHeaders"
dependsOn "mergeSSLBinaries"
dependsOn "mergeCryptoBinaries"
outputs.dir(project.openssl_install)
}