Skip to content

Commit

Permalink
MacPorts: 10-bit and 12-bit x265
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay authored and User committed Nov 19, 2017
1 parent e0f04a2 commit 711a478
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 0 deletions.
58 changes: 58 additions & 0 deletions tools/MacPorts/multimedia/x265/Portfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0

PortGroup muniversal 1.0
PortGroup cmake 1.0

name x265
version 2.5
revision 1

checksums rmd160 612e545199dcaadef782ca0a71a5ade679876509 \
sha256 2e53259b504a7edb9b21b9800163b1ff4c90e60c74e23e7001d423c69c5d3d17

categories multimedia
platforms darwin
license GPL-2+
maintainers nomaintainer

description H.265 encoder
long_description x265 is a free software library and application for \
encoding video streams into the H.265/MPEG-H HEVC \
compression format, and is released under the terms of the \
GNU GPL.
homepage https://www.videolan.org/developers/x265.html
master_sites http://ftp.videolan.org/pub/videolan/x265/
distname ${name}_${version}
worksrcdir ${distname}/source

depends_build-append \
port:yasm
cmake.out_of_source yes
compiler.blacklist *llvm-gcc-4.2

configure.env-append CONFIGURE='${configure.cmd}'
build.env-append BUILD='${build.cmd}'
destroot.env-append BUILD='${build.cmd}' ARCH=none
configure.cmd ${portpath}/${filesdir}/configure.sh
build.cmd ${portpath}/${filesdir}/build.sh

# error: illegal text-relocation to '_x265_pw_1'
# report: https://mailman.videolan.org/pipermail/x265-devel/2014-May/004476.html
# solution: http://lists.apple.com/archives/unix-porting/2008/Jan/msg00027.html
if {[variant_exists universal] && [variant_isset universal]} {
lappend merger_configure_ldflags(i386) -Wl,-read_only_relocs,suppress
foreach arch ${configure.universal_archs} {
lappend merger_configure_env(${arch}) ARCH='${arch}'
lappend merger_build_env(${arch}) ARCH='${arch}'
}
} else {
if {${build_arch} eq "i386"} {
configure.ldflags-append -Wl,-read_only_relocs,suppress
}
configure.env-append ARCH='${build_arch}'
build.env-append ARCH='${build_arch}'
}

livecheck.regex "${name}_(\\d+(?:\\.\\d+)*)${extract.suffix}"
45 changes: 45 additions & 0 deletions tools/MacPorts/multimedia/x265/Portfile.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0

PortGroup muniversal 1.0
PortGroup cmake 1.0

name x265
version 2.5

checksums rmd160 612e545199dcaadef782ca0a71a5ade679876509 \
sha256 2e53259b504a7edb9b21b9800163b1ff4c90e60c74e23e7001d423c69c5d3d17

categories multimedia
platforms darwin
license GPL-2+
maintainers nomaintainer

description H.265 encoder
long_description x265 is a free software library and application for \
encoding video streams into the H.265/MPEG-H HEVC \
compression format, and is released under the terms of the \
GNU GPL.
homepage https://www.videolan.org/developers/x265.html
master_sites http://ftp.videolan.org/pub/videolan/x265/
distname ${name}_${version}
worksrcdir ${distname}/source

depends_build-append \
port:yasm
cmake.out_of_source yes
compiler.blacklist *llvm-gcc-4.2

# error: illegal text-relocation to '_x265_pw_1'
# report: https://mailman.videolan.org/pipermail/x265-devel/2014-May/004476.html
# solution: http://lists.apple.com/archives/unix-porting/2008/Jan/msg00027.html
if {[variant_exists universal] && [variant_isset universal]} {
lappend merger_configure_ldflags(i386) -Wl,-read_only_relocs,suppress
} else {
if {${build_arch} eq "i386"} {
configure.ldflags-append -Wl,-read_only_relocs,suppress
}
}

livecheck.regex "${name}_(\\d+(?:\\.\\d+)*)${extract.suffix}"
38 changes: 38 additions & 0 deletions tools/MacPorts/multimedia/x265/Portfile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--- Portfile.orig 2017-11-18 20:07:00.000000000 +0100
+++ Portfile 2017-11-19 22:54:00.000000000 +0100
@@ -7,6 +7,7 @@

name x265
version 2.5
+revision 1

checksums rmd160 612e545199dcaadef782ca0a71a5ade679876509 \
sha256 2e53259b504a7edb9b21b9800163b1ff4c90e60c74e23e7001d423c69c5d3d17
@@ -31,15 +32,27 @@
cmake.out_of_source yes
compiler.blacklist *llvm-gcc-4.2

+configure.env-append CONFIGURE='${configure.cmd}'
+build.env-append BUILD='${build.cmd}'
+destroot.env-append BUILD='${build.cmd}' ARCH=none
+configure.cmd ${portpath}/${filesdir}/configure.sh
+build.cmd ${portpath}/${filesdir}/build.sh
+
# error: illegal text-relocation to '_x265_pw_1'
# report: https://mailman.videolan.org/pipermail/x265-devel/2014-May/004476.html
# solution: http://lists.apple.com/archives/unix-porting/2008/Jan/msg00027.html
if {[variant_exists universal] && [variant_isset universal]} {
lappend merger_configure_ldflags(i386) -Wl,-read_only_relocs,suppress
+ foreach arch ${configure.universal_archs} {
+ lappend merger_configure_env(${arch}) ARCH='${arch}'
+ lappend merger_build_env(${arch}) ARCH='${arch}'
+ }
} else {
if {${build_arch} eq "i386"} {
configure.ldflags-append -Wl,-read_only_relocs,suppress
}
+ configure.env-append ARCH='${build_arch}'
+ build.env-append ARCH='${build_arch}'
}

livecheck.regex "${name}_(\\d+(?:\\.\\d+)*)${extract.suffix}"
15 changes: 15 additions & 0 deletions tools/MacPorts/multimedia/x265/files/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e
#set -x

if [ "$ARCH" != "x86_64" ]; then
exec "$BUILD" "$@"
fi

(cd ../10bit-$ARCH && "$BUILD" "$@")
mv ../10bit-$ARCH/libx265.a libx265_main10.a
(cd ../12bit-$ARCH && "$BUILD" "$@")
mv ../12bit-$ARCH/libx265.a libx265_main12.a
"$BUILD" "$@"
mv libx265.a libx265_main.a
libtool -static -o libx265.a libx265_main.a libx265_main10.a libx265_main12.a
19 changes: 19 additions & 0 deletions tools/MacPorts/multimedia/x265/files/configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -e
#set -x

if [ "$ARCH" != "x86_64" ]; then
exec "$CONFIGURE" "$@"
fi

# gcc version 4.8 or higher required for -DENABLE_HDR10_PLUS=ON
args=( -DLINKED_10BIT=ON -DLINKED_12BIT=ON -DEXTRA_LINK_FLAGS=-L. -DEXTRA_LIB='x265_main10.a;x265_main12.a' )
high_bit_depth_args=( -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF )

[ -d ../10bit-$ARCH ] || mkdir ../10bit-$ARCH
(cd ../10bit-$ARCH && "$CONFIGURE" "$@" "${high_bit_depth_args[@]}")

[ -d ../12bit-$ARCH ] || mkdir ../12bit-$ARCH
(cd ../12bit-$ARCH && "$CONFIGURE" "$@" "${high_bit_depth_args[@]}" -DMAIN12=ON)

"$CONFIGURE" "$@" "${args[@]}"

0 comments on commit 711a478

Please sign in to comment.