Web lists-archives.com

Re: Git 2.18: RUNTIME_PREFIX... is it working?

Hi Paul,

On Wed, 4 Jul 2018, Paul Smith wrote:

> I was excited to see the RUNTIME_PREFIX for POSIX systems patchset go
> by earlier this year.  Although I didn't see any mention of it being
> included in the 2.18.0 release notes, it does appear that it was merged
> in for this release.
> Has anyone else tried to get it working?  It doesn't appear to be
> working properly for me so I'm not sure if I'm supposed to be doing
> something different... I didn't see any documentation on it.

It is working (for ages) in the Git for Windows build.

> Basically what happens is that I run configure with
> --prefix=/my/install/path --with-gitconfig=etc/gitconfig
> --with-gitattributes=etc/gitattributes.
> Then I run make with RUNTIME_PREFIX=YesPlease.

Ah. In Git for Windows, we do not use configure. I *think* this points to
an incompatibility of the RUNTIME_PREFIX feature with our autoconf
support, and this is a grand opportunity for you to step in and help.

Essentially, what you will want to do is to implement a new configure
option --with-runtime-prefix that then prevents the autoconf script from
munging the relative paths in the way it does.

> When I look in the makefile, I see that the make variable gitexecdir is
> initially properly set to libexec/git-core which is what I expect.
> However, later in the makefile we include the config.mak.autogen file,
> which was generated from config.mk.in by configure.  In the .in file we
> have this:
>  gitexecdir = @libexecdir@/git-core
> After configure gets done with it, this becomes:
>  gitexecdir = ${prefix}/libexec/git-core
> which is a fully-qualified path.  This means that exec-cmd.c is
> compiled with -DGIT_EXEC_PATH="/my/install/path/libexec/git-core" which
> effectively disables RUNTIME_PREFIX, as the exec-cmd.c:system_prefix()
> function always returns FALLBACK_RUNTIME_PREFIX since GIT_EXEC_PATH is
> not a suffix of executable_dirname (once the install location has been
> moved).


I am actually quite surprised that it builds for you, given this part of
the Makefile:

-- snip --

ifneq ($(filter /%,$(firstword $(gitexecdir_relative))),)
$(error RUNTIME_PREFIX requires a relative gitexecdir, not: $(gitexecdir))

-- snap --

I am also quite surprised that config.mk.in tries to set gitexecdir. But I
guess that is for cases where you want to override it via --libexecdir?

> I suppose we need to pass more configure options to reset paths; is
> there information somewhere on exactly which ones should be overridden?
>  For example if I try to pass configure --libexecdir=libexec to solve
> the above issue, I get an error from configure:
>  configure: error: expected an absolute directory name for --libexecdir: libexec
> Any info on how this is supposed to work, is welcome!

I just saw another thing:

-- snip --
exec-cmd.sp exec-cmd.s exec-cmd.o: GIT-PREFIX
exec-cmd.sp exec-cmd.s exec-cmd.o: EXTRA_CPPFLAGS = \
        '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
        '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
        '-DBINDIR="$(bindir_relative_SQ)"' \
-- snap --

Is it possible that we should use `gitexecdir_relative_SQ` here instead?
Does that fix things for you?

I Cc:ed Dan so he could correct my hunch that this GIT_EXEC_PATH
definition needs to be fixed.