Skip to content
  • Nirbheek Chauhan's avatar
    Rewrite MSVC/MinGW toolchain config for UWP cross compilation · 576ddac5
    Nirbheek Chauhan authored
    Unlike any other platform, on Windows we build recipes with both
    MSVC and MinGW. All Meson recipes can be built with MSVC, but the
    Autotools recipes always use MinGW.
    
    This broke the fundamental assumption that `self.config.config_env`
    contains all the information needed by the build system to find the
    toolchain that we want to use.
    
    At the time, we hacked around it by unsetting MinGW toolchain env vars
    inside `build.py`, and storing msvc toolchain env vars in
    `self.config.msvc_toolchain_env`. We would then set those only when
    building recipes that can use MSVC.
    
    This completely breaks down when you want to cross-compile on Windows,
    because we need some env vars to stay in the env, and others to only
    be in the cross file.
    
    To fix this, a bunch of things had to change:
    1. Use actual objects for environment variable values: `EnvValue` and
       other classes that inherit from it. These allow easier
       merging/overriding of env var values.
    2. Separate out env vars according to their stated purpose:
       a) Configuration for build tools (WINEPREFIX, WINDEBUG, etc)
       b) Configuration for toolchain (LIBRARY_PATH, INCLUDE, LIB, etc)
       c) Configuration for build system (CC, CFLAGS, ac_cv_*, etc)
    3. Always use a native-file or a cross-file for selecting the
       toolchain when using Meson.
    4. Rename meson_cross_properties to meson_properties, since we use
       those even when not cross-compiling.
    
    Future TODO: port all env var usage in config.py and config/*.config
    to the new EnvValue* objects
    
    Part-of: <gstreamer/cerbero!480>
    576ddac5