mirror of
https://github.com/Jguer/yay.git
synced 2026-07-16 14:06:51 -04:00
* feat(lua): add lua-language-server type stubs for the yay global Ship a meta/yay.meta.lua definition file that declares the `yay` global, all yay.opt fields, and every autocmd event payload so lua-language-server users get completion, hover docs, and typo detection without an "Undefined global `yay`" warning. - meta/yay.meta.lua: 232-line stub covering opt (45 fields), log, abort, create_autocmd with per-event overloads, and 14 payload classes for the 5 autocmd events (AURPreInstall, AURPostDownload, UpgradeSelect, PostInstall, SearchFilter). Return contracts for UpgradeSelect and SearchFilter are annotated. - doc/lua.md: add "Editor support" section with .luarc.json setup. - doc/init.lua: fix PostInstall example referencing pkg.installed, a field that does not exist on PostInstallPackage. - Makefile: install/uninstall meta/yay.meta.lua to $(PREFIX)/share/yay/meta/ so the documented /usr/share/yay/meta path exists on installed systems. Closes #2876 * doc(lua): fix api-since version to v13.0.1 * feat(lua): apply review feedback on type stubs Type opt fields as string unions with descriptions, rename to yay.d.lua per LuaLS docs, strip redundant comments from doc/init.lua, bump to v13.0.2. Tested everything again: go build, go test, lua-language-server, gendocs. * doc(lua): move "editor support", add hyperlinks added link to `init.lua` example in "location" paragraph having "editor support" paragraph at the very bottom of document didn't make any sense. user would want to have lsp editor support right after creating a file in config dir if ever. removed useless paragraph about `.luarc.json` location that already been explained aboved. added hyperlinks for luals extensions. couldn't find any special info for helix (unlike jetbrains), but it should be already covered by "other editors" --------- Co-authored-by: danielwerg <35052399+danielwerg@users.noreply.github.com>
137 lines
3.9 KiB
Makefile
137 lines
3.9 KiB
Makefile
export GO111MODULE=on
|
|
GOPROXY ?= https://proxy.golang.org,direct
|
|
export GOPROXY
|
|
|
|
BUILD_TAG = devel
|
|
ARCH ?= $(shell uname -m)
|
|
BIN := yay
|
|
DESTDIR :=
|
|
GO ?= go
|
|
PKGNAME := yay
|
|
PREFIX := /usr/local
|
|
|
|
MAJORVERSION := 13
|
|
MINORVERSION := 0
|
|
PATCHVERSION := 0
|
|
VERSION ?= ${MAJORVERSION}.${MINORVERSION}.${PATCHVERSION}
|
|
|
|
LOCALEDIR := po
|
|
SYSTEMLOCALEPATH := $(PREFIX)/share/locale/
|
|
|
|
# ls -1 po | sed -e 's/\.po$//' | paste -sd " "
|
|
LANGS := ca ca_ES cs da da_DK de en es eu fi fr fr_FR he he_IL hu id it_IT ja ko nl pl pl_PL pt pt_BR ru ru_RU sk sv tr uk vi vi_VN zh_CN zh_TW
|
|
POTFILE := default.pot
|
|
POFILES := $(addprefix $(LOCALEDIR)/,$(addsuffix .po,$(LANGS)))
|
|
MOFILES := $(POFILES:.po=.mo)
|
|
|
|
FLAGS ?= -trimpath -mod=readonly -modcacherw
|
|
EXTRA_FLAGS ?= -buildmode=pie
|
|
LDFLAGS := -X "main.yayVersion=${VERSION}" -X "main.localePath=${SYSTEMLOCALEPATH}" -linkmode=external -compressdwarf=false
|
|
|
|
RELEASE_DIR := ${PKGNAME}_${VERSION}_${ARCH}
|
|
PACKAGE := $(RELEASE_DIR).tar.gz
|
|
SOURCES ?= $(shell find . -name "*.go" -type f)
|
|
|
|
.PRECIOUS: ${LOCALEDIR}/%.po
|
|
|
|
.PHONY: default
|
|
default: build
|
|
|
|
.PHONY: all
|
|
all: | clean release
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
$(GO) clean $(FLAGS) -i ./...
|
|
rm -rf $(BIN) $(PKGNAME)_*
|
|
|
|
.PHONY: test_lint
|
|
test_lint: test lint
|
|
|
|
.PHONY: test
|
|
test:
|
|
$(GO) test -race -covermode=atomic $(FLAGS) ./...
|
|
|
|
.PHONY: test-integration
|
|
test-integration:
|
|
$(GO) test -tags=integration $(FLAGS) ./...
|
|
|
|
.PHONY: build
|
|
build: $(BIN)
|
|
|
|
.PHONY: release
|
|
release: $(PACKAGE)
|
|
|
|
.PHONY: docker-release-all
|
|
docker-release-all:
|
|
make docker-release-armv7h ARCH=armv7h
|
|
make docker-release-x86_64 ARCH=x86_64
|
|
make docker-release-aarch64 ARCH=aarch64
|
|
|
|
docker-release:
|
|
docker create --name yay-$(ARCH) yay:${ARCH} /bin/sh
|
|
docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE)
|
|
docker container rm yay-$(ARCH)
|
|
|
|
.PHONY: docker-build
|
|
docker-build:
|
|
docker build -t yay-$(ARCH):${VERSION} .
|
|
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make build VERSION=${VERSION} PREFIX=${PREFIX}
|
|
docker cp yay-$(ARCH):/app/${BIN} $(BIN)
|
|
docker container rm yay-$(ARCH)
|
|
|
|
.PHONY: lint
|
|
lint:
|
|
GOFLAGS="$(FLAGS)" golangci-lint run ./...
|
|
|
|
.PHONY: fmt
|
|
fmt:
|
|
go fmt ./...
|
|
|
|
.PHONY: install
|
|
install: build ${MOFILES}
|
|
install -Dm755 ${BIN} $(DESTDIR)$(PREFIX)/bin/${BIN}
|
|
install -Dm644 doc/${PKGNAME}.8 $(DESTDIR)$(PREFIX)/share/man/man8/${PKGNAME}.8
|
|
install -Dm644 completions/bash $(DESTDIR)$(PREFIX)/share/bash-completion/completions/${PKGNAME}
|
|
install -Dm644 completions/zsh $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_${PKGNAME}
|
|
install -Dm644 completions/fish $(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d/${PKGNAME}.fish
|
|
install -Dm644 meta/yay.d.lua $(DESTDIR)$(PREFIX)/share/${PKGNAME}/meta/yay.d.lua
|
|
for lang in ${LANGS}; do \
|
|
install -Dm644 ${LOCALEDIR}/$${lang}.mo $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/${PKGNAME}.mo; \
|
|
done
|
|
|
|
.PHONY: uninstall
|
|
uninstall:
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/${BIN}
|
|
rm -f $(DESTDIR)$(PREFIX)/share/man/man8/${PKGNAME}.8
|
|
rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/${PKGNAME}
|
|
rm -f $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_${PKGNAME}
|
|
rm -f $(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d/${PKGNAME}.fish
|
|
rm -f $(DESTDIR)$(PREFIX)/share/${PKGNAME}/meta/yay.d.lua
|
|
for lang in ${LANGS}; do \
|
|
rm -f $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/${PKGNAME}.mo; \
|
|
done
|
|
|
|
$(BIN): $(SOURCES)
|
|
$(GO) build $(FLAGS) -ldflags '$(LDFLAGS)' $(EXTRA_FLAGS) -o $@
|
|
|
|
$(RELEASE_DIR):
|
|
mkdir $(RELEASE_DIR)
|
|
|
|
$(PACKAGE): $(BIN) $(RELEASE_DIR) ${MOFILES}
|
|
strip ${BIN}
|
|
cp -t $(RELEASE_DIR) ${BIN} doc/${PKGNAME}.8 completions/* ${MOFILES}
|
|
tar -czvf $(PACKAGE) $(RELEASE_DIR)
|
|
|
|
locale:
|
|
xgotext -in . -out po
|
|
mv po/default.pot po/en.po
|
|
for lang in ${LANGS}; do \
|
|
test -f po/$$lang.po || msginit --no-translator -l po/$$lang.po -i po/${POTFILE} -o po/$$lang.po; \
|
|
msgmerge -U po/$$lang.po po/${POTFILE}; \
|
|
touch po/$$lang.po; \
|
|
done
|
|
|
|
${LOCALEDIR}/%.mo: ${LOCALEDIR}/%.po
|
|
msgfmt -o $@ $<
|