archrelease: copy trunk to community-any
[ArchLinux/community.git] / micro / trunk / PKGBUILD
blobaa5136729e8f166260a8d1d32a8a677c8d8a648e
1 # Maintainer: Morten Linderud <foxboron@archlinux.org>
2 # Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
3 # Contributor: loqs
4 # Contributor: Fredy García <frealgagu at gmail dot com>
5 # Contributor: Youngbin Han <sukso96100@gmail.com>
6 # Contributor: blainester <theblainestory@gmail.com>
7 # Contributor: mar77i <mar77i at protonmail dot ch>
9 pkgname=micro
10 pkgver=2.0.11
11 pkgrel=4
12 # manually set date instead of "go run tools/build-date.go", for reproducible builds
13 _build_date='August 09, 2022'
14 pkgdesc='Modern and intuitive terminal-based text editor'
15 arch=(x86_64)
16 url='https://micro-editor.github.io/'
17 license=(MIT)
18 makedepends=(git go)
19 optdepends=('wl-clipboard: for copying/pasting text using Wayland'
20             'xclip: for copying/pasting text using X')
21 source=("git+https://github.com/zyedidia/micro#commit=225927b9a25f0d50ea63ea18bc7bb68e404c0cfd") # tag: v2.0.11
22 b2sums=('SKIP')
24 prepare() {
25   cd $pkgname
26   # Let tools/build-date.go always return the same date, to make the package reproducible
27   echo -e '//+build ignore\npackage main\nimport "fmt"\nfunc main() { fmt.Println("'$_build_date'") }' > tools/build-date.go
28   # Modify the Go build flags
29   sed -i 's/-trimpath/-buildmode=pie -trimpath/g;s/GS)/GS) -linkmode=external -extldflags \\"$(LDFLAGS)\\"/g' Makefile
32 build() {
33   make -C $pkgname
36 check() {
37   make -C $pkgname test
40 package() {
41   cd $pkgname
42   install -Dm755 $pkgname "$pkgdir/usr/bin/$pkgname"
43   install -Dm644 assets/packaging/micro.1 -t "$pkgdir/usr/share/man/man1"
44   install -Dm644 assets/packaging/micro.desktop -t "$pkgdir/usr/share/applications"
45   install -Dm644 assets/micro-logo-mark.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/$pkgname.svg"
46   install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE LICENSE-THIRD-PARTY