Commit f6c9b85e authored by Drew's avatar Drew

Merge pull request #95 from AnarchyTools/compression

Support atbin compression
parents 13c759c7 3982ceb4
Pipeline #1863 passed with stage
FROM drewcrawford/swift:latest
RUN apt-get update && apt-get install --no-install-recommends xz-utils -y
ADD . /atbuild
WORKDIR atbuild
RUN bootstrap/build.sh linux
......
......@@ -19,6 +19,7 @@ class PackageAtbin:Tool {
case Name = "name"
case Platforms = "platforms"
case AtllbuildTask = "atllbuild-task"
case Compress = "compress"
}
func run(task: Task, toolchain: String) {
......@@ -153,5 +154,20 @@ class PackageAtbin:Tool {
s += ":type \"\(outputType.rawValue)\"\n"
s += ")\n"
try! s.write(to: atbinPath.join(Path("compiled.atpkg")))
if task[Options.Compress.rawValue]?.bool == true {
let cmd: String
switch Platform.hostPlatform {
case .OSX:
cmd = "tar c --options \"xz:compression-level=9\" -Jf bin/\(name).atbin.tar.xz bin/\(name).atbin -C bin"
case .Linux:
cmd = "XZ_OPT=-8 tar cJf bin/\(name).atbin.tar.xz bin/\(name).atbin -C bin"
default:
fatalError("Unsupported host platform \(Platform.hostPlatform)")
}
if system(cmd) != 0 {
fatalError("Failed to compress archive")
}
}
}
}
\ No newline at end of file
......@@ -52,6 +52,7 @@
:name "dynamicatbin"
:atllbuild-task "dlib"
:platforms ["all"]
:compress true
}
:ebin {
......
......@@ -130,6 +130,12 @@ if [ ! -f "bin/staticatbin.atbin/slib.a" ]; then
exit 1
fi
if [ ! -f "bin/dynamicatbin.atbin.tar.xz" ]; then
echo "Missing compressed atbin"
exit 1
fi
tar xf bin/dynamicatbin.atbin.tar.xz
if [ "$UNAME" == "Darwin" ]; then
$ATBUILD --platform ios
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment