about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-09-14 08:31:35 +0000
committerAnderson Torres <torres.anderson.85@protonmail.com>2023-09-14 09:58:41 +0000
commit6affb7c8d469f374e91f77280873aa4042a1c517 (patch)
treeebd538def7d3bac3b79dd687ad7b8a66336befcd
parent11419311288d6b186e96b55b682cd9d4f2ff20a8 (diff)
libvlc: fix cross
-rw-r--r--pkgs/applications/video/vlc/default.nix17
1 files changed, 15 insertions, 2 deletions
diff --git a/pkgs/applications/video/vlc/default.nix b/pkgs/applications/video/vlc/default.nix
index bb0a26e94fb33..13f8f40ed6358 100644
--- a/pkgs/applications/video/vlc/default.nix
+++ b/pkgs/applications/video/vlc/default.nix
@@ -1,5 +1,6 @@
 { lib
 , stdenv
+, pkgsBuildBuild
 , fetchurl
 , fetchpatch
 , SDL
@@ -110,12 +111,14 @@ stdenv.mkDerivation (finalAttrs: {
 
   nativeBuildInputs = [
     autoreconfHook
+    lua5
     perl
     pkg-config
     removeReferencesTo
     unzip
     wrapGAppsHook
   ]
+  ++ optional chromecastSupport protobuf
   ++ optionals withQt5 [ wrapQtAppsHook ]
   ++ optionals waylandSupport [
     wayland
@@ -204,7 +207,8 @@ stdenv.mkDerivation (finalAttrs: {
   env = {
     # vlc depends on a c11-gcc wrapper script which we don't have so we need to
     # set the path to the compiler
-    BUILDCC = "${stdenv.cc}/bin/gcc";
+    BUILDCC = "${pkgsBuildBuild.stdenv.cc}/bin/gcc";
+    PKG_CONFIG_WAYLAND_SCANNER_WAYLAND_SCANNER = "wayland-scanner";
   } // lib.optionalAttrs (!stdenv.hostPlatform.isAarch) {
     LIVE555_PREFIX = live555;
   };
@@ -227,6 +231,11 @@ stdenv.mkDerivation (finalAttrs: {
   postPatch = ''
     substituteInPlace modules/text_renderer/freetype/platform_fonts.h --replace \
       /usr/share/fonts/truetype/freefont ${freefont_ttf}/share/fonts/truetype
+  '' + lib.optionalString (!stdenv.hostPlatform.canExecute stdenv.buildPlatform) ''
+    # Upstream luac can't cross compile, so we have to install the lua
+    # sources, not bytecode:
+    # https://www.lua.org/wshop13/Jericke.pdf#page=39
+    substituteInPlace share/Makefile.am --replace $'.luac \\\n' $'.lua \\\n'
   '';
 
   enableParallelBuilding = true;
@@ -240,9 +249,13 @@ stdenv.mkDerivation (finalAttrs: {
   # - Touch plugins (plugins cache keyed off mtime and file size:
   #     https://github.com/NixOS/nixpkgs/pull/35124#issuecomment-370552830
   # - Remove references to the Qt development headers (used in error messages)
+  #
+  # pkgsBuildBuild is used here because buildPackages.libvlc somehow
+  # depends on a qt5.qttranslations that doesn't build, even though it
+  # should be the same as pkgsBuildBuild.qt5.qttranslations.
   postFixup = ''
     find $out/lib/vlc/plugins -exec touch -d @1 '{}' ';'
-    $out/lib/vlc/vlc-cache-gen $out/vlc/plugins
+    ${if stdenv.buildPlatform.canExecute stdenv.hostPlatform then "$out" else pkgsBuildBuild.libvlc}/lib/vlc/vlc-cache-gen $out/vlc/plugins
   '' + optionalString withQt5 ''
     remove-references-to -t "${qtbase.dev}" $out/lib/vlc/plugins/gui/libqt_plugin.so
   '';