Move sys/farm* to radare2-releases

This commit is contained in:
pancake 2017-03-13 02:38:52 +01:00
parent 65bc4e702f
commit 7378f69644
11 changed files with 0 additions and 597 deletions

View file

@ -1,307 +0,0 @@
#!/bin/sh
# Build script for radare2 - pancake<nopcode.org>
[ -z "${MAKEFLAGS}" ] && MAKEFLAGS="-j4"
[ -z "${MAKE}" ] && MAKE=make
[ -z "${NAME}" ] && NAME=radare2
[ -z "${DIR}" ] && DIR=radare2.build
[ -z "${URL}" ] && URL=http://github.com/radare/${NAME}
PYTHON=python2
WD=${PWD}/${DIR}
NOW=$(date +%Y%m%d-%H%M%S)
if [ -z "$1" ]; then
LOGFILE=${WD}/build.log.${NOW}
else
LOGFILE="$1"
fi
PREFIX=/usr
DESTDIR=${WD}/prefix
DONTFIND=""
CONFIGUREFLAGS="--prefix=${PREFIX}"
DOLOG="2>&1 | tee -a ${LOGFILE}" # verbose build
DOLOG="2>&1 | tee -a ${LOGFILE} > /dev/null"
testcc() {
eval type $1 > /dev/null 2>&1
if [ $? = 0 ]; then
log "[==] Found $1"
cc=$1
else
log "[==] Cannot find $1"
fi
}
log() {
echo $* ; echo $* >> ${LOGFILE}
}
logchk() {
if [ $1 = 0 ]; then
log "[==] RESULT: ok"
else
log "[==] RESULT: Shit happens"
fi
}
logcmd() {
eval "( $* ; logchk $? ) ${DOLOG}"
}
r2uninstall() {
cd radare2
make uninstall DESTDIR=${DESTDIR}
}
installdeps() {
VALA=vala-0.18.0
echo "I am going to install ${VALA} and valabind..."
sleep 2
wget -c http://download.gnome.org/sources/vala/0.9/${VALA}.tar.bz2
tar xjvf ${VALA}.tar.bz2
cd ${VALA}
./configure --prefix=/usr
make
make install
cd ..
echo ${VALA} > ${WD}/version.vala
type swig > /dev/null 2>&1
if [ $? = 1 ]; then
# TODO: install swig from svn!
echo "Cannot find 'swig'. apt-get install swig or get it from svn"
echo "svn co https://swig.svn.sourceforge.net/svnroot/swig/trunk swig"
else
if [ -d valabind ]; then
cd valabind
git reset --hard
git clean -xdf
git pull
else
git clone http://github.com/radare/valabind
cd valabind
fi
chmod +x configure
./configure --prefix=/usr
${MAKE} ${MAKEFLAGS}
${MAKE} install DESTDIR=${DESTDIR}
cd ..
fi
}
uninstalldeps() {
VALA=`cat ${WD}/version.vala`
cd ${VALA}
${MAKE} uninstall DESTDIR=${DESTDIR}
cd ..
rm -rf ${VALA} ${VALA}.tar.bz2
cd valabind
${MAKE} uninstall DESTDIR=${DESTDIR}
}
mkdir -p ${DIR}
cd ${DIR}
# TODO: clean spaguettis
case "$1" in
"-i")
if [ -z "$2" ]; then
echo "Usage: build.sh -i [path]"
exit 1
fi
DONTFIND=1
DESTDIR="$2"
;;
"-I")
if [ -z "$2" ]; then
echo "Usage: build.sh -I [path]"
exit 1
fi
DESTDIR="$2"
r2uninstall
exit 0
;;
"-d")
if [ -z "$2" ]; then
echo "Usage: build.sh -d [path]"
exit 1
fi
DESTDIR="$2"
installdeps
exit 0
;;
"-D")
if [ -z "$2" ]; then
echo "Usage: build.sh -D [path]"
exit 1
fi
DESTDIR="$2"
uninstalldeps
exit 0
;;
"-c")
rm -f ${WD}/build.*
rm -rf ${WD}/prefix
rm -rf ${WD}/vala*
;;
"-h")
cat<<EOF
Usage: build.sh [logfile|-option]
-i [destdir] install r2
-I [destdir] uninstall r2
-c clean build directory
-d [destdir] compile and install dependencies
-D [destdir] uninstall dependencies
-h show this help
Dependencies:
vala http://live.gnome.org/Vala
swig http://www.swig.org/
valabind http://github.com/radare/valabind
Examples:
sys/farm.sh do the build and generate log
sudo sys/farm.sh -i / install system-wide (/+/usr)
sudo sys/farm.sh -I uninstall
sudo sys/farm.sh -d / install dependencies system-wide
sys/farm.sh -d ~/prefix install dependencies in home
sudo sys/farm.sh -c clean build directory
rm -rf radare2.build remove build directory
EOF
exit 0
;;
esac
log "[==] Logging ${LOGFILE}"
:> ${LOGFILE}
ln -fs ${LOGFILE} ${WD}/build.log
log "[==] Retrieving system information"
date >> ${LOGFILE}
uname -a >> ${LOGFILE}
cat /proc/cpuinfo >> ${LOGFILE}
type git > /dev/null 2>&1
if [ ! $? = 0 ]; then
cat <<EOF
Cannot find 'git'.
EOF
exit 1
fi
log "[==] Working directory: $WD/$DIR"
if [ -d "${NAME}" ]; then
log "[==] Cleaning up old build directory..."
cd ${NAME}
git clean -xdf
git reset --hard
log "[==] Updating repository to HEAD..."
logcmd hg revert -a
logcmd hg pull -u
else
log "[==] Checking out from ${URL}..."
git clone ${URL} 2>&1 | tee -a ${LOGFILE}
cd ${NAME}
fi
if [ -e "config-user.mk" ]; then
log "[==] Running clean and mrproper..."
${MAKE} clean > /dev/null 2>&1
${MAKE} mrproper > /dev/null 2>&1
fi
log "[==] Running configure..."
logcmd time ./configure ${CONFIGUREFLAGS}
log "[==] Running make ${MAKEFLAGS}"
logcmd time ${MAKE} ${MAKEFLAGS}
log "[==] Symbolic installation... "
${MAKE} symstall DESTDIR="${DESTDIR}" > /dev/null 2>&1
if [ -z "${DONTFIND}" ]; then
log "[==] List of symbollically installed files"
logcmd "(cd ${DESTDIR} && find *)"
fi
log "[==] Running some tests..."
export PATH=${DESTDIR}${BINDIR}:$PATH
export PKG_CONFIG_PATH=${DESTDIR}${LIBDIR}/pkgconfig
export LD_LIBRARY_PATH=${DESTDIR}${LIBDIR}
logcmd type r2
logcmd type rasm2
logcmd type rabin2
logcmd radare2 -V
if [ -z "${DONTFIND}" ]; then
log "[==] List of installed files"
logcmd "(cd ${DESTDIR} && find *)"
log "[==] Uninstalling.."
logcmd time ${MAKE} uninstall DESTDIR="${DESTDIR}"
log "[==] List of residual files"
logcmd "(cd ${DESTDIR} && find *)"
fi
log "[==] Installing in ${PREFIX}"
logcmd time ${MAKE} install DESTDIR="${DESTDIR}"
log "[==] Configuring valabind bindings..."
cd swig
logcmd time ./configure --prefix=${PREFIX}
log "[==] Compiling swig/..."
logcmd time ${MAKE} ${MAKEFLAGS}
log "[==] Installing valabind bindings..."
logcmd time ${MAKE} install DESTDIR=${DESTDIR}
log "[==] Testing bindings.."
export PYTHONPATH=${DESTDIR}${LIBDIR}/python2.5/site-packages/
logcmd ${PYTHON} -c "'from r2.r_util import *;b=RBuffer()'"
logcmd ${PYTHON} -c "'from r2.r_asm import *;a=RAsm()'"
logcmd ${PYTHON} -c "'from r2.r_core import *;c=RCore()'"
# TODO. add more tests here
# back to root dir
cd ..
log "[==] Looking for mingw32 crosscompilers.."
cc=""
for a in i486-mingw32-gcc i586-mingw32msvc-gcc ; do
testcc $a
[ -n "$cc" ] && break
done
if [ -n "$cc" ]; then
log "[==] mingw32 build using $cc"
if [ -e "config-user.mk" ]; then
${MAKE} clean > /dev/null 2>&1
${MAKE} mrproper >/dev/null 2>&1
fi
rm -f *.zip
log "[==] mingw32 configure"
logcmd ./configure --without-gmp --with-ostype=windows --with-compiler=$cc --host=i586-unknown-windows
log "[==] mingw32 make"
logcmd ${MAKE} ${MAKEFLAGS}
log "[==] mingw32 w32dist"
logcmd ${MAKE} w32dist
cp radare2-w32*.zip ${WD}
# build bindings
cd swig
log "[==] mingw32 swig: configure"
logcmd ./configure --without-gmp --with-ostype=windows --with-compiler=$cc --host=i586-unknown-windows
log "[==] mingw32 swig: make"
logcmd ${MAKE} ${MAKEFLAGS} w32
log "[==] mingw32 swig: w32dist"
logcmd ${MAKE} w32dist
cd ..
else
log "[==] Cannot find any compatible w32 crosscompiler. Report if not true"
fi
echo "[==] Please report ${LOGFILE}"

