Received: from avasout-ptp-002.plus.net (avasout-ptp-002.plus.net [84.93.230.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D835B1C8638 for ; Fri, 16 May 2025 18:49:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.93.230.235 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747421373; cv=none; b=nwxyNiVJ6idklFExUpND6PZmFI6tFH8Sa+G388MCoMAM0kqSvUBFIBxvD6/gzl+6WwDiJCmav7JhMODd5X0QDhnEM4Xtfvnz8gryNaWyF7RMIbYQZ/Y4axnxd3rbVG10aEq40kg+z8J0HmMUrGfqYf7gKVaulIMkWWhyXX/uh0U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747421373; c=relaxed/simple; bh=77LDRwZCGFK03HkDJFOW3fbsVmYdBmra66B4Y9Sr+ng=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I/ZF/vNT1vi0N/ad/Ba5i4AhWieMic10S2HcwbCAMEYrvrSEx4djQma3HJ4NUccBUIZ5KeLnfWNt7OL5oXrqO09owr4hkLDe5w32zd7zlnS3AyIM1+7Yl/Sly5nKDYDiNjJNmr0iHmFZc9tc7ilNcIk8O26+pgZ6tWoSv6vJZDc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com; spf=none smtp.mailfrom=ramsayjones.plus.com; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b=gfp0jb5M; arc=none smtp.client-ip=84.93.230.235 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ramsayjones.plus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plus.com header.i=@plus.com header.b="gfp0jb5M" Received: from localhost.localdomain ([80.189.83.109]) by smtp with ESMTPA id G071uFdJgJGekG07euP0ho; Fri, 16 May 2025 19:49:30 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1747421370; bh=QWeFmqE2mDGXQ7oUcjq9OKW+cO+YDJPK1IrTZvJijPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gfp0jb5Mfpl3IJJ55azYbBYYGwb8y/Y4PJE3n3wlUKpHrqdnUm71dngGVQfTUowJx D4zmqhUdX4HdmLA4qGmfDKPPxRjx4c1hy6xherEn7J6UeO3+gtLBRpM9/ZwRps3Yw7 GzB+XS/Yf61QMdW7ukjMfctYEX1AIUJWDeS3OSWDeKmiFRRkEXnEJ5mUdwQVbT4Tdw lXShZoKAmEgRr367gJMEqqLjhAtrKjbwLNKwpkalC/EOaNrhTRItA8FeqedrauycX2 AgOKOBDFQsLt8vxtoN4P37PAL5sIGZX+2RYHf4QzscT5AL0ue8FpbzMHwZN0UKybei QK/gz3a9GkEGA== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=FoOm/Hrq c=1 sm=1 tr=0 ts=682788ba a=oM5NSl/Bl4BpjFr0C8iQlQ==:117 a=oM5NSl/Bl4BpjFr0C8iQlQ==:17 a=EBOSESyhAAAA:8 a=oT9sOl9EXadLr-pDyssA:9 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 From: Ramsay Jones To: GIT Mailing-list Cc: Ramsay Jones , Junio C Hamano , Patrick Steinhardt , Eli Schwartz , =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Subject: [PATCH v3 4/5] meson.build: correct setting of GIT_EXEC_PATH Date: Fri, 16 May 2025 19:48:42 +0100 Message-ID: <20250516184843.1524925-5-ramsay@ramsayjones.plus.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250516184843.1524925-1-ramsay@ramsayjones.plus.com> References: <20250513191739.1513460-1-ramsay@ramsayjones.plus.com> <20250516184843.1524925-1-ramsay@ramsayjones.plus.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfPLseYrPgo/sgNB0FV+vlUuXGblYOpM4Bawy512mZF7eIyM2UqSTHlkvxqbTQeNxGReGrtNXjctS61ahEb2TReKCaf/SY3BHmdCh01WCneE7KpjkAYBu EqRFp/A93w+V9/ik5DunWtbo18wXRbNj1IaYF6SGsz+zWhMFJ3l8raKfJ+7QCY2g53VeFG+y/ZwkelHA3y5IstHc3v3/aQejuT0= For the non-'runtime prefix' case, the meson build sets the GIT_EXEC_PATH build variable to an absolute path equivalent to /libexec/git-core. In comparison, the default make build sets it to a relative path equivalent to 'libexec/git-core'. Indeed, the make build requires the use of some means outside of the Makefile (eg. config.mak[.*] or the command-line) to set GIT_EXEC_PATH to anything other than 'libexec/git-core'. For example, the make invocation: $ make gitexecdir=/some/other/bin all install will build git with GIT_EXEC_PATH set to '/some/other/bin' and install the 'library' executables to that location. However, without setting the 'gitexecdir' make variable, irrespective of the 'runtime prefix' setting, the GIT_EXEC_PATH is always set to 'libexec/git-core'. The meson built-in 'libexecdir' option can be used to provide a similar configurability. The default value for the option is 'libexec'. Attempting to set the option to '' on the command-line, will reset it to the '.' string, presumably to ensure a relative path value. This commit allows the meson build, similar to the above, to configure the project like: $ meson setup --buildtype=debugoptimized -Dprefix=$HOME -Dpcre2=disabled \ -Dlibexecdir=/some/other/bin build so that the GIT_EXEC_PATH is set to '/some/other/bin'. Absent the -Dlibexecdir argument, the GIT_EXEC_PATH is set to 'libexec/git-core'. In order to correct the value of GIT_EXEC_PATH, default the value to the static string value 'libexec/git-core', and only override if the value of the 'libexecdir' option has a value different to 'libexec' or '.'. Also, like the Makefile, add a check for an absolute path when the runtime prefix option is true (and if so, error out). Signed-off-by: Ramsay Jones --- meson.build | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 8e8f228a37..bd14bc15a1 100644 --- a/meson.build +++ b/meson.build @@ -1592,10 +1592,19 @@ else error('Unsupported CSPRNG backend: ' + csprng_backend) endif +git_exec_path = 'libexec/git-core' +libexec = get_option('libexecdir') +if libexec != 'libexec' and libexec != '.' + git_exec_path = libexec +endif + if get_option('runtime_prefix') libgit_c_args += '-DRUNTIME_PREFIX' build_options_config.set('RUNTIME_PREFIX', 'true') - git_exec_path = get_option('libexecdir') / 'git-core' + + if git_exec_path.startswith('/') + error('runtime_prefix requires a relative libexecdir not:', libexec) + endif if compiler.has_header('mach-o/dyld.h') libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH' @@ -1632,7 +1641,6 @@ if get_option('runtime_prefix') endif else build_options_config.set('RUNTIME_PREFIX', 'false') - git_exec_path = get_option('prefix') / get_option('libexecdir') / 'git-core' endif libgit_c_args += '-DGIT_EXEC_PATH="' + git_exec_path + '"' -- 2.49.0