[vlc-devel] [PATCH] contrib: use the CMake define to set -fPIC when not building for Windows

Steve Lhomme robux4 at ycbcr.xyz
Sun May 19 16:10:08 CEST 2019


---
 contrib/src/ebml/rules.mak     | 2 +-
 contrib/src/main.mak           | 2 ++
 contrib/src/matroska/rules.mak | 2 +-
 contrib/src/srt/rules.mak      | 4 +---
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/contrib/src/ebml/rules.mak b/contrib/src/ebml/rules.mak
index 7c628a974a..f8c35b1689 100644
--- a/contrib/src/ebml/rules.mak
+++ b/contrib/src/ebml/rules.mak
@@ -20,7 +20,7 @@ ebml: libebml-$(EBML_VERSION).tar.xz .sum-ebml
 	$(MOVE)
 
 # libebml requires exceptions
-EBML_CXXFLAGS := $(CXXFLAGS) $(PIC) -fexceptions -fvisibility=hidden
+EBML_CXXFLAGS := $(CXXFLAGS) -fexceptions -fvisibility=hidden
 
 .ebml: ebml toolchain.cmake
 	cd $< && $(HOSTVARS_PIC) CXXFLAGS="$(EBML_CXXFLAGS)" $(CMAKE) -DBUILD_SHARED_LIBS=OFF -DENABLE_WIN32_IO=OFF
diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index 30a5e1f03a..fc71cf3f54 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -539,6 +539,8 @@ ifdef HAVE_WIN32
 ifdef HAVE_CROSS_COMPILE
 	echo "set(CMAKE_RC_COMPILER $(WINDRES))" >> $@
 endif
+else
+	set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 endif
 ifdef HAVE_DARWIN_OS
 	echo "set(CMAKE_C_FLAGS \"$(CFLAGS) $(EXTRA_CFLAGS)\")" >> $@
diff --git a/contrib/src/matroska/rules.mak b/contrib/src/matroska/rules.mak
index efed037e15..26e7c69704 100644
--- a/contrib/src/matroska/rules.mak
+++ b/contrib/src/matroska/rules.mak
@@ -23,7 +23,7 @@ libmatroska: libmatroska-$(MATROSKA_VERSION).tar.xz .sum-matroska
 	$(call pkg_static,"libmatroska.pc.in")
 	$(MOVE)
 
-MATROSKA_CXXFLAGS := $(CXXFLAGS) $(PIC) -fvisibility=hidden -O2
+MATROSKA_CXXFLAGS := $(CXXFLAGS) -fvisibility=hidden -O2
 
 .matroska: libmatroska toolchain.cmake
 	cd $< && $(HOSTVARS_PIC) CXXFLAGS="$(MATROSKA_CXXFLAGS)" $(CMAKE) -DBUILD_SHARED_LIBS=OFF
diff --git a/contrib/src/srt/rules.mak b/contrib/src/srt/rules.mak
index c9dbb59db8..41a5b9d956 100644
--- a/contrib/src/srt/rules.mak
+++ b/contrib/src/srt/rules.mak
@@ -11,8 +11,6 @@ ifeq ($(call need_pkg,"srt >= 1.3.1"),)
 PKGS_FOUND += srt
 endif
 
-SRT_CFLAGS   := $(CFLAGS) $(PIC)
-SRT_CXXFLAGS := $(CXXFLAGS) $(PIC)
 DEPS_srt = gnutls $(DEPS_gnutls)
 ifdef HAVE_WIN32
 DEPS_srt += pthreads $(DEPS_pthreads)
@@ -36,7 +34,7 @@ srt: srt-$(SRT_VERSION).tar.gz .sum-srt
 	mv srt-$(SRT_VERSION) $@ && touch $@
 
 .srt: srt toolchain.cmake
-	cd $< && $(HOSTVARS_PIC) CFLAGS="$(SRT_CFLAGS)" CXXFLAGS="$(SRT_CXXFLAGS)" $(CMAKE) \
+	cd $< && $(HOSTVARS_PIC) $(CMAKE) \
 		-DENABLE_SHARED=OFF -DUSE_GNUTLS=ON -DENABLE_CXX11=OFF -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_INCLUDEDIR=include
 	cd $< && $(MAKE) install
 	touch $@
-- 
2.18.0



More information about the vlc-devel mailing list