-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathopenssl.gradle
More file actions
89 lines (78 loc) · 2.5 KB
/
openssl.gradle
File metadata and controls
89 lines (78 loc) · 2.5 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
task prepareOpenSSLDirectories {
mustRunAfter clean
doLast {
mkdir project.openssl_build_dir
mkdir project.openssl_install
}
}
project.tasks.create("downloadJom", Download) {
src 'https://qt.mirror.constant.com/official_releases/jom/jom_1_1_3.zip'
dest buildDir
overwrite false
}
project.tasks.create("unzipJom", Copy) {
dependsOn downloadJom
from zipTree("$buildDir/jom_1_1_3.zip")
into "$buildDir/jom"
}
// Runs the configure step.
project.tasks.create("configureOpenSSL", 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", "no-tests", "--prefix=${project.openssl_install}", "--libdir=lib"
workingDir project.openssl_build_dir
// Add the arch specifier for Windows.
if (project.platform.contains("windows")) {
if (project.platform == "windows-arm64") {
args "VC-WIN64-ARM"
} else {
args "VC-WIN64A"
}
args "/FS"
dependsOn unzipJom
} else if (project.platform == "osx-arm64") {
args "darwin64-arm64-cc"
environment "ARCHFLAGS", "-arch arm64"
} else if (project.platform == "osx-x86_64") {
args "darwin64-x86_64-cc"
environment "ARCHFLAGS", "-arch x86_64"
} else {
args "--openssldir=/usr/local/ssl"
if (project.platform == "linux-arm64") {
args "linux-aarch64"
if (project.hasProperty('forcecrossbuild')) {
args "--cross-compile-prefix=aarch64-bookworm-linux-gnu-"
}
}
}
dependsOn prepareOpenSSLDirectories
}
def make = project.platform.contains("windows") ? "$buildDir/jom/jom.exe" : "make"
// Runs the build step.
project.tasks.create("buildOpenSSL", Exec) {
// Make sure that we are configured.
dependsOn "configureOpenSSL"
// OpenSSL is built with make on UNIX and jom on Windows.
executable make
args "install_dev"
workingDir project.openssl_build_dir
args "-j${project.processors}"
}
// Create a "mega-task" that builds everything.
project.tasks.create("openSSL") {
dependsOn "buildOpenSSL"
outputs.dir(project.openssl_install)
if (project.platform.contains("windows")) {
doLast {
copy {
from "$project.openssl_install/lib/libcrypto.lib"
from "$project.openssl_install/lib/libssl.lib"
into "$project.openssl_install/lib"
rename("libcrypto.lib", "libcryptod.lib")
rename("libssl.lib", "libssld.lib")
}
}
}
}