feat: initialize modules setup w/ Nix
This commit is contained in:
		
				commit
				
					
						a42efe2c82
					
				
			
		
					 8 changed files with 298 additions and 0 deletions
				
			
		|  | @ -0,0 +1,30 @@ | |||
| From 1999109df34e67ed7c34d2b6b42f59feafc22bf1 Mon Sep 17 00:00:00 2001 | ||||
| From: seth <getchoo@tuta.io> | ||||
| Date: Fri, 12 Jul 2024 21:59:14 -0400 | ||||
| Subject: [PATCH] cmake: use `FULL` install directory variants in pkg-config | ||||
|  file | ||||
| 
 | ||||
| Instead of manually prepending the install prefix to | ||||
| `CMAKE_INSTALL_<dir>` (which may already be an absolute path), we can | ||||
| let cmake do it for us | ||||
| ---
 | ||||
|  cmake/sdl3.pc.in | 4 ++-- | ||||
|  1 file changed, 2 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/cmake/sdl3.pc.in b/cmake/sdl3.pc.in
 | ||||
| index bfc2afffe..3724d6cf8 100644
 | ||||
| --- a/cmake/sdl3.pc.in
 | ||||
| +++ b/cmake/sdl3.pc.in
 | ||||
| @@ -1,7 +1,7 @@
 | ||||
|  prefix=@SDL_PKGCONFIG_PREFIX@ | ||||
|  exec_prefix=${prefix} | ||||
| -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
 | ||||
| -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
 | ||||
| +libdir=@CMAKE_INSTALL_FULL_LIBDIR@
 | ||||
| +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
 | ||||
|   | ||||
|  Name: sdl3 | ||||
|  Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. | ||||
| -- 
 | ||||
| 2.45.2 | ||||
| 
 | ||||
							
								
								
									
										95
									
								
								nix/SDL3.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								nix/SDL3.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,95 @@ | |||
| { | ||||
|   lib, | ||||
|   stdenv, | ||||
|   fetchFromGitHub, | ||||
|   alsa-lib, | ||||
|   cmake, | ||||
|   darwin, | ||||
|   dbus, | ||||
|   fcitx5, | ||||
|   libdecor, | ||||
|   libdrm, | ||||
|   libjack2, | ||||
|   libpulseaudio, | ||||
|   libxkbcommon, | ||||
|   mesa, | ||||
|   nas, | ||||
|   ninja, | ||||
|   pipewire, | ||||
|   sndio, | ||||
|   systemdLibs, | ||||
|   testers, | ||||
|   validatePkgConfig, | ||||
|   wayland, | ||||
|   xorg, | ||||
| }: | ||||
| stdenv.mkDerivation (finalAttrs: { | ||||
|   pname = "sdl3"; | ||||
|   version = "3.1.2-unstable-2024-08-01"; | ||||
| 
 | ||||
|   src = fetchFromGitHub { | ||||
|     owner = "libsdl-org"; | ||||
|     repo = "SDL"; | ||||
|     rev = "f01d4278c66e065e64bc934cd01e4f2952f613d7"; | ||||
|     hash = "sha256-ok3ortmy5dm3zZdH+3tAvOIRDrDxDDXBjxBC3nGdHDM="; | ||||
|   }; | ||||
| 
 | ||||
|   patches = [ | ||||
|     # Case of https://github.com/NixOS/nixpkgs/issues/144170 | ||||
|     # Remove if/when https://github.com/libsdl-org/SDL/pull/10246 is merged | ||||
|     ./0001-cmake-use-FULL-install-directory-variants-in-pkg-con.patch | ||||
|   ]; | ||||
| 
 | ||||
|   outputs = [ | ||||
|     "lib" | ||||
|     "dev" | ||||
|     "out" | ||||
|   ]; | ||||
| 
 | ||||
|   nativeBuildInputs = [ | ||||
|     cmake | ||||
|     ninja | ||||
|     validatePkgConfig | ||||
|   ]; | ||||
| 
 | ||||
|   buildInputs = | ||||
|     lib.optionals stdenv.isLinux [ | ||||
|       alsa-lib | ||||
|       dbus | ||||
|       fcitx5 | ||||
|       libdecor | ||||
|       libdrm | ||||
|       libjack2 | ||||
|       libpulseaudio | ||||
|       mesa # libgbm | ||||
|       nas # libaudo | ||||
|       pipewire | ||||
|       sndio | ||||
|       systemdLibs # libudev | ||||
| 
 | ||||
|       # SDL_VIDEODRIVER=wayland | ||||
|       wayland | ||||
| 
 | ||||
|       # SDL_VIDEODRIVER=x11 | ||||
|       libxkbcommon | ||||
|       xorg.libX11 | ||||
|       xorg.libXcursor | ||||
|       xorg.libXext | ||||
|       xorg.libXfixes | ||||
|       xorg.libXi | ||||
|       xorg.libXrandr | ||||
|     ] | ||||
|     ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Cocoa ]); | ||||
| 
 | ||||
|   passthru = { | ||||
|     tests.pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; }; | ||||
|   }; | ||||
| 
 | ||||
|   meta = { | ||||
|     description = "Cross-platform development library (Pre-release version)"; | ||||
|     homepage = "https://libsdl.org"; | ||||
|     license = lib.licenses.zlib; | ||||
|     maintainers = with lib.maintainers; [ getchoo ]; | ||||
|     pkgConfigModules = [ "sdl3" ]; | ||||
|   }; | ||||
| }) | ||||
		Reference in a new issue
	
	 Matias
				Matias