From: "Ezekiel Newren via GitGitGadget" <gitgitgadget@gmail•com>
To: git@vger•kernel.org
Cc: Ezekiel Newren <ezekielnewren@gmail•com>,
Ezekiel Newren <ezekielnewren@gmail•com>
Subject: [PATCH 02/13] meson: undo Patrick's changes concerning Rust
Date: Thu, 27 Nov 2025 01:10:24 +0000 [thread overview]
Message-ID: <dd8787e3e07a567acf56c23c69599aaefd87b3b0.1764205835.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2110.git.git.1764205835.gitgitgadget@gmail.com>
From: Ezekiel Newren <ezekielnewren@gmail•com>
Signed-off-by: Ezekiel Newren <ezekielnewren@gmail•com>
---
meson.build | 19 ++-----------------
meson_options.txt | 4 ++--
src/cargo-meson.sh | 39 ---------------------------------------
src/meson.build | 41 -----------------------------------------
4 files changed, 4 insertions(+), 99 deletions(-)
delete mode 100755 src/cargo-meson.sh
delete mode 100644 src/meson.build
diff --git a/meson.build b/meson.build
index 2b763f7c53..8966596ee8 100644
--- a/meson.build
+++ b/meson.build
@@ -220,7 +220,7 @@ project('git', 'c',
# learned to define __STDC_VERSION__ with C11 and later. We thus require
# GNU C99 and fall back to C11. Meson only learned to handle the fallback
# with version 1.3.0, so on older versions we use GNU C99 unconditionally.
- default_options: meson.version().version_compare('>=1.3.0') ? ['rust_std=2018', 'c_std=gnu99,c11'] : ['rust_std=2018', 'c_std=gnu99'],
+ default_options: meson.version().version_compare('>=1.3.0') ? ['c_std=gnu99,c11'] : ['c_std=gnu99'],
)
fs = import('fs')
@@ -1709,21 +1709,6 @@ version_def_h = custom_target(
)
libgit_sources += version_def_h
-cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))
-rust_option = get_option('rust').disable_auto_if(not cargo.found())
-if rust_option.allowed()
- subdir('src')
- libgit_c_args += '-DWITH_RUST'
-
- if host_machine.system() == 'windows'
- libgit_dependencies += compiler.find_library('userenv')
- endif
-else
- libgit_sources += [
- 'varint.c',
- ]
-endif
-
libgit = declare_dependency(
link_with: static_library('git',
sources: libgit_sources,
@@ -2270,7 +2255,7 @@ summary({
'pcre2': pcre2,
'perl': perl_features_enabled,
'python': target_python.found(),
- 'rust': rust_option.allowed(),
+ 'rust': get_option('with_rust'),
}, section: 'Auto-detected features', bool_yn: true)
summary({
diff --git a/meson_options.txt b/meson_options.txt
index 143dee9237..0059b7c7df 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -71,8 +71,8 @@ option('zlib_backend', type: 'combo', choices: ['auto', 'zlib', 'zlib-ng'], valu
# Build tweaks.
option('breaking_changes', type: 'boolean', value: false,
description: 'Enable upcoming breaking changes.')
-option('rust', type: 'feature', value: 'auto',
- description: 'Enable building with Rust.')
+option('with_rust', type: 'boolean', value: true,
+ description: 'Enable building with Rust, true by default.')
option('macos_use_homebrew_gettext', type: 'boolean', value: true,
description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
diff --git a/src/cargo-meson.sh b/src/cargo-meson.sh
deleted file mode 100755
index 3998db0435..0000000000
--- a/src/cargo-meson.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-if test "$#" -lt 2
-then
- exit 1
-fi
-
-SOURCE_DIR="$1"
-BUILD_DIR="$2"
-BUILD_TYPE=debug
-
-shift 2
-
-for arg
-do
- case "$arg" in
- --release)
- BUILD_TYPE=release;;
- esac
-done
-
-cargo build --lib --quiet --manifest-path="$SOURCE_DIR/Cargo.toml" --target-dir="$BUILD_DIR" "$@"
-RET=$?
-if test $RET -ne 0
-then
- exit $RET
-fi
-
-case "$(cargo -vV | sed -s 's/^host: \(.*\)$/\1/')" in
- *-windows-*)
- LIBNAME=gitcore.lib;;
- *)
- LIBNAME=libgitcore.a;;
-esac
-
-if ! cmp "$BUILD_DIR/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a" >/dev/null 2>&1
-then
- cp "$BUILD_DIR/$BUILD_TYPE/$LIBNAME" "$BUILD_DIR/libgitcore.a"
-fi
diff --git a/src/meson.build b/src/meson.build
deleted file mode 100644
index 25b9ad5a14..0000000000
--- a/src/meson.build
+++ /dev/null
@@ -1,41 +0,0 @@
-libgit_rs_sources = [
- 'lib.rs',
- 'varint.rs',
-]
-
-# Unfortunately we must use a wrapper command to move the output file into the
-# current build directory. This can fixed once `cargo build --artifact-dir`
-# stabilizes. See https://github.com/rust-lang/cargo/issues/6790 for that
-# effort.
-cargo_command = [
- shell,
- meson.current_source_dir() / 'cargo-meson.sh',
- meson.project_source_root(),
- meson.current_build_dir(),
-]
-if get_option('buildtype') == 'release'
- cargo_command += '--release'
-endif
-
-libgit_rs = custom_target('git_rs',
- input: libgit_rs_sources + [
- meson.project_source_root() / 'Cargo.toml',
- ],
- output: 'libgitcore.a',
- command: cargo_command,
-)
-libgit_dependencies += declare_dependency(link_with: libgit_rs)
-
-if get_option('tests')
- test('rust', cargo,
- args: [
- 'test',
- '--manifest-path',
- meson.project_source_root() / 'Cargo.toml',
- '--target-dir',
- meson.current_build_dir() / 'target',
- ],
- timeout: 0,
- protocol: 'rust',
- )
-endif
--
gitgitgadget
next prev parent reply other threads:[~2025-11-27 1:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 1:10 [PATCH 00/13] RFC: Convert to Cargo workspace Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 01/13] make: undo Patrick's changes concerning Rust Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` Ezekiel Newren via GitGitGadget [this message]
2025-11-27 1:10 ` [PATCH 03/13] cargo: convert from a crate to a workspace Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 04/13] build: build Rust with Makefile and Meson Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 05/13] .gitignore: ignore /generated/ Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 06/13] cargo: create crate generate-headers Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 07/13] cargo: create crate link-with-c Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 08/13] rust/gitcore: link with c Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 09/13] varint.h: unsigned char -> uint8_t Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 10/13] make: delete files in generated/ Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 11/13] github-workflows: unify with rust parameters in make and meson Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 12/13] github workflows: install Rust Ezekiel Newren via GitGitGadget
2025-11-27 1:10 ` [PATCH 13/13] rust/build-rust.sh: update dir_git_root variable instantiation Ezekiel Newren via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd8787e3e07a567acf56c23c69599aaefd87b3b0.1764205835.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail$(echo .)com \
--cc=ezekielnewren@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox