-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_oniguruma.ps1
70 lines (52 loc) · 1.44 KB
/
build_oniguruma.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
#requires -version 3.0
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2021-05-26 17:10:13 -0600
param(
[parameter(Mandatory=$true,
Position=0,
HelpMessage='Oniguruma version to build (eg - 6.9.7.1)')]
[validateset('6.9.7.1')]
[alias('v')]
[string] $version,
[parameter(HelpMessage='perform a 64-bit build')]
[switch] $x64
)
$libname = 'onig'
$source = "${libname}-${version}.tar.gz"
# fix archive version naming inconsistencies
$ver = $version.Split([char[]]'-_')[0]
if ($ver.Split('.').Length -gt 3) {
$ver = $ver.Split('.')[0..2] -join '.'
}
$build_name = "${libname}-${ver}"
$repo_root = "https://github.com/kkos/oniguruma/releases/download/v$($version.Replace('-','_'))/"
$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 {
sh -c "./configure --prefix=${install_dir} $triplets" | Out-Null
}
# build
New-Build {
sh -c 'make' | Out-Null
}
# install
sh -c 'make install-strip' | Out-Null
# archive
Archive-Build "${libname}-${version}"
Pop-Location
# cleanup
Clean-Build