From fa45954fd65895738acf403b755f5cadc2b50a63 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 30 Jan 2023 14:58:54 +0100 Subject: [PATCH 1/6] fix Android build in 2.0.18 --- recipes/sdl_ttf/all/conandata.yml | 7 +++++-- ....patch => 2.0.15-0001-cmake-fix-link-target.patch} | 0 ....patch => 2.0.18-0001-cmake-fix-link-target.patch} | 0 .../sdl_ttf/all/patches/2.0.18-0002-fix-android.patch | 11 +++++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) rename recipes/sdl_ttf/all/patches/{cmake-fix-link-target-2.0.15.patch => 2.0.15-0001-cmake-fix-link-target.patch} (100%) rename recipes/sdl_ttf/all/patches/{cmake-fix-link-target-2.0.18.patch => 2.0.18-0001-cmake-fix-link-target.patch} (100%) create mode 100644 recipes/sdl_ttf/all/patches/2.0.18-0002-fix-android.patch diff --git a/recipes/sdl_ttf/all/conandata.yml b/recipes/sdl_ttf/all/conandata.yml index a9e6c2f4488b6..4e3f1442e85e1 100644 --- a/recipes/sdl_ttf/all/conandata.yml +++ b/recipes/sdl_ttf/all/conandata.yml @@ -10,10 +10,13 @@ sources: sha256: "02e887b560faf398cbd60f56ce0a1cbaf96012dd4ddaa455f8307cb4911c86cc" patches: "2.0.18": - - patch_file: "patches/cmake-fix-link-target-2.0.18.patch" + - patch_file: "patches/2.0.18-0001-cmake-fix-link-target.patch" patch_description: "correct target name, disable PIC fixed" patch_type: "portability" + - patch_file: "patches/2.0.18-0002-fix-android.patch" + patch_description: "Fix Android build" + patch_type: "portability" "2.0.15": - - patch_file: "patches/cmake-fix-link-target-2.0.15.patch" + - patch_file: "patches/2.0.15-0001-cmake-fix-link-target.patch" patch_description: "correct target name" patch_type: "portability" diff --git a/recipes/sdl_ttf/all/patches/cmake-fix-link-target-2.0.15.patch b/recipes/sdl_ttf/all/patches/2.0.15-0001-cmake-fix-link-target.patch similarity index 100% rename from recipes/sdl_ttf/all/patches/cmake-fix-link-target-2.0.15.patch rename to recipes/sdl_ttf/all/patches/2.0.15-0001-cmake-fix-link-target.patch diff --git a/recipes/sdl_ttf/all/patches/cmake-fix-link-target-2.0.18.patch b/recipes/sdl_ttf/all/patches/2.0.18-0001-cmake-fix-link-target.patch similarity index 100% rename from recipes/sdl_ttf/all/patches/cmake-fix-link-target-2.0.18.patch rename to recipes/sdl_ttf/all/patches/2.0.18-0001-cmake-fix-link-target.patch diff --git a/recipes/sdl_ttf/all/patches/2.0.18-0002-fix-android.patch b/recipes/sdl_ttf/all/patches/2.0.18-0002-fix-android.patch new file mode 100644 index 0000000000000..5007f133c4a18 --- /dev/null +++ b/recipes/sdl_ttf/all/patches/2.0.18-0002-fix-android.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,7 +12,7 @@ endif() + cmake_minimum_required(VERSION 3.0) + project(SDL_ttf C) + +-if (ANDROID) ++if (0) + option(TTF_WITH_HARFBUZZ "use harfbuzz to improve text shaping" OFF) + + add_library(SDL2_ttf SHARED) From 7b54da5b6dcb3391efaad166af98440efe29feef Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 30 Jan 2023 15:05:44 +0100 Subject: [PATCH 2/6] few fixes --- recipes/sdl_ttf/all/conanfile.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/recipes/sdl_ttf/all/conanfile.py b/recipes/sdl_ttf/all/conanfile.py index 7d8c704e7deb2..715ae88a98cca 100644 --- a/recipes/sdl_ttf/all/conanfile.py +++ b/recipes/sdl_ttf/all/conanfile.py @@ -6,7 +6,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class SdlttfConan(ConanFile): @@ -35,15 +35,16 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "2.20.0": + del self.options.with_harfbuzz def configure(self): if self.options.shared: self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") - - if Version(self.version) < "2.20.0": - del self.options.with_harfbuzz + if Version(self.version) >= "2.20.0": + self.options["sdl"].shared = self.options.shared def layout(self): cmake_layout(self, src_folder="src") @@ -55,7 +56,7 @@ def requirements(self): self.requires("harfbuzz/6.0.0") def validate(self): - if is_msvc(self) and self.info.options.shared: + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration("sdl_ttf shared is not supported with Visual Studio") if Version(self.version).major != Version(self.dependencies["sdl"].ref.version).major: raise ConanInvalidConfiguration("sdl & sdl_ttf must have the same major version") @@ -70,7 +71,6 @@ def source(self): def generate(self): tc = CMakeToolchain(self) if Version(self.version) >= "2.20.0": - tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) tc.variables["SDL2TTF_SAMPLES"] = False tc.variables["SDL2TTF_VENDORED"] = False tc.variables["SDL2TTF_HARFBUZZ"] = self.options.with_harfbuzz From 208ecf559f4cc418978fb09a253ec1c3e1eddc21 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 31 Jan 2023 09:51:03 +0100 Subject: [PATCH 3/6] allow sdl_ttf shared with msvc since 2.20.0 --- recipes/sdl_ttf/all/conanfile.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/recipes/sdl_ttf/all/conanfile.py b/recipes/sdl_ttf/all/conanfile.py index 715ae88a98cca..e263b295e68a9 100644 --- a/recipes/sdl_ttf/all/conanfile.py +++ b/recipes/sdl_ttf/all/conanfile.py @@ -56,17 +56,18 @@ def requirements(self): self.requires("harfbuzz/6.0.0") def validate(self): - if is_msvc(self) and self.options.shared: - raise ConanInvalidConfiguration("sdl_ttf shared is not supported with Visual Studio") if Version(self.version).major != Version(self.dependencies["sdl"].ref.version).major: raise ConanInvalidConfiguration("sdl & sdl_ttf must have the same major version") - if Version(self.version) >= "2.20.0" and self.options.shared != self.dependencies["sdl"].options.shared: - raise ConanInvalidConfiguration("sdl & sdl_ttf must be build with the same options(shared or static)") + if Version(self.version) >= "2.20.0": + if self.options.shared != self.dependencies["sdl"].options.shared: + raise ConanInvalidConfiguration("sdl & sdl_ttf must be built with the same 'shared' option value") + else: + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared is not supported with Visual Studio") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) From c9603275595ee4a34fb9b1cd5bb79ab27da0b6ac Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 31 Jan 2023 09:51:24 +0100 Subject: [PATCH 4/6] download official tarball of 2.0.15 --- recipes/sdl_ttf/all/conandata.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/sdl_ttf/all/conandata.yml b/recipes/sdl_ttf/all/conandata.yml index 4e3f1442e85e1..654899436589e 100644 --- a/recipes/sdl_ttf/all/conandata.yml +++ b/recipes/sdl_ttf/all/conandata.yml @@ -6,8 +6,8 @@ sources: url: "https://github.com/libsdl-org/SDL_ttf/archive/refs/tags/release-2.0.18.tar.gz" sha256: "6b61544441b72bdfa1ced89034c6396fe80228eff201eb72c5f78e500bb80bd0" "2.0.15": - url: "https://github.com/libsdl-org/SDL_ttf/archive/refs/tags/release-2.0.15.tar.gz" - sha256: "02e887b560faf398cbd60f56ce0a1cbaf96012dd4ddaa455f8307cb4911c86cc" + url: "https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.0.15/SDL2_ttf-2.0.15.tar.gz" + sha256: "a9eceb1ad88c1f1545cd7bd28e7cbc0b2c14191d40238f531a15b01b1b22cd33" patches: "2.0.18": - patch_file: "patches/2.0.18-0001-cmake-fix-link-target.patch" From 5bc9da38f1599ea6eee19875d9c7f31953221862 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 31 Jan 2023 21:16:31 +0100 Subject: [PATCH 5/6] Disable useless .pc file install in 2.20.1 to avoid relying on CMake 3.21 features --- recipes/sdl_ttf/all/conandata.yml | 4 ++++ .../patches/2.20.1-0001-fix-cmake-min-version.patch | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 recipes/sdl_ttf/all/patches/2.20.1-0001-fix-cmake-min-version.patch diff --git a/recipes/sdl_ttf/all/conandata.yml b/recipes/sdl_ttf/all/conandata.yml index 654899436589e..ac34ee3b6fceb 100644 --- a/recipes/sdl_ttf/all/conandata.yml +++ b/recipes/sdl_ttf/all/conandata.yml @@ -9,6 +9,10 @@ sources: url: "https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.0.15/SDL2_ttf-2.0.15.tar.gz" sha256: "a9eceb1ad88c1f1545cd7bd28e7cbc0b2c14191d40238f531a15b01b1b22cd33" patches: + "2.20.1": + - patch_file: "patches/2.20.1-0001-fix-cmake-min-version.patch" + patch_description: "Disable useless .pc file install to avoid relying on CMake 3.21 features" + patch_type: "conan" "2.0.18": - patch_file: "patches/2.0.18-0001-cmake-fix-link-target.patch" patch_description: "correct target name, disable PIC fixed" diff --git a/recipes/sdl_ttf/all/patches/2.20.1-0001-fix-cmake-min-version.patch b/recipes/sdl_ttf/all/patches/2.20.1-0001-fix-cmake-min-version.patch new file mode 100644 index 0000000000000..68cbd1fdeda66 --- /dev/null +++ b/recipes/sdl_ttf/all/patches/2.20.1-0001-fix-cmake-min-version.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -325,7 +325,7 @@ if(SDL2TTF_INSTALL) + COMPONENT devel + ) + +- if(SDL2TTF_BUILD_SHARED_LIBS) ++ if(0) + # Only create a .pc file for a shared SDL2_ttf + set(prefix "${CMAKE_INSTALL_PREFIX}") + set(exec_prefix "\${prefix}") From 65963b2632c39d2e5f557307ba5a788249929cd7 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 31 Jan 2023 23:30:32 +0100 Subject: [PATCH 6/6] remove debug postfix --- recipes/sdl_ttf/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/sdl_ttf/all/conanfile.py b/recipes/sdl_ttf/all/conanfile.py index e263b295e68a9..984ebd5896713 100644 --- a/recipes/sdl_ttf/all/conanfile.py +++ b/recipes/sdl_ttf/all/conanfile.py @@ -75,6 +75,7 @@ def generate(self): tc.variables["SDL2TTF_SAMPLES"] = False tc.variables["SDL2TTF_VENDORED"] = False tc.variables["SDL2TTF_HARFBUZZ"] = self.options.with_harfbuzz + tc.variables["SDL2TTF_DEBUG_POSTFIX"] = "" tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() deps = CMakeDeps(self)