Skip to content

Commit

Permalink
Use the pre-provided %{sailfishos_version} macro when available.
Browse files Browse the repository at this point in the history
The %{sailfishos_version} macros in OBS does replace dots with zeros, so
adopt our own version logic to this format.
https://forum.sailfishos.org/t/obs-sailfishos-version-constant-is-misformatted/14817/2
  • Loading branch information
bionade24 committed Feb 23, 2023
1 parent a0f7390 commit 4f594df
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions contrac.pro
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ PKGCONFIG += \
protobuf-lite \
sailfishsecrets

greaterThan(SAILFISH_VERSION, 44) {
PKGCONFIG += quazip1-qt5
} else {
lessThan(SAILFISH_VERSION, 40500) {
PKGCONFIG += quazip
} else {
PKGCONFIG += quazip1-qt5
}

DEFINES += LINUX
Expand Down
6 changes: 3 additions & 3 deletions contracd/contracd.pro
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ PKGCONFIG += \
openssl \
protobuf-lite

greaterThan(SAILFISH_VERSION, 44) {
PKGCONFIG += quazip1-qt5
} else {
lessThan(SAILFISH_VERSION, 40500) {
PKGCONFIG += quazip
} else {
PKGCONFIG += quazip1-qt5
}

QT += dbus
Expand Down
2 changes: 1 addition & 1 deletion contracd/src/zipistreambuffer.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef ZIPISTREAMBUFFER_H
#define ZIPISTREAMBUFFER_H

#if SAILFISH_VERSION < 45
#if SAILFISH_VERSION < 40500
#include <quazip5/quazip.h>
#include <quazip5/quazipfile.h>
#else
Expand Down
8 changes: 6 additions & 2 deletions rpm/harbour-contrac.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ Name: harbour-contrac
%define version_major 0
%define version_minor 7
%define version_revis 10
%define sailfish_version %( if [ -f /bin/awk ]; then awk -F= '$1=="VERSION_ID" { print $2 ;}' /etc/os-release | cut -d '.' -f1-2 | tr -d '.'; fi )
%if %{defined sailfishos_version}
%define sailfish_version %{sailfishos_version}
%else
%define sailfish_version %( if [ -f /bin/awk ]; then awk -F= '$1=="VERSION_ID" { print $2 ;}' /etc/os-release | cut -d'.' -f1-3 | sed 's/\\./0/g'; fi )
%endif

Summary: Contrac
Version: %{version_major}.%{version_minor}.%{version_revis}
Expand All @@ -27,7 +31,7 @@ BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(protobuf-lite)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libxml-2.0)
%if %{sailfish_version} < 45
%if 0%{?sailfish_version} < 40500
BuildRequires: pkgconfig(quazip)
%else
BuildRequires: pkgconfig(quazip1-qt5)
Expand Down
8 changes: 3 additions & 5 deletions tests/tests.pro
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ PKGCONFIG += \
nemonotifications-qt5 \
protobuf-lite

greaterThan(SAILFISH_VERSION, 44) {
PKGCONFIG += quazip1-qt5
} else {
lessThan(SAILFISH_VERSION, 40500) {
PKGCONFIG += quazip
} else {
PKGCONFIG += quazip1-qt5
}

DEFINES += "SAILFISH_VERSION=$$SAILFISH_VERSION"

SOURCES += \
test_tracing.cpp
HEADERS += \
Expand Down

0 comments on commit 4f594df

Please sign in to comment.