diff --git a/aedi/target/library_tier2.py b/aedi/target/library_tier2.py index 8668cf3c..a95fd560 100644 --- a/aedi/target/library_tier2.py +++ b/aedi/target/library_tier2.py @@ -608,31 +608,71 @@ class WebpTarget(CMakeStaticDependencyTarget): self.keep_module_target(state, 'WebP::webp') -class WxWidgetsTarget(ConfigureMakeStaticDependencyTarget): +class WxWidgetsTarget(CMakeStaticDependencyTarget): def __init__(self, name='wxwidgets'): super().__init__(name) + self.os_version['x86_64'] = StrictVersion('10.10') + self.sdk_version['x86_64'] = StrictVersion('10.11') + + opts = self.options + opts['wxBUILD_SHARED'] = 'NO' + opts['wxUSE_LIBLZMA'] = 'YES' + opts['wxUSE_LIBSDL'] = 'NO' + opts['wxUSE_LIBJPEG'] = 'sys' + opts['wxUSE_LIBPNG'] = 'sys' + opts['wxUSE_LIBTIFF'] = 'sys' + def prepare_source(self, state: BuildState): state.download_source( - 'https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.5.1/wxWidgets-3.0.5.1.tar.bz2', - '440f6e73cf5afb2cbf9af10cec8da6cdd3d3998d527598a53db87099524ac807', - patches='wxwidgets-fix-configure') - - def configure(self, state: BuildState): - opts = self.options - opts['--disable-shared'] = None - opts['--with-macosx-sdk'] = state.sdk_path() - opts['--with-macosx-version-min'] = state.os_version() - opts['--with-libpng'] = 'sys' - opts['--with-libtiff'] = 'sys' - opts['--without-sdl'] = None - opts['--without-subdirs'] = None - - super().configure(state) + 'https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.5/wxWidgets-3.1.5.tar.bz2', + 'd7b3666de33aa5c10ea41bb9405c40326e1aeb74ee725bb88f90f1d50270a224', + patches='wxwidgets-library-suffix') def detect(self, state: BuildState) -> bool: return os.path.exists(state.source + 'wx-config.in') + def post_build(self, state: BuildState): + super().post_build(state) + + # Replace prefix in setup.h + def patch_setup_h(line: str): + prefix = '#define wxINSTALL_PREFIX ' + return f'{prefix}"/usr/local"\n' if line.startswith(prefix) else line + + setup_h_path = state.install_path + 'lib/wx/include/osx_cocoa-unicode-static-3.1/wx/setup.h' + self.update_text_file(setup_h_path, patch_setup_h) + + # Fix a few wx-config entries + def patch_wx_config(line: str): + prefix = 'prefix=${input_option_prefix-${this_prefix:-' + is_cross_func = 'is_cross() ' + is_cross_test = 'is_cross && target=' + output_option_cc = '[ -z "$output_option_cc" ' + output_option_cxx = '[ -z "$output_option_cxx" ' + output_option_ld = '[ -z "$output_option_ld" ' + ldlibs_gl = 'ldlibs_gl=' + + if line.startswith(prefix): + return prefix + '$(cd "${0%/*}/.."; pwd)}}\n' + elif line.startswith(is_cross_func): + return is_cross_func + '{ false; }\n' + elif line.startswith(is_cross_test): + return is_cross_test + '""\n' + elif line.startswith(output_option_cc): + return output_option_cc + '] || echo "gcc"\n' + elif line.startswith(output_option_cxx): + return output_option_cxx + '] || echo "g++"\n' + elif line.startswith(output_option_ld): + return output_option_ld + '] || echo "g++ -o"\n' + elif line.startswith(ldlibs_gl): + return ldlibs_gl + '"-lwx_baseu-3.1 -lwx_osx_cocoau_core-3.1 -framework OpenGL"\n' + + return line + + wx_config_path = state.install_path + 'bin/wx-config' + self.update_text_file(wx_config_path, patch_wx_config) + class ZstdTarget(CMakeStaticDependencyTarget): def __init__(self, name='zstd'): diff --git a/patch/wxwidgets-fix-configure.diff b/patch/wxwidgets-fix-configure.diff deleted file mode 100644 index 2d69c737..00000000 --- a/patch/wxwidgets-fix-configure.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- a/configure -+++ b/configure -@@ -3894,15 +3894,6 @@ - - - --if test "$cross_compiling" != "no"; then -- HOST_PREFIX="${host_alias}-" -- HOST_SUFFIX="-$host_alias" --else -- HOST_PREFIX= -- HOST_SUFFIX= --fi -- -- - wx_major_version_number=3 - wx_minor_version_number=0 - wx_release_number=5 -@@ -22421,6 +22412,7 @@ - - #include - #include -+ #include - - int main() - { -@@ -22667,7 +22659,7 @@ - - - TIFF_LINK= --TIFF_PREREQ_LINKS=-lm -+TIFF_PREREQ_LINKS="-llzma -lwebp -lzstd" - if test "$wxUSE_LIBTIFF" != "no" ; then - $as_echo "#define wxUSE_LIBTIFF 1" >>confdefs.h - diff --git a/patch/wxwidgets-library-suffix.diff b/patch/wxwidgets-library-suffix.diff new file mode 100644 index 00000000..5777fe1d --- /dev/null +++ b/patch/wxwidgets-library-suffix.diff @@ -0,0 +1,12 @@ +--- a/build/cmake/functions.cmake ++++ b/build/cmake/functions.cmake +@@ -211,9 +211,6 @@ + endif() + else() + set(cross_target "") +- if (CMAKE_CROSSCOMPILING) +- set(cross_target "-${CMAKE_SYSTEM_NAME}") +- endif () + + set_target_properties(${target_name} + PROPERTIES