nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 alsa-lib,
4 boost,
5 meson,
6 config,
7 expat,
8 fetchFromGitHub,
9 ffmpeg,
10 ffms,
11 fftw,
12 fontconfig,
13 freetype,
14 fribidi,
15 harfbuzz,
16 hunspell,
17 icu,
18 intltool,
19 libGL,
20 libass,
21 libpulseaudio,
22 libuchardet,
23 luajit,
24 ninja,
25 openal,
26 pkg-config,
27 portaudio,
28 python3,
29 stdenv,
30 wrapGAppsHook3,
31 wxGTK32,
32 zlib,
33 # Boolean guard flags
34 alsaSupport ? stdenv.hostPlatform.isLinux,
35 openalSupport ? true,
36 portaudioSupport ? true,
37 pulseaudioSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux,
38 spellcheckSupport ? true,
39 useBundledLuaJIT ? false,
40}:
41
42stdenv.mkDerivation (finalAttrs: {
43 pname = "aegisub";
44 version = "3.4.2";
45
46 src = fetchFromGitHub {
47 owner = "TypesettingTools";
48 repo = "aegisub";
49 tag = "v${finalAttrs.version}";
50 hash = "sha256-ho+JG570FWbiYZ86CbCKa52j6UNyPIUh8fxpM3vVU/M=";
51 };
52
53 nativeBuildInputs = [
54 meson
55 intltool
56 ninja
57 pkg-config
58 python3
59 wxGTK32
60 wrapGAppsHook3
61 ];
62
63 buildInputs = [
64 boost
65 expat
66 ffmpeg
67 ffms
68 fftw
69 fontconfig
70 freetype
71 fribidi
72 harfbuzz
73 icu
74 libGL
75 libass
76 libuchardet
77 wxGTK32
78 zlib
79 ]
80 ++ lib.optionals alsaSupport [ alsa-lib ]
81 ++ lib.optionals (openalSupport && !stdenv.hostPlatform.isDarwin) [ openal ]
82 ++ lib.optionals portaudioSupport [ portaudio ]
83 ++ lib.optionals pulseaudioSupport [ libpulseaudio ]
84 ++ lib.optionals spellcheckSupport [ hunspell ]
85 ++ lib.optionals (!useBundledLuaJIT) [ luajit ];
86
87 mesonFlags = [
88 (lib.mesonEnable "alsa" alsaSupport)
89 (lib.mesonEnable "openal" openalSupport)
90 (lib.mesonEnable "libpulse" pulseaudioSupport)
91 (lib.mesonEnable "portaudio" portaudioSupport)
92
93 (lib.mesonEnable "avisynth" false)
94
95 (lib.mesonEnable "hunspell" spellcheckSupport)
96
97 (lib.mesonBool "build_osx_bundle" stdenv.hostPlatform.isDarwin)
98 (lib.mesonBool "enable_update_checker" false)
99 (lib.mesonBool "system_luajit" (!useBundledLuaJIT))
100 ];
101
102 hardeningDisable = [
103 "bindnow"
104 "relro"
105 ];
106
107 strictDeps = true;
108
109 postPatch = ''
110 patchShebangs tools/respack.py
111
112 # TODO: Tests require wrapped GoogleTest; upstream support for
113 # system version?
114 substituteInPlace meson.build \
115 --replace-fail "subdir('tests')" "# subdir('tests')"
116 '';
117
118 # Inject the version, per the AUR package:
119 # <https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=aegisub-arch1t3cht&id=bbbea73953858fc7bf2775a0fb92cec49afb586c>
120 preBuild = ''
121 cat > git_version.h <<EOF
122 #define BUILD_GIT_VERSION_NUMBER 0
123 #define BUILD_GIT_VERSION_STRING "${finalAttrs.version}"
124 EOF
125 '';
126
127 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
128 mkdir -p $out/{Applications,bin}
129 mv Aegisub.app $out/Applications
130 makeWrapper $out/Applications/Aegisub.app/Contents/MacOS/aegisub $out/bin/aegisub
131 '';
132
133 meta = {
134 homepage = "https://github.com/TypesettingTools/Aegisub";
135 description = "Advanced subtitle editor";
136 longDescription = ''
137 Aegisub is a free, cross-platform open source tool for creating and
138 modifying subtitles. Aegisub makes it quick and easy to time subtitles to
139 audio, and features many powerful tools for styling them, including a
140 built-in real-time video preview.
141 '';
142 # The Aegisub sources are itself BSD/ISC, but they are linked against GPL'd
143 # software - so the resulting program will be GPL
144 license = with lib.licenses; [
145 bsd3
146 ];
147 mainProgram = "aegisub";
148 maintainers = with lib.maintainers; [ wegank ];
149 platforms = lib.platforms.unix;
150 };
151})