Merge pull request #304345 from atorres1985-contrib/aegisub

Aegisub: refactor
This commit is contained in:
Weijia Wang 2024-04-16 01:16:57 +02:00 committed by GitHub
commit 84ccaf7fbf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 167 additions and 164 deletions

View file

@ -1,163 +0,0 @@
{ lib
, config
, stdenv
, fetchFromGitHub
, boost179
, cmake
, expat
, harfbuzz
, ffmpeg
, ffms
, fftw
, fontconfig
, freetype
, fribidi
, glib
, icu
, intltool
, libGL
, libGLU
, libX11
, libass
, libiconv
, libuchardet
, luajit
, pcre
, pkg-config
, which
, wrapGAppsHook
, wxGTK
, zlib
, spellcheckSupport ? true
, hunspell ? null
, openalSupport ? false
, openal ? null
, alsaSupport ? stdenv.isLinux
, alsa-lib ? null
, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux
, libpulseaudio ? null
, portaudioSupport ? false
, portaudio ? null
, useBundledLuaJIT ? false
, darwin
}:
assert spellcheckSupport -> (hunspell != 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;
inherit (darwin.apple_sdk.frameworks) CoreText CoreFoundation AppKit Carbon IOKit Cocoa;
in
stdenv.mkDerivation rec {
pname = "aegisub";
version = "3.3.3";
src = fetchFromGitHub {
owner = "wangqr";
repo = pname;
rev = "v${version}";
sha256 = "sha256-oKhLv81EFudrJaaJ2ga3pVh4W5Hd2YchpjsoYoqRm78=";
};
nativeBuildInputs = [
intltool
luajit52
pkg-config
which
cmake
wrapGAppsHook
];
buildInputs = [
boost179
expat
ffmpeg
ffms
fftw
fontconfig
freetype
fribidi
glib
harfbuzz
icu
libGL
libGLU
libX11
libass
libiconv
libuchardet
pcre
wxGTK
zlib
]
++ lib.optionals stdenv.isDarwin [
CoreText
CoreFoundation
AppKit
Carbon
IOKit
Cocoa
]
++ optional alsaSupport alsa-lib
++ optional openalSupport openal
++ optional portaudioSupport portaudio
++ optional pulseaudioSupport libpulseaudio
++ optional spellcheckSupport hunspell
;
enableParallelBuilding = true;
hardeningDisable = [
"bindnow"
"relro"
];
patches = lib.optionals (!useBundledLuaJIT) [
./remove-bundled-luajit.patch
];
# error: unknown type name 'NSUInteger'
postPatch = ''
substituteInPlace src/dialog_colorpicker.cpp \
--replace "NSUInteger" "size_t"
'';
env.NIX_CFLAGS_COMPILE = "-I${luajit52}/include";
NIX_CFLAGS_LINK = "-L${luajit52}/lib";
configurePhase = ''
export FORCE_GIT_VERSION=${version}
# Workaround for a Nixpkgs bug; remove when the fix arrives
mkdir build-dir
cd build-dir
cmake -DCMAKE_INSTALL_PREFIX=$out ..
'';
meta = with lib; {
homepage = "https://github.com/wangqr/Aegisub";
description = "An advanced subtitle editor";
longDescription = ''
Aegisub is a free, cross-platform open source tool for creating and
modifying subtitles. Aegisub makes it quick and easy to time subtitles to
audio, and features many powerful tools for styling them, including a
built-in real-time video preview.
'';
# The Aegisub sources are itself BSD/ISC, but they are linked against GPL'd
# softwares - so the resulting program will be GPL
license = licenses.bsd3;
maintainers = with maintainers; [ AndersonTorres wegank ];
platforms = platforms.unix;
mainProgram = "aegisub";
};
}

View file

@ -0,0 +1,164 @@
{
lib,
alsa-lib,
boost,
cmake,
config,
darwin,
expat,
fetchFromGitHub,
ffmpeg,
ffms,
fftw,
fontconfig,
freetype,
fribidi,
glib,
harfbuzz,
hunspell,
icu,
intltool,
libGL,
libGLU,
libX11,
libass,
libiconv,
libpulseaudio,
libuchardet,
luajit,
ninja,
openal,
pcre,
pkg-config,
portaudio,
stdenv,
which,
wrapGAppsHook,
wxGTK,
zlib,
# Boolean guard flags
alsaSupport ? stdenv.isLinux,
openalSupport ? true,
portaudioSupport ? true,
pulseaudioSupport ? config.pulseaudio or stdenv.isLinux,
spellcheckSupport ? true,
useBundledLuaJIT ? false,
}:
let
inherit (darwin.apple_sdk.frameworks)
AppKit
Carbon
Cocoa
CoreFoundation
CoreText
IOKit
OpenAL;
in
stdenv.mkDerivation (finalAttrs: {
pname = "aegisub";
version = "3.3.3";
src = fetchFromGitHub {
owner = "wangqr";
repo = "aegisub";
rev = "v${finalAttrs.version}";
hash = "sha256-oKhLv81EFudrJaaJ2ga3pVh4W5Hd2YchpjsoYoqRm78=";
};
nativeBuildInputs = [
cmake
intltool
luajit
ninja
pkg-config
which
wrapGAppsHook
wxGTK
];
buildInputs = [
boost
expat
ffmpeg
ffms
fftw
fontconfig
freetype
fribidi
glib
harfbuzz
icu
libGL
libGLU
libX11
libass
libiconv
libuchardet
pcre
wxGTK
zlib
]
++ lib.optionals alsaSupport [ alsa-lib ]
++ lib.optionals openalSupport [
(if stdenv.isDarwin then OpenAL else openal)
]
++ lib.optionals portaudioSupport [ portaudio ]
++ lib.optionals pulseaudioSupport [ libpulseaudio ]
++ lib.optionals spellcheckSupport [ hunspell ]
++ lib.optionals stdenv.isDarwin [
AppKit
Carbon
Cocoa
CoreFoundation
CoreText
IOKit
];
hardeningDisable = [
"bindnow"
"relro"
];
patches = lib.optionals (!useBundledLuaJIT) [
./000-remove-bundled-luajit.patch
];
# error: unknown type name 'NSUInteger'
postPatch = ''
substituteInPlace src/dialog_colorpicker.cpp \
--replace "NSUInteger" "size_t"
'';
env = {
NIX_CFLAGS_COMPILE = "-I${lib.getDev luajit}/include";
NIX_CFLAGS_LINK = "-L${lib.getLib luajit}/lib";
};
preConfigure = ''
export FORCE_GIT_VERSION=${finalAttrs.version}
'';
cmakeBuildDir = "build-directory";
strictDeps = true;
meta = {
homepage = "https://github.com/wangqr/Aegisub";
description = "An advanced subtitle editor; wangqr's fork";
longDescription = ''
Aegisub is a free, cross-platform open source tool for creating and
modifying subtitles. Aegisub makes it quick and easy to time subtitles to
audio, and features many powerful tools for styling them, including a
built-in real-time video preview.
'';
# The Aegisub sources are itself BSD/ISC, but they are linked against GPL'd
# softwares - so the resulting program will be GPL
license = with lib.licenses; [
bsd3
];
mainProgram = "aegisub";
maintainers = with lib.maintainers; [ AndersonTorres wegank ];
platforms = lib.platforms.unix;
};
})

View file

@ -1577,7 +1577,9 @@ with pkgs;
aefs = callPackage ../tools/filesystems/aefs { };
aegisub = callPackage ../applications/video/aegisub ({
aegisub = callPackage ../by-name/ae/aegisub/package.nix ({
boost = boost179;
luajit = luajit.override { enable52Compat = true; };
wxGTK = wxGTK32;
} // (config.aegisub or {}));