|
| 1 | +module( |
| 2 | + name = "rules_coreutils", |
| 3 | + version = "1.0.0-alpha.8", |
| 4 | + bazel_compatibility = [ |
| 5 | + ">=7.0.0", |
| 6 | + ], |
| 7 | + compatibility_level = 1, |
| 8 | +) |
| 9 | + |
| 10 | +bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.1") |
| 11 | +bazel_dep(name = "download_utils", version = "1.0.0-beta.1") |
| 12 | + |
| 13 | +archive = use_repo_rule("@download_utils//download/archive:defs.bzl", "download_archive") |
| 14 | + |
| 15 | +[ |
| 16 | + archive( |
| 17 | + name = "coreutils-{}".format(triplet), |
| 18 | + srcs = ["entrypoint"], |
| 19 | + integrity = integrity, |
| 20 | + links = { |
| 21 | + "coreutils.exe" if "windows" in triplet else "coreutils": "entrypoint", |
| 22 | + }, |
| 23 | + strip_prefix = "coreutils-0.0.23-{}".format(slug), |
| 24 | + urls = ["https://github.com/uutils/coreutils/releases/download/0.0.23/coreutils-0.0.23-{}.{}".format( |
| 25 | + slug, |
| 26 | + "zip" if "windows" in triplet else "tar.gz", |
| 27 | + )], |
| 28 | + ) |
| 29 | + for triplet, slug, integrity in ( |
| 30 | + ("arm64-linux-gnu", "aarch64-unknown-linux-gnu", "sha256-8wMVMgAgf8JQ2+2LdoewkyDo416VEsf9RlMJl4jiBjk="), |
| 31 | + ("amd64-linux-gnu", "x86_64-unknown-linux-gnu", "sha256-u7OMW43Y46aXRRIKULfKdfUW51WJn6G70s5Xxwb6/1g="), |
| 32 | + ("amd64-windows-msvc", "x86_64-pc-windows-msvc", "sha256-aglIj5JvFGLm2ABwRzWAsZRTTD3X444V3GxHM9pGJS4="), |
| 33 | + ("arm64-macos-darwin", "aarch64-apple-darwin", "sha256-KP90sjKxtXDbLC+o5f4+gQnvP3Tr7O0RopME4g9QF5E="), |
| 34 | + ("amd64-macos-darwin", "x86_64-apple-darwin", "sha256-SswetVAuK/hMK1r9uBvNnKj5JpSgD0bzkbsHTxOabCo="), |
| 35 | + ) |
| 36 | +] |
| 37 | + |
| 38 | +select = use_repo_rule("@toolchain_utils//toolchain/local/select:defs.bzl", "toolchain_local_select") |
| 39 | + |
| 40 | +select( |
| 41 | + name = "coreutils", |
| 42 | + map = { |
| 43 | + "amd64-linux-gnu": "@coreutils-amd64-linux-gnu", |
| 44 | + "arm64-linux-gnu": "@coreutils-arm64-linux-gnu", |
| 45 | + "amd64-windows": "@coreutils-amd64-windows-msvc", |
| 46 | + "arm64-macos-darwin": "@coreutils-arm64-macos-darwin", |
| 47 | + "amd64-macos-darwin": "@coreutils-amd64-macos-darwin", |
| 48 | + }, |
| 49 | +) |
| 50 | + |
| 51 | +export = use_extension("@toolchain_utils//toolchain/export:defs.bzl", "toolchain_export") |
| 52 | +export.symlink( |
| 53 | + name = "coreutils", |
| 54 | + target = "@coreutils", |
| 55 | +) |
| 56 | + |
| 57 | +deb = use_repo_rule("@download_utils//download/deb:defs.bzl", "download_deb") |
| 58 | + |
| 59 | +deb( |
| 60 | + name = "busybox-arm64-linux", |
| 61 | + srcs = ["busybox"], |
| 62 | + integrity = "sha256-C0+0zi0/0Woc11BTX5d1ugxC2GOeE9ZjUka6g6DUvc8=", |
| 63 | + strip_prefix = "bin", |
| 64 | + urls = ["http://ftp.uk.debian.org/debian/pool/main/b/busybox/busybox-static_1.35.0-4+b3_arm64.deb"], |
| 65 | +) |
| 66 | + |
| 67 | +deb( |
| 68 | + name = "busybox-amd64-linux", |
| 69 | + srcs = ["busybox"], |
| 70 | + integrity = "sha256-rMRMIHKVuGEU2kiV71Ouvxhr8839wmmloaCer6xqYNs=", |
| 71 | + strip_prefix = "bin", |
| 72 | + urls = ["http://ftp.uk.debian.org/debian/pool/main/b/busybox/busybox-static_1.35.0-4+b3_amd64.deb"], |
| 73 | +) |
| 74 | + |
| 75 | +resolved = use_repo_rule("@toolchain_utils//toolchain/resolved:defs.bzl", "toolchain_resolved") |
| 76 | + |
| 77 | +which = use_repo_rule("@toolchain_utils//toolchain/local/which:defs.bzl", "toolchain_local_which") |
| 78 | + |
| 79 | +[ |
| 80 | + ( |
| 81 | + resolved( |
| 82 | + name = "resolved-{}".format(tool), |
| 83 | + basename = tool, |
| 84 | + toolchain_type = "//coreutils/toolchain/{}:type".format(tool), |
| 85 | + ), |
| 86 | + which( |
| 87 | + name = "which-{}".format(tool), |
| 88 | + basename = tool, |
| 89 | + ), |
| 90 | + ) |
| 91 | + for tool in ( |
| 92 | + "busybox", |
| 93 | + "coreutils", |
| 94 | + "arch", |
| 95 | + "base64", |
| 96 | + "basename", |
| 97 | + "cat", |
| 98 | + "chmod", |
| 99 | + "chown", |
| 100 | + "cp", |
| 101 | + "cut", |
| 102 | + "date", |
| 103 | + "dd", |
| 104 | + "df", |
| 105 | + "dirname", |
| 106 | + "du", |
| 107 | + "echo", |
| 108 | + "env", |
| 109 | + "expand", |
| 110 | + "expr", |
| 111 | + "factor", |
| 112 | + "false", |
| 113 | + "fold", |
| 114 | + "head", |
| 115 | + "hostname", |
| 116 | + "install", |
| 117 | + "link", |
| 118 | + "ln", |
| 119 | + "ls", |
| 120 | + "md5sum", |
| 121 | + "mkdir", |
| 122 | + "mktemp", |
| 123 | + "more", |
| 124 | + "mv", |
| 125 | + "nl", |
| 126 | + "nproc", |
| 127 | + "od", |
| 128 | + "paste", |
| 129 | + "printf", |
| 130 | + "pwd", |
| 131 | + "readlink", |
| 132 | + "realpath", |
| 133 | + "rm", |
| 134 | + "rmdir", |
| 135 | + "seq", |
| 136 | + "sha1sum", |
| 137 | + "sha256sum", |
| 138 | + "sha3sum", |
| 139 | + "sha512sum", |
| 140 | + "shred", |
| 141 | + "shuf", |
| 142 | + "sleep", |
| 143 | + "sort", |
| 144 | + "sync", |
| 145 | + "tac", |
| 146 | + "tail", |
| 147 | + "tee", |
| 148 | + "test", |
| 149 | + "touch", |
| 150 | + "tr", |
| 151 | + "true", |
| 152 | + "truncate", |
| 153 | + "uname", |
| 154 | + "unexpand", |
| 155 | + "uniq", |
| 156 | + "unlink", |
| 157 | + "wc", |
| 158 | + "whoami", |
| 159 | + "yes", |
| 160 | + ) |
| 161 | +] |
| 162 | + |
| 163 | +register_toolchains("//coreutils/toolchain/...") |
0 commit comments