Skip to content

Commit

Permalink
media-libs/x265: Fix x32 build, bug #510890
Browse files Browse the repository at this point in the history
x32 arch as defined on https://sites.google.com/site/x32abi is neither
X86 nor X64, then forcing -march=i686 leads to build failure as wrong
-march is used.

Forcing -march, -mfloat-abi and -mfpu for ARM is also wrong
As a global sanity sake, disable all forced -march in CMakeLists

Upstream report: https://bitbucket.org/multicoreware/x265/pull-requests/21/build-disable-march-selection-from/diff

Package-Manager: portage-2.2.20.1
  • Loading branch information
bjacquin committed Oct 11, 2015
1 parent f5927a1 commit 2c03843
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From e89069148db716d30fb81c798d0cfd83250a9f5a Mon Sep 17 00:00:00 2001
From: Bertrand Jacquin <bertrand@jacquin.bzh>
Date: Sat, 10 Oct 2015 00:05:41 +0100
Subject: [PATCH] build: Disable -march selection from CMakeLists.txt

x32 arch as defined on https://sites.google.com/site/x32abi is neither
X86 nor X64, then forcing -march=i686 leads to build failure as wrong
-march is used.

Forcing -march, -mfloat-abi and -mfpu for ARM is also wrong

As a global sanity sake, disable all forced -march in CMakeLists
---
source/CMakeLists.txt | 7 -------
1 file changed, 7 deletions(-)

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 764d5f2..fbc0d49 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -167,14 +167,7 @@ if(GCC)
if(NATIVE_BUILD)
if(INTEL_CXX)
add_definitions(-xhost)
- else()
- add_definitions(-march=native)
endif()
- elseif(X86 AND NOT X64)
- add_definitions(-march=i686)
- endif()
- if(ARM)
- add_definitions(-march=armv6 -mfloat-abi=hard -mfpu=vfp)
endif()
if(FPROFILE_GENERATE)
if(INTEL_CXX)
12 changes: 12 additions & 0 deletions media-libs/x265/x265-1.7.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ DEPEND="${RDEPEND}
abi_x86_32? ( ${ASM_DEPEND} )
abi_x86_64? ( ${ASM_DEPEND} )"

ASM_MULTILIB_ABIS="abi_x86_32 abi_x86_64"

src_unpack() {
if [[ ${PV} = 9999* ]]; then
mercurial_src_unpack
Expand All @@ -41,6 +43,10 @@ src_unpack() {
fi
}

src_prepare() {
epatch "${FILESDIR}/${PV}-build-Disable-march-selection-from-CMakeLists.txt.patch"
}

multilib_src_configure() {
append-cflags -fPIC
append-cxxflags -fPIC
Expand All @@ -51,6 +57,12 @@ multilib_src_configure() {
-DLIB_INSTALL_DIR="$(get_libdir)"
)

if has ${MULTILIB_ABI_FLAG} ${ASM_MULTILIB_ABIS} ; then
mycmakeargs+=( "-DENABLE_ASSEMBLY=ON" )
else
mycmakeargs+=( "-DENABLE_ASSEMBLY=OFF" )
fi

if [ "${ABI}" = x86 ] ; then
use 10bit && ewarn "Disabling 10bit support on x86 as it does not build (or requires to disable assembly optimizations)"
mycmakeargs+=( -DHIGH_BIT_DEPTH=OFF )
Expand Down
8 changes: 8 additions & 0 deletions media-libs/x265/x265-9999.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ DEPEND="${RDEPEND}
abi_x86_32? ( ${ASM_DEPEND} )
abi_x86_64? ( ${ASM_DEPEND} )"

ASM_MULTILIB_ABIS="abi_x86_32 abi_x86_64"

src_unpack() {
if [[ ${PV} = 9999* ]]; then
mercurial_src_unpack
Expand All @@ -51,6 +53,12 @@ multilib_src_configure() {
-DLIB_INSTALL_DIR="$(get_libdir)"
)

if has ${MULTILIB_ABI_FLAG} ${ASM_MULTILIB_ABIS} ; then
mycmakeargs+=( "-DENABLE_ASSEMBLY=ON" )
else
mycmakeargs+=( "-DENABLE_ASSEMBLY=OFF" )
fi

if [ "${ABI}" = x86 ] ; then
use 10bit && ewarn "Disabling 10bit support on x86 as it does not build (or requires to disable assembly optimizations)"
mycmakeargs+=( -DHIGH_BIT_DEPTH=OFF )
Expand Down

0 comments on commit 2c03843

Please sign in to comment.