famistudio: 4.2.1 -> 4.3.0 (#366804)

This commit is contained in:
Cosima Neidahl
2024-12-31 15:30:25 +01:00
committed by GitHub
2 changed files with 24 additions and 44 deletions
+24 -21
View File
@@ -1,5 +1,5 @@
{
stdenv,
stdenvNoCC,
lib,
buildDotnetModule,
dotnetCorePackages,
@@ -13,44 +13,46 @@
openal,
portaudio,
rtmidi,
_experimental-update-script-combinators,
gitUpdater,
}:
let
csprojName =
if stdenv.hostPlatform.isLinux then
if stdenvNoCC.hostPlatform.isLinux then
"FamiStudio.Linux"
else if stdenv.hostPlatform.isDarwin then
else if stdenvNoCC.hostPlatform.isDarwin then
"FamiStudio.Mac"
else
throw "Don't know how to build FamiStudio for ${stdenv.hostPlatform.system}";
throw "Don't know how to build FamiStudio for ${stdenvNoCC.hostPlatform.system}";
in
buildDotnetModule rec {
buildDotnetModule (finalAttrs: {
pname = "famistudio";
version = "4.2.1";
version = "4.3.0";
src = fetchFromGitHub {
owner = "BleuBleu";
repo = "FamiStudio";
rev = "refs/tags/${version}";
hash = "sha256-WYy/6cWQg3Ayok/eAdnvlWAvdcuhy/sdlWOVvaYcPkc=";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-Ldht7w1qgLTiqbRUJJvFQgl1VW6k+14w/jz58kAeMl0=";
};
postPatch =
let
libname = library: "${library}${stdenv.hostPlatform.extensions.sharedLibrary}";
libname = library: "${library}${stdenvNoCC.hostPlatform.extensions.sharedLibrary}";
buildNativeWrapper =
args:
callPackage ./build-native-wrapper.nix (
args
// {
inherit version src;
sourceRoot = "${src.name}/ThirdParty/${args.depname}";
inherit (finalAttrs) version src;
sourceRoot = "${finalAttrs.src.name}/ThirdParty/${args.depname}";
}
);
nativeWrapperToReplaceFormat =
args:
let
libPrefix = lib.optionalString stdenv.hostPlatform.isLinux "lib";
libPrefix = lib.optionalString stdenvNoCC.hostPlatform.isLinux "lib";
in
{
package = buildNativeWrapper args;
@@ -71,14 +73,14 @@ buildDotnetModule rec {
ourName = "librtmidi";
}
]
++ lib.optionals stdenv.hostPlatform.isLinux [
++ lib.optionals stdenvNoCC.hostPlatform.isLinux [
{
package = openal;
expectedName = "libopenal32";
ourName = "libopenal";
}
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
++ lib.optionals stdenvNoCC.hostPlatform.isDarwin [
{
package = portaudio;
expectedName = "libportaudio.2";
@@ -117,10 +119,10 @@ buildDotnetModule rec {
rm FamiStudio/*.{dll,dylib,so*}
# Replace copying of vendored prebuilt native libraries with copying of our native libraries
substituteInPlace ${projectFile} ${libraryReplaceArgs}
substituteInPlace ${finalAttrs.projectFile} ${libraryReplaceArgs}
# Un-hardcode target platform if set
sed -i -e '/PlatformTarget/d' ${projectFile}
sed -i -e '/PlatformTarget/d' ${finalAttrs.projectFile}
# Don't require a special name to be preserved, our OpenAL isn't 32-bit
substituteInPlace FamiStudio/Source/AudioStreams/OpenALStream.cs \
@@ -130,10 +132,8 @@ buildDotnetModule rec {
projectFile = "FamiStudio/${csprojName}.csproj";
nugetDeps = ./deps.json;
dotnet-sdk = dotnetCorePackages.sdk_8_0;
dotnet-runtime = dotnetCorePackages.runtime_8_0;
dotnetFlags = [ "-p:TargetFramework=net8.0" ];
runtimeDeps = lib.optionals stdenv.hostPlatform.isLinux [
runtimeDeps = lib.optionals stdenvNoCC.hostPlatform.isLinux [
libglvnd
];
@@ -152,7 +152,10 @@ buildDotnetModule rec {
--prefix PATH : ${lib.makeBinPath [ ffmpeg ]}
'';
passthru.updateScript = ./update.sh;
passthru.updateScript = _experimental-update-script-combinators.sequence [
(gitUpdater { }).command
(finalAttrs.passthru.fetch-deps)
];
meta = {
homepage = "https://famistudio.org/";
@@ -168,4 +171,4 @@ buildDotnetModule rec {
platforms = lib.platforms.unix;
mainProgram = "FamiStudio";
};
}
})
-23
View File
@@ -1,23 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts
set -eo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
deps_file="$(realpath "./deps.nix")"
new_version="$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
-s "https://api.github.com/repos/BleuBleu/FamiStudio/releases?per_page=1" | jq -r '.[0].tag_name')"
old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
if [[ "$new_version" == "$old_version" ]]; then
echo "Up to date"
exit 0
fi
cd ../../../..
if [[ "$1" != "--deps-only" ]]; then
update-source-version famistudio "$new_version"
fi
$(nix-build . -A famistudio.fetch-deps --no-out-link) "$deps_file"