From 7c923c531391103ecbc56c659f7f165f66e069cf Mon Sep 17 00:00:00 2001 From: q66 Date: Wed, 9 Sep 2020 19:54:11 +0200 Subject: [PATCH] chromium: fix build on ppc64le --- .../chromium/patches/xxx-ppc64le-libvpx.patch | 81 +++++++++++++++++++ .../patches/xxx-ppc64le-swiftshader.patch | 18 +++++ srcpkgs/chromium/template | 31 +++++-- 3 files changed, 123 insertions(+), 7 deletions(-) create mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch create mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch new file mode 100644 index 00000000000..b6a43980c04 --- /dev/null +++ b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch @@ -0,0 +1,81 @@ +Uses generic target for now. To use ppc64le, change --target to ppc64le-gnu +and add --enable-vsx, and change generic to ppc for the rtcd header. + +From 18e6c5c55cfae0cfb458d8210d7bc709360a0e90 Mon Sep 17 00:00:00 2001 +From: q66 +Date: Wed, 9 Sep 2020 19:08:25 +0200 +Subject: [PATCH] enable generation of ppc64 libvpx bits + +this doesn't update the gni file, that's done from +the template by running the appropriate scripts +--- + third_party/libvpx/BUILD.gn | 4 ++++ + third_party/libvpx/generate_gni.sh | 9 +++++++++ + 2 files changed, 13 insertions(+) + +diff --git third_party/libvpx/BUILD.gn third_party/libvpx/BUILD.gn +index 7198e59..3300485 100644 +--- third_party/libvpx/BUILD.gn ++++ third_party/libvpx/BUILD.gn +@@ -336,6 +336,8 @@ static_library("libvpx") { + } else { + sources = libvpx_srcs_arm64 + } ++ } else if (current_cpu == "ppc64") { ++ sources = libvpx_srcs_ppc64 + } + + configs -= [ "//build/config/compiler:chromium_code" ] +@@ -401,6 +403,8 @@ static_library("libvp9rc") { + } else { + sources = libvpx_srcs_arm64 + } ++ } else if (current_cpu == "ppc64") { ++ sources = libvpx_srcs_ppc64 + } + sources += [ "//third_party/libvpx/source/libvpx/vp9/ratectrl_rtc.cc" ] + sources += [ "//third_party/libvpx/source/libvpx/vp9/ratectrl_rtc.h" ] +diff --git third_party/libvpx/generate_gni.sh third_party/libvpx/generate_gni.sh +index bcf84b0..8a3f4f1 100755 +--- third_party/libvpx/generate_gni.sh ++++ third_party/libvpx/generate_gni.sh +@@ -361,6 +361,7 @@ gen_config_files linux/arm-neon-highbd "--target=armv7-linux-gcc ${all_platforms + gen_config_files linux/arm64-highbd "--target=armv8-linux-gcc ${all_platforms} ${HIGHBD}" + gen_config_files linux/mipsel "--target=mips32-linux-gcc ${all_platforms}" + gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}" ++gen_config_files linux/ppc64 "--target=generic-gnu $HIGHBD ${all_platforms}" + gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}" + gen_config_files win/arm64 "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}" + gen_config_files win/ia32 "--target=x86-win32-vs14 ${all_platforms} ${x86_platforms}" +@@ -386,6 +387,7 @@ lint_config linux/arm-neon-highbd + lint_config linux/arm64-highbd + lint_config linux/mipsel + lint_config linux/mips64el ++lint_config linux/ppc64 + lint_config linux/generic + lint_config win/arm64 + lint_config win/ia32 +@@ -415,6 +417,7 @@ gen_rtcd_header linux/arm-neon-highbd armv7 + gen_rtcd_header linux/arm64-highbd armv8 + gen_rtcd_header linux/mipsel mipsel + gen_rtcd_header linux/mips64el mips64el ++gen_rtcd_header linux/ppc64 generic + gen_rtcd_header linux/generic generic + gen_rtcd_header win/arm64 armv8 + gen_rtcd_header win/ia32 x86 "${require_sse2}" +@@ -500,6 +503,12 @@ if [ -z $ONLY_CONFIGS ]; then + + echo "MIPS64 source list is identical to MIPS source list. No need to generate it." + ++ echo "Generate ppc64 source list." ++ config=$(print_config_basic linux/ppc64) ++ make_clean ++ make libvpx_srcs.txt target=libs $config > /dev/null ++ convert_srcs_to_project_files libvpx_srcs.txt libvpx_srcs_ppc64 ++ + echo "Generate NaCl source list." + config=$(print_config_basic nacl) + make_clean +-- +2.28.0 + diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch b/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch new file mode 100644 index 00000000000..53549d17f5a --- /dev/null +++ b/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch @@ -0,0 +1,18 @@ +--- third_party/swiftshader/third_party/llvm-10.0/BUILD.gn ++++ third_party/swiftshader/third_party/llvm-10.0/BUILD.gn +@@ -574,6 +574,7 @@ swiftshader_llvm_source_set("swiftshader + "llvm/lib/MC/MCAsmInfoCOFF.cpp", + "llvm/lib/MC/MCAsmInfoDarwin.cpp", + "llvm/lib/MC/MCAsmInfoELF.cpp", ++ "llvm/lib/MC/MCAsmInfoXCOFF.cpp", + "llvm/lib/MC/MCAsmMacro.cpp", + "llvm/lib/MC/MCAsmStreamer.cpp", + "llvm/lib/MC/MCAssembler.cpp", +@@ -629,6 +630,7 @@ swiftshader_llvm_source_set("swiftshader + "llvm/lib/MC/MCWinCOFFStreamer.cpp", + "llvm/lib/MC/MCWinEH.cpp", + "llvm/lib/MC/MCXCOFFStreamer.cpp", ++ "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp", + "llvm/lib/MC/MachObjectWriter.cpp", + "llvm/lib/MC/StringTableBuilder.cpp", + "llvm/lib/MC/SubtargetFeature.cpp", diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template index eafa0f1ca8c..494ab81499f 100644 --- a/srcpkgs/chromium/template +++ b/srcpkgs/chromium/template @@ -72,6 +72,10 @@ post_patch() { sed -i '/config("compiler")/ a cflags_cc = [ "-fno-delete-null-pointer-checks" ]' \ build/config/linux/BUILD.gn fi + + # prevent annoying errors when regenerating gni + vsed -i 's,^update_readme$,#update_readme,' \ + third_party/libvpx/generate_gni.sh } do_configure() { local system="" conf=() @@ -82,6 +86,26 @@ do_configure() { export CXX=clang++ fi + export LDFLAGS="-pthread" + + # compile gn early, so it can be used to generate gni stuff + AR="ar" CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD LD=$CXX_FOR_BUILD \ + python2 tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles + + # we need to generate ppc64 stuff for libvpx as it's not shipped + # this has to be done before unbundling, but after gn is built + # comment out if we switch back to system libvpx again later + case "$XBPS_TARGET_MACHINE" in + ppc64*) + pushd third_party/libvpx + mkdir -p source/config/linux/ppc64 + # need PATH to find gn + PATH="${wrksrc}/out/Release:$PATH" ./generate_gni.sh || \ + msg_error "failed to generate libvpx gni" + popd + ;; + esac + # Use system-provided libraries. # TODO: use_system_hunspell (upstream changes needed). # TODO: use_system_libsrtp. @@ -227,13 +251,6 @@ do_configure() { ppc64*) conf+=( 'target_cpu="ppc64"' ) ;; esac - export LDFLAGS="-pthread" - - AR="ar" CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD LD=$CXX_FOR_BUILD \ - python2 tools/gn/bootstrap/bootstrap.py -s -v \ - --gn-gen-args "${conf[*]}" - - out/Release/gn gen out/Release --args="${conf[*]}" } do_build() {