Skip to content
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

SDL2_image and SDL2_ttf Toolchain fix #2

Open
wants to merge 2 commits into
base: knulli-main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions package/sdl2_image/sdl2_image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ SDL2_IMAGE_CONF_OPTS = \
--enable-xpm \
--enable-xv

define SDL2_IMAGE_FIX_SDL2_CONFIG_CMAKE
$(SED) '2iget_filename_component(PACKAGE_PREFIX_DIR "$${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)\n' \
$(STAGING_DIR)/usr/lib/cmake/SDL2_image/sdl2_image-config.cmake
$(SED) 's%"/usr"%$${PACKAGE_PREFIX_DIR}%' \
$(STAGING_DIR)/usr/lib/cmake/SDL2_image/sdl2_image-config.cmake
endef

SDL2_IMAGE_DEPENDENCIES = sdl2 host-pkgconf

ifeq ($(BR2_PACKAGE_JPEG),y)
Expand Down Expand Up @@ -57,4 +64,6 @@ else
SDL2_IMAGE_CONF_OPTS += --disable-webp
endif

SDL2_IMAGE_POST_INSTALL_STAGING_HOOKS += SDL2_IMAGE_FIX_SDL2_CONFIG_CMAKE

$(eval $(autotools-package))
38 changes: 38 additions & 0 deletions package/sdl2_ttf/sdl2_ttf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,43 @@ SDL2_TTF_INSTALL_STAGING = YES
SDL2_TTF_DEPENDENCIES = sdl2 freetype host-pkgconf
SDL2_TTF_CONF_OPTS = --disable-freetype-builtin --disable-harfbuzz-builtin

#
# The ttf library for some reason has a broken regex where it adds -linux-gnu
# as a library to link against, which it pulls from the path. This is only
# broken in the cross toolchain.
#
# Adding a regex to pull out the entire -linux-gnu flag after the regex runs.
#
define SDL2_TTF_FIX_SDL2_CONFIG_CMAKE
$(SED) '18iget_filename_component(PACKAGE_PREFIX_DIR "$${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)\n' \
$(STAGING_DIR)/usr/lib/cmake/SDL2_ttf/sdl2_ttf-config.cmake
$(SED) 's%"/usr"%$${PACKAGE_PREFIX_DIR}%' \
$(STAGING_DIR)/usr/lib/cmake/SDL2_ttf/sdl2_ttf-config.cmake
$(SED) '37istring(REGEX REPLACE "\-linux-gnu " "" _sdl2ttf_extra_static_libraries "${_sdl2ttf_extra_static_libraries}")' \
$(STAGING_DIR)/usr/lib/cmake/SDL2_ttf/sdl2_ttf-config.cmake
$(SED) '39iset(_sdl2ttf_extra_static_libraries "-lfreetype -lharfbuzz")' \
$(STAGING_DIR)/usr/lib/cmake/SDL2_ttf/sdl2_ttf-config.cmake
endef

# batocera
define SDL2_TTF_FIX_WAYLAND_SCANNER_PATH
sed -i "s+/usr/bin/wayland-scanner+$(HOST_DIR)/usr/bin/wayland-scanner+g" $(@D)/Makefile
endef

define SDL2_TTF_FIX_CONFIGURE_PATHS
sed -i "s+/host/bin/\.\.+/host+g" $(@D)/config.log
sed -i "s+/host/bin/\.\.+/host+g" $(@D)/config.status
sed -i "s+/host/bin/\.\.+/host+g" $(@D)/libtool
sed -i "s+/host/bin/\.\.+/host+g" $(@D)/Makefile
sed -i "s+/host/bin/\.\.+/host+g" $(@D)/sdl2_ttf-config
sed -i "s+/host/bin/\.\.+/host+g" $(@D)/sdl2_ttf.pc
sed -i "s+-I/.* ++g" $(@D)/sdl2_ttf.pc
endef

SDL2_TTF_POST_INSTALL_STAGING_HOOKS += SDL2_TTF_FIX_SDL2_CONFIG_CMAKE
SDL2_TTF_POST_CONFIGURE_HOOKS += SDL2_TTF_FIX_WAYLAND_SCANNER_PATH
SDL2_TTF_POST_CONFIGURE_HOOKS += SDL2_TTF_FIX_CONFIGURE_PATHs

ifeq ($(BR2_PACKAGE_HARFBUZZ),y)
SDL2_TTF_DEPENDENCIES += harfbuzz
SDL2_TTF_CONF_OPTS += --enable-harfbuzz
Expand All @@ -33,4 +70,5 @@ SDL2_TTF_CONF_OPTS += \
--without-x
endif


$(eval $(autotools-package))