-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
SDL_compat: set rpath during installation; add tests #405305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,12 @@ | |||||||||||||||||||
| pkg-config, | ||||||||||||||||||||
| pkg-config-unwrapped, | ||||||||||||||||||||
| stdenv, | ||||||||||||||||||||
| testers, | ||||||||||||||||||||
| dosbox, | ||||||||||||||||||||
| SDL_image, | ||||||||||||||||||||
| SDL_ttf, | ||||||||||||||||||||
| SDL_mixer, | ||||||||||||||||||||
| SDL_sound, | ||||||||||||||||||||
| # Boolean flags | ||||||||||||||||||||
| libGLSupported ? lib.elem stdenv.hostPlatform.system mesa.meta.platforms, | ||||||||||||||||||||
| openglSupport ? libGLSupported, | ||||||||||||||||||||
|
|
@@ -52,8 +58,33 @@ stdenv.mkDerivation (finalAttrs: { | |||||||||||||||||||
| ] | ||||||||||||||||||||
| ++ lib.optionals openglSupport [ libGLU ]; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| postPatch = '' | ||||||||||||||||||||
| substituteInPlace CMakeLists.txt \ | ||||||||||||||||||||
| --replace-fail 'set(CMAKE_SKIP_RPATH TRUE)' 'set(CMAKE_SKIP_RPATH FALSE)' | ||||||||||||||||||||
| ''; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| dontPatchELF = true; # don't strip rpath | ||||||||||||||||||||
|
|
||||||||||||||||||||
| cmakeFlags = | ||||||||||||||||||||
| let | ||||||||||||||||||||
| rpath = lib.makeLibraryPath [ sdl2-compat ]; | ||||||||||||||||||||
| in | ||||||||||||||||||||
| [ | ||||||||||||||||||||
| (lib.cmakeFeature "CMAKE_INSTALL_RPATH" rpath) | ||||||||||||||||||||
| (lib.cmakeFeature "CMAKE_BUILD_RPATH" rpath) | ||||||||||||||||||||
| (lib.cmakeBool "SDL12TESTS" finalAttrs.finalPackage.doCheck) | ||||||||||||||||||||
| ]; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| enableParallelBuilding = true; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Darwin fails with "Critical error: required built-in appearance SystemAppearance not found" | ||||||||||||||||||||
| doCheck = !stdenv.hostPlatform.isDarwin; | ||||||||||||||||||||
| checkPhase = '' | ||||||||||||||||||||
| runHook preCheck | ||||||||||||||||||||
| ./testver | ||||||||||||||||||||
| runHook postCheck | ||||||||||||||||||||
| ''; | ||||||||||||||||||||
|
||||||||||||||||||||
| checkPhase = '' | |
| runHook preCheck | |
| ./testver | |
| runHook postCheck | |
| ''; | |
| nativeInstallCheckInputs = [ | |
| versionCheckHook | |
| ]; | |
| doInstallCheck = true; |
The version check hook is probably the more-correct way of doing this check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versionCheckHook runs the installed executable of the package with --version argument, the testver is just one of many example programs that are built alongside the lib and never installed. Most of them are displaying something on the screen or are benchmarking so they're not very useful for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay fair! Just feels a bit weird: sdl-config has a --version flag you can give it, so versionCheckHook do the same thing at a glance. Might need a comment explaining you want the example program explicitly, not simply a version check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot that it installs sdl-config. Looking at the code, the --version argument just echoes the hardcoded version so testver, which actually links to the built library, is a better indication that it works. We can still add versionCheckHook as a separate test to check if sdl-config is installed.
Uh oh!
There was an error while loading. Please reload this page.