Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .adms/bazel/adms.mirror.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ rewrite (mirrors.edge.kernel.org)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2
rewrite (pyyaml.org)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2
rewrite (python.org)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2
rewrite (mirrors.kernel.org)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2
rewrite (curl.haxx.se)/(.*) depot-read-api-bzl.us1.ddbuild.io/$1/$2

# Rewrite Rules for External Hosts - Specific Language Ecosystems
#######################################################################
Expand Down
3 changes: 3 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ include("//deps/compile_policy:compile_policy.MODULE.bazel")
# buildifier: leave-alone
include("//deps/cpython:cpython.MODULE.bazel")

# buildifier: leave-alone
include("//deps/curl:curl.MODULE.bazel")

# buildifier: leave-alone
include("//deps/freetds:freetds.MODULE.bazel")

Expand Down
22 changes: 22 additions & 0 deletions deps/curl/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load("//bazel/tools:generate_module_bazel.bzl", "generate_module_bazel")

VERSION = "8.16.0"

generate_module_bazel(
name = "curl_module_bazel_new",
out = "curl.MODULE.bazel.new",
module = "curl",
sha256 = "a21e20476e39eca5a4fc5cfb00acf84bbc1f5d8443ec3853ad14c26b3c85b970",
strip_prefix = "curl-%s" % VERSION,
tags = ["manual"],
target_compatible_with = ["@platforms//os:linux"],
url = "https://curl.haxx.se/download/curl-%s.tar.gz" % VERSION,
)

diff_test(
name = "module_file_up_to_date_test",
file1 = ":curl.MODULE.bazel.new",
file2 = "curl.MODULE.bazel",
target_compatible_with = ["@platforms//os:linux"],
)
50 changes: 50 additions & 0 deletions deps/curl/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Hints for how to update curl from first principles
#
# This is not part of any build process. Think of it as a readme with
# executable parts.

# A tool to look at configure output and create parts to support bazel targets
C2B=$(HOME)/ws/experimental/teams/agent-supply-chain/configure2bazel

PRISTINE=curl-8.18.0

next:
echo Do both steps on each platform.
echo Adjust overlay/overlay.BUILD.bazel
echo Adjust overlay/lib/curl_config.h

# Run configure and grab the generated files to the overlay tree
# Run make to create the library outputs
macos_step1:
python3 $(C2B)/add_configuration.py \
--pristine_dir=$(PRISTINE) \
--configure_options=config_opts.txt
echo Now do: '(cd linux_aarch64 ; make)'
echo Now do: '(cd darwin_arm64 ; make)'


# Step 3
# Do some reasoning about the generated config.h. For almost every project,
# the file should be identical for x86 and arm within each OS.
# Then look at config.h differences per OS. They should almost always be
# very simliar. What might differ is the inclusion of packages which are
# os specific. Basic stuff should be in both.
# Look for HAVE_* settings which are wrong because configure can not find
# the bazel built dependency. This happens often. Edit config.h as needed
# to match the goal you want, rather than what configure finds.

# Analyze the built libraries to map library content back to the source files
# in them. Save lists by library name and arch back to lib_contents.bzl
macos_step3:
python3 $(C2B)/analyze.py \
--pristine_dir=$(PRISTINE) \
--configured_dir=darwin_arm64 \
--configured_name=darwin_arm64 \
--overlay=overlay
git diff overlay/lib_contents.bzl

# For linux, do the same as macos, but with different config names.

# Step 4
# Create your cc_library() target. Use any of the other projects using
# configure2bazel as an sample starting point.
29 changes: 29 additions & 0 deletions deps/curl/config_opts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--disable-manual
--disable-debug
--enable-optimize
--disable-static
--disable-ldap
--disable-ldaps
--disable-rtsp
--enable-proxy
--disable-dependency-tracking
--enable-ipv6
--without-applic-idn
--without-libidn2
--without-gnutls
--without-librtmp
--without-libssh2
--without-libpsl
--without-libuv
--without-winidn
--without-zsh-functions-dir
--without-fish-functions-dir
--with-ssl
--with-zlib
--with-nghttp2
--disable-docs
--disable-libcurl-option
--disable-versioned-symbols
--disable-libuv
--disable-verbose
--disable-progress-meter
17 changes: 17 additions & 0 deletions deps/curl/curl.MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is generated. Do not hand edit.

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "curl",
files = {
"BUILD.bazel": "//deps/curl:overlay/curl.BUILD.bazel",
"darwin_arm64/lib/curl_config.h": "//deps/curl:overlay/darwin_arm64/lib/curl_config.h",
"lib/curl_config.h": "//deps/curl:overlay/lib/curl_config.h",
"lib_contents.bzl": "//deps/curl:overlay/lib_contents.bzl",
"linux_arm64/lib/curl_config.h": "//deps/curl:overlay/linux_arm64/lib/curl_config.h",
},
sha256 = "e9274a5f8ab5271c0e0e6762d2fce194d5f98acc568e4ce816845b2dcc0cf88f",
strip_prefix = "curl-8.18.0",
url = "https://curl.haxx.se/download/curl-8.18.0.tar.gz",
)
Loading