From 3b10400948ec4d6165153f1d97d3c7d41253bb85 Mon Sep 17 00:00:00 2001 From: Qstick Date: Fri, 2 Dec 2022 17:58:39 -0600 Subject: [PATCH] New: FreeBSD Support Co-authored-by: Mark McDowall --- build.sh | 40 +++++++++++++------ .../Sonarr.Mono.Test.csproj | 2 +- src/NzbDrone.Mono/Sonarr.Mono.csproj | 2 +- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/build.sh b/build.sh index 7c58aca0c..337e08b99 100755 --- a/build.sh +++ b/build.sh @@ -29,12 +29,19 @@ UpdateVersionNumber() fi } -EnableBsdSupport() +EnableExtraPlatformsInSDK() { - #todo enable sdk with - #SDK_PATH=$(dotnet --list-sdks | grep -P '5\.\d\.\d+' | head -1 | sed 's/\(5\.[0-9]*\.[0-9]*\).*\[\(.*\)\]/\2\/\1/g') - # BUNDLED_VERSIONS="${SDK_PATH}/Microsoft.NETCoreSdk.BundledVersions.props" + BUNDLEDVERSIONS="${SDK_PATH}/Microsoft.NETCoreSdk.BundledVersions.props" + if grep -q freebsd-x64 "$BUNDLEDVERSIONS"; then + echo "Extra platforms already enabled" + else + echo "Enabling extra platform support" + sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64/' "$BUNDLEDVERSIONS" + fi +} +EnableExtraPlatforms() +{ if grep -qv freebsd-x64 src/Directory.Build.props; then sed -i'' -e "s^\(.*\)^\1;freebsd-x64^g" src/Directory.Build.props fi @@ -318,7 +325,8 @@ if [ $# -eq 0 ]; then FRONTEND=YES PACKAGES=YES LINT=YES - ENABLE_BSD=NO + ENABLE_EXTRA_PLATFORMS=NO + ENABLE_EXTRA_PLATFORMS_IN_SDK=NO fi while [[ $# -gt 0 ]] @@ -330,8 +338,12 @@ case $key in BACKEND=YES shift # past argument ;; - --enable-bsd) - ENABLE_BSD=YES + --enable-bsd|--enable-extra-platforms) + ENABLE_EXTRA_PLATFORMS=YES + shift # past argument + ;; + --enable-extra-platforms-in-sdk) + ENABLE_EXTRA_PLATFORMS_IN_SDK=YES shift # past argument ;; -r|--runtime) @@ -371,13 +383,17 @@ esac done set -- "${POSITIONAL[@]}" # restore positional parameters +if [ "$ENABLE_EXTRA_PLATFORMS_IN_SDK" = "YES" ]; +then + EnableExtraPlatformsInSDK +fi + if [ "$BACKEND" = "YES" ]; then UpdateVersionNumber - - if [ "$ENABLE_BSD" = "YES" ]; + if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ]; then - EnableBsdSupport + EnableExtraPlatforms fi Build @@ -389,7 +405,7 @@ then PackageTests "net6.0" "linux-x64" PackageTests "net6.0" "linux-musl-x64" PackageTests "net6.0" "osx-x64" - if [ "$ENABLE_BSD" = "YES" ]; + if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ]; then PackageTests "net6.0" "freebsd-x64" fi @@ -428,7 +444,7 @@ then Package "net6.0" "linux-arm" Package "net6.0" "osx-x64" Package "net6.0" "osx-arm64" - if [ "$ENABLE_BSD" = "YES" ]; + if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ]; then Package "net6.0" "freebsd-x64" fi diff --git a/src/NzbDrone.Mono.Test/Sonarr.Mono.Test.csproj b/src/NzbDrone.Mono.Test/Sonarr.Mono.Test.csproj index c0d20b25f..2660db2e4 100644 --- a/src/NzbDrone.Mono.Test/Sonarr.Mono.Test.csproj +++ b/src/NzbDrone.Mono.Test/Sonarr.Mono.Test.csproj @@ -7,7 +7,7 @@ See https://github.com/xamarin/XamarinComponents/issues/282 --> - + diff --git a/src/NzbDrone.Mono/Sonarr.Mono.csproj b/src/NzbDrone.Mono/Sonarr.Mono.csproj index 27b216910..7901ccd16 100644 --- a/src/NzbDrone.Mono/Sonarr.Mono.csproj +++ b/src/NzbDrone.Mono/Sonarr.Mono.csproj @@ -8,7 +8,7 @@ See https://github.com/xamarin/XamarinComponents/issues/282 --> - +