Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vivaldi: fix patched paths #72207

Merged
merged 3 commits into from Feb 12, 2020
Merged

Conversation

eadwu
Copy link
Member

@eadwu eadwu commented Oct 29, 2019

Doesn't align with the stable version but it's looking like these changes are needed for when 2.9 is released.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@eadwu
Copy link
Member Author

eadwu commented Oct 29, 2019

So basically this shouldn't be merged until 2.9 is released.

@worldofpeace worldofpeace added the 2.status: wait-for-upstream Waiting for upstream fix (or their other action). label Oct 29, 2019
@ofborg ofborg bot requested review from lluchs and betaboon October 29, 2019 01:19
Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nix-review passes on NixOS
diff LGTM
not sure how to test

[6 built, 1 copied (0.0 MiB), 0.0 MiB DL]
https://github.com/NixOS/nixpkgs/pull/72207
3 package were build:
exodus vivaldi-ffmpeg-codecs vivaldi-widevine

@betaboon
Copy link
Contributor

betaboon commented Nov 7, 2019

@eadwu i just tested this as 9.2 is released. it doesnt quite work.
These are the changes required to make it work:

diff --git a/pkgs/applications/networking/browsers/vivaldi/default.nix b/pkgs/applications/networking/browsers/vivaldi/default.nix
index d203dade224..2a51e46db71 100644
--- a/pkgs/applications/networking/browsers/vivaldi/default.nix
+++ b/pkgs/applications/networking/browsers/vivaldi/default.nix
@@ -81,7 +81,7 @@ in stdenv.mkDerivation rec {
       --suffix XDG_DATA_DIRS : ${gtk3}/share/gsettings-schemas/${gtk3.name}/ \
       ${stdenv.lib.optionalString enableWidevine "--suffix LD_LIBRARY_PATH : ${libPath}"}
   '' + stdenv.lib.optionalString enableWidevine ''
-    ln -sf ${vivaldi-widevine}/lib/libwidevinecdm.so $out/opt/${vivaldiName}/WidevineCdm
+    ln -sf ${vivaldi-widevine}/share/google/chrome/WidevineCdm $out/opt/${vivaldiName}/WidevineCdm
   '';

   meta = with stdenv.lib; {
diff --git a/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix b/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix
index cd710cb883d..78b35da1609 100644
--- a/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix
+++ b/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix
@@ -4,11 +4,11 @@

 stdenv.mkDerivation rec {
   name = "chromium-codecs-ffmpeg";
-  version = "77.0.3865.90";
+  version = "78.0.3904.70";

   src = fetchurl {
-    url = "http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_${version}-0ubuntu0.18.04.1_amd64.deb";
-    sha256 = "12736d7x1kqv1727ycx0f1ijbdq2fcc3vwklklnxpkklnf86w51q";
+    url = "http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_${version}-0ubuntu0.18.04.2_amd64.deb";
+    sha256 = "1ybzddqqim5q20jk5p0wc5kman58vjd8zj9ccs3hrk7c37hvcd16";
   };

   buildInputs = [ dpkg ];
diff --git a/pkgs/applications/networking/browsers/vivaldi/widevine.nix b/pkgs/applications/networking/browsers/vivaldi/widevine.nix
index fe626b20d4e..f8d5bd609da 100644
--- a/pkgs/applications/networking/browsers/vivaldi/widevine.nix
+++ b/pkgs/applications/networking/browsers/vivaldi/widevine.nix
@@ -14,12 +14,15 @@ stdenv.mkDerivation rec {
   buildInputs = [ unzip ];

   unpackPhase = ''
-    unzip $src libwidevinecdm.so
-    find .
+    unzip $src
   '';

-  installPhase = ''
-    install -vD libwidevinecdm.so $out/lib/libwidevinecdm.so
+  installPhase = let
+    installDir = "$out/share/google/chrome/WidevineCdm/_platform_specific/linux_x64";
+  in ''
+    install -vD libwidevinecdm.so ${installDir}/libwidevinecdm.so
+    install -vD manifest.json ${installDir}/manifest.json
+    install -vD LICENSE.txt ${installDir}/LICENSE.txt
   '';

   meta = with stdenv.lib; {

@eadwu
Copy link
Member Author

eadwu commented Nov 7, 2019

Applied patch and rebased onto master.

@jonringer
Copy link
Contributor

still all builds fine, @betaboon for testing

@eadwu
Copy link
Member Author

eadwu commented Nov 8, 2019

Might be worth noting that if follow vivaldi's specification for whether or not the widevine works [1], none of the two approaches work although they suppress the error.

[1] https://help.vivaldi.com/article/widevinecdm-eme-drm-support-on-linux/

Copy link
Contributor

@betaboon betaboon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to work fine.
i tested with: https://bitmovin.com/demos/drm
and with netflix

@jonringer
Copy link
Contributor

@GrahamcOfBorg build exodus vivaldi-ffmpeg-codecs vivaldi-widevine

@AlexeyRaga
Copy link

2.10 has been released, would be nice to have the latest version of vivaldi available.

@betaboon
Copy link
Contributor

I didnt notice this PR hasnt been merged yet :/
I'm gonna try to work on a PR for 2.10 and include these changes tomorrow in the train.

@jonringer
Copy link
Contributor

I forgot to follow up after doing the ofborg build

@AlexeyRaga
Copy link

Thanks guys!

@ofborg ofborg bot requested a review from betaboon December 27, 2019 02:41
@betaboon
Copy link
Contributor

@eadwu the mirror you're using for ffmpeg does not serve the specified version for me.
I don't see a good reason for not using the mirror that the vivaldi-update-scripts use for fetching the dependencies anyway.

I improved the update-script a little to extract the ffmpeg- and widevine version directly from the update scripts provided by the vivaldi package.

diff --git a/pkgs/applications/networking/browsers/vivaldi/update.sh b/pkgs/applications/networking/browsers/vivaldi/update.sh
index 2e6c2853eb1..b08fe3d7713 100755
--- a/pkgs/applications/networking/browsers/vivaldi/update.sh
+++ b/pkgs/applications/networking/browsers/vivaldi/update.sh
@@ -28,6 +28,7 @@ path=${prefetch[1]}
 nixpkgs="$(git rev-parse --show-toplevel)"
 default_nix="$nixpkgs/pkgs/applications/networking/browsers/vivaldi/default.nix"
 ffmpeg_nix="$nixpkgs/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix"
+widevine_nix="$nixpkgs/pkgs/applications/networking/browsers/vivaldi/widevine.nix"
 
 (cd "$root" && update-source-version vivaldi "$vivaldi_version" "$hash")
 
@@ -35,12 +36,28 @@ git add "${default_nix}"
 git commit -m "vivaldi: ${vivaldi_version_old} -> ${vivaldi_version}"
 
 # Check vivaldi-ffmpeg-codecs version.
-chromium_version_old=$(version vivaldi-ffmpeg-codecs)
-chromium_version=$(bsdtar xOf "$path" data.tar.xz | bsdtar xOf - ./opt/vivaldi/vivaldi-bin | strings | grep '^[0-9]\{2,\}\.[0-9]\+\.[0-9]\{4,\}\+\.[0-9]\+$')
+ffmpeg_version_old=$(version vivaldi-ffmpeg-codecs)
+ffmpeg_version_raw=$(bsdtar xOf "$path" data.tar.xz | bsdtar xOf - ./opt/vivaldi/update-ffmpeg | sed -n -e "s/^FFMPEG_VERSION='\(.*\)'/\1/p")
+ffmpeg_version=$(echo "$ffmpeg_version_raw" | sed -n -e "s/\(.*\)-.*/\1/p")
+ffmpeg_url=$(bsdtar xOf "$path" data.tar.xz | bsdtar xOf - ./opt/vivaldi/update-ffmpeg | sed -n -e 's/^.*FFMPEG_URL="\(.*_amd64.deb\)"/\1/p' | sed "s/\${FFMPEG_VERSION}/$ffmpeg_version_raw/")
 
-if [[ "$chromium_version" != "$chromium_version_old" ]]; then
-  (cd "$root" && update-source-version vivaldi-ffmpeg-codecs "$chromium_version")
+mapfile -t ffmpeg_prefetch < <(nix-prefetch-url --print-path "$ffmpeg_url")
+ffmpeg_hash=${ffmpeg_prefetch[0]}
+ffmpeg_path=${ffmpeg_prefetch[1]}
+
+if [[ "$ffmpeg_version" != "$ffmpeg_version_old" ]]; then
+  (cd "$root" && update-source-version vivaldi-ffmpeg-codecs "$ffmpeg_version" "$ffmpeg_hash" "$ffmpeg_url")
 
   git add "${ffmpeg_nix}"
-  git commit -m "vivaldi-ffmepg-codecs: $chromium_version_old -> $chromium_version"
+  git commit -m "vivaldi-ffmpeg-codecs: $ffmpeg_version_old -> $ffmpeg_version"
+fi
+
+# Check widevine version.
+widevine_version_old=$(version vivaldi-widevine)
+widevine_version=$(bsdtar xOf "$path" data.tar.xz | bsdtar xOf - ./opt/vivaldi/update-widevine | sed -n -e "s/^WIDEVINE_VERSION=\(.*\)/\1/p")
+
+if [[ "$widevine_version" != "$widevine_version_old" ]]; then
+  (cd "$root" && update-source-version vivaldi-widevine "$widevine_version")
+  git add "${widevine_nix}"
+  git commit -m "vivaldi-widevine: $widevine_version_old -> $widevine_version"
 fi

@eadwu
Copy link
Member Author

eadwu commented Dec 29, 2019

I don't recall the reason I originally changed it for but I would assume it would have to do with the fact I usually use snapshots and when I extracted the version the link was dead for some reason at the time. I'll change it back.

@AlexeyRaga
Copy link

Sorry, I keep bumping it up again, but is this PR ready to be merged of there is still work to be done?

@jonringer
Copy link
Contributor

@GrahamcOfBorg build exodus vivaldi-ffmpeg-codecs vivaldi-widevine

@eadwu
Copy link
Member Author

eadwu commented Jan 25, 2020

I'll just assume Widevine is correctly installed since I still can't seem to be able to watch Twitch streams. Widevine changes are mainly to fix the metadata issues in chrome://components, as it now shows the version correctly

Widevine Content Decryption Module - Version: 4.10.1582.1
Status - Up-to-date

ffmpeg changes are just fixing it so the file appears in the directory correctly "$HERE/libffmpeg.so.${VIVALDI_VERSION%\.*\.*}" from

if [ -e "/var/opt/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so" ]; then
  if [ -n "$LD_PRELOAD" ]; then
    export LD_PRELOAD="$LD_PRELOAD:/var/opt/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so"
  else
    export LD_PRELOAD="/var/opt/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so"
  fi
  export VIVALDI_FFMPEG_FOUND=YES
  # Allow a way for third party maintainers to provide a suitable file
elif [ -e "$HERE/libffmpeg.so.${VIVALDI_VERSION%\.*\.*}" ]; then
  if [ -n "$LD_PRELOAD" ]; then
    export LD_PRELOAD="$LD_PRELOAD:$HERE/libffmpeg.so.${VIVALDI_VERSION%\.*\.*}"
  else
    export LD_PRELOAD="$HERE/libffmpeg.so.${VIVALDI_VERSION%\.*\.*}"
  fi
  export VIVALDI_FFMPEG_FOUND=YES
elif [ -e "$HOME/.local/lib/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so" ]; then
  if [ -n "$LD_PRELOAD" ]; then
    export LD_PRELOAD="$LD_PRELOAD:$HOME/.local/lib/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so"
  else
    export LD_PRELOAD="$HOME/.local/lib/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so"
  fi
  export VIVALDI_FFMPEG_FOUND=YES
else
  echo "'Proprietary media' support is not installed. Fix this by running:" >&2
  echo "    $HERE/update-ffmpeg" >&2
  export VIVALDI_FFMPEG_FOUND=NO
fi

so this PR should be fine now.

@AlexeyRaga
Copy link

So it can be merged? ;)

@eadwu
Copy link
Member Author

eadwu commented Jan 29, 2020

If nothing else is blocking, then yeah.

@AlexeyRaga
Copy link

Vivaldi 2.11 is there ;)

@eadwu
Copy link
Member Author

eadwu commented Feb 12, 2020

Don't know whether it's this PR or the updates to vivaldi but Twitch seems to work now.

@jonringer
Copy link
Contributor

@GrahamcOfBorg build exodus vivaldi-ffmpeg-codecs vivaldi-widevine

@jonringer
Copy link
Contributor

seems like this is in a usable state, going to re-verify that it builds on master then merge

@jonringer jonringer merged commit 3480dd6 into NixOS:master Feb 12, 2020
@eadwu eadwu deleted the vivaldi/fix-patched-paths branch November 17, 2020 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants