]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
build system: allow to use PIC instead PIE (ARM?)
authorJaroslav Kysela <perex@perex.cz>
Thu, 5 May 2016 15:00:09 +0000 (17:00 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 5 May 2016 15:00:09 +0000 (17:00 +0200)
Makefile
Makefile.ffmpeg
Makefile.hdhomerun
configure
support/patches/libx265.pic.diff [new file with mode: 0644]

index 29c85b0f1c856823ee16f0d93619da0f9d2dfb69..af0f897ee914e73b55d7f9a987f199f01fc826f4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,11 @@ LANGUAGES ?= bg cs da de en_US en_GB es et fa fi fr he hr hu it lv nl pl pt ru s
 #
 
 CFLAGS  += -g -O2 -fPIE
+ifeq ($(CONFIG_PIE),yes)
+CFLAGS  += -fPIE
+else
+CFLAGS  += -fPIC
+endif
 ifeq ($(CONFIG_W_UNUSED_RESULT),yes)
 CFLAGS  += -Wunused-result
 endif
index 4eb0cc6e97d4ebe0853912914db7ca765c915eb1..5d74f798673c2eeec881ef24093321c3038d9773 100644 (file)
@@ -56,7 +56,11 @@ LIBX265        = x265_1.9
 LIBX265_TB     = $(LIBX265).tar.gz
 LIBX265_URL    = http://ftp.videolan.org/pub/videolan/x265/$(LIBX265_TB)
 LIBX265_SHA1   = 8c9aa3b87b0f0a418bbb9782e9354d112d75e003
+ifeq ($(CONFIG_PIE),yes)
 LIBX265_DIFFS  = libx265.pie.diff
+else
+LIBX265_DIFFS  = libx265.pic.diff
+endif
 
 LIBVPX         = libvpx-1.5.0
 LIBVPX_TB      = $(LIBVPX).tar.bz2
@@ -115,16 +119,21 @@ build: $(LIB_ROOT)/$(FFMPEG)/.tvh_build
 
 export PATH := $(LIB_ROOT)/build/ffmpeg/bin:$(PATH)
 
+ifeq ($(CONFIG_PIE),yes)
+CFLAGS_PI = -fPIE
+else
+CFLAGS_PI = -fPIC
+endif
+
 EBUILDIR  := $(LIB_ROOT)/build
 EPREFIX   := $(EBUILDIR)/ffmpeg
-ECFLAGS   := -I$(EPREFIX)/include -fPIE
+ECFLAGS   := -I$(EPREFIX)/include $(CFLAGS_PI)
 ELIBS     := -L$(EPREFIX)/lib -ldl
 
 CONFIGURE := FFMPEG_PREFIX=$(EPREFIX) \
              PKG_CONFIG=$(ROOTDIR)/support/pkg-config.ffmpeg \
              ./configure --prefix=/ffmpeg --enable-static --disable-shared
 
-
 # ##############################################################################
 # YASM
 #
@@ -177,7 +186,7 @@ $(LIB_ROOT)/$(LIBX264)/.tvh_build: \
                $(LIB_ROOT)/$(LIBX264)/.tvh_download
        cd $(LIB_ROOT)/$(LIBX264) && $(CONFIGURE) \
                --extra-asflags="-DPIC" \
-                --extra-cflags="-fPIE" \
+                --extra-cflags="$(CFLAGS_PI)" \
                --disable-cli \
                --disable-swscale \
                --disable-lavf \
@@ -275,7 +284,7 @@ $(LIB_ROOT)/$(LIBVPX)/.tvh_build: \
                $(LIB_ROOT)/$(LIBVPX)/.tvh_download
        cd $(LIB_ROOT)/$(LIBVPX) && \
                ASFLAGS="-DENABLE_PIC=1 -DPIC=1" $(CONFIGURE) \
-               --extra-cflags="-fPIE" \
+               --extra-cflags="$(CFLAGS_PI)" \
                --disable-examples \
                --disable-docs \
                --disable-unit-tests \
@@ -311,7 +320,7 @@ $(LIB_ROOT)/$(LIBOGG)/.tvh_download:
 $(LIB_ROOT)/$(LIBOGG)/.tvh_build: \
                $(LIB_ROOT)/$(YASM)/.tvh_build \
                $(LIB_ROOT)/$(LIBOGG)/.tvh_download
-       cd $(LIB_ROOT)/$(LIBOGG) && CFLAGS="-fPIE" $(CONFIGURE)
+       cd $(LIB_ROOT)/$(LIBOGG) && CFLAGS="$(CFLAGS_PI)" $(CONFIGURE)
        DESTDIR=$(EBUILDIR) \
                $(MAKE) -C $(LIB_ROOT)/$(LIBOGG) install
        @touch $@
@@ -349,7 +358,7 @@ $(LIB_ROOT)/$(LIBTHEORA)/.tvh_build: \
                $(LIB_ROOT)/$(LIBOGG)/.tvh_build \
                $(LIB_ROOT)/$(LIBTHEORA)/.tvh_download
        cd $(LIB_ROOT)/$(LIBTHEORA) && \
-               CFLAGS="-fPIE" $(CONFIGURE) \
+               CFLAGS="$(CFLAGS_PI)" $(CONFIGURE) \
                --with-ogg=$(EPREFIX) \
                --disable-examples \
                $(LIBTHEORA_HOST)
@@ -395,7 +404,7 @@ $(LIB_ROOT)/$(LIBVORBIS)/.tvh_build: \
                $(LIB_ROOT)/$(LIBOGG)/.tvh_build \
                $(LIB_ROOT)/$(LIBVORBIS)/.tvh_download
        cd $(LIB_ROOT)/$(LIBVORBIS) && \
-               CFLAGS="-fPIE" $(CONFIGURE) \
+               CFLAGS="$(CFLAGS_PI)" $(CONFIGURE) \
                --with-ogg=$(EPREFIX)
        DESTDIR=$(EBUILDIR) \
                $(MAKE) -C $(LIB_ROOT)/$(LIBVORBIS) install
@@ -436,7 +445,7 @@ $(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download:
 $(LIB_ROOT)/$(LIBFDKAAC)/.tvh_build: \
                $(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download
        cd $(LIB_ROOT)/$(LIBFDKAAC) && \
-               CXXFLAGS="-fPIE" CFLAGS="-fPIE" $(CONFIGURE)
+               CXXFLAGS="$(CFLAGS_PI)" CFLAGS="$(CFLAGS_PI)" $(CONFIGURE)
        DESTDIR=$(EBUILDIR) \
                $(MAKE) -C $(LIB_ROOT)/$(LIBFDKAAC) install
        @touch $@
@@ -490,7 +499,7 @@ $(LIB_ROOT)/$(LIBMFX)/.tvh_download:
 $(LIB_ROOT)/$(LIBMFX)/.tvh_build: \
                $(LIB_ROOT)/$(LIBMFX)/.tvh_download
        cd $(LIB_ROOT)/$(LIBMFX) && autoreconf -i && \
-               CXXFLAGS="-fPIE" CFLAGS="-fPIE" $(CONFIGURE) \
+               CXXFLAGS="$(CFLAGS_PI)" CFLAGS="$(CFLAGS_PI)" $(CONFIGURE) \
                --with-libva_x11 \
                --with-libva_drm
        DESTDIR=$(EBUILDIR) \
index 4722bbe28203da436ba94953eac89d2da7b36bb5..a7f8f81faf732899d823d44e31f5e21cf2a224b1 100644 (file)
@@ -22,6 +22,12 @@ include $(DIR)/.config.mk
 unexport CFLAGS
 unexport LDFLAGS
 
+ifeq ($(CONFIG_PIE),yes)
+CFLAGS += -fPIE
+else
+CFLAGS += -fPIC
+endif
+
 # ###########################################################################
 # Upstream Packages
 # ###########################################################################
index be3d2e223e93ade472b2a406ed54a71a485965b3..a01be574898b7ded9191ebd9ee04c46ac0d7acbb 100755 (executable)
--- a/configure
+++ b/configure
@@ -17,6 +17,7 @@ test -z "$PKG_CONFIG" && PKG_CONFIG=pkg-config
 #
 
 OPTIONS=(
+  "pie:yes"
   "cwc:yes"
   "capmt:yes"
   "constcw:yes"
diff --git a/support/patches/libx265.pic.diff b/support/patches/libx265.pic.diff
new file mode 100644 (file)
index 0000000..7aaec38
--- /dev/null
@@ -0,0 +1,19 @@
+--- source/CMakeLists.txt.old  2016-05-05 16:49:17.373993257 +0200
++++ source/CMakeLists.txt      2016-05-05 16:50:25.259801461 +0200
+@@ -100,11 +100,11 @@
+     endif(NO_ATOMICS)
+ endif(UNIX)
+-if(X64 AND NOT WIN32)
+-    option(ENABLE_PIC "Enable Position Independent Code" ON)
+-else()
+-    option(ENABLE_PIC "Enable Position Independent Code" OFF)
+-endif(X64 AND NOT WIN32)
++#if(X64 AND NOT WIN32)
++option(ENABLE_PIC "Enable Position Independent Code" ON)
++#else()
++#    option(ENABLE_PIC "Enable Position Independent Code" OFF)
++#endif(X64 AND NOT WIN32)
+ # Compiler detection
+ if(CMAKE_GENERATOR STREQUAL "Xcode")