Skip to content

Commit 8ac5375

Browse files
committed
installsrc: build a non-AOT binary from source
Enabling Native AOT made install-from-source.sh fail across every distro: linking a native binary needs a C toolchain (clang and zlib headers) that the script does not install, so the publish aborts with "gcc or clang is missing". Installing from source does not need a native binary. Build a normal framework-dependent one instead by setting PublishAot=false in the environment for the build; the executable project now honours an externally supplied PublishAot and the nested publish inherits it through the packaging scripts. The shipped packages, which set nothing, still default to AOT. This keeps the only requirement for a source install the .NET SDK the script already bootstraps, rather than a per-distro C toolchain. Assisted-by: Claude Opus 4.8 Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
1 parent 20996cd commit 8ac5375

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/linux/Packaging.Linux/install-from-source.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,5 +259,9 @@ if [ -z "$DOTNET_ROOT" ]; then
259259
fi
260260

261261
cd "$toplevel_path"
262-
$sudo_cmd env "PATH=$PATH" $DOTNET_ROOT/dotnet build ./src/linux/Packaging.Linux/Packaging.Linux.csproj -c Release -p:InstallFromSource=true -p:installPrefix=$installPrefix
262+
# Build a non-AOT binary so installing from source needs only the .NET SDK,
263+
# not a C toolchain (clang + zlib) to link a native build. PublishAot is read
264+
# from the environment by Git-Credential-Manager.csproj and inherited by the
265+
# nested publish.
266+
$sudo_cmd env "PATH=$PATH" PublishAot=false $DOTNET_ROOT/dotnet build ./src/linux/Packaging.Linux/Packaging.Linux.csproj -c Release -p:InstallFromSource=true -p:installPrefix=$installPrefix
263267
add_to_PATH "$installPrefix/bin"

src/shared/Git-Credential-Manager/Git-Credential-Manager.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
<IsTestProject>false</IsTestProject>
1111
<LangVersion>latest</LangVersion>
1212
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
13-
<PublishAot>true</PublishAot>
13+
<!-- Produce a native AOT build by default. Building from source can set
14+
PublishAot=false in the environment to opt out, so installing locally
15+
doesn't require a C toolchain (clang + zlib) just to link. -->
16+
<PublishAot Condition="'$(PublishAot)' == ''">true</PublishAot>
1417
</PropertyGroup>
1518

1619
<ItemGroup>

0 commit comments

Comments
 (0)