View file

@ -1,30 +0,0 @@
LANG=C
export LANG
# helpers
minutes() { echo $(($1*60)); }
hours() { echo $(($1*60*60)); }
days() { echo $(($1*60*60*24)); }
hhmm() { echo $((`hours $1`+`minutes $2`)); }
# every 30 minutes
SLEEP=`hhmm 0 30`
PACKAGE=radare2
REMOTEDIR=""
[ -f ~/.r2farmrc ] && . ~/.r2farmrc
TARGETS="
build
dist-bin
python-dist
mingw32
android-arm
android-x86
"
#TARGETS=" build python-dist mingw32 "
#TARGETS=android-arm
# mingw64 maemo

View file

@ -1,6 +0,0 @@
all:
sh run.sh
sh html.sh
mkdir -p log/clang
#cd .. ; sh clang-analyzer.sh && mv ../clang-log/* farm/log/clang
sh push.sh

View file

@ -1,35 +0,0 @@
The sys farm
============
[ config ]
- project name
- script list
[ daemon ]
farm/r2/linux
farm/r2/osx
farm/r2/maemo
farm/r2/mingw32
farm/r2/mingw64
- find updates in src
[ build ]
- execute all build targets to generate output results
project/date-revision-buildtype
- out/r2/20110923-3948-linux.log
- dist/r2/20110923-3948-linux/radare2-r3948.tar.gz
[ dist ]
- generate distribution tarball, debian package or zip
[ push ]
- push -f to remove remote data?
- use rsync to upload build results
[ web ] - php?
- parse pushed results
- allow download of dist
- useful for snapshots
- grep for warnings
- count errors
- view build logs

