summaryrefslogtreecommitdiff
path: root/dtc.spec
blob: 85b775011ecf66edeea7c01425f9488e2ec2b20b (plain)
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#
# Conditional build:
%bcond_without	python		# Python module (any)
%bcond_without	python2		# CPython 2.x module
%bcond_without	python3		# CPython 3.x module
%bcond_without	verbose		# verbose build (V=1)

%if %{without python}
%undefine	with_python2
%undefine	with_python3
%endif
Summary:	The Device Tree Compiler
Summary(pl.UTF-8):	Kompilator drzewiastej struktury urządzeń
Name:		dtc
Version:	1.7.0
Release:	1
License:	GPL v2+ (dtc), GPL v2+ or BSD (fdt library)
Group:		Libraries
Source0:	https://www.kernel.org/pub/software/utils/dtc/%{name}-%{version}.tar.xz
# Source0-md5:	228576aceed3aa89f54283aa0f1eb820
Patch0:		%{name}-python.patch
Patch1:		python2.patch
URL:		https://www.devicetree.org/
BuildRequires:	bison
BuildRequires:	flex
BuildRequires:	pkgconfig
BuildRequires:	rpmbuild(macros) >= 1.714
BuildRequires:	tar >= 1:1.22
BuildRequires:	xz
BuildRequires:	yaml-devel
%if %{with python}
%if %{with python2}
BuildRequires:	python-devel >= 2
BuildRequires:	python-setuptools
BuildRequires:	python-setuptools_scm
%endif
%if %{with python3}
BuildRequires:	python3-devel >= 1:3.2
BuildRequires:	python3-setuptools
BuildRequires:	python3-setuptools_scm
%endif
BuildRequires:	swig-python >= 2.0.10
%endif
Requires:	libfdt = %{version}-%{release}
Obsoletes:	dtc-doc < 1.3.0-2
BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)

%define		abi_ver	%{version}

%{?debug:%define with_verbose 1}

%description
The Device Tree Compiler, dtc, takes as input a device-tree in a given
format and outputs a device-tree in another format. Typically, the
input format is "dts", a human readable source format, and creates a
"dtb", or binary format as output.

%description -l pl.UTF-8
Kompilator drzewiastej struktury urządzeń, dtc, przyjmuje na wejściu
dane w jednym formacie by na wyjściu wyprodukować strukturę danych w
innym. Najczęściej format wejściowy to "dts", intuicyjny i łatwy w
odczycie (tzw. human readable), natomiast wyjściowy to "dtb" lub
inaczej format binarny.

%package -n libfdt
Summary:	Device tree library
Summary(pl.UTF-8):	Biblioteka drzewiastej struktury urządzeń
License:	GPL v2+ or BSD
Group:		Libraries
Obsoletes:	dtc-doc < 1.3.0-2
# does not require base. see README.license

%description -n libfdt
Device tree library.

%description -n libfdt -l pl.UTF-8
Biblioteka drzewiastej struktury urządzeń.

%package -n libfdt-devel
Summary:	Header files for fdt library
Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki fdt
License:	GPL v2+ or BSD
Group:		Development/Libraries
Requires:	libfdt = %{version}-%{release}
Obsoletes:	dtc-devel < 1.3.0
Obsoletes:	dtc-doc < 1.3.0-2

%description -n libfdt-devel
Header files for fdt library.

%description -n libfdt-devel -l pl.UTF-8
Pliki nagłówkowe biblioteki fdt.

%package -n libfdt-static
Summary:	Static fdt library
Summary(pl.UTF-8):	Statyczna biblioteka fdt
License:	GPL v2+ or BSD
Group:		Development/Libraries
Requires:	libfdt-devel = %{version}-%{release}
Obsoletes:	dtc-static < 1.3.0

%description -n libfdt-static
Static fdt library.

%description -n libfdt-static -l pl.UTF-8
Statyczna biblioteka fdt.

%package -n python-libfdt
Summary:	Python 2 binding for fdt library
Summary(pl.UTF-8):	Wiązanie Pythona 2 do biblioteki fdt
License:	GPL v2+ or BSD
Group:		Libraries/Python

%description -n python-libfdt
Python 2 binding for fdt library.

%description -n python-libfdt -l pl.UTF-8
Wiązanie Pythona 2 do biblioteki fdt.

%package -n python3-libfdt
Summary:	Python 3 binding for fdt library
Summary(pl.UTF-8):	Wiązanie Pythona 3 do biblioteki fdt
License:	GPL v2+ or BSD
Group:		Libraries/Python

%description -n python3-libfdt
Python 3 binding for fdt library.

%description -n python3-libfdt -l pl.UTF-8
Wiązanie Pythona 3 do biblioteki fdt.

%prep
%setup -q
%patch0 -p1
%patch1 -p1

%build
%{__make} -j1 \
	%{?with_verbose:V=1} \
	CC="%{__cc}" \
	CFLAGS="%{rpmcflags} -fPIC" \
	NO_PYTHON=1

%if %{with python}
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%if %{with python2}
%py_build
%endif
%if %{with python3}
%py3_build
%endif
%endif

%install
rm -rf $RPM_BUILD_ROOT

%{__make} -j1 install \
	DESTDIR=$RPM_BUILD_ROOT \
	%{?with_verbose:V=1} \
	PREFIX=%{_prefix} \
	LIBDIR=%{_libdir} \
	NO_PYTHON=1 \
	SETUP_PREFIX=%{_prefix}

%if %{with python}
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%if %{with python2}
%py_install

%py_postclean
%endif
%if %{with python3}
%py3_install
%endif
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%post	-n libfdt -p /sbin/ldconfig
%postun	-n libfdt -p /sbin/ldconfig

%files
%defattr(644,root,root,755)
%doc README.license README.md
%attr(755,root,root) %{_bindir}/convert-dtsv0
%attr(755,root,root) %{_bindir}/dtc
%attr(755,root,root) %{_bindir}/dtdiff
%attr(755,root,root) %{_bindir}/fdtdump
%attr(755,root,root) %{_bindir}/fdtget
%attr(755,root,root) %{_bindir}/fdtoverlay
%attr(755,root,root) %{_bindir}/fdtput

%files -n libfdt
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libfdt-%{abi_ver}.so
%attr(755,root,root) %ghost %{_libdir}/libfdt.so.1

%files -n libfdt-devel
%defattr(644,root,root,755)
%doc TODO Documentation/manual.txt
%attr(755,root,root) %{_libdir}/libfdt.so
%{_includedir}/fdt.h
%{_includedir}/libfdt.h
%{_includedir}/libfdt_env.h

%files -n libfdt-static
%defattr(644,root,root,755)
%{_libdir}/libfdt.a

%if %{with python2}
%files -n python-libfdt
%defattr(644,root,root,755)
%attr(755,root,root) %{py_sitedir}/_libfdt.so
%{py_sitedir}/libfdt.py[co]
%{py_sitedir}/libfdt-%{abi_ver}*.egg-info
%endif

%if %{with python3}
%files -n python3-libfdt
%defattr(644,root,root,755)
%attr(755,root,root) %{py3_sitedir}/_libfdt.cpython-*.so
%{py3_sitedir}/libfdt.py
%{py3_sitedir}/__pycache__/libfdt.cpython-*.py[co]
%{py3_sitedir}/libfdt-%{abi_ver}*.egg-info
%endif