about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsuperherointj <5861043+superherointj@users.noreply.github.com>2024-05-02 17:20:07 -0300
committerGitHub <noreply@github.com>2024-05-02 17:20:07 -0300
commit1f49ce9c46789c7ea9dea780ff1af6b03e889b87 (patch)
tree3298b835e91c1c08edb099e138c40bb985420d19
parent8daae6f98a5b413f7f6cafb2e29f148a8c7a5691 (diff)
parenta13158505e39fc3622f7a4ed07fafcfb0f49d220 (diff)
Merge pull request #308360 from atorres1985-contrib/sdl2_net
SDL2_net: adopt and refactor
-rw-r--r--pkgs/by-name/sd/SDL2_net/package.nix50
-rw-r--r--pkgs/development/libraries/SDL2_net/default.nix30
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 50 insertions, 32 deletions
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 000000000000..79e0e0098623
--- /dev/null
+++ b/pkgs/by-name/sd/SDL2_net/package.nix
@@ -0,0 +1,50 @@
+{
+  lib,
+  SDL2,
+  darwin,
+  fetchFromGitHub,
+  pkg-config,
+  stdenv,
+  # Boolean flags
+  enableSdltest ? (!stdenv.isDarwin),
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "SDL2_net";
+  version = "2.2.0";
+
+  src = fetchFromGitHub {
+    owner = "libsdl-org";
+    repo = "SDL_net";
+    rev = "release-${finalAttrs.version}";
+    hash = "sha256-sEcKn/apA6FcR7ijb7sfuvP03ZdVfjkNZTXsasK8fAI=";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [
+    SDL2
+    pkg-config
+  ];
+
+  buildInputs = lib.optionals stdenv.isDarwin [
+    darwin.libobjc
+  ];
+
+  propagatedBuildInputs = [ SDL2 ];
+
+  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";
+    license = lib.licenses.zlib;
+    maintainers = with lib.maintainers; [ AndersonTorres ];
+    inherit (SDL2.meta) platforms;
+  };
+})
diff --git a/pkgs/development/libraries/SDL2_net/default.nix b/pkgs/development/libraries/SDL2_net/default.nix
deleted file mode 100644
index 1640c5e3b86b..000000000000
--- 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 ee250c1d0ce7..f50447d709c8 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -24344,8 +24344,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 {