From 738d25b858291bb64f73c43d5c9379cfb7e11f47 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 26 Apr 2024 13:31:55 -0300 Subject: SDL2_net: migrate to by-name --- pkgs/by-name/sd/SDL2_net/package.nix | 30 +++++++++++++++++++++++++ pkgs/development/libraries/SDL2_net/default.nix | 30 ------------------------- pkgs/top-level/all-packages.nix | 2 -- 3 files changed, 30 insertions(+), 32 deletions(-) create mode 100644 pkgs/by-name/sd/SDL2_net/package.nix delete mode 100644 pkgs/development/libraries/SDL2_net/default.nix diff --git a/pkgs/by-name/sd/SDL2_net/package.nix b/pkgs/by-name/sd/SDL2_net/package.nix new file mode 100644 index 0000000000000..1640c5e3b86bc --- /dev/null +++ b/pkgs/by-name/sd/SDL2_net/package.nix @@ -0,0 +1,30 @@ +{ lib, stdenv, pkg-config, darwin, fetchurl, SDL2 }: + +stdenv.mkDerivation rec { + pname = "SDL2_net"; + version = "2.2.0"; + + src = fetchurl { + url = "https://www.libsdl.org/projects/SDL_net/release/${pname}-${version}.tar.gz"; + sha256 = "sha256-TkqJGYgxYnGXT/TpWF7R73KaEj0iwIvUcxKRedyFf+s="; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = lib.optional stdenv.isDarwin darwin.libobjc; + + configureFlags = [ "--disable-examples" ] + ++ lib.optional stdenv.isDarwin "--disable-sdltest"; + + propagatedBuildInputs = [ SDL2 ]; + + meta = with lib; { + description = "SDL multiplatform networking library"; + homepage = "https://www.libsdl.org/projects/SDL_net"; + license = licenses.zlib; + maintainers = with maintainers; [ ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/development/libraries/SDL2_net/default.nix b/pkgs/development/libraries/SDL2_net/default.nix deleted file mode 100644 index 1640c5e3b86bc..0000000000000 --- a/pkgs/development/libraries/SDL2_net/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ lib, stdenv, pkg-config, darwin, fetchurl, SDL2 }: - -stdenv.mkDerivation rec { - pname = "SDL2_net"; - version = "2.2.0"; - - src = fetchurl { - url = "https://www.libsdl.org/projects/SDL_net/release/${pname}-${version}.tar.gz"; - sha256 = "sha256-TkqJGYgxYnGXT/TpWF7R73KaEj0iwIvUcxKRedyFf+s="; - }; - - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ pkg-config ]; - - buildInputs = lib.optional stdenv.isDarwin darwin.libobjc; - - configureFlags = [ "--disable-examples" ] - ++ lib.optional stdenv.isDarwin "--disable-sdltest"; - - propagatedBuildInputs = [ SDL2 ]; - - meta = with lib; { - description = "SDL multiplatform networking library"; - homepage = "https://www.libsdl.org/projects/SDL_net"; - license = licenses.zlib; - maintainers = with maintainers; [ ]; - platforms = platforms.unix; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c0054b6f0a942..925ad531af7dd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24337,8 +24337,6 @@ with pkgs; # SDL2_mixer_2_0 pinned for lzwolf SDL2_mixer_2_0 = callPackage ../development/libraries/SDL2_mixer/2_0.nix { }; - SDL2_net = callPackage ../development/libraries/SDL2_net { }; - SDL2_gfx = callPackage ../development/libraries/SDL2_gfx { }; SDL2_sound = callPackage ../development/libraries/SDL2_sound { -- cgit 1.4.1 From 922be032e50087a60bf6b878c196ef692d62ff0d Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Wed, 1 May 2024 15:40:55 -0300 Subject: SDL2_net: adopted by AndersonTorres --- pkgs/by-name/sd/SDL2_net/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/sd/SDL2_net/package.nix b/pkgs/by-name/sd/SDL2_net/package.nix index 1640c5e3b86bc..83840a4eada64 100644 --- a/pkgs/by-name/sd/SDL2_net/package.nix +++ b/pkgs/by-name/sd/SDL2_net/package.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation rec { description = "SDL multiplatform networking library"; homepage = "https://www.libsdl.org/projects/SDL_net"; license = licenses.zlib; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ AndersonTorres ]; platforms = platforms.unix; }; } -- cgit 1.4.1 From a13158505e39fc3622f7a4ed07fafcfb0f49d220 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 26 Apr 2024 13:59:54 -0300 Subject: SDL2_net: refactor - finalAttrs - use fetchFromGitHub (since the url is deactivated) - strictDeps - no nested with --- pkgs/by-name/sd/SDL2_net/package.nix | 54 ++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/pkgs/by-name/sd/SDL2_net/package.nix b/pkgs/by-name/sd/SDL2_net/package.nix index 83840a4eada64..79e0e0098623d 100644 --- a/pkgs/by-name/sd/SDL2_net/package.nix +++ b/pkgs/by-name/sd/SDL2_net/package.nix @@ -1,30 +1,50 @@ -{ lib, stdenv, pkg-config, darwin, fetchurl, SDL2 }: - -stdenv.mkDerivation rec { +{ + lib, + SDL2, + darwin, + fetchFromGitHub, + pkg-config, + stdenv, + # Boolean flags + enableSdltest ? (!stdenv.isDarwin), +}: + +stdenv.mkDerivation (finalAttrs: { pname = "SDL2_net"; version = "2.2.0"; - src = fetchurl { - url = "https://www.libsdl.org/projects/SDL_net/release/${pname}-${version}.tar.gz"; - sha256 = "sha256-TkqJGYgxYnGXT/TpWF7R73KaEj0iwIvUcxKRedyFf+s="; + src = fetchFromGitHub { + owner = "libsdl-org"; + repo = "SDL_net"; + rev = "release-${finalAttrs.version}"; + hash = "sha256-sEcKn/apA6FcR7ijb7sfuvP03ZdVfjkNZTXsasK8fAI="; }; outputs = [ "out" "dev" ]; - nativeBuildInputs = [ pkg-config ]; - - buildInputs = lib.optional stdenv.isDarwin darwin.libobjc; + nativeBuildInputs = [ + SDL2 + pkg-config + ]; - configureFlags = [ "--disable-examples" ] - ++ lib.optional stdenv.isDarwin "--disable-sdltest"; + buildInputs = lib.optionals stdenv.isDarwin [ + darwin.libobjc + ]; propagatedBuildInputs = [ SDL2 ]; - meta = with lib; { + configureFlags = [ + (lib.enableFeature false "examples") # can't find libSDL2_test.a + (lib.enableFeature enableSdltest "sdltest") + ]; + + strictDeps = true; + + meta = { + homepage = "https://github.com/libsdl-org/SDL_net"; description = "SDL multiplatform networking library"; - homepage = "https://www.libsdl.org/projects/SDL_net"; - license = licenses.zlib; - maintainers = with maintainers; [ AndersonTorres ]; - platforms = platforms.unix; + license = lib.licenses.zlib; + maintainers = with lib.maintainers; [ AndersonTorres ]; + inherit (SDL2.meta) platforms; }; -} +}) -- cgit 1.4.1