-
-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
{SDL1, SDL_compat}: migrate to by-name (#339311)
- Loading branch information
Showing
8 changed files
with
85 additions
and
61 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
46 changes: 23 additions & 23 deletions
46
...elopment/libraries/SDL_compat/default.nix → pkgs/by-name/sd/SDL_compat/package.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,62 @@ | ||
{ lib | ||
, stdenv | ||
, fetchFromGitHub | ||
, cmake | ||
, pkg-config | ||
, SDL2 | ||
, cmake | ||
, darwin | ||
, fetchFromGitHub | ||
, libGLU | ||
, libiconv | ||
, Cocoa | ||
, autoSignDarwinBinariesHook | ||
, mesa | ||
, pkg-config | ||
, stdenv | ||
# Boolean flags | ||
, libGLSupported ? lib.elem stdenv.hostPlatform.system mesa.meta.platforms | ||
, openglSupport ? libGLSupported | ||
, libGLU | ||
}: | ||
|
||
let | ||
inherit (lib) optionals makeLibraryPath; | ||
|
||
inherit (darwin.apple_sdk.frameworks) Cocoa; | ||
inherit (darwin) autoSignDarwinBinariesHook; | ||
in | ||
stdenv.mkDerivation rec { | ||
stdenv.mkDerivation (finalAttrs: { | ||
pname = "SDL_compat"; | ||
version = "1.2.68"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "libsdl-org"; | ||
repo = "sdl12-compat"; | ||
rev = "release-" + version; | ||
rev = "release-" + finalAttrs.version; | ||
hash = "sha256-f2dl3L7/qoYNl4sjik1npcW/W09zsEumiV9jHuKnUmM="; | ||
}; | ||
|
||
nativeBuildInputs = [ cmake pkg-config ] | ||
++ optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ]; | ||
++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ]; | ||
|
||
propagatedBuildInputs = [ SDL2 ] | ||
++ optionals stdenv.hostPlatform.isDarwin [ libiconv Cocoa ] | ||
++ optionals openglSupport [ libGLU ]; | ||
++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv Cocoa ] | ||
++ lib.optionals openglSupport [ libGLU ]; | ||
|
||
enableParallelBuilding = true; | ||
|
||
setupHook = ../SDL/setup-hook.sh; | ||
setupHook = ./setup-hook.sh; | ||
|
||
postFixup = '' | ||
for lib in $out/lib/*${stdenv.hostPlatform.extensions.sharedLibrary}* ; do | ||
if [[ -L "$lib" ]]; then | ||
${if stdenv.hostPlatform.isDarwin then '' | ||
install_name_tool ${lib.strings.concatMapStrings (x: " -add_rpath ${makeLibraryPath [x]} ") propagatedBuildInputs} "$lib" | ||
install_name_tool ${lib.strings.concatMapStrings (x: " -add_rpath ${lib.makeLibraryPath [x]} ") finalAttrs.propagatedBuildInputs} "$lib" | ||
'' else '' | ||
patchelf --set-rpath "$(patchelf --print-rpath $lib):${makeLibraryPath propagatedBuildInputs}" "$lib" | ||
patchelf --set-rpath "$(patchelf --print-rpath $lib):${lib.makeLibraryPath finalAttrs.propagatedBuildInputs}" "$lib" | ||
''} | ||
fi | ||
done | ||
''; | ||
|
||
meta = with lib; { | ||
meta = { | ||
homepage = "https://www.libsdl.org/"; | ||
description = "Cross-platform multimedia library - build SDL 1.2 applications against 2.0"; | ||
license = lib.licenses.zlib; | ||
mainProgram = "sdl-config"; | ||
homepage = "https://www.libsdl.org/"; | ||
license = licenses.zlib; | ||
maintainers = with maintainers; [ peterhoeg ]; | ||
platforms = platforms.all; | ||
maintainers = lib.teams.sdl.members ++ (with lib.maintainers; [ peterhoeg ]); | ||
platforms = lib.platforms.all; | ||
}; | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
addSDLPath () { | ||
if [ -e "$1/include/SDL" ]; then | ||
export SDL_PATH="${SDL_PATH-}${SDL_PATH:+ }$1/include/SDL" | ||
# NB this doesn’t work with split dev packages because different packages | ||
# will contain "include/SDL/" and "lib/" directories. | ||
# | ||
# However the SDL_LIB_PATH is consumed by SDL itself and serves to locate | ||
# libraries like SDL_mixer, SDL_image, etc which are not split-package | ||
# so the check above will only trigger on them. | ||
if [ -e "$1/lib" ]; then | ||
export SDL_LIB_PATH="${SDL_LIB_PATH-}${SDL_LIB_PATH:+ }-L$1/lib" | ||
fi | ||
fi | ||
} | ||
|
||
addEnvHooks "$hostOffset" addSDLPath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters