From 50a78ee55eb8db8b1afd9a89305f8011974a104a Mon Sep 17 00:00:00 2001 From: iphydf Date: Sun, 12 Jan 2025 23:32:42 +0000 Subject: [PATCH] cleanup: Remove zig repository. Nobody is maintaining or using this. --- .gitmodules | 3 --- WORKSPACE | 30 --------------------- third_party/zig/BUILD.bazel | 27 ------------------- third_party/zig/csource.c | 23 ---------------- third_party/zig/csource.h | 3 --- third_party/zig/main.zig | 9 ------- third_party/zig/toolchains.bzl | 49 ---------------------------------- tools/BUILD.bazel | 1 - tools/git-remotes | 5 ---- zig-toxcore-c | 1 - 10 files changed, 151 deletions(-) delete mode 100644 third_party/zig/BUILD.bazel delete mode 100644 third_party/zig/csource.c delete mode 100644 third_party/zig/csource.h delete mode 100644 third_party/zig/main.zig delete mode 100644 third_party/zig/toolchains.bzl delete mode 160000 zig-toxcore-c diff --git a/.gitmodules b/.gitmodules index 927d10d5..c4e5ee26 100644 --- a/.gitmodules +++ b/.gitmodules @@ -94,6 +94,3 @@ [submodule "wiki/qtox.wiki"] path = wiki/qtox.wiki url = https://github.com/TokTok/qtox.wiki -[submodule "zig-toxcore-c"] - path = zig-toxcore-c - url = https://github.com/TokTok/zig-toxcore-c diff --git a/WORKSPACE b/WORKSPACE index 81695f9f..3c91da08 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -28,36 +28,6 @@ load("@hermetic_cc_toolchain//toolchain:defs.bzl", zig_toolchains = "toolchains" zig_toolchains() -# Actual zig toolchain (the above is for C/C++) -# ========================================================= - -# Run before adding the default toolchains below, so this one gets used first. -register_toolchains( - "//third_party/zig:aarch64-linux-nix_toolchain", - "//third_party/zig:x86_64-linux-nix_toolchain", -) - -# https://github.com/aherrmann/rules_zig -github_archive( - name = "rules_zig", - integrity = "sha256-2CKwqWqx87hXsAhgfyztqzG3ikp+obARtWVAAPGnKsA=", - repo = "aherrmann/rules_zig", - version = "v0.7.0", -) - -load( - "@rules_zig//zig:repositories.bzl", - "rules_zig_dependencies", - "zig_register_toolchains", -) - -rules_zig_dependencies() - -zig_register_toolchains( - name = "zig", - zig_version = "0.11.0", -) - # Python # ========================================================= diff --git a/third_party/zig/BUILD.bazel b/third_party/zig/BUILD.bazel deleted file mode 100644 index aabb730f..00000000 --- a/third_party/zig/BUILD.bazel +++ /dev/null @@ -1,27 +0,0 @@ -load("@rules_cc//cc:defs.bzl", "cc_library") -load("@rules_zig//zig:defs.bzl", "zig_test") -load(":toolchains.bzl", "zig_nix_toolchains") - -zig_nix_toolchains() - -cc_library( - name = "clib", - srcs = ["csource.c"], - hdrs = ["csource.h"], - tags = ["no-windows"], - deps = ["@libsodium"], -) - -zig_test( - name = "testsuite", - size = "small", - cdeps = [ - ":clib", - "@rules_zig//zig/lib:libc", - ], - main = "main.zig", - tags = [ - "no-san", - "no-windows", - ], -) diff --git a/third_party/zig/csource.c b/third_party/zig/csource.c deleted file mode 100644 index 70191a0e..00000000 --- a/third_party/zig/csource.c +++ /dev/null @@ -1,23 +0,0 @@ -#define _DEFAULT_SOURCE -#include "csource.h" - -#include -#include - -static char answer_data[sizeof(unsigned int)]; - -unsigned int get_answer(unsigned int question) { - unsigned int previous_answer; - memcpy(&previous_answer, answer_data, sizeof(int)); - // Not available in the default zig toolchain, so tests whether we have the - // correct glibc. - explicit_bzero(answer_data, sizeof(int)); - memcpy(answer_data, &previous_answer, sizeof(int)); - - // Check that we can link against libsodium. - if (question >= randombytes_uniform(42)) { - return 42; - } - - return previous_answer + 23; -} diff --git a/third_party/zig/csource.h b/third_party/zig/csource.h deleted file mode 100644 index cf4fc4f5..00000000 --- a/third_party/zig/csource.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -unsigned int get_answer(unsigned int question); diff --git a/third_party/zig/main.zig b/third_party/zig/main.zig deleted file mode 100644 index 2bcf0dfa..00000000 --- a/third_party/zig/main.zig +++ /dev/null @@ -1,9 +0,0 @@ -const std = @import("std"); - -const c = @cImport({ - @cInclude("third_party/zig/csource.h"); -}); - -test { - try std.io.getStdOut().writer().print("{d}\n", .{c.get_answer(4)}); -} diff --git a/third_party/zig/toolchains.bzl b/third_party/zig/toolchains.bzl deleted file mode 100644 index 82b87396..00000000 --- a/third_party/zig/toolchains.bzl +++ /dev/null @@ -1,49 +0,0 @@ -""" -Toolchain definitions for Zig. -""" - -load("@rules_zig//zig:toolchain.bzl", "zig_target_toolchain") -load("//third_party:nixpkgs.bzl", "LD_LINUX") - -CPUS = { - "aarch64": { - "cpu": "arm64", - "dynamic_linker": None, - }, - "x86_64": { - "cpu": "x86_64", - "dynamic_linker": LD_LINUX, - }, -} - -def zig_nix_toolchains(name = "zig_nix_toolchains"): - """ - Define toolchains for each supported CPU. - - Args: - name: The name of the rule (unused). - """ - for arch in CPUS: - native.platform( - name = arch + "-linux-gnu", - constraint_values = [ - "@platforms//os:linux", - "@platforms//cpu:" + CPUS[arch]["cpu"], - ], - ) - - zig_target_toolchain( - name = arch + "-linux-nix_target", - dynamic_linker = CPUS[arch]["dynamic_linker"], - target = arch + "-linux-gnu.2.34", - ) - - native.toolchain( - name = arch + "-linux-nix_toolchain", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:" + CPUS[arch]["cpu"], - ], - toolchain = arch + "-linux-nix_target", - toolchain_type = "@rules_zig//zig/target:toolchain_type", - ) diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index 93b0f622..1a41b233 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel @@ -32,7 +32,6 @@ workspace(projects = [ "toxic", "toxins", "website", - "zig-toxcore-c", ]) exports_files(srcs = glob(["LICENSE.*"])) diff --git a/tools/git-remotes b/tools/git-remotes index 4a2c53bc..3b3e8eeb 100755 --- a/tools/git-remotes +++ b/tools/git-remotes @@ -183,11 +183,6 @@ our %REPOS = ( repo 'robinlinden', repo 'zoff99', }], - 'zig-toxcore-c' => ['zig-toxcore-c', { - upstream => 'toktok', - repo 'iphydf', - repo ['nodecum', 'c-toxcore-zig'], - }], ); # Get map of remote -> url in current directory. diff --git a/zig-toxcore-c b/zig-toxcore-c deleted file mode 160000 index 91887865..00000000 --- a/zig-toxcore-c +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 918878655cce5a833a7bc86c76e426e05832e91d