From b2fdba820a868d805f05562feb07e19960b9ea1d Mon Sep 17 00:00:00 2001 From: Yarny0 <41838844+Yarny0@users.noreply.github.com> Date: Sun, 8 Jan 2023 13:46:35 +0100 Subject: [PATCH] tvbrowser: build from source This commit changes from a precompiled bundle to a source file. Accordingly, the expression file is renamed to `default.nix` and the old attribute name is changed to `tvbrowser`, the old one being now a throw-message. The upstream build script tries to download the news plugin; so, we provide this and pass it as a parameter. Given that this is still a piece of a precompiled Java bytecode, along with a main readable source bundle, `meta.sourceProvenance` is updated accordingly. --- .../from_md/release-notes/rl-2305.section.xml | 6 +++ .../manual/release-notes/rl-2305.section.md | 2 + .../misc/tvbrowser/{bin.nix => default.nix} | 42 ++++++++++++++----- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 2 +- 5 files changed, 41 insertions(+), 12 deletions(-) rename pkgs/applications/misc/tvbrowser/{bin.nix => default.nix} (62%) diff --git a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml index b8affabb864..88f7e2cb2fb 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml @@ -836,6 +836,12 @@ libax25 package. + + + tvbrowser-bin was removed, and now + tvbrowser is built from source. + + nixos-version now accepts diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md index 96f67673211..3d24f08242d 100644 --- a/nixos/doc/manual/release-notes/rl-2305.section.md +++ b/nixos/doc/manual/release-notes/rl-2305.section.md @@ -209,6 +209,8 @@ In addition to numerous new and upgraded packages, this release has the followin - [Xastir](https://xastir.org/index.php/Main_Page) can now access AX.25 interfaces via the `libax25` package. +- `tvbrowser-bin` was removed, and now `tvbrowser` is built from source. + - `nixos-version` now accepts `--configuration-revision` to display more information about the current generation revision - The option `services.nomad.extraSettingsPlugins` has been fixed to allow more than one plugin in the path. diff --git a/pkgs/applications/misc/tvbrowser/bin.nix b/pkgs/applications/misc/tvbrowser/default.nix similarity index 62% rename from pkgs/applications/misc/tvbrowser/bin.nix rename to pkgs/applications/misc/tvbrowser/default.nix index ec4920eabd0..0dceca70b09 100644 --- a/pkgs/applications/misc/tvbrowser/bin.nix +++ b/pkgs/applications/misc/tvbrowser/default.nix @@ -1,8 +1,21 @@ -{ lib, stdenv, fetchurl, makeWrapper, jre, makeDesktopItem }: +{ lib +, fetchurl +, makeDesktopItem +, stdenv +, fetchzip +, ant +, jdk +, makeWrapper +}: let minimalJavaVersion = "11"; + newsPlugin = fetchurl { + url = "https://www.tvbrowser.org/data/uploads/1372016422809_543/NewsPlugin.jar"; + hash = "sha256-5XoypuMd2AFBE2SJ6EdECuvq6D81HLLuu9UoA9kcKAM="; + }; + desktopItem = makeDesktopItem { name = "tvbrowser"; exec = "tvbrowser"; @@ -16,25 +29,32 @@ let }; in -assert lib.versionAtLeast jre.version minimalJavaVersion; +assert lib.versionAtLeast jdk.version minimalJavaVersion; stdenv.mkDerivation rec { pname = "tvbrowser"; version = "4.2.7"; - name = "${pname}-bin-${version}"; - src = fetchurl { - url = "mirror://sourceforge/${pname}/TV-Browser%20Releases%20%28Java%20${minimalJavaVersion}%20and%20higher%29/${version}/${pname}_${version}_bin.tar.gz"; - hash = "sha256-A1ZLGHA1sSSafwWy6MlPikQMk+6CechftzFTLDaBfrs="; + src = fetchzip { + url = "mirror://sourceforge/${pname}/TV-Browser%20Releases%20%28Java%20${minimalJavaVersion}%20and%20higher%29/${version}/${pname}_${version}_src.tar.gz"; + hash = "sha256-dmNfI6T0MU7UtMH+C/2hiAeDwZlFCB4JofQViZezoqI="; }; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ ant jdk makeWrapper ]; + + buildPhase = '' + runHook preBuild + + ant runtime-linux -Dnewsplugin.url=file://${newsPlugin} + + runHook postBuild + ''; installPhase = '' runHook preInstall mkdir -p $out/share/java/${pname} - cp -R * $out/share/java/${pname} - rm $out/share/java/${pname}/${pname}.{sh,desktop} + cp -R runtime/tvbrowser_linux/* $out/share/java/${pname} + rm $out/share/java/${pname}/${pname}.sh mkdir -p $out/share/applications ln -s ${desktopItem}/share/applications/* $out/share/applications/ @@ -45,7 +65,7 @@ stdenv.mkDerivation rec { done mkdir -p $out/bin - makeWrapper ${jre}/bin/java $out/bin/${pname} \ + makeWrapper ${jdk}/bin/java $out/bin/${pname} \ --add-flags "--module-path=lib:${pname}.jar -m ${pname}/tvbrowser.TVBrowser" \ --chdir "$out/share/java/${pname}" @@ -55,7 +75,7 @@ stdenv.mkDerivation rec { meta = with lib; { description = "Electronic TV Program Guide"; homepage = "https://www.tvbrowser.org/"; - sourceProvenance = with sourceTypes; [ binaryBytecode ]; + sourceProvenance = with sourceTypes; [ binaryBytecode fromSource ]; license = licenses.gpl3; platforms = platforms.linux; maintainers = with maintainers; [ jfrankenau yarny ]; diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 8e828c88c01..0de2417ef36 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1543,6 +1543,7 @@ mapAliases ({ truecrypt = throw "'truecrypt' has been renamed to/replaced by 'veracrypt'"; # Converted to throw 2022-02-22 tuijam = throw "tuijam has been removed because Google Play Music was discontinued"; # Added 2021-03-07 turbo-geth = throw "turbo-geth has been renamed to erigon"; # Added 2021-08-08 + tvbrowser-bin = throw "tvbrowser-bin was removed because it is now built from sources; use 'tvbrowser' instead"; # Added 2023-02-04 twister = throw "twister has been removed: abandoned by upstream and python2-only"; # Added 2022-04-26 tychus = throw "tychus has been dropped due to the lack of maintenance from upstream since 2018"; # Added 2022-06-03 typora = throw "Newer versions of typora use anti-user encryption and refuse to start. As such it has been removed"; # Added 2021-09-11 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 67db500b961..1c49c7d23f1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -38261,7 +38261,7 @@ with pkgs; trufflehog = callPackage ../tools/security/trufflehog { }; - tvbrowser-bin = callPackage ../applications/misc/tvbrowser/bin.nix { }; + tvbrowser = callPackage ../applications/misc/tvbrowser { }; tvheadend = callPackage ../servers/tvheadend { dtv-scan-tables = dtv-scan-tables_tvheadend;