Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
build system: allow to use PIC instead PIE (ARM?)
  • Loading branch information
perexg committed May 5, 2016
1 parent 673e720 commit 0faba8a
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
5 changes: 5 additions & 0 deletions Makefile
Expand Up @@ -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
Expand Down
27 changes: 18 additions & 9 deletions Makefile.ffmpeg
Expand Up @@ -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
Expand Down Expand Up @@ -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
#
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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 $@
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 $@
Expand Down Expand Up @@ -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) \
Expand Down
6 changes: 6 additions & 0 deletions Makefile.hdhomerun
Expand Up @@ -22,6 +22,12 @@ include $(DIR)/.config.mk
unexport CFLAGS
unexport LDFLAGS

ifeq ($(CONFIG_PIE),yes)
CFLAGS += -fPIE
else
CFLAGS += -fPIC
endif

# ###########################################################################
# Upstream Packages
# ###########################################################################
Expand Down
1 change: 1 addition & 0 deletions configure
Expand Up @@ -17,6 +17,7 @@ test -z "$PKG_CONFIG" && PKG_CONFIG=pkg-config
#

OPTIONS=(
"pie:yes"
"cwc:yes"
"capmt:yes"
"constcw:yes"
Expand Down
19 changes: 19 additions & 0 deletions support/patches/libx265.pic.diff
@@ -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")

0 comments on commit 0faba8a

Please sign in to comment.