# Modified from https://gitlab.archlinux.org/archlinux/packaging/packages/micro/-/blob/dffc678799d1ade1edd55aec66f9312a3d4c8ea3/PKGBUILD _realname=micro pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" pkgver=2.0.15 pkgrel=1 # manually set date instead of "go run tools/build-date.go", for reproducible builds _build_date='January 27, 2026' pkgdesc='Modern and intuitive terminal-based text editor' arch=(any) mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64') url='https://micro-editor.github.io/' msys2_repository_url='https://github.com/zyedidia/micro' license=('spdx:MIT') msys2_references=( 'anitya: 19017' 'aur: micro-git' 'gentoo: app-editors/micro' ) makedepends=(git "${MINGW_PACKAGE_PREFIX}-go" "${MINGW_PACKAGE_PREFIX}-cc") source=("git+https://github.com/zyedidia/micro#commit=6a62575bcfdf4965f187eedafceb3400316e612b") # tag: v2.0.15 b2sums=('49b68b8b3e5c1f501d97921162f8585f7796c024fb1a9877e1fdbe99beb6873b6cfd5fd5a718f0eb3f35bdd826fbd2341b418212b468c8d630527bb18b7318b2') prepare() { cd $_realname # Let tools/build-date.go always return the same date, to make the package reproducible echo -e '//+build ignore\npackage main\nimport "fmt"\nfunc main() { fmt.Println("'$_build_date'") }' > tools/build-date.go # Modify the Go build flags sed -i 's/-trimpath/-buildmode=pie -trimpath/g;s/GS)/GS) -linkmode=external -extldflags \\"$(LDFLAGS)\\"/g' Makefile } build() { make -C $_realname CC=cc CGO_ENABLED=1 } check() { make -C $_realname test } package() { cd $_realname install -Dm755 $_realname "${pkgdir}${MINGW_PREFIX}/bin/$_realname" install -Dm644 assets/packaging/micro.1 -t "${pkgdir}${MINGW_PREFIX}/share/man/man1" install -Dm644 assets/packaging/micro.desktop -t "${pkgdir}${MINGW_PREFIX}/share/applications" install -Dm644 assets/micro-logo-mark.svg "${pkgdir}${MINGW_PREFIX}/share/icons/hicolor/scalable/apps/$_realname.svg" install -Dm644 -t "${pkgdir}${MINGW_PREFIX}/share/licenses/$_realname" LICENSE LICENSE-THIRD-PARTY }