Skip to content

Commit

Permalink
package/sdl2: fix sdl2-config.cmake instead of removing it
Browse files Browse the repository at this point in the history
SDL2 autotools-provided sdl2-config.cmake uses the absolute /usr prefix.
For this reason, we previously removed it (as of d592618).

This commit fixes sdl2-config.cmake to use relative paths instead.

Signed-off-by: Gleb Mazovetskiy <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
  • Loading branch information
glebm authored and tpetazzoni committed Jul 29, 2021
1 parent 209e580 commit cb46522
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions package/sdl2/sdl2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ SDL2_CONF_OPTS += \

# We are using autotools build system for sdl2, so the sdl2-config.cmake
# include path are not resolved like for sdl2-config script.
# Remove sdl2-config.cmake file and avoid unsafe include path if this
# file is used by a cmake based package.
# Change the absolute /usr path to resolve relatively to the sdl2-config.cmake location.
# https://bugzilla.libsdl.org/show_bug.cgi?id=4597
define SDL2_REMOVE_SDL2_CONFIG_CMAKE
rm -rf $(STAGING_DIR)/usr/lib/cmake/SDL2
define SDL2_FIX_SDL2_CONFIG_CMAKE
$(SED) '2iget_filename_component(PACKAGE_PREFIX_DIR "$${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)\n' \
$(STAGING_DIR)/usr/lib/cmake/SDL2/sdl2-config.cmake
$(SED) 's%"/usr"%$${PACKAGE_PREFIX_DIR}%' \
$(STAGING_DIR)/usr/lib/cmake/SDL2/sdl2-config.cmake
endef
SDL2_POST_INSTALL_STAGING_HOOKS += SDL2_REMOVE_SDL2_CONFIG_CMAKE
SDL2_POST_INSTALL_STAGING_HOOKS += SDL2_FIX_SDL2_CONFIG_CMAKE

# We must enable static build to get compilation successful.
SDL2_CONF_OPTS += --enable-static
Expand Down

0 comments on commit cb46522

Please sign in to comment.