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