summaryrefslogtreecommitdiffstats
path: root/src/utau/openutau/APKBUILD
blob: 3fdf57448ebc66f2a57c164b0ec9f35018a954cc (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
# Maintainer: memdmp <memdmp@estrogen.zone>
_reponame="OpenUtau"
_repoowner="stakira"
_repourl="https://${GITHUB_CODELOAD_URL:-"codeload.github.com"}/${_repoowner}/${_reponame}" # GITHUB_CODELOAD_URL due to github not having IPv6.
_reporef="c3ff44b01f5dcd0ef1bbdb5aa11ef1319cab3a03" # Must be a TAG OR BRANCH! Anything else may break shit.
_reporefdate="20250610" # YYYYMMDD of the ref
_buildtarget="Release" # or `Debug` for testing

pkgname="openutau"
pkgver=0.1.529 # for refs that aren't tags, use the previous release before it!
pkgrel=0
pkgdesc="Open singing synthesis platform / Open source UTAU successor"
url="https://www.openutau.com/"
arch="x86_64"
license="MIT"

# so:ld-linux-x86-64.so.2 and so:libgcompat.so.0 are provided by gcompat
# so:libfontconfig.so.1 is provided by fontconfig
# TODO: once not in testing, add so:libonnxruntime.so provided by onnxruntime-dev
depends="dotnet8-runtime so:libgcompat.so.0 so:ld-linux-x86-64.so.2 so:libfontconfig.so.1"

# Docs say to use .NET 6, but thats testing repos only.
# Bazel 8 and 9 remove required features for worldline for some reason.
makedepends="dotnet8-sdk musl-dev zsh bazel7@testing linux-headers gcompat-libdl2"

install=""
subpackages="${pkgname}-worldline ${pkgname}-onnxruntime"

options="net !check !strip" # network needed for dotnet restore, no check due to laziness for now, dotnet dies with strip

# for when we're building off of a commit
_pkgver="${pkgver}"
if [[ "${pkgver}" != "${_reporef}" ]] && [[ "${pkgver}" != "v${_reporef}" ]]; then pkgver="${pkgver}_git${_reporefdate}";from_tag=false;else from_tag=true; fi

source="${_reponame}-${_reporef}.tar.gz::${_repourl}/tar.gz/${_reporef}
        build-worldline
        openutau.desktop
        openutau.svg
        UpdaterDialog.axaml.cs
        0001-Remove-remaining-update-check-shit.patch"
builddir="${srcdir}/${_reponame}-${_reporef}"
_outdir="${builddir}/OpenUtau/bin/${_buildtarget}"

prepare() {
  # Apply Patches
  dos2unix "${builddir}/OpenUtau/ViewModels/UpdaterViewModel.cs"
  default_prepare

  # Replace Dialog
  cp "${srcdir}/UpdaterDialog.axaml.cs" "${builddir}/OpenUtau/Views/UpdaterDialog.axaml.cs"

  # Replace version with the actual version where needed
  local displayed_version="v$pkgver"
  if [[ "$from_tag" == "false" ]]; then
    displayed_version="${_reporefdate:0:4}-${_reporefdate:4:2}-${_reporefdate:6:2} (${_reporef:0:7})"
  fi
  sed -i 's/v{System.Reflection.Assembly.GetEntryAssembly()?.GetName().Version}/'"${displayed_version}"'/g' OpenUtau/ViewModels/MainWindowViewModel.cs OpenUtau/ViewModels/MainWindowViewModel.cs
}

build() {
  cd "${builddir}"
  rm -rf runtimes/linux-*

  # Build worldline
  # TODO: consider packaging worldline seperately at some point
  builddir="${builddir}" CARCH="${CARCH}" "${srcdir}/build-worldline"

  # Build openutau itself
  export DOTNET_CLI_TELEMETRY_OPTOUT=1
  # TODO: figure out how to move dotnet shit into a snapshot()
  dotnet restore --locked-mode --use-current-runtime --disable-build-servers --locked-mode OpenUtau
  dotnet publish OpenUtau --use-current-runtime --no-restore --no-self-contained --disable-build-servers "-p:PublishSingleFile=true;StaticExecutable=true" -c "${_buildtarget}" -o "${builddir}/OpenUtau/bin/${_buildtarget}"
}

package() {
  # Install the main binary
  mkdir -p "${pkgdir}/usr/bin" "${pkgdir}/usr/lib/openutau"
  install -Dm755 "${_outdir}/OpenUtau" "${pkgdir}/usr/lib/openutau/OpenUtau"
  ln -s "../lib/openutau/OpenUtau" "${pkgdir}/usr/bin/openutau"

  # Install dependencies
  # TODO: somehow split these into different packages
  mkdir -p "${pkgdir}/usr/lib/openutau"
  install -Dm755 "${_outdir}/libHarfBuzzSharp.so" "${pkgdir}/usr/lib/openutau/libHarfBuzzSharp.so"
  install -Dm755 "${_outdir}/libSkiaSharp.so" "${pkgdir}/usr/lib/openutau/libSkiaSharp.so"

  # when debugging:
  # tar caf "${pkgdir}/usr/lib/openutau/all.tar.gz" --directory="${_outdir}" .

  # Install desktop icons
	install -Dm755 "${srcdir}/${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
	install -Dm644 "${srcdir}/${pkgname}.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/${pkgname}.svg"
}

onnxruntime() {
  pkgdesc="The onnxruntime library as provided by OpenUtau"
  install_if="${pkgname}=${pkgver}-r${pkgrel}"
  # options="!check !strip !tracedeps"
  install -Dm755 "${_outdir}/libonnxruntime.so" "${subpkgdir}/usr/lib/openutau/libonnxruntime.so"
}

worldline() {
  pkgdesc="The WORLDLINE-R resampler for OpenUtau"
  depends="so:libstdc++.so.6 so:libgcc_s.so.1"
  install_if="${pkgname}=${pkgver}-r${pkgrel}"
  # TODO: consider moving these to /usr/lib/ directly
  install -Dm755 "${builddir}/cpp/bazel-bin/worldline/libworldline.so" "${subpkgdir}/usr/lib/openutau/libworldline.so"
}

sha512sums="
d9fd1b694a7c204800a566e12c3b5ac755072236c6f86b59ee00c6762854e9b0982ae66a3d7bab0772ca811eeb2aee39df28404ca6c195f4e881a8be61f5db03  OpenUtau-c3ff44b01f5dcd0ef1bbdb5aa11ef1319cab3a03.tar.gz
0fc9a1b9e8e5ac24d663e5ce4b90839f3e310532cb2befc7cecd179b610b5db331297aedf7ea0603ff7d40504dc97fc328920a5208ce13016f7ea58886f639e5  build-worldline
ecd2480ef21ac77678f727f848120590e052c48b9027da98eabcbf3a6dcc4cc250b8528e9d4e82ba7ea787b8978f5d2ea14d20065dace516c93d25022570ff11  openutau.desktop
3c8118d019c02b3f5b49c5f714229f9687169b3a1943adf48bf3980b5fc3304852bfc568aa7166eae5ea91e6bd7ff3903927e6ad94c2e7dc8fd9d56bd02f82ee  openutau.svg
159c98095afcabc14824c2e0a7bdf67ee07d91eb7e1bfd9ea8e9296dbc98d062105e886cf763b3542b365bb0da5a8732ce3d97c0926230b0a0b2daeaef9a0997  UpdaterDialog.axaml.cs
494cc5b679b60623df6a4d81df6175176486c8d603e2ff2333eb22d6d5afaa29295c3a37dbb5e4ed176bda9e22b2b84d4c79190c12c71020bf6ba9e958fd2706  0001-Remove-remaining-update-check-shit.patch
"