* Honor --libdir --includedir and --bindir

* Put rsc2 scripts in ${LIBDIR}/radare2/bin
* Force RELEASE=1 in r2-bindings. Oops
This commit is contained in:
pancake 2011-07-19 11:25:11 +02:00
parent afbe4894a7
commit ad30b95b45
7 changed files with 93 additions and 71 deletions

View File

@ -85,8 +85,8 @@ install: install-doc install-man
cd binr && ${MAKE} install PREFIX=${PREFIX} DESTDIR=${DESTDIR}
install-pkgconfig-symlink:
@${INSTALL_DIR} ${PFX}/lib/pkgconfig
cd pkgcfg ; for a in *.pc ; do ln -fs $${PWD}/$$a ${PFX}/lib/pkgconfig/$$a ; done
@${INSTALL_DIR} ${DESTDIR}/${LIBDIR}/pkgconfig
cd pkgcfg ; for a in *.pc ; do ln -fs $${PWD}/$$a ${DESTDIR}/${LIBDIR}/pkgconfig/$$a ; done
symstall install-symlink: install-man-symlink install-doc-symlink install-pkgconfig-symlink
cd libr && ${MAKE} install-symlink PREFIX=${PREFIX} DESTDIR=${DESTDIR}
@ -100,15 +100,15 @@ deinstall uninstall:
@echo
purge:
rm -rf ${DESTDIR}/${PREFIX}/lib/libr_*
rm -rf ${DESTDIR}/${PREFIX}/lib/radare2
rm -rf ${DESTDIR}/${PREFIX}/include/libr
rm -rf ${DESTDIR}/${LIBDIR}/libr_*
rm -rf ${DESTDIR}/${LIBDIR}/radare2
rm -rf ${DESTDIR}/${INCLUDEDIR}/libr
cd man ; for a in *.1 ; do rm -f ${MDR}/man1/$$a ; done
rm -f ${MDR}/man1/r2.1
beta: dist r2-bindings-dist
scp ../radare2-${VERSION}.tar.gz ${REMOTE}
scp radare2-bindings-${VERSION}.tar.gz ${REMOTE}
scp r2-bindings-${VERSION}.tar.gz ${REMOTE}
r2-bindings-dist:
cd r2-bindings && ${MAKE} dist

View File

