Oh, because I wrestle with buildsystem anyway ...

I created three x265 patches, to be put in thirdparty/src alongside x265 tarball

patch 1 basically adds empty (/bin/true) pseudo configure
patch 2  adds Makefile - it will do some library copying work
patch 3 adds miltilib.sh, adapted from x265's own version:


--- /dev/null   2020-03-14 06:02:18.586124011 +0300
+++ ./multilib.sh       2020-03-18 00:04:59.404807407 +0300
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+mkdir -p 8bit 10bit 12bit
+
+cd 12bit
+cmake ../source -DHIGH_BIT_DEPTH=ON -DENABLE_ASSEMBLY=OFF -DEXPORT_C_API=OFF 
-DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DMAIN12=ON
+make  -j 1
+
+cd ../10bit
+cmake ../source -DHIGH_BIT_DEPTH=ON -DENABLE_ASSEMBLY=OFF -DEXPORT_C_API=OFF 
-DENABLE_SHARED=OFF -DENABLE_CLI=OFF
+make -j 1
+
+cd ../8bit
+ln -sf ../10bit/libx265.a libx265_main10.a
+ln -sf ../12bit/libx265.a libx265_main12.a
+cmake ../source -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DENABLE_SHARED=OFF 
-DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=ON -DLINKED_12BIT=ON
+make -j 1
+
+# rename the 8bit library, then combine all three into libx265.a
+mv libx265.a libx265_main.a
+
+uname=`uname`
+if [ "$uname" = "Linux" ]
+then
+
+# On Linux, we use GNU ar to combine the static libraries together
+ar -M <<EOF
+CREATE libx265.a
+ADDLIB libx265_main.a
+ADDLIB libx265_main10.a
+ADDLIB libx265_main12.a
+SAVE
+END
+EOF
+
+else
+
+# Mac/BSD libtool
+libtool -static -o libx265.a libx265_main.a libx265_main10.a libx265_main12.a 
2>/dev/null
+
+fi

Note, I disabled high-bit-depth assembly because it simply doesn't exist on 
x86-32!
But for x86-64 you probably want it ON. Some bash arch detection needed ... 

After buildsystem unpacks and patches x265 sources it will try to execute 
./configure
 ..and opps, it was not executable!

So, I modified thirdparty/Makefile AGAIN, this time only x265 line:

x265.cfg_vars?=chmod +x ./configure; chmod +x ./multilib.sh;

after this buildsystem makes (8-10-12 bit-ready) .a library, ready to link into 
ffmpeg.
--- /dev/null	2020-03-14 06:02:18.586124011 +0300
+++ ./configure	2020-03-18 00:04:59.360807192 +0300
@@ -0,0 +1 @@
+/bin/true
--- /dev/null	2020-03-14 06:02:18.586124011 +0300
+++ ./Makefile	2020-03-18 00:04:59.388807329 +0300
@@ -0,0 +1,4 @@
+#$(shell cd build/linux ; ./multilib.sh)
+.NOTPARALLEL:
+all:
+	$(shell ./multilib.sh ; cp 8bit/libx265.a . ; cp 8bit/x265.pc . ; cp 8bit/x265_config.h .)
--- /dev/null	2020-03-14 06:02:18.586124011 +0300
+++ ./multilib.sh	2020-03-18 00:04:59.404807407 +0300
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+mkdir -p 8bit 10bit 12bit
+
+cd 12bit
+cmake ../source -DHIGH_BIT_DEPTH=ON -DENABLE_ASSEMBLY=OFF -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DMAIN12=ON
+make  -j 1
+
+cd ../10bit
+cmake ../source -DHIGH_BIT_DEPTH=ON -DENABLE_ASSEMBLY=OFF -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF
+make -j 1
+
+cd ../8bit
+ln -sf ../10bit/libx265.a libx265_main10.a
+ln -sf ../12bit/libx265.a libx265_main12.a
+cmake ../source -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DENABLE_SHARED=OFF -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=ON -DLINKED_12BIT=ON
+make -j 1
+
+# rename the 8bit library, then combine all three into libx265.a
+mv libx265.a libx265_main.a
+
+uname=`uname`
+if [ "$uname" = "Linux" ]
+then
+
+# On Linux, we use GNU ar to combine the static libraries together
+ar -M <<EOF
+CREATE libx265.a
+ADDLIB libx265_main.a
+ADDLIB libx265_main10.a
+ADDLIB libx265_main12.a
+SAVE
+END
+EOF
+
+else
+
+# Mac/BSD libtool
+libtool -static -o libx265.a libx265_main.a libx265_main10.a libx265_main12.a 2>/dev/null
+
+fi
-- 
Cin mailing list
[email protected]
https://lists.cinelerra-gg.org/mailman/listinfo/cin

Reply via email to