Add build.sh to adguard-home

This commit is contained in:
none 2023-11-04 17:46:23 +01:00
parent 875a5cc55b
commit 3f4b2d2ab9
3 changed files with 61 additions and 2 deletions

View File

@ -28,8 +28,8 @@ src_configure() {
}
src_compile() {
emake bin/"$PN"
# CHANNEL=development SIGN=0 VERBOSE=1 ARCH=amd64 OS=linux ./scripts/make/build-release.sh
# emake bin/"$PN"
env CHANNEL=edge SIGN=0 VERBOSE=1 ARCH=amd64 OS=linux ${FILESDIR}/build.sh
}
src_install() {

View File

@ -0,0 +1,4 @@
GO=${GO:-go}
all:

View File

@ -0,0 +1,55 @@
go="${GO:-go}"
readonly go
bump_minor='/^v[0-9]+\.[0-9]+\.0$/ {
print($1 "." $2 + 1 ".0");
next;
}
{
printf("invalid release version: \"%s\"\n", $0);
exit 1;
}'
readonly bump_minor
get_last_minor_zero() {
git tag\
| grep -e 'v[0-9]\+\.[0-9]\+\.0$'\
| sort -k 1.2,1nr -k 2,2nr -t '.'\
| head -n 1
}
last_minor_zero="$( get_last_minor_zero )"
readonly last_minor_zero
num_commits_since_minor="$( git rev-list --count "${last_minor_zero}..HEAD" )"
readonly num_commits_since_minor
next_minor="$( echo "$last_minor_zero" | awk -F '.' "$bump_minor" )"
readonly next_minor
version="${next_minor}-a.${num_commits_since_minor}+$( git rev-parse --short HEAD )"
CGO_ENABLED='1'
GO111MODULE='on'
export CGO_ENABLED
export GO111MODULE
version_pkg='github.com/AdguardTeam/AdGuardHome/internal/version'
readonly version_pkg
ldflags="-s -w"
ldflags="${ldflags} -X ${version_pkg}.version=${version}"
ldflags="${ldflags} -X ${version_pkg}.channel=${channel}"
"$go" build\
--ldflags "$ldflags"\
--race=1\
--trimpath\
-o=AdGuardHome\
-v=1\
-x=1