diff --git a/pkgs/development/libraries/csfml/default.nix b/pkgs/by-name/cs/csfml/package.nix similarity index 51% rename from pkgs/development/libraries/csfml/default.nix rename to pkgs/by-name/cs/csfml/package.nix index 397d5186a1c4f..1b9b6c5b84ce1 100644 --- a/pkgs/development/libraries/csfml/default.nix +++ b/pkgs/by-name/cs/csfml/package.nix @@ -1,19 +1,32 @@ -{ lib, stdenv, fetchFromGitHub, cmake, sfml }: +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + sfml, +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "csfml"; - version = "2.5.2"; + version = "2.6.1"; + src = fetchFromGitHub { owner = "SFML"; - repo = "CSFML"; - rev = version; - sha256 = "sha256-A5C/4SnxUX7mW1wkPWJWX3dwMhrJ79DkBuZ7UYzTOqE="; + repo = "CSFML"; + rev = finalAttrs.version; + hash = "sha256-ECt0ySDpYWF0zuDBSnQzDwUm4Xj4z1+XSC55D6yivac="; }; + nativeBuildInputs = [ cmake ]; buildInputs = [ sfml ]; cmakeFlags = [ "-DCMAKE_MODULE_PATH=${sfml}/share/SFML/cmake/Modules/" ]; - meta = with lib; { + postPatch = '' + substituteInPlace tools/pkg-config/* \ + --replace-fail 'libdir=''${exec_prefix}/@CMAKE_INSTALL_LIBDIR@' "libdir=@CMAKE_INSTALL_FULL_LIBDIR@" + ''; + + meta = { homepage = "https://www.sfml-dev.org/"; description = "Simple and fast multimedia library"; longDescription = '' @@ -21,8 +34,8 @@ stdenv.mkDerivation rec { It provides access to windowing, graphics, audio and network. It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python. ''; - license = licenses.zlib; - maintainers = [ maintainers.jpdoyle ]; - platforms = platforms.linux; + license = lib.licenses.zlib; + maintainers = with lib.maintainers; [ drawbu jpdoyle ]; + platforms = lib.platforms.unix; }; -} +}) diff --git a/pkgs/by-name/sf/sfml/CMakeLists.txt-pkgconfig.patch b/pkgs/by-name/sf/sfml/CMakeLists.txt-pkgconfig.patch new file mode 100644 index 0000000000000..c8e36750419da --- /dev/null +++ b/pkgs/by-name/sf/sfml/CMakeLists.txt-pkgconfig.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fc9a268e..512eb6a7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -301,6 +301,9 @@ endif() + sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES ${SFML_INSTALL_PKGCONFIG_DEFAULT} BOOL "TRUE to automatically install pkg-config files so other projects can find SFML") + + if(SFML_INSTALL_PKGCONFIG_FILES) ++ file(RELATIVE_PATH SFML_RELATIVE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_LIBDIR}) ++ set(SFML_PKGCONFIG_DIR "/${SFML_RELATIVE_INSTALL_LIBDIR}/pkgconfig") ++ + sfml_set_option(SFML_PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${SFML_PKGCONFIG_DIR}" PATH "Install directory for SFML's pkg-config .pc files") + + foreach(sfml_module IN ITEMS all system window graphics audio network) diff --git a/pkgs/by-name/sf/sfml/package.nix b/pkgs/by-name/sf/sfml/package.nix new file mode 100644 index 0000000000000..be5719afad97b --- /dev/null +++ b/pkgs/by-name/sf/sfml/package.nix @@ -0,0 +1,99 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + libX11, + freetype, + libjpeg, + openal, + flac, + libvorbis, + glew, + libXrandr, + libXrender, + udev, + xcbutilimage, + darwin, + libXcursor, + fetchpatch, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "sfml"; + version = "2.6.1"; + + src = fetchFromGitHub { + owner = "SFML"; + repo = "SFML"; + rev = finalAttrs.version; + hash = "sha256-R+ULgaKSPadcPNW4D2/jlxMKHc1L9e4FprgqLRuyZk4="; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = + [ + freetype + libjpeg + openal + flac + libvorbis + glew + ] + ++ lib.optional stdenv.hostPlatform.isLinux udev + ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ + libX11 + libXrandr + libXrender + xcbutilimage + libXcursor + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin ( + with darwin.apple_sdk.frameworks; + [ + IOKit + Foundation + AppKit + OpenAL + ] + ); + + cmakeFlags = [ + "-DSFML_INSTALL_PKGCONFIG_FILES=yes" + "-DSFML_MISC_INSTALL_PREFIX=share/SFML" + "-DSFML_BUILD_FRAMEWORKS=no" + "-DSFML_USE_SYSTEM_DEPS=yes" + ]; + + patches = [ + # Fix pkg-config + # See https://github.com/SFML/SFML/issues/2815 + # Also, too much changes in CMakeLists.txt and changelog.md, + # so we patchin cmake ourself + (fetchpatch { + url = "https://patch-diff.githubusercontent.com/raw/SFML/SFML/pull/2835.patch"; + hash = "sha256-kdOAXR9YPQllx64z9dgwCV+vy0cJvIsZZboZKFc4Q8Q="; + excludes = [ + "changelog.md" + "CMakeLists.txt" + ]; + }) + ./CMakeLists.txt-pkgconfig.patch + ]; + + meta = { + homepage = "https://www.sfml-dev.org/"; + description = "Simple and fast multimedia library"; + longDescription = '' + SFML is a simple, fast, cross-platform and object-oriented multimedia API. + It provides access to windowing, graphics, audio and network. + It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python. + ''; + license = lib.licenses.zlib; + maintainers = with lib.maintainers; [ + drawbu + astsmtl + ]; + platforms = lib.platforms.unix; + }; +}) diff --git a/pkgs/development/libraries/sfml/default.nix b/pkgs/development/libraries/sfml/default.nix deleted file mode 100644 index 2b28228c5f57e..0000000000000 --- a/pkgs/development/libraries/sfml/default.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, fetchpatch -, cmake -, libX11 -, freetype -, libjpeg -, openal -, flac -, libvorbis -, glew -, libXrandr -, libXrender -, udev -, xcbutilimage -, IOKit -, Foundation -, AppKit -, OpenAL -}: - -stdenv.mkDerivation rec { - pname = "sfml"; - version = "2.5.1"; - - src = fetchFromGitHub { - owner = "SFML"; - repo = "SFML"; - rev = version; - sha256 = "sha256-Xt2Ct4vV459AsSvJxQfwMsNs6iA5y3epT95pLWJGeSk="; - }; - - patches = [ - (fetchpatch { - url = "https://github.com/macports/macports-ports/raw/4df1fc235a708ff28200ffc0a39120974ed4b6e1/multimedia/sfml/files/patch-apple-silicon.diff"; - extraPrefix = ""; - sha256 = "sha256-9dNawJaYtkugR+2NvhQOhgsf6w9ZXHkBgsDRh8yAJc0="; - }) - (fetchpatch { - url = "https://github.com/SFML/SFML/commit/bf92efe9a4035fee0258386173d53556aa196e49.patch"; - hash = "sha256-1htwPfpn7Z6s/3b+/i1tQ+btjr/tWv5m6IyDVMBNqQA="; - }) - ]; - - nativeBuildInputs = [ cmake ]; - buildInputs = [ freetype libjpeg openal flac libvorbis glew ] - ++ lib.optional stdenv.hostPlatform.isLinux udev - ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ libX11 libXrandr libXrender xcbutilimage ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ IOKit Foundation AppKit OpenAL ]; - - cmakeFlags = [ - "-DSFML_INSTALL_PKGCONFIG_FILES=yes" - "-DSFML_MISC_INSTALL_PREFIX=share/SFML" - "-DSFML_BUILD_FRAMEWORKS=no" - "-DSFML_USE_SYSTEM_DEPS=yes" - ]; - - meta = with lib; { - homepage = "https://www.sfml-dev.org/"; - description = "Simple and fast multimedia library"; - longDescription = '' - SFML is a simple, fast, cross-platform and object-oriented multimedia API. - It provides access to windowing, graphics, audio and network. - It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python. - ''; - license = licenses.zlib; - maintainers = [ maintainers.astsmtl ]; - platforms = platforms.unix; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b15df4f0cfdef..83b3b32b2d2e3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22948,11 +22948,6 @@ with pkgs; simpleitk = callPackage ../development/libraries/simpleitk { lua = lua5_4; }; - sfml = callPackage ../development/libraries/sfml { - inherit (darwin.apple_sdk.frameworks) IOKit Foundation AppKit OpenAL; - }; - csfml = callPackage ../development/libraries/csfml { }; - sharness = callPackage ../development/libraries/sharness { }; shibboleth-sp = callPackage ../development/libraries/shibboleth-sp { };