Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kristall -v option doesn't have a version when built outside a git repo #264

Closed
charles2910 opened this issue Dec 30, 2022 · 3 comments
Closed

Comments

@charles2910
Copy link
Contributor

Hi,

while building kristall for Debian sergiodj noticed an error:

--8<---------------cut here---------------start------------->8---
make[2]: Entering directory '/<<PKGBUILDDIR>>/build'
/usr/lib/qt5/bin/uic ../src/browsertab.ui -o ui_browsertab.h
/bin/sh: 1: git: not found
/bin/sh: 1: git: not found
--8<---------------cut here---------------end--------------->8---

This happens because we don't build from the git repo, but from the downloaded tarball. So the following command from src/kristall.pro fails.

DEFINES += KRISTALL_VERSION="\"$(shell cd $$PWD; git describe --tags)\""

And the built application doesn't get a proper version when kristall -v is invoked:

# xvfb-run kristall -v
new locale is "en" "American English"
kristall

We (sergiodj and I) came up with a solution to the problem - I'll attach below and will be very happy to open a PR. But I think it's very specific so you might not want it merged - it keeps working when in a git repo though.

Description: fix missing kristall version when not building in git repo
Author: Sergio Durigan Junior <sergiodj@debian.org>
Author: Carlos Henrique Lima Melara <charlesmelara@outlook.com>
Forwarded: https://github.com/MasterQ32/kristall/issues/262
Last-Update: 2022-12-29

--- a/src/kristall.pro
+++ b/src/kristall.pro
@@ -9,7 +9,13 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets network multimedia multimediawid
 # deprecated API in order to know how to port your code away from it.
 DEFINES += QT_DEPRECATED_WARNINGS
 
-DEFINES += KRISTALL_VERSION="\"$(shell cd $$PWD; git describe --tags)\""
+KRISTALL_VERSION = $$(KRISTALL_VERSION)
+
+isEmpty(KRISTALL_VERSION) {
+    KRISTALL_VERSION = $(shell cd $$PWD; git describe --tags)
+}
+
+DEFINES += KRISTALL_VERSION="\"$$KRISTALL_VERSION\""
 
 # You can also make your code fail to compile if it uses deprecated APIs.
 # In order to do so, uncomment the following line.

TLDR we're exporting KRISTALL_VERSION to the build environment so the qmake variable is not empty in our case.

@MasterQ32
Copy link
Owner

I tried applying the patch in d88dd7b, should be good now

@charles2910
Copy link
Contributor Author

Thanks!

And version 0.4 will be in Debian next stable release (12 - Bookworm, due around July) and also in Ubuntu 23.04, so people will be able to just apt install kristall!

@MasterQ32
Copy link
Owner

That's pretty cool. I hope i can spend some time on Kristall the next days, so i can finally tack a 1.0 to the program and officially go into "maintainence" mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants