1SUMMARY="A waveform editor for the E370 and E352 Eurorack synthesizer modules"
2DESCRIPTION="WaveEdit is a free tool on PC/Mac/Linux that allows powerful creation and editing of wavetables \
3for the E352 and E370 VCOs. Using standard WAV formats, the editor includes a full toolbox of shortcuts. \
4An audio Preview is available to audition the waves before loading into the module."
5HOMEPAGE="https://synthtech.com/waveedit/"
6COPYRIGHT="1998-2022 Synthesis Technology"
7LICENSE="GNU GPL v3"
8REVISION="1"
9SOURCE_URI="https://github.com/AndrewBelt/WaveEdit/archive/refs/tags/v$portVersion.tar.gz"
10CHECKSUM_SHA256="d3c1fadeb99f6f12ba75cae7b40df11b3074b608767f83cf0722d97fa917a608"
11SOURCE_DIR="WaveEdit-$portVersion"
12srcGitRev_2="cfb1dd6cae8f4dbbcb36377edfec52a9cd874308"
13SOURCE_URI_2="https://github.com/AndrewBelt/imgui/archive/$srcGitRev_2.tar.gz"
14CHECKSUM_SHA256_2="1a73b8d66dff7515c072cf4aa4432fffd4256d22f231ff891329ea14e4f2de86"
15SOURCE_DIR_2="imgui-$srcGitRev_2"
16srcGitRev_3="8a0f16afe74a6abf85e3b45e9558283022021a59"
17SOURCE_URI_3="https://github.com/lvandeve/lodepng/archive/$srcGitRev_3.zip"
18CHECKSUM_SHA256_3="30a99e0b6e928f496d0c7837770c09cd36d27f48cc84e7089bea3e2b2bf8c0e7"
19SOURCE_DIR_3="lodepng-$srcGitRev_3"
20srcGitRev_4="c5062dc2dd6c1f053ca85fc53cc3bfbfd30e13d1"
21SOURCE_URI_4="https://github.com/marton78/pffft/archive/$srcGitRev_4.zip"
22CHECKSUM_SHA256_4="2922f36fef17d6a52860bb42f67e6c01192d0352edb424971a667422d767746e"
23SOURCE_DIR_4="pffft-$srcGitRev_4"
24srcGitRev_5="e66caf0f9d3266a79c513dcc73b57b6b3eb38120"
25SOURCE_URI_5="https://github.com/AndrewBelt/osdialog/archive/$srcGitRev_5.zip"
26CHECKSUM_SHA256_5="db03216390234adbadd5fe92d7adbdc8ae2d2de7752b19ffa18767c0c5392305"
27SOURCE_DIR_5="osdialog-$srcGitRev_5"
28PATCHES="waveedit-$portVersion.patchset"
29PATCHES_5="osdialog.patchset"
30ADDITIONAL_FILES="waveedit.rdef.in"
31
32ARCHITECTURES="all !x86_gcc2"
33SECONDARY_ARCHITECTURES="x86"
34
35PROVIDES="
36	waveedit$secondaryArchSuffix = $portVersion
37	app:WaveEdit = $portVersion
38	"
39REQUIRES="
40	haiku$secondaryArchSuffix
41	lib:libGL$secondaryArchSuffix
42	lib:libcurl$secondaryArchSuffix
43	lib:libjansson$secondaryArchSuffix
44	lib:libsamplerate$secondaryArchSuffix
45	lib:libsndfile$secondaryArchSuffix
46	lib:libsdl2_2.0$secondaryArchSuffix
47	"
48
49BUILD_REQUIRES="
50	haiku${secondaryArchSuffix}_devel
51	devel:libGL$secondaryArchSuffix
52	devel:libcurl$secondaryArchSuffix
53	devel:libjansson$secondaryArchSuffix
54	devel:libsamplerate$secondaryArchSuffix
55	devel:libsndfile$secondaryArchSuffix
56	devel:libsdl2_2.0$secondaryArchSuffix
57	"
58BUILD_PREREQUIRES="
59	cmd:gcc$secondaryArchSuffix
60	cmd:make
61	cmd:pkg_config$secondaryArchSuffix
62	"
63
64BUILD()
65{
66	cp -Rf $sourceDir2/* ext/imgui
67	cp -Rf $sourceDir3/* ext/lodepng
68	cp -Rf $sourceDir4/* ext/pffft
69	cp -Rf $sourceDir5/* ext/osdialog
70
71	make ARCH=haiku
72}
73
74INSTALL()
75{
76	mkdir -p $appsDir/WaveEdit
77	cp -R {WaveEdit,logo-dark.png,logo-light.png,fonts,catalog,banks,doc/manual.pdf} $appsDir/WaveEdit
78
79	local APP_SIGNATURE="application/x-vnd.synthesis-waveedit"
80	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
81	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
82	local LONG_INFO="$SUMMARY"
83	sed \
84		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
85		-e "s|@MAJOR@|$MAJOR|" \
86		-e "s|@MIDDLE@|$MIDDLE|" \
87		-e "s|@LONG_INFO@|$LONG_INFO|" \
88		$portDir/additional-files/waveedit.rdef.in > waveedit.rdef
89
90	addResourcesToBinaries waveedit.rdef $appsDir/WaveEdit/WaveEdit
91	addAppDeskbarSymlink $appsDir/WaveEdit/WaveEdit
92}
93