Skip to content

Commit 17250be

Browse files
author
Matthew John Cheetham
authored
don't require runtime to be set to install from source (#1757)
@mjcheetham this should fix this #1633 (comment) it also fixes as a side effect the alpine linux build from source being built against the wrong [glibc linux (linux-x64)](https://github.com/git-ecosystem/git-credential-manager/actions/runs/11573830139/job/32216761503#step:5:142) runtime instead of the correct [musl linux (linux-musl-x64)](https://github.com/theofficialgman/git-credential-manager/actions/runs/11706600286/job/32604070640#step:5:142) runtime full test run: https://github.com/theofficialgman/git-credential-manager/actions/runs/11706600286
2 parents 31ce754 + 5cd01b6 commit 17250be

File tree

3 files changed

+38
-31
lines changed

3 files changed

+38
-31
lines changed

src/linux/Packaging.Linux/build.sh

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,10 @@ if [ ! -d "$INSTALL_PREFIX" ]; then
4949
mkdir -p "$INSTALL_PREFIX"
5050
fi
5151

52-
# Fall back to host architecture if no explicit runtime is given.
53-
if test -z "$RUNTIME"; then
54-
HOST_ARCH="`dpkg-architecture -q DEB_HOST_ARCH`"
55-
56-
case $HOST_ARCH in
57-
amd64)
58-
RUNTIME="linux-x64"
59-
;;
60-
arm64)
61-
RUNTIME="linux-arm64"
62-
;;
63-
armhf)
64-
RUNTIME="linux-arm"
65-
;;
66-
*)
67-
die "Could not determine host architecture!"
68-
;;
69-
esac
52+
if [ ! -z "$RUNTIME" ]; then
53+
echo "Building for runtime ${RUNTIME}"
7054
fi
7155

72-
echo "Building for runtime ${RUNTIME}"
73-
7456
# Perform pre-execution checks
7557
CONFIGURATION="${CONFIGURATION:=Debug}"
7658
if [ -z "$VERSION" ]; then

src/linux/Packaging.Linux/layout.sh

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ PROJ_OUT="$OUT/linux/Packaging.Linux"
4444
# Build parameters
4545
FRAMEWORK=net8.0
4646

47-
if [ -z "$RUNTIME" ]; then
48-
die "--runtime was not set"
49-
fi
50-
5147
# Perform pre-execution checks
5248
CONFIGURATION="${CONFIGURATION:=Debug}"
5349

@@ -76,13 +72,22 @@ fi
7672

7773
# Publish core application executables
7874
echo "Publishing core application..."
79-
$DOTNET_ROOT/dotnet publish "$GCM_SRC" \
80-
--configuration="$CONFIGURATION" \
81-
--framework="$FRAMEWORK" \
82-
--runtime="$RUNTIME" \
83-
--self-contained \
84-
-p:PublishSingleFile=true \
85-
--output="$(make_absolute "$PAYLOAD")" || exit 1
75+
if [ -z "$RUNTIME" ]; then
76+
$DOTNET_ROOT/dotnet publish "$GCM_SRC" \
77+
--configuration="$CONFIGURATION" \
78+
--framework="$FRAMEWORK" \
79+
--self-contained \
80+
-p:PublishSingleFile=true \
81+
--output="$(make_absolute "$PAYLOAD")" || exit 1
82+
else
83+
$DOTNET_ROOT/dotnet publish "$GCM_SRC" \
84+
--configuration="$CONFIGURATION" \
85+
--framework="$FRAMEWORK" \
86+
--runtime="$RUNTIME" \
87+
--self-contained \
88+
-p:PublishSingleFile=true \
89+
--output="$(make_absolute "$PAYLOAD")" || exit 1
90+
fi
8691

8792
# Collect symbols
8893
echo "Collecting managed symbols..."

src/linux/Packaging.Linux/pack.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,26 @@ INSTALL_TO="$DEBROOT/usr/local/share/gcm-core/"
100100
LINK_TO="$DEBROOT/usr/local/bin/"
101101
mkdir -p "$DEBROOT/DEBIAN" "$INSTALL_TO" "$LINK_TO" || exit 1
102102

103+
# Fall back to host architecture if no explicit runtime is given.
104+
if test -z "$RUNTIME"; then
105+
HOST_ARCH="`dpkg-architecture -q DEB_HOST_ARCH`"
106+
107+
case $HOST_ARCH in
108+
amd64)
109+
RUNTIME="linux-x64"
110+
;;
111+
arm64)
112+
RUNTIME="linux-arm64"
113+
;;
114+
armhf)
115+
RUNTIME="linux-arm"
116+
;;
117+
*)
118+
die "Could not determine host architecture!"
119+
;;
120+
esac
121+
fi
122+
103123
# Determine architecture for debian control file from the runtime architecture
104124
case $RUNTIME in
105125
linux-x64)

0 commit comments

Comments
 (0)