Switch the buildsystem to meson

This builds the libflashrom shared library used by other projects such as fwupd.
This commit is contained in:
Richard Hughes 2020-02-17 10:28:52 +00:00
parent eb00fe7115
commit bb5adc403e
2 changed files with 92 additions and 10 deletions

View File

@ -0,0 +1,43 @@
From b820207aeff98b5ccf21649036259333fd0e0175 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Mon, 17 Feb 2020 09:57:01 +0000
Subject: [PATCH] Install the man file when using meson as a buildsystem
This fixes a regression with the Fedora package.
Change-Id: I881bd5002a842072ce9dadea033c51a2668f9e7c
Signed-off-by: Richard Hughes <richard@hughsie.com>
---
meson.build | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/meson.build b/meson.build
index 375089c3..df39290b 100644
--- a/meson.build
+++ b/meson.build
@@ -299,6 +299,7 @@ endif
prefix = get_option('prefix')
sbindir = join_paths(prefix, get_option('sbindir'))
libdir = join_paths(prefix, get_option('libdir'))
+mandir = join_paths(prefix, get_option('mandir'))
install_headers([
'libflashrom.h',
@@ -372,6 +373,14 @@ pkgg.generate(
description : 'library to interact with flashrom',
)
+configure_file(
+ input : 'flashrom.8.tmpl',
+ output : 'flashrom.8',
+ copy: true,
+ install: true,
+ install_dir: join_paths(mandir, 'man8'),
+)
+
flashrom_dep = declare_dependency(
link_with : flashrom,
include_directories : include_directories('.'),
--
2.24.1

View File

@ -1,13 +1,17 @@
Name: flashrom
Version: 1.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Simple program for reading/writing flash chips content
License: GPLv2
URL: https://flashrom.org
Source0: https://download.flashrom.org/releases/%{name}-v%{version}.tar.bz2
# upstream already: https://review.coreboot.org/c/flashrom/+/38939
Patch0: 0001-Install-the-man-file-when-using-meson-as-a-buildsyst.patch
BuildRequires: gcc
BuildRequires: meson
BuildRequires: pciutils-devel
BuildRequires: libftdi-devel
BuildRequires: libusb-devel
@ -30,28 +34,53 @@ flash chips. It is designed to flash BIOS/EFI/coreboot/firmware/optionROM
images on mainboards, network/graphics/storage controller cards, and various
other programmer devices.
%package devel
Summary: Development package for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Files for development with %{name}.
%prep
%setup -q -n %{name}-v%{version}
%autosetup -p1 -n %{name}-v%{version}
# Replace GROUP="plugdev" specifiers with TAG+="uaccess"
sed -e 's/MODE="[0-9]*", GROUP="plugdev"/TAG+="uaccess"/g' util/z60_flashrom.rules -i
%build
%meson \
%ifarch %{ix86} x86_64
# 'internal' programmer is only supported on x86 platforms
%global flashrom_flags CFLAGS='%{optflags}'
-Dconfig_internal=true
%else
%global flashrom_flags CFLAGS='%{optflags}' CONFIG_INTERNAL=no
-Dconfig_atahpt=false \
-Dconfig_atapromise=false \
-Dconfig_atavia=false \
-Dconfig_drkaiser=false \
-Dconfig_gfxnvidia=false \
-Dconfig_it8212=false \
-Dconfig_nic3com=false \
-Dconfig_nicintel_eeprom=false \
-Dconfig_nicintel=false \
-Dconfig_nicintel_spi=false \
-Dconfig_nicnatsemi=false \
-Dconfig_nicrealtek=false \
-Dconfig_ogp_spi=false \
-Dconfig_rayer_spi=false \
-Dconfig_satamv=false \
-Dconfig_satasii=false \
-Dconfig_internal=false
%endif
%meson_build
%build
make %{?_smp_mflags} %{flashrom_flags}
%if 0%{?enable_tests}
%check
%meson_test
%endif
%install
make install %{flashrom_flags} DESTDIR=%{buildroot} PREFIX=%{_prefix}
install -D -p -m 0644 util/z60_flashrom.rules %{buildroot}/%{_udevrulesdir}/60_flashrom.rules
%meson_install
install -D -p -m 0644 util/z60_flashrom.rules %{buildroot}/%{_udevrulesdir}/60_flashrom.rules
%files
%{!?_licensedir:%global license %%doc}
@ -60,9 +89,19 @@ install -D -p -m 0644 util/z60_flashrom.rules %{buildroot}/%{_udevrulesdir}/60_f
%{_sbindir}/%{name}
%{_mandir}/man8/%{name}.*
%{_udevrulesdir}/60_flashrom.rules
%{_libdir}/libflashrom.so.1
%{_libdir}/libflashrom.so.1.0.0
%files devel
%{_includedir}/libflashrom.h
%{_libdir}/libflashrom.so
%{_libdir}/pkgconfig/flashrom.pc
%changelog
* Mon Feb 17 2020 Richard Hughes <richard@hughsie.com> - 1.2-2
- Build the package using meson to get the libflashrom shared library support
required by fwupd.
* Tue Feb 11 2020 mrnuke <mr.nuke.me@gmail.com> - 1.2-1
- Update to flashrom 1.2 (Release was intended to fix #1799344)