Skip to content
  • James Hilliard's avatar
    package/pkg-cargo: configure cargo profiles · 5b0094c1
    James Hilliard authored and arnout's avatar arnout committed
    pkg-cargo currently sets the --release flag unless BR2_ENABLE_DEBUG is
    set. However, this does not accurately reflect the configured build
    settings. In addition, it only works for packages that use the cargo
    infrastructure directory and not with packages using the cargo
    environment indirectly, such as pyo3 based python packages. To support
    these, we really want to pass the necessary flags in PKG_CARGO_ENV.
    
    In order to accurately reflect the configured build settings
    (optimization and debug levels), we set the appropriate environment
    variables according to the global settings.
    
    There is no way to specify the profile to use through an environment
    variable, it has to be set through a cargo flag like --release. Since we
    can't easily control the profile flags used by non-cargo package
    infrastructures, we instead set the env variables for both root profiles
    (dev/release). For the aspects that are not affected by the global
    settings (incremental, codegen-units, split-debuginfo), we set them
    equal to the default for release - which in our context is the
    appropriate choice even when BR2_ENABLE_DEBUG is set.
    
    For reference the default cargo root profile settings are:
    https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles
    
    
    
    Cc: Moritz Bitsch <moritz@h6t.eu>
    Signed-off-by: default avatarJames Hilliard <james.hilliard1@gmail.com>
    Tested-by: default avatarMoritz Bitsch <moritz@h6t.eu>
    Tested-by: default avatarAdam Duskett <adam.duskett@amarulasolutions.com>
    Reviewed-by: default avatarAdam Duskett <adam.duskett@amarulasolutions.com>
    Signed-off-by: default avatarArnout Vandecappelle <arnout@mind.be>
    5b0094c1
Loading