Fix numerous issues with pkgconfig files.

* Modifications like adding @SSL_CFLAGS@ to .pc.acr files that
    would be overwritten by `make pkgcfg` have been moved to
    Makefiles proper.
  * Missing .pc.acr files for libraries r_egg and r_crypto were
    added to the tree as well as the configure script.
  * Instead of explicitly listing every -lr_* library in every
    .pc file in the Libs: section, r_* libraries are now listed
    in the Requires: section, which ensures that flags get
    transitively propagated. This gets rid of the MAGICSED hack.
This commit is contained in:
whitequark 2018-01-10 14:08:35 +00:00 committed by radare
parent e5c22bd4f9
commit 0f97fdd228
29 changed files with 108 additions and 84 deletions

8
configure vendored
View File

@ -424,7 +424,7 @@ USE_LIB_MAGIC="1"
LIBMAGIC="-lmagic"
else
USE_LIB_MAGIC="0"
LIBMAGIC="-lr_magic"; fi
LIBMAGIC=""; fi
[ -z "${PKGCONFIG}" ] && PKGCONFIG=pkg-config
type ${PKGCONFIG} > /dev/null 2>&1 || echo "ERROR: Cannot find PKGCONFIG ${PKGCONFIG}"
echo 'Using PKGCONFIG: '${PKGCONFIG}
@ -451,10 +451,10 @@ USE_LIB_ZIP="1"
LIBZIP="-lz -lzip"
else
USE_LIB_ZIP="0"
LIBZIP="-lrz"; fi
LIBZIP=""; fi
else
USE_LIB_ZIP="0"
LIBZIP="-lrz"; fi
LIBZIP=""; fi
HAVE_LIB_GMP="0"
check_library HAVE_LIB_SSL ssl 0
[ -z "${PKGCONFIG}" ] && PKGCONFIG=pkg-config
@ -525,7 +525,7 @@ for A in ${ENVWORDS} ; do
SEDFLAGS="${SEDFLAGS}s,@${A}@,${VAR},g;"
done
SEDFLAGS="${SEDFLAGS}'"
for A in ./config-user.mk libr/include/r_userconf.h pkgcfg/r_io.pc pkgcfg/r_magic.pc pkgcfg/r_asm.pc pkgcfg/r_bin.pc pkgcfg/r_anal.pc pkgcfg/r_hash.pc pkgcfg/r_cons.pc pkgcfg/r_core.pc pkgcfg/r_lang.pc pkgcfg/r_socket.pc pkgcfg/r_debug.pc pkgcfg/r_reg.pc pkgcfg/r_config.pc pkgcfg/r_flag.pc pkgcfg/r_syscall.pc pkgcfg/r_util.pc pkgcfg/r_search.pc pkgcfg/r_bp.pc pkgcfg/r_parse.pc pkgcfg/r_fs.pc ; do # SUBDIRS
for A in ./config-user.mk libr/include/r_userconf.h pkgcfg/r_io.pc pkgcfg/r_magic.pc pkgcfg/r_asm.pc pkgcfg/r_bin.pc pkgcfg/r_anal.pc pkgcfg/r_hash.pc pkgcfg/r_cons.pc pkgcfg/r_core.pc pkgcfg/r_lang.pc pkgcfg/r_socket.pc pkgcfg/r_debug.pc pkgcfg/r_reg.pc pkgcfg/r_config.pc pkgcfg/r_flag.pc pkgcfg/r_syscall.pc pkgcfg/r_util.pc pkgcfg/r_search.pc pkgcfg/r_bp.pc pkgcfg/r_parse.pc pkgcfg/r_fs.pc pkgcfg/r_egg.pc pkgcfg/r_crypto.pc ; do # SUBDIRS
if [ -f "${VPATH}/${A}.acr" ]; then
SD_TARGET=${A}
else

View File

