forked from DylanVanAssche/droid-hal-version
-
Notifications
You must be signed in to change notification settings - Fork 0
/
droid-hal-version.inc
139 lines (114 loc) · 3.94 KB
/
droid-hal-version.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
%if 0%{?_obs_build_project:1}
%define _build_flavour %(echo %{_obs_build_project} | awk -F : '{if ($NF == "testing" || $NF == "release") print $NF; else if ($NF ~ /[0-9]\.[0-9]\.[0-9]/ && NF == 3) print strdevel; else if (NF == 2) print strdevel; else print strunknown}' strdevel=devel strunknown=unknown)
%else
%define _build_flavour unknown
%endif
# needs to match the prjconf in pj:tools
%define _obs_build_count %(echo %{release} | awk -F . '{if (NF >= 3) print $3; else print $1 }')
%define _obs_commit_count %(echo %{release} | awk -F . '{if (NF >= 2) print $2; else print $1 }')
%if "%{_build_flavour}" == "release"
%define _version_appendix %{nil}
%else
%define _version_appendix \ (%{_build_flavour})
%endif
%define _shortened_version %(echo %{version} | awk -F '+' '{print $1}')
%if 0%{!?rpm_device:1}
%define rpm_device %{device}
%endif
%if 0%{!?rpm_vendor:1}
%define rpm_vendor %{vendor}
%endif
Name: droid-hal-version-%{rpm_device}
Version: 0.0.1
Release: 1
Summary: SailfishOS HW Adaptation droid version package %{_shortened_version}.%{_obs_build_count} (%{_build_flavour})
Group: System/Libraries
License: BSD-3-Clause
Source: %{name}-%{version}.tar.gz
# Generic dependencies
#BuildRequires: droid-hal
BuildRequires: droid-config
BuildRequires: droid-config-sailfish
%if 0%{!?native_build:1}
BuildRequires: libhybris
%endif
# LEDs for notifications
%if 0%{?have_led:1}
BuildRequires: mce-plugin-libhybris
%endif
# If /system has been packaged to rpm package
%if 0%{?have_droid_bin:1}
BuildRequires: droid-bin
%endif
# Kernel & Boot
#BuildRequires: droid-hal-kernel
#BuildRequires: droid-hal-img-boot
#BuildRequires: droid-hal-img-recovery
#BuildRequires: droid-config-preinit-plugins
# Kernel modules
%if 0%{?have_kernel_modules:1}
BuildRequires: droid-hal-kernel-modules
%endif
# Audio
BuildRequires: pulseaudio-modules-droid
BuildRequires: droid-config-pulseaudio-settings
# Haptics native
%if 0%{?have_vibrator_native:1} && 0%{!?have_vibrator:1} && 0%{!?have_ffmemless:1}
BuildRequires: ngfd-plugin-native-vibrator
BuildRequires: qt5-feedback-haptics-native-vibrator
%endif
# Haptics
%if 0%{!?have_vibrator_native:1} && 0%{?have_vibrator:1} && 0%{!?have_ffmemless:1}
BuildRequires: ngfd-plugin-droid-vibrator
BuildRequires: qt5-feedback-haptics-droid-vibrator
%endif
# Haptics with ffmemless
%if 0%{!?have_vibrator_native:1} && 0%{!?have_vibrator:1} && 0%{?have_ffmemless:1}
BuildRequires: qt5-feedback-haptics-ffmemless
%endif
# Sensors
%if 0%{!?native_build:1}
BuildRequires: hybris-libsensorfw-qt5
%endif
# Graphics
%if 0%{!?native_build:1}
BuildRequires: qt5-qpa-hwcomposer-plugin
BuildRequires: qtscenegraph-adaptation
%endif
%description
SailfishOS HW Adaptation %{rpm_device} version/umbrella package (%{version}.%{_obs_build_count}).
%files
%defattr(-,root,root,-)
%config %{_sysconfdir}/hw-release
%package doc
Summary: SailfishOS %{version}.%{_obs_build_count} (%{_build_flavour})
Group: System/Libraries
%description doc
%{summary}.
%files doc
%defattr(-,root,root,-)
%doc %{_datadir}/doc/SailfishOS/*
%prep
%build
%install
echo "Building for %{_build_flavour}"
mkdir -p %{buildroot}/%{_sysconfdir}
echo Creating hw-release
# based on http://www.freedesktop.org/software/systemd/man/os-release.html
cat > %{buildroot}/%{_sysconfdir}/hw-release <<EOF
# This file is copied as hw-release (analogous to os-release)
NAME="%{vendor_pretty} %{device_pretty}"
ID=%{rpm_device}
MER_HA_DEVICE=%{rpm_device}
MER_HA_VENDOR=%{rpm_vendor}
VERSION="%{version}.%{_obs_build_count}%{_version_appendix}"
VERSION_ID=%{version}.%{_obs_build_count}
PRETTY_NAME="$DEVICE %{version}.%{_obs_build_count}%{_version_appendix}"
SAILFISH_BUILD=%{_obs_build_count}
SAILFISH_FLAVOUR=%{_build_flavour}
HOME_URL="https://sailfishos.org/"
EOF
cat %{buildroot}/%{_sysconfdir}/hw-release
mkdir -p %{buildroot}/%{_datadir}/doc/SailfishOS
cp %{buildroot}/%{_sysconfdir}/hw-release %{buildroot}/%{_datadir}/doc/SailfishOS/
rpm -qa | sort > %{buildroot}/%{_datadir}/doc/SailfishOS/extended-packagelist-droid