summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 358a95b5067c1d0121ec5c62673a42253cbed794 (plain)
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
165
# Maintainer: Funami
# Maintainer: Takina Lina <0tkl.zhaoqing@gmail.com>
# Contributor: Fredrick R. Brennan <copypaste@kittens.ph>
# Contributor: witchymary

pkgname=aegisub-arch1t3cht
pkgver=feature_11
_aspver=3.7.3
_vsver=R65
pkgrel=1
pkgdesc="A general-purpose subtitle editor with ASS/SSA support (arch1t3cht fork)"
arch=(x86_64)
url=https://github.com/arch1t3cht/Aegisub
license=(
  GPL
  BSD
)
provides=(aegisub)
conflicts=(
  aegisub
  aegisub-arch1t3cht-git
)
depends=(
  alsa-lib
  boost-libs
  ffmpeg
  ffms2
  fftw
  fontconfig
  hicolor-icon-theme
  hunspell
  icu
  jansson
  libass
  libgl
  libpulse
  openal
  portaudio
  python
  uchardet
  vapoursynth
  vapoursynth-plugin-bestsource-git
  vapoursynth-plugin-lsmashsource
  vapoursynth-plugin-wwxd-git
  wxwidgets-common
  wxwidgets-gtk3
  zlib
)
makedepends=(
  git
  meson
  cmake
  boost
)
optdepends=(
  'avisynthplus: AviSynth source support'
  # 'vapoursynth-plugin-wwxd: VapourSynth plugin for keyframe generation'
  'vapoursynth-plugin-scxvid: VapourSynth plugin for keyframe generation'
)
source=(
  "$pkgname.tar.gz::https://github.com/arch1t3cht/Aegisub/archive/$pkgver.tar.gz"
  "$pkgname-bestsource::git+https://github.com/vapoursynth/bestsource.git#commit=ba1249c1f5443be6d0ec2be32490af5bbc96bf99"
  "$pkgname-avisynth.tar.gz::https://github.com/AviSynth/AviSynthPlus/archive/v$_aspver.tar.gz"
  "$pkgname-vapoursynth.tar.gz::https://github.com/vapoursynth/vapoursynth/archive/$_vsver.tar.gz"
  "$pkgname-luajit::git+https://github.com/LuaJIT/LuaJIT.git#branch=v2.1"
  "$pkgname-gtest-1.8.1.zip::https://github.com/google/googletest/archive/release-1.8.1.zip"
  "$pkgname-gtest-1.8.1-1-wrap.zip::https://wrapdb.mesonbuild.com/v1/projects/gtest/1.8.1/1/get_zip"
  "0001-bas-to-bs.patch"
)
noextract=(
  $pkgname-gtest-1.8.1.zip
  $pkgname-gtest-1.8.1-1-wrap.zip
)
sha256sums=(
  '20ec6d042d7879f8a0a1a778ca2197a59216428c4ec35d669ef2b93e7bd55120'
  'SKIP'
  'b847705af6f16fa26664d06e0fea2bda14a7f6aac8249a9c37e4106ecb8fd44c'
  '2bde5233b82d914b5e985119ed9cc344e3c27c3c068b5c4ab909176cd1751dce'
  'SKIP'
  '927827c183d01734cc5cfef85e0ff3f5a92ffe6188e0d18e909c5efebf28a0c7'
  'f79f5fd46e09507b3f2e09a51ea6eb20020effe543335f5aee59f30cc8d15805'
  '3e113a5eaf02d3b85f59487cdbe30b4e004b095d02ad0231c013b7a4cb95c466'
)

AEGISUB_AUR_DEFAULT_AUDIO_OUTPUT=${AEGISUB_AUR_DEFAULT_AUDIO_OUTPUT:=PulseAudio}

prepare() {
  cd Aegisub-$pkgver
  patch -p1 < $srcdir/0001-bas-to-bs.patch

  # If build dir exists (it won't ever if makepkg is passed --cleanbuild)
  # call --reconfigure rather than setup without it which will fail)
  local MESON_FLAGS=''
  if [ -d build ]; then
    MESON_FLAGS='--reconfigure'
  else
    # Initialize subproject wraps for bestsource
    ln -s "$srcdir/$pkgname-bestsource" subprojects/bestsource

    # Initialize subproject wraps for avisynth
    ln -s "$srcdir/AviSynthPlus-$_aspver" subprojects/avisynth

    # Initialize subproject wraps for vapoursynth
    ln -s "$srcdir/vapoursynth-$_vsver" subprojects/vapoursynth

    # Initialize subproject wraps for luajit
    ln -s "$srcdir/$pkgname-luajit" subprojects/luajit

    # Initialize subproject wraps for gtest
    mkdir subprojects/packagecache
    ln -s "$srcdir/$pkgname-gtest-1.8.1.zip" subprojects/packagecache/gtest-1.8.1.zip
    ln -s "$srcdir/$pkgname-gtest-1.8.1-1-wrap.zip" subprojects/packagecache/gtest-1.8.1-1-wrap.zip
  fi

  meson subprojects packagefiles --apply bestsource
  meson subprojects packagefiles --apply avisynth
  meson subprojects packagefiles --apply vapoursynth
  meson subprojects packagefiles --apply luajit

  # check if the OPTIONS array contains "!strip"
  check_makepkg_options() (
    source /etc/makepkg.conf

    if [ "$?" -ne 0 ]; then
      >&2 echo 'Failed to source /etc/makepkg.conf'
      echo release # use release as fallback buildtype
      return 1
    fi

    if [[ " ${OPTIONS[@]} " =~ ' !strip ' ]]; then
      >&2 echo '!strip found in OPTIONS array'
      echo debug
    else
      >&2 echo '!strip not found in OPTIONS array'
      echo release
    fi
  )
  local BUILDTYPE="$(check_makepkg_options 2> /dev/null)"

  mkdir -p build
  echo """#define BUILD_GIT_VERSION_NUMBER 0
#define BUILD_GIT_VERSION_STRING \"$pkgver\"
""" > build/git_version.h

  # Disabling LTO because it seems to lead to crashing aegisub scripts for some people
  # (https://aur.archlinux.org/packages/aegisub-arch1t3cht-git#comment-911741)
  arch-meson --buildtype="${BUILDTYPE}" -D b_lto=false -D vapoursynth=enabled \
  -D default_audio_output="${AEGISUB_AUR_DEFAULT_AUDIO_OUTPUT}" ${MESON_FLAGS} build
}

build() {
  cd Aegisub-$pkgver
  meson compile -C build
}

check() {
  cd Aegisub-$pkgver
  meson test -C build --print-errorlogs --verbose "gtest main"
}

package() {
  cd Aegisub-$pkgver
  meson install -C build --destdir $pkgdir
  install -Dm644 LICENCE -t "$pkgdir/usr/share/licenses/$pkgname"
}