summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f3a15de0a4f9b149c906c914feabc95b40263f8a (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
# Maintainer: Dale Whinham <daleyo at gmail dot com>
pkgname=ag-dsp-controller
pkgver=1.1.0.0
pkgrel=2
pkgdesc="Yamaha AG06/AG03 DSP Controller software, patched to work with Linux/Wine MIDI device names (uses Wine)"
arch=("i686" "x86_64")
url="https://www.yamaha.com/"
license=("custom")
depends=("wine")
depends_i686=("alsa-lib")
depends_x86_64=("lib32-alsa-lib")
makedepends=("bsdiff")
source=("https://usa.yamaha.com/files/download/software/6/827126/AG_DSP_Controller_v1100_win.zip"
		"ag-dsp-controller.sh"
		"ag-dsp-controller.desktop"
		"LICENSE"
		"fix-midi-device-name.patch")
sha256sums=("2b2a7af814be568bf65885b9514b492565cdf0a9d42d0620ffe7ab24069de117"
			"63483086e47e6f6e7cab27ea33306fed49f495d41a3640e99bc9e5a094df58e7"
			"10a81716c2083c13763d27423512d286eb9e6805be8d589c34e13d630a9aa6f9"
			"fe7a83618459c97f038d32e8c54b77c76541bdfd522e6bd4fbe15ab709570bde"
			"b354db1682d1306822305c2942b3b6921532a4e9088c3e4379f35f07b8f29cea")

build() {
	# Run installer silently in temporary Wine environment
	install -m755 -d "$srcdir"/tmp "$srcdir"/tmp/env "$srcdir"/tmp/local
	export XDG_DATA_HOME="$srcdir"/tmp/local
	export WINEPREFIX="$srcdir"/tmp/env
	export WINEARCH=win32
	export WINEDEBUG=-all
	export WINEDLLOVERRIDES=mscoree=d
	wine "$srcdir"/setup.exe /s /v/qn

	# Extract icon generated by winemenubuilder during installation
	icon_name=$(grep "Icon" tmp/local/applications/wine/Programs/AG\ DSP\ Controller.desktop | cut -d '=' -f 2)
	install -m644 "$srcdir"/tmp/local/icons/hicolor/256x256/apps/"$icon_name".png "$srcdir"/"$pkgname".png

	# Apply binary patch so that program looks for "AG06/AG03 - AG06/AG03 MIDI 1" as the MIDI device name instead of "AG06/AG03"
	bspatch "$srcdir"/tmp/env/drive_c/Program\ Files/YAMAHA/AG\ DSP\ Controller/ag_dsp_controller.exe "$srcdir"/ag_dsp_controller_patched.exe "$srcdir"/fix-midi-device-name.patch
}

package() {
	find "$srcdir"/tmp/env/drive_c/Program\ Files/YAMAHA/AG\ DSP\ Controller -type f -name "*.csv" -execdir install -Dm644 {,${pkgdir}/usr/share/"$pkgname"/}{} \;
	install -Dm755 "$srcdir"/ag_dsp_controller_patched.exe "$pkgdir"/usr/share/"$pkgname"/ag_dsp_controller.exe
	install -Dm755 "$srcdir"/$pkgname.sh "$pkgdir"/usr/bin/"$pkgname"
	install -Dm644 "$pkgname".desktop "$pkgdir"/usr/share/applications/"$pkgname".desktop
	install -Dm644 "$pkgname".png "$pkgdir"/usr/share/pixmaps/"$pkgname".png
	install -Dm644 "$srcdir"/LICENSE "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
}