Skip to content

Commit

Permalink
build: fetch urcrypt instead of vendoring it
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-levan committed Sep 27, 2023
1 parent 7ba4bca commit 9d5c2e8
Show file tree
Hide file tree
Showing 35 changed files with 41 additions and 1,812 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ defined in its own package:

- [`pkg/c3`](pkg/c3): A set of basic utilities for writing Urbit's style of C.
- [`pkg/ent`](pkg/ent): A cross-platform wrapper for `getentropy(2)`.
- [`pkg/urcrypt`](pkg/urcrypt): A standardized interface for calling various
cryptographic functions used in the Urbit runtime.
- [`pkg/ur`](pkg/ur): An implementation of [jam][jam] and [cue][cue], Urbit's
bitwise noun serialization and deserialization algorithms, respectively.
- [`pkg/noun`](pkg/noun): The Nock virtual machine and snapshotting system.
Expand Down
50 changes: 9 additions & 41 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,6 @@ versioned_http_archive(
version = "9681279cfaa6e6399bb7ca3afbbc27fc2e19df4b",
)

versioned_http_archive(
name = "argon2",
build_file = "//bazel/third_party/argon2:argon2.BUILD",
sha256 = "40850e6e6324be10f14228d17b617ad2074bb926eeddd6fe40ad5df833833949",
strip_prefix = "argon2-{version}",
url = "https://github.com/urbit/argon2/archive/{version}.tar.gz",
version = "a4c1e3f7138c2e577376beb99f964cf71e1c8b1b",
)

versioned_http_archive(
name = "bazel_gazelle",
sha256 = "efbbba6ac1a4fd342d5122cbdfdb82aeb2cf2862e35022c752eaddffada7c3f3",
Expand All @@ -154,15 +145,6 @@ versioned_http_archive(
version = "7.85.0",
)

versioned_http_archive(
name = "ed25519",
build_file = "//bazel/third_party/ed25519:ed25519.BUILD",
sha256 = "373923c85f61276e3cad2c0ae7a5d5cd4809ffe46c5abc1dc8276683a55782a0",
strip_prefix = "ed25519-{version}",
url = "https://github.com/orlp/ed25519/archive/{version}.tar.gz",
version = "7fa6712ef5d581a6981ec2b08ee623314cd1d1c4",
)

versioned_http_archive(
name = "gmp",
build_file = "//bazel/third_party/gmp:gmp.BUILD",
Expand Down Expand Up @@ -214,17 +196,6 @@ versioned_http_file(
version = "255fb1ca8206072f1d09425f0db61ecfe7ff5b17",
)

versioned_http_archive(
name = "keccak_tiny",
build_file = "//bazel/third_party/keccak_tiny:keccak_tiny.BUILD",
patch_args = ["-p1"],
patches = ["//bazel/third_party/keccak_tiny:{version}.patch"],
sha256 = "6d4717f96b84805886c74bad89e911076664d992f197634fd7cdfca2ac0f62ef",
strip_prefix = "keccak-tiny-{version}",
url = "https://github.com/coruus/keccak-tiny/archive/{version}.tar.gz",
version = "64b6647514212b76ae7bca0dea9b7b197d1d8186",
)

versioned_http_archive(
name = "lmdb",
build_file = "//bazel/third_party/lmdb:lmdb.BUILD",
Expand Down Expand Up @@ -272,18 +243,6 @@ versioned_http_archive(
version = "67108d883061043e55d0fb13961ac1b6fc8a485c",
)

versioned_http_archive(
name = "scrypt",
build_file = "//bazel/third_party/scrypt:scrypt.BUILD",
sha256 = "df681fb19b653b1a12970ebb6091bb2b58411b9e7baf01143870f6be3f099541",
strip_prefix = "libscrypt-{version}",
url = "https://github.com/technion/libscrypt/archive/{version}.tar.gz",
# When bumping the version, compare `Makefile` in the `scrypt` repo to
# {build_file} and confirm that {build_file} remains an accurate description
# of the scrypt build process.
version = "60e585cdd752262b22ed4113eca41c0461a61608",
)

versioned_http_archive(
name = "secp256k1",
build_file = "//bazel/third_party/secp256k1:secp256k1.BUILD",
Expand Down Expand Up @@ -337,6 +296,15 @@ versioned_http_file(
version = "ea8fee3aa0434d4bdf1bf785e5ec346c7ecba7fd",
)

versioned_http_archive(
name = "urcrypt",
build_file = "//bazel/third_party/urcrypt:urcrypt.BUILD",
sha256 = "00ec597c14c418802d5db2d6a68cf83bd4f5419071b95f979374d3184599d6c8",
strip_prefix = "urcrypt-{version}",
url = "https://github.com/urbit/urcrypt/archive/{version}.tar.gz",
version = "b970baefa6e0a680fffa2b2ee19c956a4ae20355",
)

versioned_http_archive(
name = "uv",
build_file = "//bazel/third_party/uv:uv.BUILD",
Expand Down
3 changes: 1 addition & 2 deletions bazel/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ refresh_compile_commands(
"//pkg/ent",
"//pkg/noun",
"//pkg/ur",
"//pkg/urcrypt",
"//pkg/vere:urbit",
],
# No need to add flags already in .bazelrc. They're automatically picked up.
# If you don't need flags, a list of targets is also okay, as is a single target string.
# Wildcard patterns, like //... for everything, *are* allowed here, just like a build.
# As are additional targets (+) and subtractions (-), like in bazel query https://docs.bazel.build/versions/main/query.html#expressions
# And if you're working on a header-only library, specify a test or binary target that compiles it.
)
)
Empty file.
28 changes: 28 additions & 0 deletions bazel/third_party/urcrypt/urcrypt.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")

filegroup(
name = "all",
srcs = glob(["**"]),
)

configure_make(
name = "urcrypt",
autogen = True,
configure_in_place = True,
configure_options = [
"--disable-shared",
],
copts = [
"-Wall",
"-g",
"-O3",
],
deps = [
"@aes_siv",
"@openssl",
"@secp256k1"
],
lib_source = ":all",
out_static_libs = ["liburcrypt.a"],
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion pkg/noun/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ vere_library(
"//pkg/c3",
"//pkg/ent",
"//pkg/ur",
"//pkg/urcrypt",
"@gmp",
"@murmur3",
"@openssl",
"@pdjson",
"@sigsegv",
"@softfloat",
"@urcrypt",
] + select({
"@platforms//os:macos": ["//pkg/noun/platform/darwin"],
"@platforms//os:linux": ["//pkg/noun/platform/linux"],
Expand Down
2 changes: 1 addition & 1 deletion pkg/noun/jets.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "retrieve.h"
#include "serial.h"
#include "trace.h"
#include "urcrypt/urcrypt.h"
#include "urcrypt.h"
#include "vortex.h"
#include "xtract.h"

Expand Down
2 changes: 1 addition & 1 deletion pkg/noun/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "platform/rsignal.h"
#include "retrieve.h"
#include "trace.h"
#include "urcrypt/urcrypt.h"
#include "urcrypt.h"
#include "vortex.h"
#include "xtract.h"

Expand Down
56 changes: 0 additions & 56 deletions pkg/urcrypt/.gitignore

This file was deleted.

36 changes: 0 additions & 36 deletions pkg/urcrypt/BUILD.bazel

This file was deleted.

33 changes: 0 additions & 33 deletions pkg/urcrypt/README.md

This file was deleted.

Loading

0 comments on commit 9d5c2e8

Please sign in to comment.