[vlc-devel] [PATCH 4/4] contrib: move macOS compilation flags to the script where they belong and generalize Darwin OS environment manipulations
David Fuhrmann
david.fuhrmann at gmail.com
Thu Jan 25 19:07:54 CET 2018
Hi Felix,
> Am 24.01.2018 um 23:57 schrieb Felix Paul Kühne <fkuehne at videolan.org>:
>
> From: Felix Paul Kühne <felix at feepk.net>
>
> ---
> contrib/src/main.mak | 23 ++++++++++-------------
> extras/package/macosx/build.sh | 14 +++++++++++---
> 2 files changed, 21 insertions(+), 16 deletions(-)
>
> diff --git a/contrib/src/main.mak b/contrib/src/main.mak
> index 0398a5ad1a..49b4627110 100644
> --- a/contrib/src/main.mak
> +++ b/contrib/src/main.mak
> @@ -112,11 +112,16 @@ CXX := clang++
> endif
> endif
>
> +ifdef HAVE_DARWIN_OS
> +CC=xcrun clang
> +CXX=xcrun clang++
> +AR=xcrun ar
> +LD=xcrun ld
> +STRIP=xcrun strip
> +RANLIB=xcrun ranlib
> +endif
Please do not add those lines, I specifically removed this for macOS a couple of months ago.
Main reason is that this build system should not hardcode any compilers, its the responsibility of the caller to set different nonstandard tools if needed.
Besides that, I believe this might not even be needed anymore, no? My /usr/bin directory contains all those tools nowadays.
Additionally, this reintroduces a known bug for xcodeproj compilation in contribs.
> +
> ifdef HAVE_MACOSX
> -MIN_OSX_VERSION=10.7
> -EXTRA_CFLAGS += -isysroot $(MACOSX_SDK) -mmacosx-version-min=$(MIN_OSX_VERSION) -DMACOSX_DEPLOYMENT_TARGET=$(MIN_OSX_VERSION)
Would the compilation succeed if you remove this and do not compile with build.sh? If yes, then this looks fine.
> -EXTRA_CXXFLAGS += -stdlib=libc++
I am not sure about that one, AFAIK we do not really support linking with libstdc++ anymore. Seeing how many problems we already had with mixed compilations, I would prefer if we can keep this in here, hardcoded (analogous to configure.ac).
> -EXTRA_LDFLAGS += -Wl,-syslibroot,$(MACOSX_SDK) -mmacosx-version-min=$(MIN_OSX_VERSION) -isysroot $(MACOSX_SDK) -DMACOSX_DEPLOYMENT_TARGET=$(MIN_OSX_VERSION)
> ifeq ($(ARCH),x86_64)
> EXTRA_CFLAGS += -m64
> EXTRA_LDFLAGS += -m64
> @@ -132,18 +137,10 @@ endif
> CCAS=$(CC) -c
>
> ifdef HAVE_IOS
> -CC=xcrun clang
> -CXX=xcrun clang++
> ifdef HAVE_NEON
> AS=perl $(abspath ../../extras/tools/build/bin/gas-preprocessor.pl) $(CC)
> CCAS=gas-preprocessor.pl $(CC) -c
> -else
> -CCAS=$(CC) -c
> endif
> -AR=xcrun ar
> -LD=xcrun ld
> -STRIP=xcrun strip
> -RANLIB=xcrun ranlib
> EXTRA_CFLAGS += $(CFLAGS)
> endif
>
> @@ -346,7 +343,7 @@ UPDATE_AUTOCONFIG = for dir in $(AUTOMAKE_DATA_DIRS); do \
> fi; \
> done
>
> -ifdef HAVE_IOS
> +ifdef HAVE_DARWIN_OS
> AUTORECONF = AUTOPOINT=true autoreconf
Is this really needed? So far I did not see any problems without this option.
> else
> AUTORECONF = autoreconf
> diff --git a/extras/package/macosx/build.sh b/extras/package/macosx/build.sh
> index 72c2320d73..219d349e68 100755
> --- a/extras/package/macosx/build.sh
> +++ b/extras/package/macosx/build.sh
> @@ -193,9 +193,17 @@ spopd
> # enabled. (e.g. ffmpeg)
> # - This will fail the build if a partially available symbol is added later on
> # in contribs and not mentioned in the list of symbols above.
> -export CFLAGS="-Werror=partial-availability"
> -export CXXFLAGS="-Werror=partial-availability"
> -export OBJCFLAGS="-Werror=partial-availability"
> +CFLAGS="-Werror=partial-availability"
> +CXXFLAGS="-Werror=partial-availability"
> +OBJCFLAGS="-Werror=partial-availability"
> +
> +CFLAGS += -isysroot $(SDKROOT) -mmacosx-version-min=$(MINIMAL_OSX_VERSION) -DMACOSX_DEPLOYMENT_TARGET=$(MINIMAL_OSX_VERSION)
> +CXXFLAGS += -stdlib=libc++
> +LDFLAGS += -Wl,-syslibroot,$(MACOSX_SDK) -mmacosx-version-min=$(MINIMAL_OSX_VERSION) -isysroot $(SDKROOT) -DMACOSX_DEPLOYMENT_TARGET=$(MINIMAL_OSX_VERSION)
> +
> +export CFLAGS=${CFLAGS}
> +export CXXFLAGS=${CXXFLAGS}
> +export LDFLAGS=${LDFLAGS}
>
> info "Building contribs"
> spushd "${vlcroot}/contrib"
> --
> 2.15.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