package/pifmrds: use pkg-config
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Sun, 23 May 2021 10:11:21 +0000 (12:11 +0200)
committerYann E. MORIN <yann.morin.1998@free.fr>
Mon, 24 May 2021 12:01:05 +0000 (14:01 +0200)
Use pkg-config to retrieve libsndfile dependencies

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
package/pifmrds/0003-Makefile-fix-static-link.patch
package/pifmrds/pifmrds.mk

index ecd7c4fc4cb612ec1814fb5b94ec45134e0be82a..3bd91c981f217df4b805cb3beecccaecdb0521b4 100644 (file)
@@ -4,6 +4,8 @@ Since libsndfile uses funtions from libm, the -lm should be specified
 after libsndfile for static linking.
 
 Signed-off-by: "Eric Limpens" <Limpens@gmail.com>
+[Fabrice: add $(SNDFILE_LIBS) to pass all dependencies from pkg-config]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
 
 diff -purN pifmrds-0bf57f9ce0d954365a38d8af8e7be6f28521c3f2.orig/src/Makefile pifmrds-0bf57f9ce0d954365a38d8af8e7be6f28521c3f2/src/Makefile
 --- pifmrds-0bf57f9ce0d954365a38d8af8e7be6f28521c3f2.orig/src/Makefile 2016-02-26 08:06:43.102962592 +0100
@@ -13,11 +15,11 @@ diff -purN pifmrds-0bf57f9ce0d954365a38d8af8e7be6f28521c3f2.orig/src/Makefile pi
  
  app: rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o
 -      $(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -lm -lsndfile
-+      $(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -lsndfile -lm
++      $(CC) $(LDFLAGS) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o $(SNDFILE_LIBS)
  
  rds_wav: rds.o waveforms.o rds_wav.o fm_mpx.o
 -      $(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o -lm -lsndfile
-+      $(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o -lsndfile -lm
++      $(CC) $(LDFLAGS) -o rds_wav rds_wav.o rds.o waveforms.o fm_mpx.o $(SNDFILE_LIBS)
  
  rds.o: rds.c waveforms.h
        $(CC) $(CFLAGS) rds.c
index 509ec808768e98133d5f858a190abe0133deb77c..33c13bae337ddafed5cea954e931d47d697f4d31 100644 (file)
@@ -6,13 +6,14 @@
 
 PIFMRDS_VERSION = 0bf57f9ce0d954365a38d8af8e7be6f28521c3f2
 PIFMRDS_SITE = $(call github,ChristopheJacquet,PiFmRds,$(PIFMRDS_VERSION))
-PIFMRDS_DEPENDENCIES = libsndfile
+PIFMRDS_DEPENDENCIES = host-pkgconf libsndfile
 PIFMRDS_LICENSE = GPL-3.0+
 PIFMRDS_LICENSE_FILES = LICENSE
 
 define PIFMRDS_BUILD_CMDS
        $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src CC="$(TARGET_CC)" LDFLAGS="$(TARGET_LDFLAGS)" \
                CFLAGS="$(TARGET_CFLAGS) -std=gnu99 -ffast-math -c" \
+               SNDFILE_LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs sndfile`" \
                app rds_wav
 endef