@ -18,7 +18,7 @@ IFAND HAVE_LIB_MAGIC USE_MAGIC {
LIBMAGIC = -lmagic ;
}{
USE_LIB_MAGIC = 0 ;
LIBMAGIC = -lr_magic ;
LIBMAGIC = ;
}
(( useful for static builds . see sys/static.sh ))
@ -43,11 +43,11 @@ IFAND HAVE_LIB_Z USE_ZIP {
LIBZIP = -lz -lzip ;
}{
USE_LIB_ZIP = 0 ;
LIBZIP = -lrz ; (( static linking to shlr/zip ))
LIBZIP = ; (( static linking to shlr/zip ))
}
}{
USE_LIB_ZIP = 0 ;
LIBZIP = -lrz ; (( static linking to shlr/zip ))
LIBZIP = ; (( static linking to shlr/zip ))
}
ARG_WITHOUT WITH_GPL gpl do not build GPL code (grub, cxx, ... ) ;
@ -161,4 +161,6 @@ SUBDIRS ./config-user.mk
pkgcfg/r_bp.pc
pkgcfg/r_parse.pc
pkgcfg/r_fs.pc
pkgcfg/r_egg.pc
pkgcfg/r_crypto.pc
;

View File

@ -5,6 +5,8 @@ NAME=r_core
DEPS=r_config r_cons r_io r_util r_flag r_asm
DEPS+=r_debug r_hash r_bin r_lang r_io r_anal r_parse r_bp r_egg
DEPS+=r_reg r_search r_syscall r_socket r_fs r_magic r_crypto
PCCFLAGS=@SSL_CFLAGS@ @CAPSTONE_CFLAGS@
PCLIBS=@SSL_LDFLAGS@ @CAPSTONE_LDFLAGS@
OBJS=core.o cmd.o file.o cconfig.o visual.o cio.o yank.o libs.o graph.o
OBJS+=fortune.o hack.o vasm.o patch.o cbin.o log.o rtr.o cmd_api.o

View File

@ -3,6 +3,7 @@ include $(LTOP)/config.mk
NAME=r_magic
DEPS=r_util
PCLIBS=@LIBMAGIC@
CFLAGS+=-I.
ifeq (${USE_LIB_MAGIC},1)
LDFLAGS+=-lmagic

View File

