From 5cd01b6e7aeccc05afdc17eae2104e8cf7a2c67b Mon Sep 17 00:00:00 2001 From: theofficialgman <28281419+theofficialgman@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:17:18 -0500 Subject: [PATCH] don't require runtime to be set to install from source --- src/linux/Packaging.Linux/build.sh | 22 ++-------------------- src/linux/Packaging.Linux/layout.sh | 27 ++++++++++++++++----------- src/linux/Packaging.Linux/pack.sh | 20 ++++++++++++++++++++ 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/src/linux/Packaging.Linux/build.sh b/src/linux/Packaging.Linux/build.sh index 88f1b0359..62352a7e8 100755 --- a/src/linux/Packaging.Linux/build.sh +++ b/src/linux/Packaging.Linux/build.sh @@ -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 diff --git a/src/linux/Packaging.Linux/layout.sh b/src/linux/Packaging.Linux/layout.sh index 9355eaa02..ccf031156 100755 --- a/src/linux/Packaging.Linux/layout.sh +++ b/src/linux/Packaging.Linux/layout.sh @@ -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}" @@ -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..." diff --git a/src/linux/Packaging.Linux/pack.sh b/src/linux/Packaging.Linux/pack.sh index 817704f76..4cf5aaea7 100755 --- a/src/linux/Packaging.Linux/pack.sh +++ b/src/linux/Packaging.Linux/pack.sh @@ -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)