about summary refs log tree commit diff
path: root/pkgs/by-name/ae/aegisub/package.nix
blob: cdec1259fd08b7d891969503a9477877cdb84d5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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,
  wrapGAppsHook3,
  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
    wrapGAppsHook3
    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;
  };
})