summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorCynthetika2021-11-07 00:00:00 +0000
committerCynthetika2021-11-07 00:00:00 +0000
commitcf1a3bc1b8381e537b5e774c9b857f8395e7a5bd (patch)
treeeefafe12cdaac4d260d2e138923ed27f089bdea2
parentd063e2cf0d5e70e61b5ce84961559cd7d38815b4 (diff)
downloadaur-cf1a3bc1b8381e537b5e774c9b857f8395e7a5bd.tar.gz
Changes (new maintainer):
1. updated source version 1.1.0>1.2.0 2. completely rewritten PKGBUILD
-rw-r--r--.SRCINFO14
-rw-r--r--.gitignore3
-rw-r--r--PKGBUILD69
3 files changed, 61 insertions, 25 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 88d552977e79..f7a0adf91250 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,14 @@
pkgbase = mimemagic
pkgdesc = Powerful and versatile MIME sniffing package using pre-compiled glob patterns, magic number signatures, XML document namespaces, and tree magic for mounted volumes, generated from the XDG shared-mime-info database
- pkgver = 1.1.0
+ pkgver = 1.2.0
pkgrel = 1
- url = https://github.com/zRedShift/mimemagic
- arch = x86_64
- license = MIT
+ url = https://godoc.org/github.com/zRedShift/mimemagic
+ arch = any
+ license = GPL2
makedepends = go
depends = glibc
- source = mimemagic-1.1.0.tar.gz::https://github.com/zRedShift/mimemagic/archive/v1.1.0.tar.gz
- sha256sums = 3f20e5a7e28080c3dd23721d40d9d419509f26e38c69f11b2c9838c8b41a1927
+ conflicts = mimemagic-git
+ source = mimemagic-1.2.0.tar.gz::https://github.com/zRedShift/mimemagic/archive/v1.2.0.tar.gz
+ sha256sums = 7131b6be01748a5a3498ae2f518e53f3a72bfd87e6208b5dc8cc8ecf948d6629
pkgname = mimemagic
-
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..1d65adf6de3a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*
+!PKGBUILD
+!.SRCINFO
diff --git a/PKGBUILD b/PKGBUILD
index 9482536c9386..ab8ab8392f25 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,35 +1,68 @@
-# Maintainer: Dimitris Kiziridis <ragouel at outlook dot com>
+# Maintainer: Cynthetika <opensourceATcynthetikaDOTcom>
+# Contributor: Dimitris Kiziridis <ragouel at outlook dot com>
pkgname=mimemagic
-pkgver=1.1.0
+pkgver=1.2.0
pkgrel=1
pkgdesc="Powerful and versatile MIME sniffing package using pre-compiled glob patterns, magic number signatures, XML document namespaces, and tree magic for mounted volumes, generated from the XDG shared-mime-info database"
-arch=('x86_64')
-url='https://github.com/zRedShift/mimemagic'
-license=('MIT')
+arch=('any')
+url='https://godoc.org/github.com/zRedShift/mimemagic'
+license=('GPL2')
depends=('glibc')
makedepends=('go')
-source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
-sha256sums=('3f20e5a7e28080c3dd23721d40d9d419509f26e38c69f11b2c9838c8b41a1927')
+conflicts=("$pkgname-git")
+
+source=("$pkgname-$pkgver.tar.gz::https://github.com/zRedShift/$pkgname/archive/v$pkgver.tar.gz")
+sha256sums=('7131b6be01748a5a3498ae2f518e53f3a72bfd87e6208b5dc8cc8ecf948d6629')
prepare() {
- cd "${srcdir}/${pkgname}-${pkgver}"
- mkdir -p build/
+ cd "$pkgname-$pkgver"
+
+ # create build output directory if not present
+ mkdir -p build
+
+ # update module fetching method for Go version >1.17
+ go mod tidy
+
+ # download Go module dependencies
+ go mod download
}
build() {
- cd "${srcdir}/${pkgname}-${pkgver}"
- export CGO_LDFLAGS="${LDFLAGS}"
- export CGO_CFLAGS="${CFLAGS}"
+ cd "$pkgname-$pkgver"
+
+ # set build flags per Arch hardening recommendations
export CGO_CPPFLAGS="${CPPFLAGS}"
+ export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
- export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
+ export CGO_LDFLAGS="-Wl,-O1,--sort-common,-z,relro,-z,now"
+ export GOFLAGS=" \
+ -buildmode=pie \
+ -trimpath \
+ -ldflags=-linkmode=external \
+ -ldflags=-extldflags=-Wl,-O1,--sort-common,-z,relro,-z,now \
+ -mod=readonly \
+ -modcacherw \
+ "
+
+ # recursively build all project binaries
go build -o build ./cmd/...
}
+check() {
+ cd "$pkgname-$pkgver"
+
+ # run build test
+ go test
+}
+
package() {
- cd "${srcdir}/${pkgname}-${pkgver}"
- install -Dm755 build/mimemagic "${pkgdir}/usr/bin/mimemagic"
- install -Dm755 build/parser "${pkgdir}/usr/bin/parser"
- install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
-} \ No newline at end of file
+ cd "$pkgname-$pkgver"
+
+ # install built Go binaries
+ install -Dm 755 -t "$pkgdir/usr/bin" build/$pkgname
+ install -Dm 755 -t "$pkgdir/usr/bin" build/parser
+
+ # install project "readme" documentation
+ install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
+}