Skip to content

Commit 52aa7e5

Browse files
committed
Merge branch 'bc/rust-by-default' into jch
Rust support is enabled by default (but still allows opting out) in some future version of Git. * bc/rust-by-default: Enable Rust by default Linux: link against libdl ci: install cargo on Alpine docs: update version with default Rust support
2 parents b571cd9 + 32d5b90 commit 52aa7e5

8 files changed

Lines changed: 17 additions & 11 deletions

File tree

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,9 @@ include shared.mak
498498
#
499499
# == Optional Rust support ==
500500
#
501-
# Define WITH_RUST if you want to include features and subsystems written in
502-
# Rust into Git. For now, Rust is still an optional feature of the build
503-
# process. With Git 3.0 though, Rust will always be enabled.
501+
# Define NO_RUST if you want to disable features and subsystems written in Rust
502+
# from being compiled into Git. For now, Rust is still an optional feature of
503+
# the build process. With Git 3.0 though, Rust will always be enabled.
504504
#
505505
# Building Rust code requires Cargo.
506506
#
@@ -1351,7 +1351,7 @@ LIB_OBJS += urlmatch.o
13511351
LIB_OBJS += usage.o
13521352
LIB_OBJS += userdiff.o
13531353
LIB_OBJS += utf8.o
1354-
ifndef WITH_RUST
1354+
ifdef NO_RUST
13551355
LIB_OBJS += varint.o
13561356
endif
13571357
LIB_OBJS += version.o
@@ -1590,7 +1590,7 @@ endif
15901590
ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_APPEND)
15911591
ALL_LDFLAGS = $(LDFLAGS) $(LDFLAGS_APPEND)
15921592

1593-
ifdef WITH_RUST
1593+
ifndef NO_RUST
15941594
BASIC_CFLAGS += -DWITH_RUST
15951595
GITLIBS += $(RUST_LIB)
15961596
ifeq ($(uname_S),Windows)

ci/install-dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ alpine-*)
2929
apk add --update shadow sudo meson ninja-build gcc libc-dev curl-dev openssl-dev expat-dev gettext \
3030
zlib-ng-dev pcre2-dev python3 musl-libintl perl-utils ncurses \
3131
apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
32-
bash cvs gnupg perl-cgi perl-dbd-sqlite perl-io-tty >/dev/null
32+
bash cvs gnupg perl-cgi perl-dbd-sqlite perl-io-tty cargo >/dev/null
3333
;;
3434
fedora-*|almalinux-*)
3535
case "$jobname" in

ci/lib.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ linux-asan-ubsan)
372372
osx-meson)
373373
MESONFLAGS="$MESONFLAGS -Dcredential_helpers=osxkeychain"
374374
;;
375+
windows-*)
376+
export NO_RUST=UnfortunatelyYes
377+
;;
375378
esac
376379

377380
MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"

ci/run-build-and-tests.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
export TEST_CONTRIB_TOO=yes
99

1010
case "$jobname" in
11+
linux-musl-meson)
12+
MESONFLAGS="$MESONFLAGS -Drust=disabled"
13+
;;
1114
fedora-breaking-changes-musl|linux-breaking-changes)
1215
export WITH_BREAKING_CHANGES=YesPlease
13-
export WITH_RUST=YesPlease
1416
MESONFLAGS="$MESONFLAGS -Dbreaking_changes=true"
15-
MESONFLAGS="$MESONFLAGS -Drust=enabled"
1617
;;
1718
linux-TEST-vars)
1819
export OPENSSL_SHA1_UNSAFE=YesPlease
@@ -30,6 +31,7 @@ linux-TEST-vars)
3031
export GIT_TEST_PACK_USE_BITMAP_BOUNDARY_TRAVERSAL=1
3132
;;
3233
linux-clang)
34+
export NO_RUST=UnfortunatelyYes
3335
export GIT_TEST_DEFAULT_HASH=sha1
3436
;;
3537
linux-sha256)

config.mak.uname

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ ifeq ($(uname_S),Linux)
6363
PROCFS_EXECUTABLE_PATH = /proc/self/exe
6464
HAVE_PLATFORM_PROCINFO = YesPlease
6565
COMPAT_OBJS += compat/linux/procinfo.o
66+
EXTLIBS += -ldl
6667
# centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.
6768
ifneq ($(findstring .el7.,$(uname_R)),)
6869
BASIC_CFLAGS += -std=c99

meson.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,8 +1751,7 @@ version_def_h = custom_target(
17511751
)
17521752
libgit_sources += version_def_h
17531753

1754-
cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))
1755-
rust_option = get_option('rust').disable_auto_if(not cargo.found())
1754+
rust_option = get_option('rust')
17561755
if rust_option.allowed()
17571756
subdir('src')
17581757
libgit_c_args += '-DWITH_RUST'

meson_options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ option('zlib_backend', type: 'combo', choices: ['auto', 'zlib', 'zlib-ng'], valu
7777
# Build tweaks.
7878
option('breaking_changes', type: 'boolean', value: false,
7979
description: 'Enable upcoming breaking changes.')
80-
option('rust', type: 'feature', value: 'auto',
80+
option('rust', type: 'feature', value: 'enabled',
8181
description: 'Enable building with Rust.')
8282
option('macos_use_homebrew_gettext', type: 'boolean', value: true,
8383
description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')

src/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ libgit_rs = custom_target('git_rs',
2929
)
3030
libgit_dependencies += declare_dependency(link_with: libgit_rs)
3131

32+
cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))
3233
if get_option('tests')
3334
test('rust', cargo,
3435
args: [

0 commit comments

Comments
 (0)