[x265] [PATCH] cmake: add `ar` and `libtool` examples to multlib.bat for linux and BSD

Steve Borho steve at borho.org
Thu Jul 9 18:09:59 CEST 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1436455835 18000
#      Thu Jul 09 10:30:35 2015 -0500
# Node ID 31a94659ced71b3304257f3dc8115c1f00e040c4
# Parent  83bc6fac1fb54e9d5241c5c10d8578811a355273
cmake: add `ar` and `libtool` examples to multlib.bat for linux and BSD

This script is not going to be super portable, but should be a good hint to
packagers for how to combine the static libraries of the individual builds
together into a single static library which can then be installed by the default
install rule.

diff -r 83bc6fac1fb5 -r 31a94659ced7 build/linux/multilib.sh
--- a/build/linux/multilib.sh	Wed Jul 08 13:35:39 2015 -0500
+++ b/build/linux/multilib.sh	Thu Jul 09 10:30:35 2015 -0500
@@ -15,3 +15,28 @@
 ln -sf ../12bit/libx265.a libx265_main12.a
 cmake ../../../source -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=ON -DLINKED_12BIT=ON
 make ${MAKEFLAGS}
+
+uname=`uname`
+if [[ "$uname" == "Linux" ]];
+then
+
+# On Linux, we use GNU ar to combine the static libraries together
+ar -M <<EOF
+CREATE libx265_all.a
+ADDLIB libx265.a
+ADDLIB libx265_main10.a
+ADDLIB libx265_main12.a
+SAVE
+END
+EOF
+
+else
+
+# Mac/BSD libtool
+libtool -static -o libx265_all.a libx265.a libx265_main10.a libx265_main12.a 2>/dev/null
+
+fi
+
+# then rename the combined library over libx265.a so the install rules
+# will find this copy
+mv libx265_all.a libx265.a


More information about the x265-devel mailing list