dtc/dtc.spec

155 lines
3.8 KiB
RPMSpec
Raw Normal View History

2022-03-25 11:09:43 +00:00
%define major 1
2023-12-20 11:38:49 +10:00
%define libname %mklibname fdt %{major}
%define devname %mklibname fdt -d
%define sdevname %mklibname fdt -d -s
2020-04-17 14:35:30 +00:00
2023-12-20 11:38:49 +10:00
Summary: Device Tree Compiler
2020-04-17 14:35:30 +00:00
Name: dtc
2025-02-21 14:49:12 +00:00
Version: 1.7.2
2023-10-19 08:21:03 +00:00
Release: 1
2020-04-17 14:35:30 +00:00
License: GPLv2+
2023-12-20 11:38:49 +10:00
Group: Development/Other
2025-02-21 14:49:12 +00:00
URL: https://www.devicetree.org
Source0: https://www.kernel.org/pub/software/utils/dtc/%{name}-%{version}.tar.gz
2020-04-17 14:35:30 +00:00
BuildRequires: bison
BuildRequires: flex
BuildRequires: swig
BuildRequires: pkgconfig(python3)
BuildRequires: python3-pip
2023-12-20 11:40:13 +10:00
BuildRequires: python3-setuptools
2023-12-20 12:03:12 +10:00
BuildRequires: python3-setuptools_scm
BuildRequires: python3-wheel
2024-05-14 15:27:56 +00:00
BuildRequires: python38-devel
2025-02-21 14:49:12 +00:00
BuildRequires: python38-setuptools
2020-04-17 14:35:30 +00:00
%description
The Device Tree Compiler generates flattened Open Firmware style device trees
for use with PowerPC machines that lack an Open Firmware implementation and
ARM/AArch64 devices that don't implement UEFI.
2023-12-20 11:38:49 +10:00
%files
%{_bindir}/*
#----------------------------------------------------------------------------
%package -n %{libname}
2020-04-17 14:35:30 +00:00
Summary: Device tree library
Group: System/Libraries
2023-12-20 11:38:49 +10:00
Conflicts: %{_lib}fdt1_1 < 1.7.0
Obsoletes: %{_lib}fdt1_1 < 1.7.0
2020-04-17 14:35:30 +00:00
%description -n %{libname}
libfdt is a library to process Open Firmware style device trees on various
architectures.
2023-12-20 11:38:49 +10:00
%files -n %{libname}
2025-02-21 15:03:16 +00:00
%{_libdir}/libfdt.so.%{major}*
2020-04-17 14:35:30 +00:00
2023-12-20 11:38:49 +10:00
#----------------------------------------------------------------------------
2020-04-17 14:35:30 +00:00
2023-12-20 11:38:49 +10:00
%package -n %{devname}
2020-04-17 14:35:30 +00:00
Summary: Development headers for device tree library
2023-12-20 11:38:49 +10:00
Group: Development/C
Requires: %{libname} = %{EVRD}
Provides: %{name}-devel = %{EVRD}
Provides: fdt-devel = %{EVRD}
Conflicts: %{_lib}fdt1-devel < 1.7.0
Obsoletes: %{_lib}fdt1-devel < 1.7.0
%description -n %{devname}
2020-04-17 14:35:30 +00:00
This package provides development files for libfdt
2023-12-20 11:38:49 +10:00
%files -n %{devname}
2024-05-14 15:27:56 +00:00
%doc GPL
2023-12-20 11:38:49 +10:00
%{_libdir}/libfdt.so
%{_includedir}/*.h
#----------------------------------------------------------------------------
%package -n %{sdevname}
Summary: %{name} static library
Group: Development/C
Requires: %{devname} = %{EVRD}
Provides: fdt-static-devel = %{EVRD}
Conflicts: %{_lib}fdt_static1-devel < 1.7.0
Obsoletes: %{_lib}fdt_static1-devel < 1.7.0
%description -n %{sdevname}
This package provides %{name} static library.
%files -n %{sdevname}
%{_libdir}/libfdt.a
#----------------------------------------------------------------------------
2020-04-17 14:35:30 +00:00
%package -n python3-%{name}
2020-04-17 14:38:00 +00:00
Summary: Python 3 bindings for %{name}
2023-12-20 11:38:49 +10:00
Group: Development/Python
2020-05-16 11:27:46 +00:00
Provides: python3-libfdt = %{EVRD}
2020-04-17 14:35:30 +00:00
Requires: %{name} = %{EVRD}
%description -n python3-%{name}
2020-05-16 11:20:02 +00:00
This package provides python3 bindings for %{name}.
2020-04-17 14:35:30 +00:00
2023-12-20 11:38:49 +10:00
%files -n python3-%{name}
%{python3_sitearch}/*
#----------------------------------------------------------------------------
2020-04-17 14:35:30 +00:00
%prep
%setup -q
2024-05-14 15:27:56 +00:00
#autopatch -p1
2023-10-19 08:21:03 +00:00
sed -i 's@--prefix=$(PREFIX)@--prefix=$(PREFIX) --root=/@' pylibfdt/Makefile.pylibfdt
2020-04-17 14:35:30 +00:00
2022-04-05 15:13:27 +03:00
%ifarch %{e2k}
# -MG is an unrecognized option for lcc
sed -i 's,-MG,,' Makefile
2022-04-05 16:12:03 +03:00
echo '#define DTC_VERSION "DTC %{version}"' > version_gen.h
2022-04-05 15:13:27 +03:00
%endif
2020-04-17 14:35:30 +00:00
%build
2025-02-21 14:49:12 +00:00
/usr/libexec/python3.8 -m venv .
. ./bin/activate
2023-10-19 08:21:03 +00:00
%set_build_flags
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
2020-04-17 14:35:30 +00:00
2024-05-14 15:27:56 +00:00
2020-04-17 14:35:30 +00:00
sed -i \
2024-05-14 15:27:56 +00:00
-e '/^CFLAGS =/s:=:+= %{optflags}:' \
2020-04-17 14:35:30 +00:00
-e '/^CPPFLAGS =/s:=:+=:' \
-e '/^WARNINGS =/s:=:+=:' \
-e "/^PREFIX =/s:=.*:= %{_prefix}:" \
-e "/^LIBDIR =/s:=.*:= \%{_libdir}:" \
Makefile
# no-macro-redefined is a workaround for flex bug
# https://github.com/westes/flex/issues/155
2024-05-14 15:27:56 +00:00
export PYTHONPATH=%{python38_sitelib}
export PYTHON3=/usr/libexec/python3.8
export PYTHON=/usr/libexec/python3.8
2023-12-20 11:38:49 +10:00
%make_build \
2024-05-14 15:27:56 +00:00
CC=%{__cc} \
2023-12-20 11:38:49 +10:00
LDFLAGS="%{optflags}" \
2024-05-14 15:27:56 +00:00
WARNINGS+=-Wno-macro-redefined \
PYTHON=/usr/libexec/python3.8
# NO_PYTHON=1 \
2020-04-17 14:35:30 +00:00
%install
2023-10-19 08:21:03 +00:00
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
2023-12-20 11:38:49 +10:00
%make_install \
DESTDIR=%{buildroot} \
PREFIX=%{buildroot}%{_prefix} \
LIBDIR=%{_libdir} \
BINDIR=%{_bindir} \
INCLUDEDIR=%{_includedir}
2023-10-19 08:21:03 +00:00
# we don't want ftdump and it conflicts with freetype-demos, so drop it (rhbz 797805)
2023-12-20 11:38:49 +10:00
rm -f %{buildroot}%{_bindir}/ftdump
2020-04-17 14:35:30 +00:00