#!/usr/bin/env bash # Build one plugin zip per Jellyfin generation into ./artifacts. # # Jellyfin binds a plugin to the exact API it was compiled against, and 10.11 changed # signatures that still compile but fail at runtime. So each generation gets its own DLL # (see the TargetFrameworks comment in Jellyfin.Plugin.SRFPlay.csproj) and its own # manifest entry. Jellyfin installs the highest version whose targetAbi is <= the server # version, so the flavour code is folded into the version to keep them apart: # # net8.0 -> targetAbi 10.9.0.0 (Jellyfin 10.9 / 10.10) code 9 # net9.0 -> targetAbi 10.11.0.0 (Jellyfin 10.11) code 11 # net10.0 -> targetAbi 12.0.0.0 (Jellyfin 12) code 12 # # Usage: build-plugins.sh # is a printf format that receives the flavour code, e.g. # "1.2.0.%d" -> 1.2.0.9, 1.2.0.11, 1.2.0.12 (release) # "1.0.20260924.204%02d" -> 1.0.20260924.20409, ...20411, ...20412 (nightly) # # Writes artifacts/builds.tsv with one line per zip: version, targetAbi, zip path, md5. set -euo pipefail FORMAT="$1" FLAVOURS=( "net8.0 10.9.0.0 9" "net9.0 10.11.0.0 11" "net10.0 12.0.0.0 12" ) mkdir -p artifacts : > artifacts/builds.tsv # jprm has no targetAbi flag and reads it from build.yaml, so rewrite it per flavour. cp build.yaml build.yaml.orig trap 'mv -f build.yaml.orig build.yaml' EXIT for flavour in "${FLAVOURS[@]}"; do read -r framework abi code <<< "$flavour" # shellcheck disable=SC2059 # the format is the argument by design version=$(printf "$FORMAT" "$code") cp build.yaml.orig build.yaml sed -i \ -e "s/^version:.*/version: \"${version}\"/" \ -e "s/^targetAbi:.*/targetAbi: \"${abi}\"/" \ -e "s/^framework:.*/framework: \"${framework}\"/" \ -e "s/^dotnet_framework:.*/dotnet_framework: \"${framework}\"/" \ build.yaml echo ">> ${version}: ${framework}, targetAbi ${abi}" jprm --verbosity=debug plugin build . --dotnet-framework "${framework}" --version "${version}" zip="artifacts/srfplay_${version}.zip" if [ ! -f "${zip}" ]; then echo "jprm did not produce ${zip}" >&2 exit 1 fi printf '%s\t%s\t%s\t%s\n' "${version}" "${abi}" "${zip}" "$(md5sum "${zip}" | awk '{print $1}')" >> artifacts/builds.tsv done cat artifacts/builds.tsv