diff --git a/pkgs/applications/video/aegisub/default.nix b/pkgs/applications/video/aegisub/default.nix index 133840e066bb..f6e4b22e7217 100644 --- a/pkgs/applications/video/aegisub/default.nix +++ b/pkgs/applications/video/aegisub/default.nix @@ -1,8 +1,8 @@ { lib , config , stdenv -, fetchurl -, fetchpatch +, fetchFromGitHub +, autoreconfHook , boost , ffmpeg , ffms @@ -16,7 +16,9 @@ , libX11 , libass , libiconv +, libuchardet , pkg-config +, which , wxGTK , zlib @@ -24,7 +26,7 @@ , hunspell ? null , automationSupport ? true -, lua ? null +, luajit ? null , openalSupport ? false , openal ? null @@ -37,64 +39,39 @@ , portaudioSupport ? false , portaudio ? null + }: assert spellcheckSupport -> (hunspell != null); -assert automationSupport -> (lua != null); +assert automationSupport -> (luajit != null); assert openalSupport -> (openal != null); assert alsaSupport -> (alsa-lib != null); assert pulseaudioSupport -> (libpulseaudio != null); assert portaudioSupport -> (portaudio != null); let + luajit52 = luajit.override { enable52Compat = true; }; inherit (lib) optional; in stdenv.mkDerivation rec { pname = "aegisub"; - version = "3.2.2"; + version = "3.3.2"; - src = fetchurl { - url = "http://ftp.aegisub.org/pub/releases/${pname}-${version}.tar.xz"; - hash = "sha256-xV4zlFuC2FE8AupueC8Ncscmrc03B+lbjAAi9hUeaIU="; + src = fetchFromGitHub { + owner = "wangqr"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-Er0g8fJyx7zjNVpKw7zUHE40hU10BdYlZohlqJq2LE0="; }; - patches = [ - # Compatibility with ICU 59 - (fetchpatch { - url = "https://github.com/Aegisub/Aegisub/commit/dd67db47cb2203e7a14058e52549721f6ff16a49.patch"; - sha256 = "sha256-R2rN7EiyA5cuBYIAMpa0eKZJ3QZahfnRp8R4HyejGB8="; - }) - - # Compatbility with Boost 1.69 - (fetchpatch { - url = "https://github.com/Aegisub/Aegisub/commit/c3c446a8d6abc5127c9432387f50c5ad50012561.patch"; - sha256 = "sha256-7nlfojrb84A0DT82PqzxDaJfjIlg5BvWIBIgoqasHNk="; - }) - - # Compatbility with make 4.3 - (fetchpatch { - url = "https://github.com/Aegisub/Aegisub/commit/6bd3f4c26b8fc1f76a8b797fcee11e7611d59a39.patch"; - sha256 = "sha256-rG8RJokd4V4aSYOQw2utWnrWPVrkqSV3TAvnGXNhLOk="; - }) - - # Compatibility with ffms2 - (fetchpatch { - url = "https://github.com/Aegisub/Aegisub/commit/1aa9215e7fc360de05da9b7ec2cd68f1940af8b2.patch"; - sha256 = "sha256-JsuI4hQTcT0TEqHHoSsGbuiTg4hMCH3Cxp061oLk8Go="; - }) - - ./update-ffms2.patch - - # Compatibility with X11 - (fetchpatch { - url = "https://github.com/Aegisub/Aegisub/commit/7a6da26be6a830f4e1255091952cc0a1326a4520.patch"; - sha256 = "sha256-/aTcIjFlZY4N9+IyHL4nwR0hUR4HTJM7ibbdKmNxq0w="; - }) - ]; + patches = [ ./no-git.patch ]; nativeBuildInputs = [ + autoreconfHook intltool + luajit52 pkg-config + which ]; buildInputs = [ boost @@ -109,17 +86,24 @@ stdenv.mkDerivation rec { libX11 libass libiconv + libuchardet wxGTK zlib ] ++ optional alsaSupport alsa-lib - ++ optional automationSupport lua + ++ optional automationSupport luajit52 ++ optional openalSupport openal ++ optional portaudioSupport portaudio ++ optional pulseaudioSupport libpulseaudio ++ optional spellcheckSupport hunspell ; + configureFlags = [ + "--with-boost-libdir=${boost.out}/lib" + "--with-system-luajit" + "FORCE_GIT_VERSION=${version}" + ]; + enableParallelBuilding = true; hardeningDisable = [ @@ -127,22 +111,10 @@ stdenv.mkDerivation rec { "relro" ]; - postPatch = '' - sed -i 's/-Wno-c++11-narrowing/-Wno-narrowing/' configure.ac src/Makefile - ''; - - # compat with icu61+ - # https://github.com/unicode-org/icu/blob/release-64-2/icu4c/readme.html#L554 - CXXFLAGS = [ "-DU_USING_ICU_NAMESPACE=1" ]; - - # this is fixed upstream though not yet in an officially released version, - # should be fine remove on next release (if one ever happens) - NIX_LDFLAGS = "-lpthread"; - postInstall = "ln -s $out/bin/aegisub-* $out/bin/aegisub"; meta = with lib; { - homepage = "https://github.com/Aegisub/Aegisub"; + homepage = "https://github.com/wangqr/Aegisub"; description = "An advanced subtitle editor"; longDescription = '' Aegisub is a free, cross-platform open source tool for creating and @@ -157,4 +129,3 @@ stdenv.mkDerivation rec { platforms = [ "i686-linux" "x86_64-linux" ]; }; } -# TODO [ AndersonTorres ]: update to fork release diff --git a/pkgs/applications/video/aegisub/no-git.patch b/pkgs/applications/video/aegisub/no-git.patch new file mode 100644 index 000000000000..c98467ca6525 --- /dev/null +++ b/pkgs/applications/video/aegisub/no-git.patch @@ -0,0 +1,41 @@ +Modified from +to patch cleanly to v3.3.2. Necessary for building without git. +Upstream and will be in next release. + +diff --git a/build/version.sh b/build/version.sh +index 8cea0a3f3..d505341e4 100755 +--- a/build/version.sh ++++ b/build/version.sh +@@ -10,13 +10,13 @@ if ! test -d "${srcdir}/.git"; then + done < "${version_h_path}" + if test x$BUILD_GIT_VERSION_NUMBER != x -a x$BUILD_GIT_VERSION_STRING != x; then + export VERSION_SOURCE="from cached git_version.h" +- return 0 ++ exit 0 + else + echo "invalid git_version.h" + exit 2 + fi +- else +- echo "git repo not found and no cached git_version.h" ++ elif [ -z "$FORCE_GIT_VERSION" ]; then ++ echo "git repo not found and no cached git_version.h - use FORCE_GIT_VERSION to override" + exit 2 + fi + fi +@@ -25,13 +25,13 @@ last_svn_revision=6962 + last_svn_hash="16cd907fe7482cb54a7374cd28b8501f138116be" + + git_revision=$(expr $last_svn_revision + $(git log --pretty=oneline $last_svn_hash..HEAD 2>/dev/null | wc -l)) +-git_version_str=$(git describe --exact-match 2> /dev/null) ++git_version_str=${FORCE_GIT_VERSION:-$(git describe --exact-match 2> /dev/null)} + installer_version='0.0.0' + resource_version='0, 0, 0' + if test x$git_version_str != x; then + git_version_str="${git_version_str##v}" + tagged_release=1 +- if [ $(echo $git_version_str | grep '\d\.\d\.\d') ]; then ++ if [ $(echo $git_version_str | grep '[0-9].[0-9].[0-9]') ]; then + installer_version=$git_version_str + resource_version=$(echo $git_version_str | sed 's/\./, /g') + fi diff --git a/pkgs/applications/video/aegisub/update-ffms2.patch b/pkgs/applications/video/aegisub/update-ffms2.patch deleted file mode 100644 index affa46365cfb..000000000000 --- a/pkgs/applications/video/aegisub/update-ffms2.patch +++ /dev/null @@ -1,105 +0,0 @@ -commit 89c4e8d34ab77c3322f097b91fd9de22cbea7a37 -Author: Thomas Goyne -Date: Wed Nov 21 16:41:05 2018 -0800 - - Update ffmpeg and ffms2 - -diff --git a/src/video_provider_ffmpegsource.cpp b/src/video_provider_ffmpegsource.cpp -index 8bd68fbbf..f4ed6a2f2 100644 ---- a/src/video_provider_ffmpegsource.cpp -+++ b/src/video_provider_ffmpegsource.cpp -@@ -44,6 +44,23 @@ - #include - - namespace { -+typedef enum AGI_ColorSpaces { -+ AGI_CS_RGB = 0, -+ AGI_CS_BT709 = 1, -+ AGI_CS_UNSPECIFIED = 2, -+ AGI_CS_FCC = 4, -+ AGI_CS_BT470BG = 5, -+ AGI_CS_SMPTE170M = 6, -+ AGI_CS_SMPTE240M = 7, -+ AGI_CS_YCOCG = 8, -+ AGI_CS_BT2020_NCL = 9, -+ AGI_CS_BT2020_CL = 10, -+ AGI_CS_SMPTE2085 = 11, -+ AGI_CS_CHROMATICITY_DERIVED_NCL = 12, -+ AGI_CS_CHROMATICITY_DERIVED_CL = 13, -+ AGI_CS_ICTCP = 14 -+} AGI_ColorSpaces; -+ - /// @class FFmpegSourceVideoProvider - /// @brief Implements video loading through the FFMS library. - class FFmpegSourceVideoProvider final : public VideoProvider, FFmpegSourceProvider { -@@ -78,7 +95,7 @@ public: - if (matrix == RealColorSpace) - FFMS_SetInputFormatV(VideoSource, CS, CR, FFMS_GetPixFmt(""), nullptr); - else if (matrix == "TV.601") -- FFMS_SetInputFormatV(VideoSource, FFMS_CS_BT470BG, CR, FFMS_GetPixFmt(""), nullptr); -+ FFMS_SetInputFormatV(VideoSource, AGI_CS_BT470BG, CR, FFMS_GetPixFmt(""), nullptr); - else - return; - ColorSpace = matrix; -@@ -103,16 +120,16 @@ std::string colormatrix_description(int cs, int cr) { - std::string str = cr == FFMS_CR_JPEG ? "PC" : "TV"; - - switch (cs) { -- case FFMS_CS_RGB: -+ case AGI_CS_RGB: - return "None"; -- case FFMS_CS_BT709: -+ case AGI_CS_BT709: - return str + ".709"; -- case FFMS_CS_FCC: -+ case AGI_CS_FCC: - return str + ".FCC"; -- case FFMS_CS_BT470BG: -- case FFMS_CS_SMPTE170M: -+ case AGI_CS_BT470BG: -+ case AGI_CS_SMPTE170M: - return str + ".601"; -- case FFMS_CS_SMPTE240M: -+ case AGI_CS_SMPTE240M: - return str + ".240M"; - default: - throw VideoOpenError("Unknown video color space"); -@@ -206,8 +223,10 @@ void FFmpegSourceVideoProvider::LoadVideo(agi::fs::path const& filename, std::st - - // set thread count - int Threads = OPT_GET("Provider/Video/FFmpegSource/Decoding Threads")->GetInt(); -+#if FFMS_VERSION < ((2 << 24) | (30 << 16) | (0 << 8) | 0) - if (FFMS_GetVersion() < ((2 << 24) | (17 << 16) | (2 << 8) | 1) && FFMS_GetSourceType(Index) == FFMS_SOURCE_LAVF) - Threads = 1; -+#endif - - // set seekmode - // TODO: give this its own option? -@@ -235,18 +254,22 @@ void FFmpegSourceVideoProvider::LoadVideo(agi::fs::path const& filename, std::st - else - DAR = double(Width) / Height; - -- CS = TempFrame->ColorSpace; -+ int VideoCS = CS = TempFrame->ColorSpace; - CR = TempFrame->ColorRange; - -- if (CS == FFMS_CS_UNSPECIFIED) -- CS = Width > 1024 || Height >= 600 ? FFMS_CS_BT709 : FFMS_CS_BT470BG; -+ if (CS == AGI_CS_UNSPECIFIED) -+ CS = Width > 1024 || Height >= 600 ? AGI_CS_BT709 : AGI_CS_BT470BG; - RealColorSpace = ColorSpace = colormatrix_description(CS, CR); - - #if FFMS_VERSION >= ((2 << 24) | (17 << 16) | (1 << 8) | 0) -- if (CS != FFMS_CS_RGB && CS != FFMS_CS_BT470BG && ColorSpace != colormatrix && (colormatrix == "TV.601" || OPT_GET("Video/Force BT.601")->GetBool())) { -- if (FFMS_SetInputFormatV(VideoSource, FFMS_CS_BT470BG, CR, FFMS_GetPixFmt(""), &ErrInfo)) -+ if (CS != AGI_CS_RGB && CS != AGI_CS_BT470BG && ColorSpace != colormatrix && (colormatrix == "TV.601" || OPT_GET("Video/Force BT.601")->GetBool())) { -+ CS = AGI_CS_BT470BG; -+ ColorSpace = colormatrix_description(AGI_CS_BT470BG, CR); -+ } -+ -+ if (CS != VideoCS) { -+ if (FFMS_SetInputFormatV(VideoSource, CS, CR, FFMS_GetPixFmt(""), &ErrInfo)) - throw VideoOpenError(std::string("Failed to set input format: ") + ErrInfo.Buffer); -- ColorSpace = colormatrix_description(FFMS_CS_BT470BG, CR); - } - #endif