Skip to content

Commit

Permalink
don't require runtime to be set to install from source
Browse files Browse the repository at this point in the history
  • Loading branch information
theofficialgman committed Nov 6, 2024
1 parent 31ce754 commit 5cd01b6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 31 deletions.
22 changes: 2 additions & 20 deletions src/linux/Packaging.Linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,10 @@ if [ ! -d "$INSTALL_PREFIX" ]; then
mkdir -p "$INSTALL_PREFIX"
fi

# Fall back to host architecture if no explicit runtime is given.
if test -z "$RUNTIME"; then
HOST_ARCH="`dpkg-architecture -q DEB_HOST_ARCH`"

case $HOST_ARCH in
amd64)
RUNTIME="linux-x64"
;;
arm64)
RUNTIME="linux-arm64"
;;
armhf)
RUNTIME="linux-arm"
;;
*)
die "Could not determine host architecture!"
;;
esac
if [ ! -z "$RUNTIME" ]; then
echo "Building for runtime ${RUNTIME}"
fi

echo "Building for runtime ${RUNTIME}"

# Perform pre-execution checks
CONFIGURATION="${CONFIGURATION:=Debug}"
if [ -z "$VERSION" ]; then
Expand Down
27 changes: 16 additions & 11 deletions src/linux/Packaging.Linux/layout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ PROJ_OUT="$OUT/linux/Packaging.Linux"
# Build parameters
FRAMEWORK=net8.0

if [ -z "$RUNTIME" ]; then
die "--runtime was not set"
fi

# Perform pre-execution checks
CONFIGURATION="${CONFIGURATION:=Debug}"

Expand Down Expand Up @@ -76,13 +72,22 @@ fi

# Publish core application executables
echo "Publishing core application..."
$DOTNET_ROOT/dotnet publish "$GCM_SRC" \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
-p:PublishSingleFile=true \
--output="$(make_absolute "$PAYLOAD")" || exit 1
if [ -z "$RUNTIME" ]; then
$DOTNET_ROOT/dotnet publish "$GCM_SRC" \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--self-contained \
-p:PublishSingleFile=true \
--output="$(make_absolute "$PAYLOAD")" || exit 1
else
$DOTNET_ROOT/dotnet publish "$GCM_SRC" \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
-p:PublishSingleFile=true \
--output="$(make_absolute "$PAYLOAD")" || exit 1
fi

# Collect symbols
echo "Collecting managed symbols..."
Expand Down
20 changes: 20 additions & 0 deletions src/linux/Packaging.Linux/pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,26 @@ INSTALL_TO="$DEBROOT/usr/local/share/gcm-core/"
LINK_TO="$DEBROOT/usr/local/bin/"
mkdir -p "$DEBROOT/DEBIAN" "$INSTALL_TO" "$LINK_TO" || exit 1

# Fall back to host architecture if no explicit runtime is given.
if test -z "$RUNTIME"; then
HOST_ARCH="`dpkg-architecture -q DEB_HOST_ARCH`"

case $HOST_ARCH in
amd64)
RUNTIME="linux-x64"
;;
arm64)
RUNTIME="linux-arm64"
;;
armhf)
RUNTIME="linux-arm"
;;
*)
die "Could not determine host architecture!"
;;
esac
fi

# Determine architecture for debian control file from the runtime architecture
case $RUNTIME in
linux-x64)
Expand Down

0 comments on commit 5cd01b6

Please sign in to comment.