Control: tags -1 patch

On Sat, Apr 22 2023 at 11:16:26 PM -04:00:00, Andres Salomon <dilin...@queued.net> wrote:

However, I can't for the life of me figure out how to tell dh-golang to actually pass that to the Go compiler. *shrug*


Here we go. This patch allows both `yggdrasil --version` and `yggdrasilctl getself` to report the current version.



--- a/debian/rules	2022-11-21 12:58:57.000000000 +0000
+++ b/debian/rules	2023-04-23 04:25:49.437999309 +0000
@@ -1,11 +1,18 @@
 #!/usr/bin/make -f
 
+include /usr/share/dpkg/pkg-info.mk
+
+LDFLAGS := -X github.com/yggdrasil-network/yggdrasil-go/src/version.buildName=yggdrasil -X github.com/yggdrasil-network/yggdrasil-go/src/version.buildVersion=$(DEB_VERSION_UPSTREAM)
+
 DH_GOLANG_EXCLUDES:=ansible mobile
 export DH_GOLANG_EXCLUDES
 
 %:
 	dh $@ --builddirectory=_build --buildsystem=golang --with=golang
 
+override_dh_auto_build:
+	dh_auto_build -- -ldflags "$(LDFLAGS)"
+
 override_dh_installsystemd:
 	dh_installsystemd --no-enable --no-restart-on-upgrade --no-start
 

Reply via email to