From 704b860700fa3d3941a35f1b5008a6ad573725c5 Mon Sep 17 00:00:00 2001 From: pancake Date: Wed, 4 May 2016 01:31:07 +0200 Subject: [PATCH] Fix #4762 - Remove shared plugins that are already static --- Makefile | 2 ++ configure-plugins | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/Makefile b/Makefile index c84d47a1a5..f5a99e71da 100644 --- a/Makefile +++ b/Makefile @@ -196,6 +196,7 @@ install love: install-doc install-man install-www cp -f doc/hud "${DESTDIR}${LIBDIR}/radare2/${VERSION}/hud/main" mkdir -p "${DESTDIR}${DATADIR}/radare2/${VERSION}/" sys/ldconfig.sh + ./configure-plugins --rm-static $(DESTDIR)/$(LIBDIR)/radare2/last/ # Remove make .d files. fixes build when .c files are removed rmd: @@ -239,6 +240,7 @@ symstall install-symlink: install-man-symlink install-doc-symlink install-pkgcon ln -fs "${PWD}/doc/hud" "${DESTDIR}${LIBDIR}/radare2/${VERSION}/hud/main" mkdir -p "${DESTDIR}${DATADIR}/radare2/${VERSION}/" sys/ldconfig.sh + ./configure-plugins --rm-static $(DESTDIR)/$(LIBDIR)/radare2/last/ deinstall uninstall: cd libr && ${MAKE} uninstall PARENT=1 diff --git a/configure-plugins b/configure-plugins index 33a1234772..31f46f579b 100755 --- a/configure-plugins +++ b/configure-plugins @@ -22,6 +22,7 @@ help () { echo "Usage: ./configure-plugins [options]" echo " -n do nothing.. do not generate any file" echo " --list list all static and shared plugins" + echo " --rm-static [dir] remove plugins that are already in core from dir" echo " --static [name ..] define named plugin as static" echo " --shared [name ..] define named plugin as shared" echo " --help, -h display this helpful message" @@ -166,6 +167,29 @@ MODE="" DONOTHING=0 DEFCFG=./plugins.def.cfg +rmstatic() { + C=0 + if [ -z "$1" ]; then + echo "Missing argument" + exit 1 + fi + for a in ${STATIC} ; do + b="`echo $a | tr . _`" + for ext in dll dylib so ; do + f="$b.$ext" + if [ -f "$f" ]; then + C=$(($C+1)) + printf " $C found\r" + #echo "rm -f $f" + rm -f "$f" + fi + done + done + echo "Removed $C shared plugins that are already static" +} + +RMSTATIC=- + while : ; do [ -z "$1" ] && break case "$1" in @@ -173,6 +197,7 @@ while : ; do "--shared") MODE=shared ; ;; "--without-gpl") DEFCFG=./plugins.nogpl.cfg ;; "--disable-loadlibs") LOADLIBS=0 ;; + "--rm-static") RMSTATIC="$2" ; ;; "--list") sort_vars ; list ; ;; "-n") DONOTHING=1 ; ;; "-h"|"--help") help ; ;; @@ -184,6 +209,17 @@ done load ${DEFCFG} sort_vars +if [ - != "${RMSTATIC}" ]; then + if [ -z "${RMSTATIC}" ]; then + echo "Missing argument" > /dev/stderr + exit + fi + if [ -d "${RMSTATIC}" ]; then + cd "${RMSTATIC}" && rmstatic "${RMSTATIC}" + fi + exit 0 +fi + [ ${DONOTHING} = 0 ] && generate echo SHARED: ${SHARED}