@ -25,7 +25,6 @@ CFLAGS+=-I$(LIBR)/include
LINK+=$(addprefix -L../,$(subst r_,,$(BINDEPS)))
LINK+=$(addprefix -l,$(BINDEPS))
SRC=$(subst .o,.c,$(OBJ))
MAGICSED=| sed -e 's,-lr_magic,@LIBMAGIC@,g'
BEXE=$(BIN)$(EXT_EXE)
@ -108,10 +107,10 @@ pkgcfg:
@echo 'Name: ${NAME}' >> ../../pkgcfg/${NAME}.pc.acr
@echo 'Description: radare foundation libraries' >> ../../pkgcfg/${NAME}.pc.acr
@echo 'Version: @VERSION@' >> ../../pkgcfg/${NAME}.pc.acr
@echo 'Requires:' >> ../../pkgcfg/${NAME}.pc.acr
@echo 'Requires: $(filter r_%,${DEPS})' >> ../../pkgcfg/${NAME}.pc.acr
@if [ "${NAME}" = "libr" ]; then NAME=''; else NAME=${NAME}; fi ;\
echo 'Libs: -L$${libdir} '`echo $${NAME} ${DEPS}|sed -e s,r_,-lr_,g` ${MAGICSED} >> ../../pkgcfg/${NAME}.pc.acr
@echo 'Cflags: -I$${includedir}/libr' >> ../../pkgcfg/${NAME}.pc.acr
echo 'Libs: -L$${libdir} -l${NAME} $(filter-out r_%,${DEPS}) ${PCLIBS}' >> ../../pkgcfg/${NAME}.pc.acr
@echo 'Cflags: -I$${includedir}/libr ${PCCFLAGS}' >> ../../pkgcfg/${NAME}.pc.acr
clean:: ${EXTRA_CLEAN}
-rm -f *.${EXT_EXE} *.${EXT_SO} *.${EXT_AR} *.d */*.d */*/*.d */*/*/*.d

View File

@ -2,7 +2,7 @@ include ../config.mk
NAME=r_util
CFLAGS+=-DCORELIB -I$(TOP)/shlr
DEPS=
PCLIBS=@LIBZIP@ @DL_LIBS@
OBJS=binheap.o mem.o pool.o unum.o str.o hex.o file.o range.o tinyrange.o
OBJS+=prof.o cache.o sys.o buf.o w32-sys.o ubase64.o base85.o base91.o

View File

@ -1,2 +0,0 @@
all:
$(MAKE) -C libr pkgcfg

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_anal
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_anal -lr_util -lr_reg -lr_syscall -lr_search -lr_cons -lr_flag
Requires: r_util r_reg r_syscall r_search r_cons r_flag
Libs: -L${libdir} -lr_anal
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_asm
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_asm -lr_syscall -lr_lang -lr_util -lr_parse -lr_flag -lr_cons -lr_reg
Requires: r_syscall r_lang r_util r_parse r_flag r_cons r_reg
Libs: -L${libdir} -lr_asm
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_bin
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_bin -lr_util -lr_io -lr_socket @LIBMAGIC@
Requires: r_util r_io r_socket r_magic
Libs: -L${libdir} -lr_bin
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_bp
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_bp -lr_util
Requires: r_util
Libs: -L${libdir} -lr_bp
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_config
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_config -lr_util
Requires: r_util
Libs: -L${libdir} -lr_config
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_cons
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_cons -lr_util
Requires: r_util
Libs: -L${libdir} -lr_cons
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_core
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_core -lr_config -lr_cons -lr_io -lr_util -lr_flag -lr_asm -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_bp -lr_egg -lr_reg -lr_search -lr_syscall -lr_socket -lr_fs @LIBMAGIC@ -lr_crypto -lr_crypto @LIBMAGIC@ @SSL_LDFLAGS@ @CAPSTONE_LDFLAGS@
Requires: r_config r_cons r_io r_util r_flag r_asm r_debug r_hash r_bin r_lang r_io r_anal r_parse r_bp r_egg r_reg r_search r_syscall r_socket r_fs r_magic r_crypto r_crypto
Libs: -L${libdir} -lr_core @SSL_LDFLAGS@ @CAPSTONE_LDFLAGS@
Cflags: -I${includedir}/libr @SSL_CFLAGS@ @CAPSTONE_CFLAGS@

11
pkgcfg/r_crypto.pc.acr Normal file
View File

@ -0,0 +1,11 @@
prefix=@PREFIX@
exec_prefix=${prefix}
libdir=@LIBDIR@
includedir=${prefix}/include
Name: r_crypto
Description: radare foundation libraries
Version: @VERSION@
Requires: r_hash r_util r_util r_util
Libs: -L${libdir} -lr_crypto
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_debug
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_debug -lr_reg -lr_anal -lr_bp -lr_io -lr_parse -lr_cons -lr_syscall -lr_hash -lr_flag -lr_util -lr_egg -lr_socket
Requires: r_reg r_anal r_bp r_io r_parse r_cons r_syscall r_hash r_flag r_util r_egg r_socket
Libs: -L${libdir} -lr_debug
Cflags: -I${includedir}/libr

11
pkgcfg/r_egg.pc.acr Normal file
View File

@ -0,0 +1,11 @@
prefix=@PREFIX@
exec_prefix=${prefix}
libdir=@LIBDIR@
includedir=${prefix}/include
Name: r_egg
Description: radare foundation libraries
Version: @VERSION@
Requires: r_asm r_syscall r_util r_parse r_reg r_flag r_cons
Libs: -L${libdir} -lr_egg
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_flag
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_flag -lr_util
Requires: r_util
Libs: -L${libdir} -lr_flag
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_fs
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_fs -lr_util -lr_io
Requires: r_util r_io
Libs: -L${libdir} -lr_fs
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_io
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_io -lr_util -lr_socket
Requires: r_util r_socket
Libs: -L${libdir} -lr_io
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_lang
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_lang -lr_util -lr_cons
Requires: r_util r_cons
Libs: -L${libdir} -lr_lang
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_magic
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} @LIBMAGIC@ -lr_util
Requires: r_util
Libs: -L${libdir} -lr_magic @LIBMAGIC@
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_parse
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_parse -lr_flag -lr_util -lr_syscall -lr_reg -lr_cons
Requires: r_flag r_util r_syscall r_reg r_cons
Libs: -L${libdir} -lr_parse
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_reg
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_reg -lr_util
Requires: r_util
Libs: -L${libdir} -lr_reg
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_search
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_search -lr_util
Requires: r_util
Libs: -L${libdir} -lr_search
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_socket
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_socket -lr_util
Requires: r_util
Libs: -L${libdir} -lr_socket
Cflags: -I${includedir}/libr

View File

@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: r_syscall
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_syscall -lr_util
Requires: r_util
Libs: -L${libdir} -lr_syscall
Cflags: -I${includedir}/libr

View File

@ -7,5 +7,5 @@ Name: r_util
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_util
Libs: -L${libdir} -lr_util @LIBZIP@ @DL_LIBS@
Cflags: -I${includedir}/libr