summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1cc2acb77dc2d44ddbbb4e21fadd5f230a45c827 (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
# Maintainer:  Travis Collins <erbrecht at pobox dot com>
# Contributor: Justin Kromlinger <hashworks@archlinux.org>
# Contributor: Sefa Eyeoglu <contact@scrumplex.net>

# Note: The upstream maintainer does not allow ANY modifications
# to the source code. Please refrain from doing so.
# https://lists.archlinux.org/pipermail/aur-general/2021-May/036230.html

pkgname=noisetorch
pkgver=0.12.2
pkgrel=2
pkgdesc='Real-time microphone noise suppression on Linux.'
arch=('x86_64')
url=https://github.com/noisetorch/NoiseTorch
license=('GPL3')
depends=('pulseaudio' 'polkit' 'hicolor-icon-theme')
makedepends=('go' 'cmake' 'git')
provides=('noisetorch')
install="${pkgname}.install"
source=(
    "$pkgname::git+https://github.com/noisetorch/NoiseTorch.git#tag=v${pkgver}"
    "git+https://github.com/noisetorch/c-ringbuf.git"
    "git+https://github.com/noisetorch/rnnoise.git"
)
sha512sums=('SKIP'
            'SKIP'
            'SKIP')


prepare() {
    cd "$pkgname"

    git submodule init
    git config submodule."c/c-ringbuf".url "${srcdir}/c-ringbuf"
    git config submodule."c/rnnoise".url "${srcdir}/rnnoise"
    git submodule--helper update
}

build() {
    cd "$pkgname"

	export GOPATH="$srcdir/go"

    pushd "c/ladspa"
	make
    popd

	vendor_flags="-X main.version=${pkgver} -X main.distribution=archlinux"

	export CGO_CPPFLAGS="${CPPFLAGS}"
	export CGO_CFLAGS="${CFLAGS}"
	export CGO_CXXFLAGS="${CXXFLAGS}"
	export CGO_LDFLAGS="${LDFLAGS}"
	export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
	go generate
	go build -ldflags "$vendor_flags -linkmode=external" -o bin/noisetorch
	go clean -modcache
}

package() {
	cd "$pkgname"

	install -D -m755 bin/noisetorch "${pkgdir}/usr/bin/noisetorch"
	install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
	install -D -m644 assets/noisetorch.desktop "${pkgdir}/usr/share/applications/noisetorch.desktop"
	install -D -m644 assets/icon/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/icon-LICENSE"
	install -D -m644 assets/icon/noisetorch.png "${pkgdir}/usr/share/icons/hicolor/256x256/apps/noisetorch.png"
}