-
-
Notifications
You must be signed in to change notification settings - Fork 18k
x265: fix build on aarch64 #100807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
x265: fix build on aarch64 #100807
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
...evelopment/libraries/x265/0001-dynamicHDR10-update-CMakeLists.txt-for-aarch64-suppo.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| From 4ba35c72ff39fa1f379e7c69e8c4fd0662961df9 Mon Sep 17 00:00:00 2001 | ||
| From: Andrew Childs <lorne@cons.org.nz> | ||
| Date: Sat, 17 Oct 2020 13:26:01 +0900 | ||
| Subject: [PATCH] dynamicHDR10: update CMakeLists.txt for aarch64 support | ||
|
|
||
| Directly copied from the main CMakeLists.txt, which was updated in | ||
| ec7396adaa6afd2c8aab1918cfe4bb6e384740c3 | ||
| --- | ||
| source/dynamicHDR10/CMakeLists.txt | 20 +++++++++++++++----- | ||
| 1 file changed, 15 insertions(+), 5 deletions(-) | ||
|
|
||
| diff --git a/source/dynamicHDR10/CMakeLists.txt b/source/dynamicHDR10/CMakeLists.txt | ||
| index 22fb79d44..853378d27 100644 | ||
| --- a/source/dynamicHDR10/CMakeLists.txt | ||
| +++ b/source/dynamicHDR10/CMakeLists.txt | ||
| @@ -43,14 +43,24 @@ if(GCC) | ||
| endif() | ||
| endif() | ||
| if(ARM AND CROSS_COMPILE_ARM) | ||
| - set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC) | ||
| + if(ARM64) | ||
| + set(ARM_ARGS -fPIC) | ||
| + else() | ||
| + set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC) | ||
| + endif() | ||
| + message(STATUS "cross compile arm") | ||
| elseif(ARM) | ||
| - find_package(Neon) | ||
| - if(CPU_HAS_NEON) | ||
| - set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC) | ||
| + if(ARM64) | ||
| + set(ARM_ARGS -fPIC) | ||
| add_definitions(-DHAVE_NEON) | ||
| else() | ||
| - set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm) | ||
| + find_package(Neon) | ||
| + if(CPU_HAS_NEON) | ||
| + set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC) | ||
| + add_definitions(-DHAVE_NEON) | ||
| + else() | ||
| + set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm) | ||
| + endif() | ||
| endif() | ||
| endif() | ||
| add_definitions(${ARM_ARGS}) | ||
| -- | ||
| 2.28.0 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,11 +7,11 @@ | |
| , custatsSupport ? false # Internal profiling of encoder work | ||
| , cliSupport ? true # Build standalone CLI application | ||
| , unittestsSupport ? false # Unit tests | ||
| , withHighBitDepth ? stdenv.hostPlatform.isx86_64 # requires explicit upstream support for platform | ||
| }: | ||
|
|
||
| let | ||
| mkFlag = optSet: flag: if optSet then "-D${flag}=ON" else "-D${flag}=OFF"; | ||
| inherit (stdenv) is64bit; | ||
|
|
||
| cmakeFlagsAll = [ | ||
| "-DSTATIC_LINK_CRT=OFF" | ||
|
|
@@ -34,9 +34,13 @@ let | |
| sha256 = "1jzgv2hxhcwmsdf6sbgyzm88a46dp09ll1fqj92g9vckvh9a7dsn"; | ||
| }; | ||
|
|
||
| patches = stdenv.lib.optionals stdenv.hostPlatform.isAarch64 [ | ||
| ./0001-dynamicHDR10-update-CMakeLists.txt-for-aarch64-suppo.patch | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't bundle patches in nixpkgs, if they can be sent upstream, and When doing so, please also add a comment pointing to the upstream PR. |
||
| ]; | ||
|
|
||
| buildLib = has12Bit: stdenv.mkDerivation rec { | ||
| name = "libx265-${if has12Bit then "12" else "10"}-${version}"; | ||
| inherit src; | ||
| inherit src patches; | ||
| enableParallelBuilding = true; | ||
|
|
||
| postPatch = '' | ||
|
|
@@ -66,7 +70,7 @@ in | |
|
|
||
| stdenv.mkDerivation rec { | ||
| pname = "x265"; | ||
| inherit version src; | ||
| inherit version src patches; | ||
|
|
||
| enableParallelBuilding = true; | ||
|
|
||
|
|
@@ -79,7 +83,7 @@ stdenv.mkDerivation rec { | |
| "-DENABLE_SHARED=ON" | ||
| "-DHIGH_BIT_DEPTH=OFF" | ||
| "-DENABLE_HDR10_PLUS=OFF" | ||
| ] ++ stdenv.lib.optionals is64bit [ | ||
| ] ++ stdenv.lib.optionals withHighBitDepth [ | ||
| "-DEXTRA_LIB=${libx265-10}/lib/libx265.a;${libx265-12}/lib/libx265.a" | ||
| "-DLINKED_10BIT=ON" | ||
| "-DLINKED_12BIT=ON" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patches shouldn't be conditional on a specific architecture - assuming the patch won't apply after a bump, this will lead to silent breakages.
If this patch doesn't break other arches, it should just be applied independent of architecture