[64ab2e9] | 1 | #! /bin/sh |
---|
| 2 | # |
---|
| 3 | # Generate all the specs and then cycle through building them. |
---|
| 4 | # |
---|
| 5 | |
---|
| 6 | RTEMS_DIR=`dirname $0` |
---|
| 7 | CFG=./setup.cache |
---|
| 8 | dst=@RPM_SPECSdir@ |
---|
| 9 | |
---|
| 10 | usage() |
---|
| 11 | { |
---|
| 12 | echo "$0 [options] <target_alias>" |
---|
| 13 | echo " options:" |
---|
| 14 | echo " -cfg <setup.cache>" |
---|
| 15 | echo " -o <rpm-spec-dir>" |
---|
| 16 | exit 1 ; |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | while test $# -ge 1; do |
---|
| 20 | case $1 in |
---|
| 21 | -cfg) |
---|
| 22 | test $# -ge 2 || usage |
---|
| 23 | shift |
---|
| 24 | CFG=$1 |
---|
| 25 | shift |
---|
| 26 | ;; |
---|
| 27 | -o) |
---|
| 28 | test $# -ge 2 || usage |
---|
| 29 | shift |
---|
| 30 | dst=$1 |
---|
| 31 | shift |
---|
| 32 | ;; |
---|
| 33 | -*) |
---|
| 34 | echo "invalid option $1"; |
---|
| 35 | usage |
---|
| 36 | ;; |
---|
| 37 | *) |
---|
| 38 | TARGETS="${TARGETS} $1" |
---|
| 39 | shift |
---|
| 40 | ;; |
---|
| 41 | esac |
---|
| 42 | done |
---|
| 43 | |
---|
| 44 | # This is the full list .. hppa1.1 does not build now. |
---|
| 45 | #ALL_TARGETS="hppa1.1-rtems i386-rtems i960-rtems m68k-rtems \ |
---|
| 46 | # m68k-rtemself mips64orion-rtems \ |
---|
| 47 | # powerpc-rtems sh-rtems sh-rtemself sparc-rtems" |
---|
| 48 | |
---|
| 49 | # This is the full buildable set. |
---|
| 50 | if [ "X${TARGETS}" = "X" ] ; then |
---|
| 51 | TARGETS="i386-rtems i960-rtems m68k-rtems \ |
---|
| 52 | mips64orion-rtems powerpc-rtems sh-rtems sparc-rtems" |
---|
| 53 | fi |
---|
| 54 | |
---|
| 55 | . $CFG |
---|
| 56 | |
---|
| 57 | binutils=${binutils_version} |
---|
| 58 | gcc=${gcc_version} |
---|
[df49c60] | 59 | gnat=${gnat_version} |
---|
[64ab2e9] | 60 | gdb=${gdb_version} |
---|
| 61 | newlib=${newlib_version} |
---|
| 62 | # also use binutils_rpm_release |
---|
| 63 | buildroot=/tmp |
---|
| 64 | |
---|
| 65 | testing=no |
---|
[71506054] | 66 | do_binutils=no # binutils included in gnatnewlib |
---|
[64ab2e9] | 67 | do_gnatnewlib=yes |
---|
| 68 | do_gdb=yes |
---|
| 69 | |
---|
| 70 | # |
---|
| 71 | # Now get started |
---|
| 72 | # |
---|
| 73 | start=`date` |
---|
| 74 | |
---|
| 75 | echo PATH=$PATH |
---|
| 76 | |
---|
| 77 | if [ ${testing} = yes ] ; then |
---|
| 78 | ECHO=echo |
---|
| 79 | fi |
---|
| 80 | |
---|
[df49c60] | 81 | installed_count=`rpm -q -g gnatrtems | wc -l` |
---|
[64ab2e9] | 82 | if [ ${installed_count} -ne 0 ] ; then |
---|
| 83 | echo This script should be run with NO rtems RPMs installed. |
---|
| 84 | echo It appears that the following rtems RPMs are installed: |
---|
| 85 | echo |
---|
| 86 | rpm -qa | grep rtems |
---|
| 87 | echo |
---|
| 88 | echo Please remove these and restart this script. |
---|
| 89 | exit 1 |
---|
| 90 | fi |
---|
| 91 | |
---|
| 92 | echo Copying specs files. |
---|
| 93 | if [ ${testing} = no ] ; then |
---|
| 94 | cd ${RTEMS_DIR} |
---|
| 95 | |
---|
| 96 | # ./configure || exit 1 |
---|
| 97 | make || exit 1 |
---|
| 98 | |
---|
| 99 | # Now generate all the specs |
---|
| 100 | for target in ${TARGETS} |
---|
| 101 | do |
---|
| 102 | tspecs=`find . -name "${target}*"` |
---|
| 103 | if [ "X${tspecs}" = "X" ] ; then |
---|
| 104 | echo RPM specifications were not generated for ${tspec}. |
---|
| 105 | exit 1 |
---|
| 106 | fi |
---|
| 107 | ${ECHO} cp -r ${tspecs} ${dst} |
---|
| 108 | done |
---|
| 109 | fi |
---|
| 110 | |
---|
| 111 | # clean up a bit before we start |
---|
| 112 | cd ${dst} |
---|
| 113 | test -d log || mkdir log |
---|
| 114 | |
---|
| 115 | # do all the tools |
---|
| 116 | for target in ${TARGETS} |
---|
| 117 | do |
---|
| 118 | if [ ${do_binutils} = yes ] ; then |
---|
| 119 | logfile=log/${target}-binutils |
---|
[df49c60] | 120 | specfile=${dst}/${target}-gnat-${gnat}-binutils-${binutils}.spec |
---|
[64ab2e9] | 121 | echo "rpm -ba ${specfile} >${logfile} 2>&1" |
---|
| 122 | if [ ${testing} = no ] ; then |
---|
| 123 | rpm -ba ${specfile} >${logfile} 2>&1 |
---|
| 124 | fi |
---|
| 125 | ${ECHO} rm -rf ${dst}/../BUILD/${target}-binutils* |
---|
[0610a988] | 126 | ${ECHO} rm -rf ${buildroot}/opt/gnatrtems |
---|
[64ab2e9] | 127 | else |
---|
| 128 | echo Skipping binutils for ${target} |
---|
| 129 | fi |
---|
| 130 | |
---|
| 131 | # |
---|
| 132 | # build gcc/newlib |
---|
| 133 | # |
---|
| 134 | |
---|
| 135 | if [ ${do_gnatnewlib} = yes ] ; then |
---|
| 136 | # now build gcc/newlib |
---|
| 137 | # NOTE: This requires having binutils installed and we immediately |
---|
| 138 | # remove it once finished. |
---|
[71506054] | 139 | # base_binutils_rpm=${dst}/../RPMS/i386/rtems-base-binutils-${binutils}-${binutils_rpm_release}.i386.rpm |
---|
| 140 | # binutils_rpm=${dst}/../RPMS/i386/${target}-binutils-${binutils}-${binutils_rpm_release}.i386.rpm |
---|
| 141 | # if [ ! -f ${binutils_rpm} ] ; then |
---|
| 142 | # echo There is no RPM for binutils for ${target}. |
---|
| 143 | # echo Looked for ${binutils_rpm}. |
---|
| 144 | # fi |
---|
| 145 | # ${ECHO} rpm -i ${base_binutils_rpm} |
---|
| 146 | # ${ECHO} rpm -i ${binutils_rpm} |
---|
[64ab2e9] | 147 | |
---|
| 148 | logfile=log/${target}-gnatnewlib |
---|
[df49c60] | 149 | specfile=${dst}/${target}-gnat-${gnat}-newlib-${newlib}.spec |
---|
[64ab2e9] | 150 | echo "rpm -ba ${specfile} >${logfile} 2>&1" |
---|
| 151 | if [ ${testing} = no ] ; then |
---|
| 152 | rpm -ba ${specfile} >${logfile} 2>&1 |
---|
| 153 | fi |
---|
| 154 | ${ECHO} rm -rf ${dst}/../BUILD/${target}-gcc* |
---|
[0610a988] | 155 | ${ECHO} rm -rf ${buildroot}/opt/gnatrtems |
---|
[64ab2e9] | 156 | |
---|
[71506054] | 157 | # echo uninstalling binutils for ${target} |
---|
| 158 | # if [ ${testing} = no ] ; then |
---|
| 159 | # rpm -e `rpm -qa | grep rtems` |
---|
| 160 | # rm -rf /opt/gnatrtems/* |
---|
| 161 | # fi |
---|
[64ab2e9] | 162 | else |
---|
| 163 | echo Skipping gcc/newlib for ${target} |
---|
| 164 | fi |
---|
| 165 | |
---|
| 166 | # |
---|
| 167 | # build gdb |
---|
| 168 | # |
---|
| 169 | |
---|
| 170 | if [ ${do_gdb} = yes ] ; then |
---|
| 171 | # now build gdb |
---|
| 172 | logfile=log/${target}-gdb |
---|
[df49c60] | 173 | specfile=${dst}/${target}-gnat-${gnat}-gdb-${gdb}.spec |
---|
[64ab2e9] | 174 | echo "rpm -ba ${specfile} >${logfile} 2>&1" |
---|
| 175 | if [ ${testing} = no ] ; then |
---|
| 176 | rpm -ba ${specfile} >${logfile} 2>&1 |
---|
| 177 | fi |
---|
| 178 | ${ECHO} rm -rf ${dst}/../BUILD/${target}-gdb* |
---|
[0610a988] | 179 | ${ECHO} rm -rf ${buildroot}/opt/gnatrtems |
---|
[64ab2e9] | 180 | else |
---|
| 181 | echo Skipping gdb for ${target} |
---|
| 182 | fi |
---|
| 183 | |
---|
| 184 | done |
---|
| 185 | |
---|
| 186 | # Now we are done |
---|
| 187 | |
---|
| 188 | stop=`date` |
---|
| 189 | |
---|
| 190 | echo |
---|
| 191 | echo "Started: " $start |
---|
| 192 | echo "Finished: " $stop |
---|
| 193 | exit 0 |
---|