-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_tcltk.ps1
86 lines (69 loc) · 2.19 KB
/
build_tcltk.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
85
86
#requires -version 3.0
# Author: Jon Maken
# License: 3-clause BSD
# Revision: 2016-11-09 20:49:42 -0600
param(
[parameter(Mandatory=$true,
Position=0,
HelpMessage='TclTk version to build (eg - 8.6.6)')]
[validateset('8.5.19','8.6.6')]
[alias('v')]
[string] $version,
[parameter(HelpMessage='perform a 64-bit build')]
[switch] $x64
)
$sources = @{tcl = "tcl${version}-src.tar.gz"; tk = "tk${version}-src.tar.gz"}
$repo_root = 'http://prdownloads.sourceforge.net/tcl/'
$archives = @{tcl = "${repo_root}$($sources.tcl)"; tk = "${repo_root}$($sources.tk)"}
$hash_uris = @{tcl = "https://raw.github.com/jonforums/buildlets/master/hashery/tcl.sha1";
tk = "https://raw.github.com/jonforums/buildlets/master/hashery/tk.sha1"}
# source the buildlet library
. "$PWD\buildlet_utils.ps1"
# download, validate, and extract source archives
# download source archives
if (-not ((Test-Path $sources.tcl) -and (Test-Path $sources.tk))) {
foreach ($k in $archives.keys) {
$source = $sources[$k]
$archive = $archives[$k]
Fetch-Archive
}
}
# download hash data and validate source archives
foreach ($k in $archives.keys) {
$source = $sources[$k]
$hash_uri = $hash_uris[$k]
Validate-Archive
}
# extract
foreach ($k in $archives.keys) {
$source = $sources[$k]
Extract-Archive
}
# patch, configure, build, archive
foreach ($source_dir in "tcl${version}", "tk${version}") {
Push-Location $source_dir/win
# activate toolchain
Activate-Toolchain
# configure
Configure-Build {
$clean_pwd = $(Split-Path $PWD -parent).Replace('\','/')
$script:install_dir = "$clean_pwd/my_install"
$cfg_args = "--prefix=$install_dir --enable-threads"
if ($source_dir -match '^tcl') { $script:tcl_build_dir = "$clean_pwd/win" }
if ($source_dir -match '^tk') { $cfg_args += " --with-tcl=$tcl_build_dir" }
sh -c "./configure ${cfg_args} ${triplets}" | Out-Null
}
# build
New-Build {
sh -c "make" | Out-Null
}
# install
sh -c "make install" | Out-Null
# archive
Archive-Build
Pop-Location
}
# cleanup
Clean-Build {
foreach ($dir in "tcl${version}", "tk${version}") { rm $dir -recurse -force }
}