From ef2c607b745ab9c488697a42e0775bac46a232cb Mon Sep 17 00:00:00 2001 From: Puqns67 Date: Sat, 23 Nov 2024 21:10:14 +0800 Subject: [PATCH] serenity-elaina-git/1.1.0.alpha3.r4.g0a1889c-2: new --- packages/serenity-elaina-git/.SRCINFO | 20 ++++++++ packages/serenity-elaina-git/PKGBUILD | 71 +++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 packages/serenity-elaina-git/.SRCINFO create mode 100644 packages/serenity-elaina-git/PKGBUILD diff --git a/packages/serenity-elaina-git/.SRCINFO b/packages/serenity-elaina-git/.SRCINFO new file mode 100644 index 0000000..d7d3c28 --- /dev/null +++ b/packages/serenity-elaina-git/.SRCINFO @@ -0,0 +1,20 @@ +pkgbase = serenity-elaina-git + pkgdesc = The configuration generator for sing-box, elaina edition + pkgver = 1.1.0.alpha3.r4.g0a1889c + pkgrel = 2 + url = https://git.puqns67.icu/Puqns67/serenity + arch = x86_64 + arch = aarch64 + license = GPL-3.0-or-later + license = LicenseRef-Name-use-and-association-addition + makedepends = git + makedepends = go + depends = glibc + optdepends = sing-box + provides = serenity + conflicts = serenity + backup = etc/serenity/config.json + source = serenity-elaina::git+https://git.puqns67.icu/Puqns67/serenity.git + b2sums = SKIP + +pkgname = serenity-elaina-git diff --git a/packages/serenity-elaina-git/PKGBUILD b/packages/serenity-elaina-git/PKGBUILD new file mode 100644 index 0000000..fe51289 --- /dev/null +++ b/packages/serenity-elaina-git/PKGBUILD @@ -0,0 +1,71 @@ +# Maintainer: Puqns67 +# Contributor: Misaka13514 +# Contributor: Henry-ZHR + +# This PKGBUILD is base on the AUR repo serenity, +# by Misaka13514 and Henry-ZHR + +_pkgname='serenity' +pkgname="${_pkgname}-elaina-git" +pkgver=1.1.0.alpha3.r4.g0a1889c +pkgrel=2 +pkgdesc='The configuration generator for sing-box, elaina edition' +arch=('x86_64' 'aarch64') +url='https://git.puqns67.icu/Puqns67/serenity' +license=('GPL-3.0-or-later' 'LicenseRef-Name-use-and-association-addition') +depends=('glibc') +makedepends=('git' 'go') +optdepends=('sing-box') +provides=("${_pkgname}") +conflicts=("${_pkgname}") +backup=("etc/${_pkgname}/config.json") +source=("${_pkgname}-elaina"::"git+${url}.git") +b2sums=('SKIP') + +pkgver() { + git -C "${srcdir}/${_pkgname}-elaina" describe --long --tags | sed 's/^v\([0-9\.]\+\)\(-*[0-9\.abcehlprt]*\)-\([0-9]\+\)-g\([0-9a-f]\{7\}\)$/\1\2.r\3.g\4/g' | sed 's/-\(alpha\|beta\|rc\)\./.\1/g' +} + +prepare() { + mkdir -v "${srcdir}/completions" + + # Download dependencies + cd "${srcdir}/${_pkgname}-elaina" + go mod vendor +} + +build() { + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + export GOFLAGS="-v -x -work -modcacherw -trimpath -buildmode=pie -mod=readonly" + + cd "${srcdir}/${_pkgname}-elaina" + + go build \ + -o "${srcdir}/${_pkgname}" \ + -ldflags "-w -s -linkmode external -X github.com/sagernet/serenity/constant.Version=${pkgver}" \ + ./cmd/... + + go run "./cmd/${_pkgname}" completion bash > "${srcdir}/completions/${_pkgname}" + go run "./cmd/${_pkgname}" completion fish > "${srcdir}/completions/${_pkgname}.fish" + go run "./cmd/${_pkgname}" completion zsh > "${srcdir}/completions/_${_pkgname}" +} + +check() { + go test -C "${srcdir}/${_pkgname}-elaina" ./... +} + +package() { + install -Dm755 "${srcdir}/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}" + + install -Dm644 "${srcdir}/${_pkgname}-elaina/release/config/config.json" "${pkgdir}/etc/${_pkgname}/config.json" + install -Dm644 "${srcdir}/${_pkgname}-elaina/release/config/${_pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${_pkgname}.service" + install -Dm644 "${srcdir}/${_pkgname}-elaina/release/config/${_pkgname}@.service" "${pkgdir}/usr/lib/systemd/system/${_pkgname}@.service" + + install -Dm644 "${srcdir}/completions/${_pkgname}" "${pkgdir}/usr/share/bash-completion/completions/${_pkgname}" + install -Dm644 "${srcdir}/completions/${_pkgname}.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/${_pkgname}.fish" + install -Dm644 "${srcdir}/completions/_${_pkgname}" "${pkgdir}/usr/share/zsh/site-functions/_${_pkgname}" + + install -Dm644 "${srcdir}/${_pkgname}-elaina/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" +}