diff --git a/hound/PKGBUILD b/hound/PKGBUILD new file mode 100644 index 0000000..d9f1009 --- /dev/null +++ b/hound/PKGBUILD @@ -0,0 +1,84 @@ +# Maintainer: George Rawlinson + +pkgname=hound +pkgver=0.4.0 +pkgrel=1 +pkgdesc="Lightning fast code searching made easy" +arch=('x86_64') +url="https://github.com/hound-search/hound" +license=('MIT') +depends=('glibc') +makedepends=('go') # no need for npm as the UI is pre-compiled +optdepends=( + 'git: for git repositories' + 'bzr: for bazaar repositories' + 'mercurial: for mercurial repositories' + 'svn: for subversion repositories' +) +source=( + "$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz" + 'systemd.service' + 'sysusers.conf' + 'tmpfiles.conf' +) +sha512sums=('5f72d63269f6ed548abe36a9736a72eadaf8e5149f8190648bfe9f64367084252e4f509321622e4f2ceb14baf03872a7db339aab75266c2d5a40577ab1fbd427' + 'eca1ca8c4df3bb25fab83ff7ae15671a37f8a02860f606aee683b25263860a18c32855f118a73e802bc98912d39ece065c820a56c234707fff354bec069c03dd' + 'f683d969f29a84251ef00aa8e1d713a3331756530ef50a3ad738baf15956e5e2b83c8f1611a9e8e8a1c3161c17d375fde54fb42c451849b4578c6a7342226121' + '9a26a065237d3edd2f09d399ad1999276304db71398a7737b846a5e70eb0740baab4bdd56dfb225060c3ca995f4c13db9cfec1aebe1825473a6299484bdac5b9') +b2sums=('eec71fbd4716848901d55db743a81971c2b595330b5a86ed78d0142a9bf42df8c12da196991019d671ad84fa63a746b05bf681f178e166dc0ea10650ee32e4bc' + '90f529ed44632f0c17c994d9f80dfdfbda8c7de61a4d7756f05d5aa52c582c9fa7e280a3003b28758097d3fa2311697b8f9c14ff17ca0f90600908581f46e085' + 'cc66b8408c35c73911fd01c1c4137401ea223db828085e8750f25f4f41f42c2eda3f3fc5a0b3f64e08495ad4a6367a0ff35b132c924f396bfbe4da47899c6edd' + '509003822d9bd826b5921d52483c79a5275b1da121e6f88bf66a644681c2a76a7abac5cf8241a094100c164f32e510da04b9f6037cf5e0910c98b062c68742e5') + +prepare() { + cd "$pkgname-$pkgver" + + # create directory for build output + mkdir build + + # download dependencies + go mod vendor +} + +build() { + cd "$pkgname-$pkgver" + + # set Go flags + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + + go build -v \ + -trimpath \ + -buildmode=pie \ + -mod=vendor \ + -modcacherw \ + -ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \ + -o build \ + ./cmds/... +} + +check() { + cd "$pkgname-$pkgver" + go test -v ./... +} + +package() { + # systemd integration + install -vDm644 systemd.service "$pkgdir/usr/lib/systemd/system/$pkgname.service" + install -vDm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/$pkgname.conf" + install -vDm644 tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf" + + cd "$pkgname-$pkgver" + + # binary + install -vDm755 -t "$pkgdir/usr/bin" build/* + + # license + install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE + + # documentation + install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" \ + CONTRIBUTING.md README.md config-example.json default-config.json docs/* +} + diff --git a/hound/systemd.service b/hound/systemd.service new file mode 100644 index 0000000..2710301 --- /dev/null +++ b/hound/systemd.service @@ -0,0 +1,16 @@ +[Unit] +Description=Hound Code Search and Indexing Daemon +Documentation=https://github.com/hound-search/hound +Requires=network-online.target +After=network-online.target + +[Service] +User=hound +Group=hound +WorkingDirectory=/var/lib/hound +ExecStart=/usr/bin/houndd +Restart=always +RestartSec=30 + +[Install] +WantedBy=multi-user.target diff --git a/hound/sysusers.conf b/hound/sysusers.conf new file mode 100644 index 0000000..7af1d4f --- /dev/null +++ b/hound/sysusers.conf @@ -0,0 +1 @@ +u hound - "Hound daemon user" /var/lib/hound diff --git a/hound/tmpfiles.conf b/hound/tmpfiles.conf new file mode 100644 index 0000000..51be58a --- /dev/null +++ b/hound/tmpfiles.conf @@ -0,0 +1 @@ +d /var/lib/hound 0750 hound hound