|
Peter Lemenkov |
328521 |
#!/bin/bash
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
# This script reads filenames from STDIN and outputs any relevant provides
|
|
Peter Lemenkov |
328521 |
# information that needs to be included in the package.
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
BUILDDIR=
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
while true; do
|
|
Peter Lemenkov |
328521 |
case "$1" in
|
|
Peter Lemenkov |
328521 |
-b) BUILDDIR="$2"; shift 2;;
|
|
Peter Lemenkov |
328521 |
--) shift; break;;
|
|
Peter Lemenkov |
328521 |
*) echo "$0: option error at $1"; exit 1;;
|
|
Peter Lemenkov |
328521 |
esac
|
|
Peter Lemenkov |
328521 |
done
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
filelist=`sed "s/['\"]/\\\&/g"`
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
/usr/lib/rpm/rpmdeps --provides $filelist
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
# Get the list of *.app files
|
|
Peter Lemenkov |
328521 |
appfiles=$(echo $filelist | tr [:blank:] '\n' | grep -o -E '.*/ebin/.*\.app$')
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
for f in $appfiles; do
|
|
Peter Lemenkov |
328521 |
app=`cat $f | tr -d [:space:] | awk -F '{application,' '{print $2}'|cut -d , -f 1`
|
|
Peter Lemenkov |
328521 |
ver=`cat $f | tr -d [:space:] | grep -o -E '\{vsn,\".*[0-9]\"\}' | sed -e "s,.vsn\,\",,g;s,\".,,g"`
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
# HiPE module is different from others
|
|
Peter Lemenkov |
328521 |
if [ "$app" == "hipe" ] ;
|
|
Peter Lemenkov |
328521 |
then
|
|
Peter Lemenkov |
328521 |
# Hardcoded minimal set of HiPE exported functions
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_amd64_main:rtl_to_amd64/3)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_arm_main:rtl_to_arm/3)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe:c/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe:compile/4)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_data_pp:pp/4)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_icode2rtl:translate/2)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_icode_heap_test:cfg/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_ppc_main:rtl_to_ppc/3)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_arch:endianess/0)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_arch:nr_of_return_regs/0)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_arch:word_size/0)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_cfg:init/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_cfg:linearize/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_cfg:pp/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_cfg:remove_trivial_bbs/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_cfg:remove_unreachable_code/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_cleanup_const:cleanup/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_lcm:rtl_lcm/2)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_ssa_avail_expr:cfg/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_ssa:check/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_ssa_const_prop:propagate/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_ssa:convert/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_ssapre:rtl_ssapre/2)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_ssa:remove_dead_code/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_ssa:unconvert/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_rtl_symbolic:expand/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_sparc_main:rtl_to_sparc/3)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_tagscheme:fixnum_val/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_tagscheme:is_fixnum/1)"
|
|
Peter Lemenkov |
328521 |
echo "erlang(hipe_x86_main:rtl_to_x86/3)"
|
|
Peter Lemenkov |
328521 |
fi
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
echo "erlang($app) = $ver"
|
|
Peter Lemenkov |
328521 |
done
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
a943e7 |
# Check for two special cases by inspecting path to ebin directory
|
|
Peter Lemenkov |
328521 |
basedirs=$(echo $filelist | tr [:blank:] '\n' | grep -o -E 'erlang\/lib\/[a-zA-Z_0-9]*-[0-9.]*\/ebin' | cut -d \/ -f 3 | sort | uniq)
|
|
Peter Lemenkov |
328521 |
for bd in $basedirs; do
|
|
Peter Lemenkov |
328521 |
basename=`echo $bd | cut -d \- -f 1`
|
|
Peter Lemenkov |
328521 |
basever=`echo $bd | cut -d \- -f 2`
|
|
Peter Lemenkov |
328521 |
case $basename in
|
|
Peter Lemenkov |
328521 |
"erts")
|
|
Peter Lemenkov |
328521 |
echo "erlang($basename) = $basever"
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
# BIFs from erts - this module is very specific
|
|
Peter Lemenkov |
328521 |
cat $BUILDDIR/erts/emulator/*/erl_bif_list.h 2>/dev/null |\
|
|
Peter Lemenkov |
328521 |
grep -v am__AtomAlias |\
|
|
Peter Lemenkov |
328521 |
grep -o -E 'am_.*\,am_.*\,.\,' |\
|
|
Peter Lemenkov |
328521 |
sed s,am_,,g |\
|
|
Peter Lemenkov |
328521 |
sed -e "s,Plus,+,g;s,Minus,-,g;s,Neqeq,=\/=,g;s,Neq,\/=,g;s,Div,\/,g;s,Eqeq,=\:=,g;s,Eq,==,g;s,Ge,>=,g;s,Gt,>,g;s,Le,=<,g;s,Lt,<,g;s,Times,*,g;s,subtract,--,g;s,append\,,++\,,g" |\
|
|
Peter Lemenkov |
328521 |
awk -F \, '{print "erlang(" $1 ":" $2 "/" $3 ")" }'
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
# Add BIFs for HiPE
|
|
Peter Lemenkov |
328521 |
grep "bif " $BUILDDIR/erts/emulator/hipe/*.tab | awk -F "bif " '{print "erlang(" $2 ")"}'
|
|
Peter Lemenkov |
328521 |
;;
|
|
Peter Lemenkov |
328521 |
"wx")
|
|
Peter Lemenkov |
a943e7 |
# wx module doesn't contain app-file.
|
|
Peter Lemenkov |
328521 |
echo "erlang($basename) = $basever"
|
|
Peter Lemenkov |
328521 |
;;
|
|
Peter Lemenkov |
328521 |
*)
|
|
Peter Lemenkov |
328521 |
;;
|
|
Peter Lemenkov |
328521 |
esac
|
|
Peter Lemenkov |
328521 |
done
|
|
Peter Lemenkov |
328521 |
|
|
Peter Lemenkov |
328521 |
# Get the list of *.beam files
|
|
Peter Lemenkov |
328521 |
beamfiles=$(echo $filelist | tr [:blank:] '\n' | grep -o -E '.*/ebin/.*\.beam$')
|
|
Peter Lemenkov |
328521 |
/usr/lib/rpm/erlang-find-provides.escript $beamfiles | sed s,\',,g
|
|
Peter Lemenkov |
328521 |
|