1*4882a593SmuzhiyunFrom d079cac1110cc2761417f0dcb0a142b217eb1eda Mon Sep 17 00:00:00 2001 2*4882a593SmuzhiyunFrom: Fabrice Fontaine <fontaine.fabrice@gmail.com> 3*4882a593SmuzhiyunDate: Fri, 31 Jan 2020 20:26:29 +0100 4*4882a593SmuzhiyunSubject: [PATCH] Add libmagic.pc 5*4882a593Smuzhiyun 6*4882a593Smuzhiyunlibmagic can optionally depends on xz (for lzma) or bzip2 since version 7*4882a593Smuzhiyun5.38 and 8*4882a593Smuzhiyunhttps://github.com/file/file/commit/b259a07ea95827f565faa20f0316e5b2704064f7 9*4882a593Smuzhiyunso add libmagic.pc so package (such as gerbera) that links with libmagic 10*4882a593Smuzhiyunwill be able to use pkg-config to retrieve those static dependencies 11*4882a593SmuzhiyunFor example, this will avoid the following build failure: 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun[100%] Linking CXX executable gerbera 14*4882a593Smuzhiyun/home/br-user/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/br-user/autobuild/run/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmagic.a(compress.o): in function `uncompressbuf': 15*4882a593Smuzhiyuncompress.c:(.text+0x69c): undefined reference to `BZ2_bzDecompressInit' 16*4882a593Smuzhiyun/home/br-user/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: compress.c:(.text+0x710): undefined reference to `BZ2_bzDecompress' 17*4882a593Smuzhiyun/home/br-user/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: compress.c:(.text+0x730): undefined reference to `BZ2_bzDecompressEnd' 18*4882a593Smuzhiyun/home/br-user/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: compress.c:(.text+0x7bc): undefined reference to `lzma_auto_decoder' 19*4882a593Smuzhiyun/home/br-user/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: compress.c:(.text+0x828): undefined reference to `lzma_code' 20*4882a593Smuzhiyun/home/br-user/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: compress.c:(.text+0x848): undefined reference to `lzma_end' 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunFixes: 23*4882a593Smuzhiyun - http://autobuild.buildroot.org/results/37b1ef54dc41100689f311fbc31fc9300dc6ae63 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunSigned-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 26*4882a593Smuzhiyun[Upstream status: https://bugs.astron.com/view.php?id=136] 27*4882a593Smuzhiyun--- 28*4882a593Smuzhiyun Makefile.am | 5 +++++ 29*4882a593Smuzhiyun configure.ac | 2 +- 30*4882a593Smuzhiyun libmagic.pc.in | 10 ++++++++++ 31*4882a593Smuzhiyun 3 files changed, 16 insertions(+), 1 deletion(-) 32*4882a593Smuzhiyun create mode 100644 libmagic.pc.in 33*4882a593Smuzhiyun 34*4882a593Smuzhiyundiff --git a/Makefile.am b/Makefile.am 35*4882a593Smuzhiyunindex 8bd927d9..2ab67ed7 100644 36*4882a593Smuzhiyun--- a/Makefile.am 37*4882a593Smuzhiyun+++ b/Makefile.am 38*4882a593Smuzhiyun@@ -3,3 +3,8 @@ ACLOCAL_AMFLAGS = -I m4 39*4882a593Smuzhiyun EXTRA_DIST = MAINT 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun SUBDIRS = src magic tests doc python 42*4882a593Smuzhiyun+ 43*4882a593Smuzhiyun+# This variable must have 'exec' in its name, in order to be installed 44*4882a593Smuzhiyun+# by 'install-exec' target (instead of default 'install-data') 45*4882a593Smuzhiyun+pkgconfigexecdir = $(libdir)/pkgconfig 46*4882a593Smuzhiyun+pkgconfigexec_DATA = libmagic.pc 47*4882a593Smuzhiyundiff --git a/configure.ac b/configure.ac 48*4882a593Smuzhiyunindex ac37fccd..b2e2e5b8 100644 49*4882a593Smuzhiyun--- a/configure.ac 50*4882a593Smuzhiyun+++ b/configure.ac 51*4882a593Smuzhiyun@@ -217,5 +217,5 @@ if test "$ac_cv_header_lzma_h$ac_cv_lib_lzma_lzma_stream_decoder" = "yesyes"; t 52*4882a593Smuzhiyun AC_DEFINE([XZLIBSUPPORT], 1, [Enable xzlib compression support]) 53*4882a593Smuzhiyun fi 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun-AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile]) 56*4882a593Smuzhiyun+AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile libmagic.pc]) 57*4882a593Smuzhiyun AC_OUTPUT 58*4882a593Smuzhiyundiff --git a/libmagic.pc.in b/libmagic.pc.in 59*4882a593Smuzhiyunnew file mode 100644 60*4882a593Smuzhiyunindex 00000000..3ad1290b 61*4882a593Smuzhiyun--- /dev/null 62*4882a593Smuzhiyun+++ b/libmagic.pc.in 63*4882a593Smuzhiyun@@ -0,0 +1,10 @@ 64*4882a593Smuzhiyun+prefix=@prefix@ 65*4882a593Smuzhiyun+exec_prefix=@exec_prefix@ 66*4882a593Smuzhiyun+libdir=@libdir@ 67*4882a593Smuzhiyun+includedir=@includedir@ 68*4882a593Smuzhiyun+ 69*4882a593Smuzhiyun+Name: libmagic 70*4882a593Smuzhiyun+Description: Magic number recognition library 71*4882a593Smuzhiyun+Version: @VERSION@ 72*4882a593Smuzhiyun+Libs: -L${libdir} -lmagic 73*4882a593Smuzhiyun+Libs.private: @LIBS@ 74*4882a593Smuzhiyun-- 75*4882a593Smuzhiyun2.24.1 76*4882a593Smuzhiyun 77