-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_fossil.ps1
84 lines (65 loc) · 2.03 KB
/
build_fossil.ps1
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
#requires -version 3.0
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2021-05-31 00:45:39 -0600
param(
[parameter(Mandatory=$true,
Position=0,
HelpMessage='fossil version to build (eg - 2.15.1)')]
[validateset('2.15.1')]
[alias('v')]
[string] $version,
[parameter(HelpMessage='perform a 64-bit build')]
[switch] $x64,
[parameter(HelpMessage='path to OpenSSL dev library root directory')]
[alias('with-ssl-dir')]
[string] $SSL_DIR = 'C:/devlibs/openssl/x86/1.1.1k'
)
$libname = 'fossil'
$source = "${libname}-src-${version}.tar.gz"
$build_name = "${libname}-${version}"
$repo_root = "https://fossil-scm.org/home/uv/"
$archive = "${repo_root}${source}"
$hash_uri = "https://raw.github.com/jonforums/buildlets/master/hashery/${libname}.sha1"
# source the buildlet library
. "$PWD\buildlet_utils.ps1"
# download source archive
Fetch-Archive
# download hash data and validate source archive
Validate-Archive
# extract
Extract-Archive
# patch, configure, build, archive
Push-Location "${build_src_dir}"
# activate toolchain
Activate-Toolchain
# configure
Configure-Build {
$SSL_DIR = $SSL_DIR.Replace('\', '/')
if ($SSL_DIR.ToLower() -eq 'no') { $SSL_DIR = $null }
$defs = [System.Collections.ArrayList]@('FOSSIL_ENABLE_JSON=1')
if ($x64) { $defs += 'X64=1' }
if ($SSL_DIR) {
# statically link OpenSSL libs
sed -i '/^LIB += -lssl/c LIB += -l:libssl.a -l:libcrypto.a -lgdi32 -lcrypt32' win/Makefile.mingw
$defs += @('FOSSIL_ENABLE_SSL=1'
"OPENSSLINCDIR=${SSL_DIR}/include"
"OPENSSLLIBDIR=${SSL_DIR}/lib")
}
$script:defines = "$($defs -join ' ')"
}
# build
New-Build {
sh -c "make $defines -f win/Makefile.mingw" | Out-Null
}
# stage
Stage-Build {
New-Item "$install_dir" -itemtype directory | Out-Null
mv "${libname}.exe" "$install_dir" | Out-Null
strip --strip-unneeded "$install_dir/${libname}.exe" | Out-Null
}
# archive
Archive-Build -variant 'static-cli'
Pop-Location
# cleanup
Clean-Build