[vlc-devel] [PATCH] package/win32: use VLC_DEPLOYMENT_TARGET_CFLAGS environment variable to pass CFLAGS

Alexandre Janniaux ajanni at videolabs.io
Wed Dec 11 15:46:13 CET 2019


Hi,

On Wed, Dec 11, 2019 at 03:24:49PM +0100, Steve Lhomme wrote:
> So that Meson doesn't try to pick them.
>
> Similar to 5c76f3478cb038a550de21f6267d57c55c963391 on macos.

The intent is not really clear, you're adding flags in a
different variable to prevent Meson from using them ? Why ?
Can you extend the commit message with the reason ?

> ---
>  extras/package/win32/build.sh | 37 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
> index 9607fcfe058..96c567743f9 100755
> --- a/extras/package/win32/build.sh
> +++ b/extras/package/win32/build.sh
> @@ -106,6 +106,34 @@ else
>      COMPILING_WITH_CLANG=0
>  fi
>
> +# Write config.mak for contribs
> +# Globals:
> +#   VLC_DEPLOYMENT_TARGET_CFLAGS
> +#   VLC_DEPLOYMENT_TARGET_CXXFLAGS
> +#   VLC_DEPLOYMENT_TARGET_LDFLAGS
> +write_config_mak()

Would it benefit from having a parameter for where to write
the config.mak ?

> +{
> +    # Flags to be used for C-like compilers (C, C++, Obj-C)
> +    local clike_flags="$VLC_DEPLOYMENT_TARGET_CFLAGS"
> +
> +    # local vlc_cppflags="-arch $ARCH"
> +    local vlc_cflags="$clike_flags"
> +    local vlc_cxxflags="$VLC_DEPLOYMENT_TARGET_CXXFLAGS $clike_flags"
> +    local vlc_objcflags="$clike_flags"
> +
> +    local vlc_ldflags="$VLC_DEPLOYMENT_TARGET_LDFLAGS"
> +
> +    echo "Creating makefile..."
> +    test -e config.mak && unlink config.mak



> +    exec 3>config.mak || return $?
> +
> +    printf '# This file was automatically generated!\n\n' >&3
> +    printf '%s := %s\n' "CFLAGS" "${vlc_cflags}" >&3
> +    printf '%s := %s\n' "CXXFLAGS" "${vlc_cxxflags}" >&3
> +    printf '%s := %s\n' "OBJCFLAGS" "${vlc_objcflags}" >&3
> +    printf '%s := %s\n' "LDFLAGS" "${vlc_ldflags}" >&3

This part looks rather complex for what it does, why not just

echo "# This file was automatically generated!\n\n" >&3
echo "CFLAGS := ${vlc_cflags}" >> config.mak
echo "CXXFLAGS := ${vlc_cxxflags}" >> config.mak
echo "OBJCFLAGS := ${vlc_objcflags}" >> config.mak
echo "LDFLAGS := ${vlc_ldflags}" >> config.mak

or even more compact form?

>  cd extras/tools
> @@ -147,6 +175,11 @@ fi
>  if [ "$RELEASE" != "yes" ]; then
>       CONTRIBFLAGS="$CONTRIBFLAGS --disable-optim"
>  fi
> +
> +# Write config.mak with flags for the build and compiler overrides
> +# Set flag to error on partial availability
> +write_config_mak
> +
>  ${SCRIPT_PATH}/../../../contrib/bootstrap --host=$TRIPLET $CONTRIBFLAGS
>
>  # Rebuild the contribs or use the prebuilt ones
> @@ -190,7 +223,9 @@ if [ ! -z "$WITH_PDB" ]; then
>      CONFIGFLAGS="$CONFIGFLAGS --enable-pdb"
>  fi
>
> -${SCRIPT_PATH}/configure.sh --host=$TRIPLET --with-contrib=../contrib/$TRIPLET $CONFIGFLAGS
> +${SCRIPT_PATH}/configure.sh --host=$TRIPLET --with-contrib=../contrib/$TRIPLET $CONFIGFLAGS \
> +    CFLAGS="$VLC_DEPLOYMENT_TARGET_CFLAGS -Werror=missing-field-initializers" \
> +    CXXFLAGS="$VLC_DEPLOYMENT_TARGET_CXXFLAGS -Werror=missing-field-initializers"
>
>  info "Compiling"
>  make -j$JOBS
> --
> 2.17.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list