Re: [PATCH v6 2/5] libgit-sys: introduce Rust wrapper for libgit.a
On 2025.01.15 15:13, Junio C Hamano wrote:
Show 35 quoted lines
> Josh Steadmon <steadmon@google.com> writes:
>
> > diff --git a/contrib/libgit-sys/public_symbol_export.c b/contrib/libgit-sys/public_symbol_export.c
> > new file mode 100644
> > index 0000000000..7cd5007902
> > --- /dev/null
> > +++ b/contrib/libgit-sys/public_symbol_export.c
> > @@ -0,0 +1,21 @@
> > +// Shim to publicly export Git symbols. These must be renamed so that the
> > +// original symbols can be hidden. Renaming these with a "libgit_" prefix also
> > +// avoids conflicts with other libraries such as libgit2.
>
> Style.
>
> > +#include "git-compat-util.h"
> > +#include "contrib/libgit-sys/public_symbol_export.h"
> > +#include "version.h"
> > +
> > +#pragma GCC visibility push(default)
> > +
> > +const char *libgit_user_agent(void)
> > +{
> > + return git_user_agent();
> > +}
> > +
> > +const char *libgit_user_agent_sanitized(void)
> > +{
> > + return git_user_agent_sanitized();
> > +}
> > +
> > +#pragma GCC visibility pop
>
> I do not think we would mind not having Rust binding support on
> platforms without GCC (and clang---I assume it would be aware of and
> react to that #pragma GCC the same way?).Yes, GCC and clang both handle this the same way.
> But do we allow this file
> to be left uncompiled when the build wants to opt out of Rust
> support?
Yes, in V7 this will only be built if INCLUDE_LIBGIT_RS is set.