From e60eb81d5666399502e5aab83a439839454a294d Mon Sep 17 00:00:00 2001 From: Zi Ree Date: Thu, 19 Jan 2023 12:38:02 +0100 Subject: [PATCH] Linux: use system wide fontconfig instead of 3p library, if all goes well we can later remove it from autobuild.xml - patch by PorkChop, thank you! --- indra/cmake/Copy3rdPartyLibs.cmake | 4 ++-- indra/cmake/FreeType.cmake | 12 ++++++------ indra/cmake/UI.cmake | 2 +- indra/cmake/ViewerMiscLibs.cmake | 3 ++- indra/llwindow/CMakeLists.txt | 7 +++++-- indra/newview/linux_tools/wrapper.sh | 2 +- indra/newview/viewer_manifest.py | 4 ++-- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index b9d18e10aa..d0c32504a2 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -256,8 +256,8 @@ elseif(LINUX) #libopenjpeg.so libuuid.so.16 libuuid.so.16.0.22 - libfontconfig.so.1.10.1 - libfontconfig.so.1 + #libfontconfig.so.1.10.1 # fontconfig and freetype should be taken from the + #libfontconfig.so.1 # user's system, and not be packaged with the viewer libaprutil-1.so.0 libapr-1.so.0 ) diff --git a/indra/cmake/FreeType.cmake b/indra/cmake/FreeType.cmake index 79159843e1..d3d42a6d72 100644 --- a/indra/cmake/FreeType.cmake +++ b/indra/cmake/FreeType.cmake @@ -6,14 +6,14 @@ if (USESYSTEMLIBS) pkg_check_modules(FREETYPE REQUIRED freetype2) else (USESYSTEMLIBS) - use_prebuilt_binary(freetype) - set(FREETYPE_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) - set(FREETYPE_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/freetype2) # Also add freetype2 to search dir, or some includes will fail. - # Linux links this via UI.cmake - if( NOT LINUX ) + if (LINUX) # linux fontconfig and freetype should come + find_package(Freetype REQUIRED) # from the user's system + else (LINUX) # Linux links this via llwindow/CMakeLists + use_prebuilt_binary(freetype) + set(FREETYPE_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) + set(FREETYPE_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/freetype2) # Also add freetype2 to search dir, or some includes will fail. set(FREETYPE_LIBRARIES freetype) endif() - # endif (USESYSTEMLIBS) link_directories(${FREETYPE_LIBRARY_DIRS}) diff --git a/indra/cmake/UI.cmake b/indra/cmake/UI.cmake index e00413b1a4..015600588e 100644 --- a/indra/cmake/UI.cmake +++ b/indra/cmake/UI.cmake @@ -47,7 +47,7 @@ else (USESYSTEMLIBS) if (LINUX) set(UI_LIB_NAMES libfltk.a - libfreetype.a + # libfreetype.a # fontconfig and freetype should be taken from the user's system, and not be packaged with the viewer ) foreach(libname ${UI_LIB_NAMES}) diff --git a/indra/cmake/ViewerMiscLibs.cmake b/indra/cmake/ViewerMiscLibs.cmake index 980b2a0fdc..4bada32021 100644 --- a/indra/cmake/ViewerMiscLibs.cmake +++ b/indra/cmake/ViewerMiscLibs.cmake @@ -4,7 +4,8 @@ include(Prebuilt) if (NOT USESYSTEMLIBS) if (LINUX) use_prebuilt_binary(libuuid) - use_prebuilt_binary(fontconfig) + find_package(Fontconfig REQUIRED) # fontconfig and freetype should be taken from the + # use_prebuilt_binary(fontconfig) # user's system, and not be packaged with the viewer endif (LINUX) use_prebuilt_binary(libhunspell) use_prebuilt_binary(slvoice) diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 6fa501e58b..8d6c2f379e 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -67,6 +67,7 @@ set(viewer_HEADER_FILES # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level if (LINUX) + find_package(Fontconfig REQUIRED) # fontconfig and freetype should be taken from the user's system set(llwindow_LINK_LIBRARIES ${LLCOMMON_LIBRARIES} ${LLIMAGE_LIBRARIES} @@ -77,8 +78,10 @@ if (LINUX) ${LLXML_LIBRARIES} ${UI_LIBRARIES} # for GTK sdl - libfontconfig.a # For FCInit and other FC* functions. - libfreetype.a + # libfontconfig.a # fontconfig and freetype should + # libfreetype.a # be taken from the user's system, + Freetype::Freetype # and not be packaged with + Fontconfig::Fontconfig # the viewer ) if( USE_SDL1 ) diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index b19e9ed9e6..8248e16087 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -57,7 +57,7 @@ exportMutliArchDRIPath() { ## Help fontconfig find its default configuration file, otherwise the viewer will stall ## with Fontconfig error: Cannot load default config file -export FONTCONFIG_PATH=/etc/fonts +# export FONTCONFIG_PATH=/etc/fonts if [ "`uname -m`" = "x86_64" ]; then echo '64-bit Linux detected.' diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 7f5907d08a..2c8829d306 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -2203,10 +2203,10 @@ class Linux_i686_Manifest(LinuxManifest): # particular wildcard specification gets us exactly what the # previous call did, without having to explicitly state the # version number. - self.path("libfontconfig.so.*.*") + # self.path("libfontconfig.so.*.*") # fontconfig and freetype should be taken from the user's system # Include libfreetype.so. but have it work as libfontconfig does. - self.path("libfreetype.so.*.*") + # self.path("libfreetype.so.*.*") # fontconfig and freetype should be taken from the user's system try: self.path("libtcmalloc.so*") #formerly called google perf tools