forked from mia/Aegisub
Switch to downloading a release tarball for fribidi
This commit is contained in:
parent
135b61595c
commit
2e40f2b246
6 changed files with 114 additions and 17 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -75,6 +75,7 @@ tools/osx-bundle-restart-helper
|
||||||
tools/osx-bundle.sed
|
tools/osx-bundle.sed
|
||||||
tools/repack-thes-dict
|
tools/repack-thes-dict
|
||||||
tools/repack-thes-dict.dSYM
|
tools/repack-thes-dict.dSYM
|
||||||
|
vendor/fribidi
|
||||||
vendor/luajit/src/host/buildvm
|
vendor/luajit/src/host/buildvm
|
||||||
vendor/luajit/src/host/minilua
|
vendor/luajit/src/host/minilua
|
||||||
vendor/luajit/src/jit/vmdef.lua
|
vendor/luajit/src/jit/vmdef.lua
|
||||||
|
|
4
.gitmodules
vendored
4
.gitmodules
vendored
|
@ -1,7 +1,3 @@
|
||||||
[submodule "fribidi"]
|
|
||||||
path = vendor/fribidi
|
|
||||||
url = git://anongit.freedesktop.org/fribidi/fribidi
|
|
||||||
ignore = dirty
|
|
||||||
[submodule "freetype2"]
|
[submodule "freetype2"]
|
||||||
path = vendor/freetype2
|
path = vendor/freetype2
|
||||||
url = git://git.sv.nongnu.org/freetype/freetype2.git
|
url = git://git.sv.nongnu.org/freetype/freetype2.git
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
<Compile Include="MsysPath.cs" />
|
<Compile Include="MsysPath.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ShellWrapper.cs" />
|
<Compile Include="ShellWrapper.cs" />
|
||||||
|
<Compile Include="TarballProject.cs" />
|
||||||
<Compile Include="UpdateFile.cs" />
|
<Compile Include="UpdateFile.cs" />
|
||||||
<Compile Include="Utils.cs" />
|
<Compile Include="Utils.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
96
build/BuildTasks/TarballProject.cs
Normal file
96
build/BuildTasks/TarballProject.cs
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
// Copyright (c) 2014, Thomas Goyne <plorkyeran@aegisub.org>
|
||||||
|
//
|
||||||
|
// Permission to use, copy, modify, and distribute this software for any
|
||||||
|
// purpose with or without fee is hereby granted, provided that the above
|
||||||
|
// copyright notice and this permission notice appear in all copies.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
//
|
||||||
|
// Aegisub Project http://www.aegisub.org/
|
||||||
|
|
||||||
|
using ICSharpCode.SharpZipLib.Tar;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
|
namespace BuildTasks {
|
||||||
|
public class TarballProject : Microsoft.Build.Utilities.Task {
|
||||||
|
public string Url { get; set; }
|
||||||
|
public string Root { get; set; }
|
||||||
|
public string Hash { get; set; }
|
||||||
|
|
||||||
|
private bool NeedsUpdate() {
|
||||||
|
try {
|
||||||
|
return Hash != File.ReadAllText(Path.Combine(Root, "aegisub.hash"));
|
||||||
|
}
|
||||||
|
catch (IOException) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExtractEntry(string destDir, TarEntry entry, ICSharpCode.SharpZipLib.Tar.TarInputStream stream) {
|
||||||
|
string name = entry.Name;
|
||||||
|
if (Path.IsPathRooted(name))
|
||||||
|
name = name.Substring(Path.GetPathRoot(name).Length);
|
||||||
|
name = name.Replace('/', Path.DirectorySeparatorChar);
|
||||||
|
name = name.Substring(name.IndexOf(Path.DirectorySeparatorChar) + 1);
|
||||||
|
|
||||||
|
string dest = Path.Combine(destDir, name);
|
||||||
|
if (entry.IsDirectory)
|
||||||
|
Directory.CreateDirectory(dest);
|
||||||
|
else {
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(dest));
|
||||||
|
using (Stream outputStream = File.Create(dest)) {
|
||||||
|
stream.CopyEntryContents(outputStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Execute() {
|
||||||
|
if (!NeedsUpdate()) return true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
var ms = new MemoryStream();
|
||||||
|
var downloadStream = new System.Net.WebClient().OpenRead(Url);
|
||||||
|
downloadStream.CopyTo(ms);
|
||||||
|
ms.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
var hash = new SHA256Managed().ComputeHash(ms);
|
||||||
|
if (BitConverter.ToString(hash).Replace("-", "").ToLower() != this.Hash) {
|
||||||
|
Log.LogError("Got wrong hash for {0}", Url);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Directory.Delete(Root, true);
|
||||||
|
}
|
||||||
|
catch (DirectoryNotFoundException) {
|
||||||
|
// Obviously not an issue
|
||||||
|
}
|
||||||
|
|
||||||
|
ms.Seek(0, SeekOrigin.Begin);
|
||||||
|
var bzStream = new ICSharpCode.SharpZipLib.BZip2.BZip2InputStream(ms);
|
||||||
|
var tarStream = new ICSharpCode.SharpZipLib.Tar.TarInputStream(bzStream);
|
||||||
|
while (true) {
|
||||||
|
TarEntry entry = tarStream.GetNextEntry();
|
||||||
|
if (entry == null) break;
|
||||||
|
ExtractEntry(Root, entry, tarStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
File.WriteAllText(Path.Combine(Root, "aegisub.hash"), Hash);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Log.LogErrorFromException(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,6 +11,21 @@
|
||||||
<Import Project="$(MSBuildThisFileDirectory)..\aegisub.props" />
|
<Import Project="$(MSBuildThisFileDirectory)..\aegisub.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
|
||||||
|
<!-- Download fribidi -->
|
||||||
|
<UsingTask TaskName="TarballProject" AssemblyFile="$(AegisubBinaryDir)BuildTasks.dll" />
|
||||||
|
<Target
|
||||||
|
Name="Download"
|
||||||
|
Inputs="$(FribidiSrcDir)aegisub.hash"
|
||||||
|
Outputs="$(FribidiSrcDir)nonexistent-file"
|
||||||
|
>
|
||||||
|
<TarballProject
|
||||||
|
Url="http://fribidi.org/download/fribidi-0.19.6.tar.bz2"
|
||||||
|
Hash="cba8b7423c817e5adf50d28ec9079d14eafcec9127b9e8c8f1960c5ad585e17d"
|
||||||
|
Root="$(FribidiSrcDir)"
|
||||||
|
/>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<!-- Build it -->
|
||||||
<PropertyGroup Label="ConfigArgs">
|
<PropertyGroup Label="ConfigArgs">
|
||||||
<Cflags>-nologo -DFRIBIDI_ENTRY=\"\"</Cflags>
|
<Cflags>-nologo -DFRIBIDI_ENTRY=\"\"</Cflags>
|
||||||
<CfgDebug Condition="'$(Configuration)' == 'Debug'">--enable-debug CFLAGS="-MDd $(Cflags)"</CfgDebug>
|
<CfgDebug Condition="'$(Configuration)' == 'Debug'">--enable-debug CFLAGS="-MDd $(Cflags)"</CfgDebug>
|
||||||
|
@ -30,16 +45,6 @@
|
||||||
<SourceFiles Include="$(AbsSrcDir)\**\*.c" />
|
<SourceFiles Include="$(AbsSrcDir)\**\*.c" />
|
||||||
<SourceFiles Include="$(AbsSrcDir)\**\*.h" />
|
<SourceFiles Include="$(AbsSrcDir)\**\*.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Target Name="Bootstrap"
|
|
||||||
Inputs="$(AbsSrcDir)\configure.ac;@(AutomakeFiles)"
|
|
||||||
Outputs="$(AbsSrcDir)\configure"
|
|
||||||
>
|
|
||||||
<ExecShellScript
|
|
||||||
Command="$(AbsSrcDir)\bootstrap"
|
|
||||||
WorkingDirectory="$(AbsSrcDir)"
|
|
||||||
Configuration="@(ExecShellScript)"
|
|
||||||
/>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="Configure"
|
<Target Name="Configure"
|
||||||
Inputs="$(AbsSrcDir)\configure"
|
Inputs="$(AbsSrcDir)\configure"
|
||||||
|
@ -96,8 +101,7 @@
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="Build">
|
<Target Name="Build">
|
||||||
<Error Condition="!Exists('$(AbsSrcDir)')" Text="Fribidi source not found at '$(AbsSrcDir)'" />
|
<CallTarget Targets="Download;Configure;Compile;Install" />
|
||||||
<CallTarget Targets="Bootstrap;Configure;Compile;Install" />
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="Clean">
|
<Target Name="Clean">
|
||||||
|
|
1
vendor/fribidi
vendored
1
vendor/fribidi
vendored
|
@ -1 +0,0 @@
|
||||||
Subproject commit 77f7f6c0bb16b89eac1e3b3d264f49b2ee02de3e
|
|
Loading…
Reference in a new issue