View file

@ -1,13 +0,0 @@
#!/bin/sh
cd `dirname $PWD/$0`
b=log/bin
p=`../../configure --version|head -n1|cut -d ' ' -f 1`
rm -rf $b/*
mkdir -p $b
os=`uname -sm|sed -e 's, ,-,'|tr 'A-Z' 'a-z'`
cp ../../$p-bin.tar.gz $b/$p-$os.tar.gz
cp ../../$p-android*.gz $b
cp ../../radare2-*.zip $b
cp ../../r2-bindings-0.8.5.tar.gz $b

View file

@ -1,12 +0,0 @@
#!/bin/sh
revision() {
echo `git log | head -1 | cut -d " " -f 2`
}
cd `dirname $PWD/$0` ; cd ..
. ./farm/CONFIG
[ ! -f farm/last-revision ] && exit 1
now=`revision`
old=`cat farm/last-revision`
[ "$now" = "$old" ]

View file

@ -1,14 +0,0 @@
#!/bin/sh
cd `dirname $PWD/$0`
up() {
if [ -d ../../.hg ]; then
hg pull -u
elif [ -d ../../.git ]; then
git pull
fi
}
. ./CONFIG
while : ; do
up ; ( ./check.sh ) && ./run.sh
sleep ${SLEEP}
done

View file

@ -1,110 +0,0 @@
#!/bin/sh
cd `dirname $PWD/$0` || exit
test -f ./bins.sh && ./bins.sh
# gen htmls
for a in log/*.log ; do
b=$(sed -e 's,.log$,.html,' $a)
r=$(sed -e 's,.log$,.ret,' $a)
t=$(sed -e 's,.log$,.time,' $a)
c=$(sed -e 's,.log$,.cpu,' $a)
echo "<html><body style=background-color:black;color:white;font-family:Verdana>" > $b
echo "<h1><a href=./>index</a></h1>" >> $b
echo "<h1>$a</h1>" >> $b
allocas=$(grep -ce "alloca'" $a)
formats=$(grep -c -e "in format" -e "format'" $a)
unused=$(grep -c -e "not used" -e unused $a)
casts=$(grep -ce incompatible $a)
warnings=$(grep "warning:" $a)
undefineds=$(grep undefined $a)
errors=$(grep -c -e error: -e 'returned 1' $a)
if [ -f $t ]; then
echo "<h2>time:</h2>" >> $b
echo "<pre>" >> $b
cat $t >> $b
echo "</pre>" >> $b
fi
if [ -f $c ]; then
echo "<h2>cpu:</h2>" >> $b
echo "<pre>" >> $b
cat $c >> $b
echo "</pre>" >> $b
fi
echo "<pre>" >> $b
echo "<h2>warnings: $warnings</h2>" >> $b
echo "read below" >> $b
echo "<h2>errors: $errors + $undefineds</h2>" >> $b
echo "read below" >> $b
echo "<h2>return: "`cat $r`"</h2>" >> $b
echo "<h2>casts: $casts</h2>" >> $b
grep -e "incompatible" $a | awk '{
gsub(/incompatible (.*)$/,"<b style=color:yellow>incompatible &</b>");
print}' >> $b
echo "<h2>formats: $formats</h2>" >> $b
grep -e "in format" -e "format'" $a | awk '{
gsub(/format(.*)$/,"<b style=color:yellow>format &</b>");
print}' >> $b
echo "<h2>allocas: $allocas</h2>" >> $b
grep "alloca'" $a | awk '{
gsub(/warning\: (.*)$/,"<b style=color:yellow>&</b>");
print}' >> $b
echo "<h2>undefined: $undefineds</h2>" >> $b
grep -C 2 undefined $a | awk '{
gsub(/undefined (.*)$/,"<b style=color:orange>&</b>");
print}' >> $b
echo "<h2>errors:</h2>" >> $b
grep -e Error -e error: $a | awk '{
gsub(/rror\: (.*)$/,"<b style=color:red>&</b>");
print}' >> $b
grep -C 2 'returned 1' $a | awk '{
gsub(/^---$/,"<br />");
gsub(/^(.*)$/,"<b style=color:red>&</b>");
print}' >> $b
echo "<h2>unused: $unused</h2>" >> $b
grep -e "not used" -e unused $a | awk '{
gsub(/warning\: (.*)$/,"<b style=color:yellow>&</b>");
print}' >> $b
echo "<h2>warnings:</h2>" >> $b
grep warning: $a | awk '{
gsub(/warning\: (.*)$/,"<b style=color:yellow>&</b>");
print}' >> $b
echo "<h2>build:</h2>" >> $b
awk '{
gsub(/warning\: (.*)$/,"<b style=color:yellow>warning: &</b>");
gsub(/error\: (.*)$/,"<b style=color:red>&</b>");
print}' $a >> $b
echo "<pre></body></html>" >> $b
done
# gen index
cat <<EOF > log/index.html
<html>
<title>r2 build farm</title>
<body style=background-color:black;color:white;font-family:Verdana>
<h1>r2 build farm</h1>
<h2>bins</h2>
EOF
(cd log/bin &&
for a in * ; do
s=$(du -hs $a |awk '{print $1}')
echo "<h3><a href='bin/$a'>$a</a> ($s)</h3>" >> ../index.html
done
)
echo "<h2>builds</h2>" >> log/index.html
for a in `ls -rt log/*.log | tac`; do
[ $a = log/index.html ] && continue
f=$(echo $a | sed -e 's,log/,,' -e s,.log,,)
l=log/$f.log
ft=log/$f.time
n=$(sed -e 's,-, ,g' $f)
t=$(awk '/real/{print $2}' $ft)
warnings=$(grep -c "warning:" $l)
errors=$(grep -c "error:" $l)
echo "<h3><a href=$f.html>$n</a> (<font color=yellow>w:</font>$warnings <font color=red>e:</font>$errors $t)</h3>" >> log/index.html
done
cat <<EOF >> log/index.html
</body>
</html>
EOF

View file

@ -1,15 +0,0 @@
#!/bin/sh
# install all deps in order to setup the farm
PREPARE="
vala
swig
valabind
python-deps
mingw32-deps
mingw64-deps
"
cd `dirname $PWD/$0` ; cd ..
for a in ${PREPARE} ; do
./${a}.sh
done

View file

@ -1,15 +0,0 @@
#!/bin/sh
# find root
cd `dirname $PWD/$0` ; cd ..
. ./farm/CONFIG
if [ -z "${REMOTEDIR}" ]; then
echo "# You have to setup the REMOTEDIR var in your config var"
echo "echo 'REMOTEDIR=user@host:/path/remote/dir' > ~/.r2farmrc"
exit 1
fi
echo rsync -avz farm/log/ ${REMOTEDIR}
rsync -avz farm/log/ ${REMOTEDIR}

View file

@ -1,40 +0,0 @@
#!/bin/sh
cd `dirname $PWD/$0` ; cd ..
. ./farm/CONFIG
revision() {
R=`hg tip 2>/dev/null|head -n 1|cut -d : -f 2`
[ -z "$R" ] && R=`git log|head -n1 |cut -d ' ' -f 2`
[ -n "$R" ] && echo $R
}
tstamp() {
date +%Y%m%d-%H
}
logfile() {
echo "log/${PACKAGE}-`tstamp`-`revision`-$1"
}
getcpu() {
uname -a
grep "model name" /proc/cpuinfo | head -n1
printf "cpus: "
grep processor /proc/cpuinfo | tail -n 1 | awk '{print $3}'
printf "bogomips: "
grep bogomips /proc/cpuinfo | tail -n 1 | awk '{print $3}'
}
mkdir -p farm/log
for a in ${TARGETS} ; do
L=farm/`logfile $a`
T=$L.time
C=$L.cpu
getcpu > $C
echo "= $a" | tee $L.log
(time ./${a}.sh 2>&1 | tee -a $L.log) 2> $T
echo $? > $L.ret
done
echo `revision` > farm/last-revision
exit 0