[packages/flashrom] - switched build to meson, now we get libflashrom library here - added meson-jlink patch (add missin

qboosh qboosh at pld-linux.org
Tue Jun 15 19:04:14 CEST 2021


commit 7a009e4c3995f51ef7e74055687747b18d84d1c8
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Jun 15 19:06:53 2021 +0200

    - switched build to meson, now we get libflashrom library here
    - added meson-jlink patch (add missing jaylink support to meson build)
    - use default _sbindir (meson complained about /sbin and already relies on libs in /usr)

 flashrom-meson-jlink.patch | 52 +++++++++++++++++++++++++
 flashrom.spec              | 97 ++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 137 insertions(+), 12 deletions(-)
---
diff --git a/flashrom.spec b/flashrom.spec
index 8e7a049..63e6b2a 100644
--- a/flashrom.spec
+++ b/flashrom.spec
@@ -1,5 +1,6 @@
 #
 # Conditional build:
+%bcond_without	apidocs	# API documentation
 %bcond_without	ftdi	# FTDI chips
 %bcond_without	jaylink	# J-Link chips
 #
@@ -12,18 +13,22 @@ License:	GPL v2+
 Group:		Applications/System
 Source0:	https://download.flashrom.org/releases/%{name}-v%{version}.tar.bz2
 # Source0-md5:	7f8e4b87087eb12ecee0fcc5445b4956
+Patch0:		%{name}-meson-jlink.patch
 URL:		https://www.flashrom.org/Flashrom
+%{?with_apidocs:BuildRequires:	doxygen}
 %{?with_ftdi:BuildRequires:	libftdi1-devel >= 1.0}
 %{?with_jaylink:BuildRequires:	libjaylink-devel}
 BuildRequires:	libusb-devel >= 1.0
+BuildRequires:	meson >= 0.47.0
+BuildRequires:	ninja >= 1.5
 BuildRequires:	pciutils-devel
+BuildRequires:	rpm-build >= 4.6
+BuildRequires:	rpmbuild(macros) >= 1.736
 BuildRequires:	pkgconfig
 BuildRequires:	zlib-devel
 ExclusiveArch:	%{ix86} %{x8664} x32 mips ppc ppc64 sparc sparcv9 sparc64
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-%define		_sbindir		/sbin
-
 %description
 flashrom is a utility for identifying, reading, writing, verifying and
 erasing flash chips. It's often used to flash BIOS / EFI / coreboot /
@@ -84,28 +89,96 @@ BIOS-u / EFI / coreboot / firmware'u.
    Debian/kFreeBSD), Dragonfly BSD, Solaris, Mac OS X oraz inne
    systemy operacyjne oparte na Uniksie, a także GNU Hurd.
 
+%package -n libflashrom
+Summary:	Flash ROM programming library
+Summary(pl.UTF-8):	Biblioteka do programowania pamięci Flash ROM
+Group:		Libraries
+
+%description -n libflashrom
+Flash ROM programming library.
+
+%description -n libflashrom -l pl.UTF-8
+Biblioteka do programowania pamięci Flash ROM.
+
+%package -n libflashrom-devel
+Summary:	Header files for libflashrom library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki libflashrom
+Group:		Development/Libraries
+Requires:	libflashrom = %{version}-%{release}
+
+%description -n libflashrom-devel
+Header files for libflashrom library.
+
+%description -n libflashrom-devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki libflashrom.
+
+%package -n libflashrom-apidocs
+Summary:	API documentation for libflashrom library
+Summary(pl.UTF-8):	Dokumentacja API biblioteki libflashrom
+Group:		Documentation
+BuildArch:	noarch
+
+%description -n libflashrom-apidocs
+API documentation for libflashrom library.
+
+%description -n libflashrom-apidocs -l pl.UTF-8
+Dokumentacja API biblioteki libflashrom.
+
 %prep
 %setup -q -n %{name}-v%{version}
+%patch0 -p1
 
 %build
-%{__make} \
-	CC='%{__cc}' \
-	CFLAGS="%{rpmcflags}" \
-	LDFLAGS="%{rpmldflags}" \
-	%{!?with_ftdi:CONFIG_FT2232_SPI=no} \
-	%{?with_jaylink:CONFIG_JLINK_SPI=yes}
+%meson build \
+	-Dconfig_atahpt=true \
+	-Dconfig_atapromise=true \
+	%{!?with_ftdi:-Dconfig_ft2232_spi=false} \
+	%{?with_jaylink:-Dconfig_jlink_spi=true} \
+	-Dconfig_mstarddc_spi=true \
+	-Dconfig_nicnatsemi=true \
+
+%ninja_build -C build
+
+# missing from meson
+%{__make} flashrom.8
+
+%if %{with apidocs}
+doxygen
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man8}
-install %{name} $RPM_BUILD_ROOT%{_sbindir}
-install %{name}.8 $RPM_BUILD_ROOT%{_mandir}/man8
+install -d $RPM_BUILD_ROOT%{_mandir}/man8
+
+%ninja_install -C build
+
+cp -p flashrom.8 $RPM_BUILD_ROOT%{_mandir}/man8
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post	-n libflashrom -p /sbin/ldconfig
+%postun	-n libflashrom -p /sbin/ldconfig
+
 %files
 %defattr(644,root,root,755)