@ -3,7 +3,9 @@ PWD=$(shell pwd)
.PHONY: all clean install install-symlink deinstall uninstall mrproper
PFX=${DESTDIR}${PREFIX}
PFX=${DESTDIR}/${PREFIX}
BFX=${DESTDIR}/${BINDIR}
LFX=${DESTDIR}/${LIBDIR}
BINS=rax2 rasm2 rabin2 rahash2 radiff2 radare2 rafind2 rarc2 ranal2 rasc2 rsc2
@ -11,32 +13,32 @@ all:
@for a in ${BINS} ; do (cd $$a && ${MAKE} all) || exit 1; done
install:
mkdir -p ${PFX}/bin
mkdir -p ${BFX}
pwd
for a in ${BINS} ; do ${INSTALL_PROGRAM} $$a/$$a ${PFX}/bin/$$a ; done
#for a in ${BINS} ; do cp -f $$a/$$a ${PFX}/bin/$$a ; done
for a in ${BINS} ; do ${INSTALL_PROGRAM} $$a/$$a ${BFX}/$$a ; done
#for a in ${BINS} ; do cp -f $$a/$$a ${BFX}/$$a ; done
# rarc2
cp -f rarc2/rarc2 ${PFX}/bin
cp -f rarc2/rarc2-tool ${PFX}/bin
cp -f rarc2/rarc2 ${BFX}
cp -f rarc2/rarc2-tool ${BFX}
# shortcut
-cd ${PFX}/bin && rm -f r2 ; ln -fs radare2 r2
mkdir -p ${PFX}/lib/radare/bin
cp -f rsc2/scripts/* ${PFX}/lib/radare/bin
chmod +x ${PFX}/lib/radare/bin/*
-cd ${BFX} && rm -f r2 ; ln -fs radare2 r2
mkdir -p ${LFX}/radare2/bin
cp -f rsc2/scripts/* ${LFX}/radare2/bin
chmod +x ${LFX}/radare2/bin/*
symstall install-symlink:
mkdir -p ${PFX}/bin
mkdir -p ${PFX}/lib/radare/bin
mkdir -p ${BFX}
mkdir -p ${LFX}/radare/bin
chmod +x rsc2/scripts/*
cd rsc2/scripts ; for a in * ; do ln -fs ${PWD}/rsc2/scripts/$$a ${PFX}/lib/radare/bin/$$a ; done
for a in ${BINS} ; do ln -fs ${PWD}/$$a/$$a ${PFX}/bin/$$a ; done
ln -fs ${PWD}/rarc2/rarc2-tool ${PFX}/bin/rarc2-tool
-ln -fs ${PFX}/bin/radare2 ${PFX}/bin/r2
cd rsc2/scripts ; for a in * ; do ln -fs ${PWD}/rsc2/scripts/$$a ${LFX}/radare/bin/$$a ; done
for a in ${BINS} ; do ln -fs ${PWD}/$$a/$$a ${BFX}/$$a ; done
ln -fs ${PWD}/rarc2/rarc2-tool ${BFX}/rarc2-tool
-ln -fs ${PFX}/bin/radare2 ${BFX}/r2
deinstall uninstall:
for a in ${BINS} ; do rm -f ${PFX}/bin/$$a ; done
rm -f ${PFX}/bin/rarc2-tool
-rm -f ${PFX}/bin/r2
for a in ${BINS} ; do rm -f ${BFX}/$$a ; done
rm -f ${BFX}/rarc2-tool
-rm -f ${BFX}/r2
clean:
@for a in ${BINS} ; do (cd $$a && ${MAKE} clean); done

View File

@ -28,10 +28,10 @@
#include <r_util.h>
//#define DATADIR "/usr/share/"
#define RSCDATADIR LIBDIR"/radare/bin"
#define RSCDATADIR LIBDIR"/radare2/bin"
static void rsc_help() {
printf ("Usage: rsc [-l] [script] [-h]\n");
printf ("Usage: rsc2 [-l] [script] [-h]\n");
printf ("RSCDATADIR="RSCDATADIR"\n");
}
@ -122,7 +122,7 @@ static int rsc_run(int argc, const char **argv) {
for (i=2;i<argc;i++) {
strncat (buf, "\"", sizeof (buf));
strncat (buf, argv[i], sizeof (buf));
strncat (buf, argv[i], sizeof (buf)-4);
strncat (buf, "\" ", sizeof (buf));
}
// printf("system('%s')\n", buf);

View File

@ -2,7 +2,10 @@
DESTDIR=
PREFIX=@PREFIX@
BINDIR=@BINDIR@
LIBDIR=@LIBDIR@
MANDIR=@MANDIR@
INCLUDEDIR=@INCLUDEDIR@
HAVE_LIB_EWF=@HAVE_LIB_EWF@
HAVE_LIB_GMP=@HAVE_LIB_GMP@
LIL_ENDIAN=@LIL_ENDIAN@

View File

@ -50,5 +50,21 @@ Before any release we have to:
simplificable use cases of the API for every module.
FUTURE
------
- Commands should be handled in a structural way, not by a bunch of switch/cases
HOW TO RELEASE
--------------
- Set RELEASE=1 in global.mk and r2-bindings/config.mk.acr
== RADARE2
- bump revision
- ./configure
- make dist
== R2-BINDINGS
- ./configure --enable-devel
- make
- make dist

View File

@ -2,9 +2,10 @@ include ../global.mk
include config.mk
PREFIX?=${PWD}/../prefix
PFX=${DESTDIR}${PREFIX}
PFX=${DESTDIR}/${PREFIX}
LFX=${DESTDIR}/${LIBDIR}
IFX=${DESTDIR}/${INCLUDEDIR}
PWD=`pwd`
#PREFIX=${PFX}
# Libraries
LIBLIST=util socket cons line lib io lang flags bin hash config syscall cmd
@ -26,31 +27,31 @@ pkgcfg:
# TODO: Magically generate libr.pc.acr here using LIBLIST and so :)
install-pkgconfig:
@${INSTALL_DIR} ${PFX}/lib/pkgconfig
for a in ../pkgcfg/*.pc ; do ${INSTALL_DATA} $$a ${PFX}/lib/pkgconfig ; done
@${INSTALL_DIR} ${LFX}/pkgconfig
for a in ../pkgcfg/*.pc ; do ${INSTALL_DATA} $$a ${LFX}/pkgconfig ; done
install-includes:
@${INSTALL_DIR} ${PFX}/include/libr
(cd include && for a in *.h ; do ${INSTALL_DATA} $$a ${PFX}/include/libr ; done)
@${INSTALL_DIR} ${IFX}/libr
(cd include && for a in *.h ; do ${INSTALL_DATA} $$a ${IFX}/libr ; done)
install-symlink:
mkdir -p ${PFX}/bin
mkdir -p ${PFX}/include
mkdir -p ${PFX}/lib/pkgconfig
mkdir -p ${PFX}/lib/radare2/${VERSION}
rm -rf ${PFX}/include/libr && ln -fs ${PWD}/include ${PFX}/include/libr
mkdir -p ${IFX}
mkdir -p ${LFX}/pkgconfig
mkdir -p ${LFX}/radare2/${VERSION}
rm -rf ${IFX}/libr && ln -fs ${PWD}/include ${IFX}/libr
cd ../pkgcfg && for a in *.pc ; do \
if [ -e ${PWD}/../pkgcfg/$${a} ] ; then \
ln -fs ${PWD}/../pkgcfg/$${a} ${PFX}/lib/pkgconfig/$${a} ; \
ln -fs ${PWD}/../pkgcfg/$${a} ${LFX}/pkgconfig/$${a} ; \
fi ; \
done
for a in ${LIBLIST} ; do \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${PFX}/lib/libr_$${a}.${EXT_SO} ; \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${PFX}/lib/libr_$${a}.${EXT_SO}.${LIBVERSION} ; \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_AR} ${PFX}/lib/libr_$${a}.${EXT_AR} ; \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${LFX}/libr_$${a}.${EXT_SO} ; \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${LFX}/libr_$${a}.${EXT_SO}.${LIBVERSION} ; \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_AR} ${LFX}/libr_$${a}.${EXT_AR} ; \
for b in $${a}/p/*.${EXT_SO} ; do \
if [ -e ${PWD}/$${b} ] ; then \
ln -fs ${PWD}/$${b} ${PFX}/lib/radare2/${VERSION}/ ; \
ln -fs ${PWD}/$${b} ${LFX}/radare2/${VERSION}/ ; \
fi ; \
done ; \
done
@ -58,59 +59,59 @@ install-symlink:
install: install-includes install-pkgconfig
# TODO :Use INSTALL_DATA_DIR instead of mkdir
# libraries
@${INSTALL_DIR} ${PFX}/lib
@${INSTALL_DIR} ${LFX}
@for a in `find * -type f | grep -e '\.${EXT_SO}$$' | grep -v lib/t | grep lib | grep -v /p/` ; do \
b=`echo $$a|cut -d / -f 2`; \
echo " ${PFX}/lib/$$b.${LIBVERSION}"; \
${INSTALL_LIB} $$a ${PFX}/lib/$$b.${LIBVERSION} ; \
( cd ${PFX}/lib ; ln -fs $$b.${LIBVERSION} $$b.0 ; ln -fs $$b.0 $$b ); \
echo " ${LFX}/$$b.${LIBVERSION}"; \
${INSTALL_LIB} $$a ${LFX}/$$b.${LIBVERSION} ; \
( cd ${LFX} ; ln -fs $$b.${LIBVERSION} $$b.0 ; ln -fs $$b.0 $$b ); \
done
# object archives
@for a in `find * -type f | grep -e '\.a$$' | grep -v fs/p` ; do \
echo " ${PFX}/lib/$$a"; ${INSTALL_DATA} $$a ${PFX}/lib ; done
echo " ${LFX}/$$a"; ${INSTALL_DATA} $$a ${LFX} ; done
# plugins
@${INSTALL_DIR} ${PFX}/lib/radare2/${VERSION}
@${INSTALL_DIR} ${LFX}/radare2/${VERSION}
@for a in `find */p -perm -u+x -type f | grep -v exe | grep -v dll | grep ${EXT_SO}`; \
do echo " ${PFX}/lib/radare2/${VERSION}/$$a"; \
${INSTALL_DATA} $$a ${PFX}/lib/radare2/${VERSION} ; done
@echo "lang/p/radare.* ${PFX}/lib/radare2/${VERSION}"
${INSTALL_DATA} lang/p/radare.* ${PFX}/lib/radare2/${VERSION}
do echo " ${LFX}/radare2/${VERSION}/$$a"; \
${INSTALL_DATA} $$a ${LFX}/radare2/${VERSION} ; done
@echo "lang/p/radare.* ${DESTDIR}/${PFX}/${LIBDIR}/radare2/${VERSION}"
${INSTALL_DATA} lang/p/radare.* ${LFX}/radare2/${VERSION}
deinstall uninstall:
# libraries
-@for a in `find * | grep -e '\.${EXT_SO}$$' | grep -v 'lib/t' | grep lib` ; do \
a=`echo $$a | awk -F / '{ print $$NF; }'`; \
echo ${PFX}/lib/$$a ; rm -f ${PFX}/lib/$$a ; done
echo ${LFX}/$$a ; rm -f ${LFX}/$$a ; done
# object archives
-@for a in `find * | grep -e '\.a$$'` ; do \
a=`echo $$a | awk -F / '{ print $$NF; }'`; \
echo ${PFX}/lib/$$a ; rm -f ${PFX}/lib/$$a ; done
echo ${LFX}/$$a ; rm -f ${LFX}/$$a ; done
# includes
-(cd include && for a in * ; do rm -f ${PFX}/libr/$$a ; done)
-(cd include && for a in * ; do rm -f ${IFX}/libr/$$a ; done)
# programs
-@for a in `find */t -perm -u+x -type f | grep 2`; do \
a=`echo $$a|awk -F / '{ print $$NF; }'`; \
echo ${PFX}/bin/$$a ; rm -f ${PFX}/bin/$$a ; done
# plugins
-@for a in `find */p -perm -u+x -type f`; do \
a="${PFX}/lib/radare2/${VERSION}/`echo $$a|awk -F / '{ print $$NF; }'`"; \
a="${LFX}/radare2/${VERSION}/`echo $$a|awk -F / '{ print $$NF; }'`"; \
echo $$a ; rm -f $$a ; done
rm -rf ${PFX}/lib/radare2/${VERSION}
rm -f ${PFX}/lib/pkgconfig/libr.pc
rm -f ${PFX}/lib/pkgconfig/r_*.pc
rm -rf ${LFX}/radare2/${VERSION}
rm -f ${LFX}/pkgconfig/libr.pc
rm -f ${LFX}/pkgconfig/r_*.pc
# test programs
rm -rf ${PFX}/bin/libr-test
# TODO: use for a in LIBLIST (like in binr/Makefile)
rm -rf ${PFX}/include/libr
rm -rf ${PFX}/lib/libr_*.so.${LIBVERSION}
rm -rf ${PFX}/lib/libr_*.so.0
rm -rf ${PFX}/lib/libr_*.so
rm -rf ${PFX}/lib/libr_*.a
rm -rf ${PFX}/lib/libr2.so*
rm -rf ${PFX}/lib/libr2.a
rm -rf ${PFX}/lib/libr.so*
rm -rf ${PFX}/lib/libr.a
rm -rf ${PFX}/share/doc/radare2
rm -rf ${IFX}/libr
rm -rf ${LFX}/libr_*.so.${LIBVERSION}
rm -rf ${LFX}/libr_*.so.0
rm -rf ${LFX}/libr_*.so
rm -rf ${LFX}/libr_*.a
rm -rf ${LFX}/libr2.so*
rm -rf ${LFX}/libr2.a
rm -rf ${LFX}/libr.so*
rm -rf ${LFX}/libr.a
rm -rf ${DESTDIR}${DATADIR}/share/doc/radare2
@echo libr aka radare2 has been uninstalled from PREFIX=${PFX}
clean:

View File

@ -1,5 +1,5 @@
VERSION=@VERSION@
RELEASE=0
RELEASE=1
CC=@USERCC@
CXX=@USERCXX@