Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions pkgs/development/libraries/SDL/setup-hook.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
addSDLPath () {
if [ -e "$1/include/SDL" ]; then
export SDL_PATH="${SDL_PATH-}${SDL_PATH:+ }$1/include/SDL"
fi
if [ -e "$1/lib" ]; then
export SDL_LIB_PATH="${SDL_LIB_PATH-}${SDL_LIB_PATH:+ }-L$1/lib"
# 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 SDL2_mixer, SDL2_image, etc which are not split-package
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sdl2-mixer has out and dev however sdl-mixer doesn't

and there's no sdl-* which have split outputs fd --type d 'sdl_' pkgs/development/libraries | xargs -I {} cat "{}/default.nix" | grep outputs

#296919

Copy link
Member

@Artturin Artturin Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the lib file names could be matched for sdl? that could work with split outputs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're accidentally fine - SDL_PATH is only used by the SDL package. For SDL2 there's SDL2_PATH and different setup hook, still employing similar structure and probably susceptible to sdl2-mixer having split outputs: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/SDL2/setup-hook.sh.

Maybe the lib file names could be matched for sdl? that could work with split outputs

Do you mean that shell in setup-hook.sh would somehow analyse its argument to determine whether we're looking at an sdl components 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
}

Expand Down