summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szuba <marecki@gentoo.org>2020-07-29 00:09:18 +0200
committerMarek Szuba <marecki@gentoo.org>2020-07-29 00:13:21 +0200
commitc6600e403c0fc58fc168d7f3b2d0b911ed836fca (patch)
tree5b7174eb5558764da309553256c99419b2a31bea /sys-apps/flashrom/files
parentapp-text/podofo: Remove vulnerable <0.9.6_p20190928 (diff)
downloadgentoo-c6600e403c0fc58fc168d7f3b2d0b911ed836fca.tar.gz
gentoo-c6600e403c0fc58fc168d7f3b2d0b911ed836fca.tar.bz2
gentoo-c6600e403c0fc58fc168d7f3b2d0b911ed836fca.zip
sys-apps/flashrom: try making libflashrom usable for sys-apps/fwupd
Create a pkgconfig file so that fwupd can actually find this library, and fix a makefile bug which left the symbol 'boards_known' undefined in the library. Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'sys-apps/flashrom/files')
-rw-r--r--sys-apps/flashrom/files/flashrom-1.2_make-libflashrom-usable.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/sys-apps/flashrom/files/flashrom-1.2_make-libflashrom-usable.patch b/sys-apps/flashrom/files/flashrom-1.2_make-libflashrom-usable.patch
new file mode 100644
index 000000000000..ea15a4230592
--- /dev/null
+++ b/sys-apps/flashrom/files/flashrom-1.2_make-libflashrom-usable.patch
@@ -0,0 +1,70 @@
+1. Add an (extremely primitive) rule for generating a pkgconfig file
+ for libflashrom, as fwupd cannot find it without one. Note that this
+ rule depends on several variables to be passed to make, see ebuilds
+ using this patch for details;
+2. Tweak the way library dependencies are passed around a bit to make it
+ easier to inject them into said pkgconfig file;
+3. Move print.o from CLI_OBJS to LIB_OBJS - it contains the array
+ 'boards_known' which is used in library code. Upstream have already
+ fixed this in Meson files but not in the Makefile.
+
+diff -urN a/flashrom.pc.in b/flashrom.pc.in
+--- a/flashrom.pc.in 1970-01-01 01:00:00.000000000 +0100
++++ b/flashrom.pc.in 2020-07-28 22:47:01.928679346 +0200
+@@ -0,0 +1,9 @@
++prefix=@PREFIX@
++libdir=${prefix}/@LIBDIR@
++includedir=${prefix}/@INCLUDEDIR@
++
++Name: libflashrom
++Description: library to interact with flashrom
++Version: @VERSION@
++Libs: -L${libdir} -lflashrom @LIBS@
++Cflags: -I${includedir}
+diff -urN a/Makefile b/Makefile
+--- a/Makefile 2019-12-31 18:25:41.000000000 +0100
++++ b/Makefile 2020-07-28 23:18:41.019492448 +0200
+@@ -570,12 +570,12 @@
+ ###############################################################################
+ # Library code.
+
+-LIB_OBJS = libflashrom.o layout.o flashrom.o udelay.o programmer.o helpers.o ich_descriptors.o fmap.o
++LIB_OBJS = libflashrom.o layout.o flashrom.o udelay.o programmer.o helpers.o ich_descriptors.o fmap.o print.o
+
+ ###############################################################################
+ # Frontend related stuff.
+
+-CLI_OBJS = cli_classic.o cli_output.o cli_common.o print.o
++CLI_OBJS = cli_classic.o cli_output.o cli_common.o
+
+ # versioninfo.inc stores metadata required to build a packaged flashrom. It is generated by the export rule and
+ # imported below. If versioninfo.inc is not found and the variables are not defined by the user, the info will
+@@ -1130,11 +1130,16 @@
+ @+$(MAKE) -C util/ich_descriptors_tool/ TARGET_OS=$(TARGET_OS) EXEC_SUFFIX=$(EXEC_SUFFIX)
+ endif
+
++ALL_LIBS = $(LIBS) $(PCILIBS) $(FEATURE_LIBS) $(USBLIBS) $(USB1LIBS) $(JAYLINKLIBS) $(NI845X_LIBS)
++
++flashrom.pc:
++ sed -e "s#@PREFIX@#$(PREFIX)#" -e "s#@LIBDIR@#$(LIBDIR)#" -e "s#@INCLUDEDIR@#$(INCLUDEDIR)#" -e "s#@VERSION@#$(VERSION)#" -e "s#@LIBS@#$(ALL_LIBS)#" < $@.in > $@.tmp && mv $@.tmp $@
++
+ $(PROGRAM)$(EXEC_SUFFIX): $(OBJS)
+- $(CC) $(LDFLAGS) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJS) $(LIBS) $(PCILIBS) $(FEATURE_LIBS) $(USBLIBS) $(USB1LIBS) $(JAYLINKLIBS) $(NI845X_LIBS)
++ $(CC) $(LDFLAGS) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJS) $(ALL_LIBS)
+
+-libflashrom.a: $(LIBFLASHROM_OBJS)
+- $(AR) rcs $@ $^
++libflashrom.a: $(LIBFLASHROM_OBJS) flashrom.pc
++ $(AR) rcs $@ $(LIBFLASHROM_OBJS)
+ $(RANLIB) $@
+
+ # TAROPTIONS reduces information leakage from the packager's system.
+@@ -1149,7 +1154,7 @@
+ # This includes all frontends and libflashrom.
+ # We don't use EXEC_SUFFIX here because we want to clean everything.
+ clean:
+- rm -f $(PROGRAM) $(PROGRAM).exe libflashrom.a *.o *.d $(PROGRAM).8 $(PROGRAM).8.html $(BUILD_DETAILS_FILE)
++ rm -f $(PROGRAM) $(PROGRAM).exe libflashrom.a flashrom.pc *.o *.d $(PROGRAM).8 $(PROGRAM).8.html $(BUILD_DETAILS_FILE)
+ @+$(MAKE) -C util/ich_descriptors_tool/ clean
+
+ distclean: clean