Mercurial
comparison third_party/tectonic/runtime.bzl @ 247:70f2a3dafc1c
[build] Bundle offline Tectonic runtime
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 03 Aug 2026 20:20:06 -0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 246:4f2b50bc78e7 | 247:70f2a3dafc1c |
|---|---|
| 1 def _tectonic_runtime_impl(ctx): | |
| 2 output = ctx.actions.declare_directory(ctx.label.name) | |
| 3 commands = [ | |
| 4 "set -e", | |
| 5 "mkdir -p {}/bin {}/cache {}/sysroot/etc/fonts {}/sysroot/usr/share/fontconfig/conf.avail".format( | |
| 6 output.path, | |
| 7 output.path, | |
| 8 output.path, | |
| 9 output.path, | |
| 10 ), | |
| 11 "cp {} {}/bin/tectonic".format(ctx.file.binary.path, output.path), | |
| 12 "cp {} {}/sysroot/etc/fonts/fonts.conf".format( | |
| 13 ctx.file.fontconfig.path, | |
| 14 output.path, | |
| 15 ), | |
| 16 "cp {} {}/LICENSE".format(ctx.file.license.path, output.path), | |
| 17 "cp {} {}/THIRD_PARTY_NOTICES.md".format( | |
| 18 ctx.file.notices.path, | |
| 19 output.path, | |
| 20 ), | |
| 21 "tar -xzf {} -C {}/cache".format( | |
| 22 ctx.file.cache_archive.path, | |
| 23 output.path, | |
| 24 ), | |
| 25 "chmod 0555 {}/bin/tectonic".format(output.path), | |
| 26 "chmod 0444 {}/sysroot/etc/fonts/fonts.conf".format(output.path), | |
| 27 "chmod 0444 {}/LICENSE {}/THIRD_PARTY_NOTICES.md".format( | |
| 28 output.path, | |
| 29 output.path, | |
| 30 ), | |
| 31 ] | |
| 32 commands.append("chmod -R a-w {}/cache".format(output.path)) | |
| 33 | |
| 34 ctx.actions.run_shell( | |
| 35 inputs = [ | |
| 36 ctx.file.binary, | |
| 37 ctx.file.cache_archive, | |
| 38 ctx.file.fontconfig, | |
| 39 ctx.file.license, | |
| 40 ctx.file.notices, | |
| 41 ], | |
| 42 outputs = [output], | |
| 43 command = "\n".join(commands), | |
| 44 progress_message = "Assembling offline Tectonic runtime", | |
| 45 ) | |
| 46 return [ | |
| 47 DefaultInfo( | |
| 48 files = depset([output]), | |
| 49 runfiles = ctx.runfiles(files = [output]), | |
| 50 ), | |
| 51 ] | |
| 52 | |
| 53 tectonic_runtime = rule( | |
| 54 implementation = _tectonic_runtime_impl, | |
| 55 attrs = { | |
| 56 "binary": attr.label(allow_single_file = True, mandatory = True), | |
| 57 "cache_archive": attr.label(allow_single_file = True, mandatory = True), | |
| 58 "fontconfig": attr.label(allow_single_file = True, mandatory = True), | |
| 59 "license": attr.label(allow_single_file = True, mandatory = True), | |
| 60 "notices": attr.label(allow_single_file = True, mandatory = True), | |
| 61 }, | |
| 62 ) |