-%doc README
+%doc README Documentation/*.txt
 %attr(755,root,root) %{_sbindir}/flashrom
 %{_mandir}/man8/flashrom.8*
+
+%files -n libflashrom
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libflashrom.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libflashrom.so.1
+
+%files -n libflashrom-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libflashrom.so
+%{_includedir}/libflashrom.h
+%{_pkgconfigdir}/flashrom.pc
+
+%if %{with apidocs}
+%files -n libflashrom-apidocs
+%defattr(644,root,root,755)
+%doc libflashrom-doc/html/{search,*.css,*.html,*.js,*.png}
+%endif
diff --git a/flashrom-meson-jlink.patch b/flashrom-meson-jlink.patch
new file mode 100644
index 0000000..e637004
--- /dev/null
+++ b/flashrom-meson-jlink.patch
@@ -0,0 +1,52 @@
+From 13a356815d2438103689a6ea1ac7e58d4d508ddb Mon Sep 17 00:00:00 2001
+From: Marc Schink <dev at zapb.de>
+Date: Tue, 8 Dec 2020 22:20:50 +0100
+Subject: [PATCH] meson: Add missing config option for J-Link SPI
+
+Signed-off-by: Marc Schink <dev at zapb.de>
+Change-Id: I476c649f9db7342688560aac9ee5df056517a028
+Reviewed-on: https://review.coreboot.org/c/flashrom/+/48478
+Tested-by: build bot (Jenkins) <no-reply at coreboot.org>
+Reviewed-by: Angel Pons <th3fanbus at gmail.com>
+Reviewed-by: Edward O'Callaghan <quasisec at chromium.org>
+---
+ meson.build       | 6 ++++++
+ meson_options.txt | 1 +
+ 2 files changed, 7 insertions(+)
+
+diff --git a/meson.build b/meson.build
+index fd5a5ef79..556183e5e 100644
+--- a/meson.build
++++ b/meson.build
+@@ -38,6 +38,7 @@ config_ch341a_spi = get_option('config_ch341a_spi')
+ config_dediprog = get_option('config_dediprog')
+ config_developerbox_spi = get_option('config_developerbox_spi')
+ config_digilent_spi = get_option('config_digilent_spi')
++config_jlink_spi = get_option('config_jlink_spi')
+ config_drkaiser = get_option('config_drkaiser')
+ config_dummy = get_option('config_dummy')
+ config_ene_lpc = get_option('config_ene_lpc')
+@@ -159,6 +160,11 @@ if config_digilent_spi
+   srcs += 'digilent_spi.c'
+   cargs += '-DCONFIG_DIGILENT_SPI=1'
+ endif
++if config_jlink_spi
++  srcs += 'jlink_spi.c'
++  cargs += '-DCONFIG_JLINK_SPI=1'
++  deps += dependency('libjaylink')
++endif
+ if config_drkaiser
+   srcs += 'drkaiser.c'
+   cargs += '-DCONFIG_DRKAISER=1'
+diff --git a/meson_options.txt b/meson_options.txt
+index 9c0a7982e..89fcbee88 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -9,6 +9,7 @@ option('config_ch341a_spi', type : 'boolean', value : true, description : 'Winch
+ option('config_dediprog', type : 'boolean', value : true, description : 'Dediprog SF100')
+ option('config_developerbox_spi', type : 'boolean', value : true, description : 'Developerbox emergency recovery')
+ option('config_digilent_spi', type : 'boolean', value : true, description : 'Digilent Development board JTAG')
++option('config_jlink_spi', type : 'boolean', value : false, description : 'SEGGER J-Link and compatible devices')
+ option('config_drkaiser', type : 'boolean', value : true, description : 'Dr. Kaiser')
+ option('config_dummy', type : 'boolean', value : true, description : 'dummy tracing')
+ option('config_ene_lpc', type : 'boolean', value : true, description : 'ENE LPC interface keyboard controller')
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/flashrom.git/commitdiff/7a009e4c3995f51ef7e74055687747b18d84d1c8



More information about the pld-cvs-commit mailing list