This repository has been archived by the owner on May 1, 2023. It is now read-only.
/
export.ps1
62 lines (53 loc) · 1.7 KB
/
export.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
param (
[string]$vcpkg = "C:\Tools\vcpkg",
[string]$triplet = "x64-windows",
[string]$features = "core"
)
# get version from CONTROL
$control = Get-Content "$vcpkg\ports\ffmpeg\vcpkg.json" | ConvertFrom-Json
$ver = $control."version"
$pver = $control."port-version"
if($ver -Eq $null) { throw "could not find version-string from vcpkg.json" }
if($pver -Eq $null) { throw "could not find port-version from vcpkg.json" }
$version = $control."version", $control."port-version" -Join "-"
Write-Output "FFmpeg version $version"
# get license from copyright file
$copyright = `
Get-Content "$vcpkg\installed\$triplet\share\ffmpeg\copyright" -First 2 -Encoding Ascii `
| ForEach-Object { $_.Trim() }
if(!$copyright) { throw "could not find copyright file" }
Write-Output $copyright
if ($copyright[0] -Eq "GNU LESSER GENERAL PUBLIC LICENSE") {
if ($copyright[1] -Eq "Version 2.1, February 1999") {
$license = "lgpl21"
}
elseif ($copyright[1] -Eq "Version 3, 29 June 2007") {
$license = "lgpl3"
}
else {
throw "unknown LGPL version"
}
}
elseif ($copyright[0] -Eq "GNU GENERAL PUBLIC LICENSE") {
if ($copyright[1] -Eq "Version 2, June 1991") {
$license = "gpl2"
}
elseif ($copyright[1] -Eq "Version 3, 29 June 2007") {
$license = "gpl3"
}
else {
throw "unknown GPL version"
}
}
elseif ($copyright -Eq "License: nonfree and unredistributable") {
$license = "nonfree"
}
else {
throw "unknown license"
}
# export
$ffmpeg = "ffmpeg-$version-$license-$triplet"
Write-Output "Exporting $ffmpeg..."
& "$vcpkg\vcpkg" export "ffmpeg:$triplet" --output=$ffmpeg --7zip
# move vcpkg export to the right location
Move-Item -Path "$vcpkg\$ffmpeg.7z" -Destination "." -ErrorAction "Stop"