source: rtems/contrib/mingw/build-exes.sh @ 5ceb567e

4.104.114.84.95
Last change on this file since 5ceb567e was 61e5a32, checked in by Chris Johns <chrisj@…>, on 08/07/06 at 07:01:54

Removed the tool version as Ralf has removed it from the rpms.

  • Property mode set to 100755
File size: 4.5 KB
Line 
1#! /bin/sh
2#
3# $Id$
4#
5# RTEMS Build Executable Installers script.
6#
7# This script takes the RPM files built using the crossrpms/build-rpms.sh
8# script.
9#
10
11terminate()
12{
13  echo "error: $*" >&2
14  exit 1
15}
16
17check()
18{
19 if [ $? -ne 0 ]; then
20  terminate
21 fi
22}
23
24version=4.7
25tool_build=1
26
27target_list="i386 m68k powerpc sparc arm mips"
28
29mingw32_cpu_list="i686"
30
31rpm_topdir=$(rpm --eval "%{_topdir}")
32
33common_label="common"
34local_rpm_database=yes
35targets=$target_list
36run_prefix=
37relocation=
38
39source=$(dirname $0)
40
41if [ "$source" = "." ]; then
42 source=$(pwd)
43fi
44
45while [ $# -gt 0 ];
46do
47 case $1 in
48  -d)
49   set -x
50   ;;
51  -l)
52   shift
53   rpm_prefix=$1-
54   rpm_prefix_arg="--enable-rpmprefix=$rpm_label"
55   ;;
56  -n)
57   run_prefix="echo "
58   ;;
59  -p)
60   shift
61   prefix=$1
62   ;;
63  -R)
64   local_rpm_database=no
65   ;;
66  -r)
67   shift
68   relocation=$1
69   ;;
70  -t)
71   shift
72   targets=$1
73   ;;
74  -v)
75   shift
76   version=$1
77   ;;
78  --help)
79   echo "$0 -??"
80   exit 2
81   ;;
82  *)
83   terminate "error: invalid option (try --help): $1"
84   ;;
85 esac
86 shift
87done
88
89cd=${run_prefix}cd
90cp=${run_prefix}cp
91make=${run_prefix}make
92makensis=${run_prefix}makensis
93mkdir=${run_prefix}mkdir
94rm=${run_prefix}rm
95rpmbuild=${run_prefix}rpmbuild
96rpm=${run_prefix}rpm
97
98if [ -z "$relocation" ]; then
99 terminate "error: a relocation path needs to be specified"
100fi
101
102if [ $local_rpm_database = yes ]; then
103  rpm_database="--dbpath $prefix/var/lib/rpm"
104else
105  rpm_database=
106fi
107
108get_rpm_list()
109{
110  if [ -d $rpm_topdir/mingw32/RPMS/$1 ]; then
111   echo $(ls $rpm_topdir/mingw32/RPMS/$1/*.rpm | grep -v "debuginfo" | grep $2)
112  fi
113}
114
115#
116# Handle each type of host processor.
117#
118for p in $mingw32_cpu_list
119do
120 common_rpms=$(get_rpm_list $p $common_label)
121 check "getting the common RPM list"
122
123 rpm_options="--ignoreos --force --nodeps --noorder "
124
125 for t in $targets
126 do
127  rpms=$(get_rpm_list $p $t)
128  check "getting the RPM list"
129  if [ -n "$rpms" ]; then
130   echo "Clean the relocation directory"
131   $rm -rf $relocation
132   check "removing the relocation directory: $relocation"
133
134   for r in $common_rpms $rpms
135   do
136    echo "rpm $rpm_database --relocate $prefix=$relocation $rpm_options -i $r"
137    $rpm $rpm_database --relocate $prefix=$relocation $rpm_options -i $r
138    check "installing rpm: $r"
139   done
140
141   files=$(find $relocation -type f | sed -e "s/^$(echo ${relocation} | sed 's/\//\\\//g')//" -e "s/^\///" | sort)
142   check "find the file list"
143
144   of=$relocation/rtems-files.nsi
145
146   echo "!macro RTEMS_INSTALL_FILES" > $of
147   echo " !ifndef EMPTY_INSTALLER" >> $of
148
149   install_dir=
150
151   for f in $files
152   do
153    d=$(dirname $f)
154    if [ "$install_dir" != "$d" ]; then
155     id=$(echo $d | sed -e 's/\//\\/g' -e 's/\/$//')
156     echo "  SetOutPath \"\$INSTDIR\\$id\"" >> $of
157     install_dir=$d
158    fi
159    echo "  File \"$relocation/$f\"" >> $of
160   done
161
162   echo " !endif" >> $of
163   echo "!macroend" >> $of
164
165   echo "!macro RTEMS_DELETE_FILES" >> $of
166   echo " !ifndef EMPTY_INSTALLER" >> $of
167
168   remove_dirs=
169   remove_dir=
170
171   for f in $files
172   do
173    d=$(dirname $f)
174    if [ "$remove_dir" != "$d" ]; then
175     remove_dirs="$remove_dirs $d"
176     remove_dir=$d
177    fi
178    rf=$(echo $f | sed -e 's/\//\\/g' -e 's/\/$//')
179    echo "  Delete \"\$INSTDIR\\$rf\"" >> $of
180   done
181
182   remove_dirs=$(for r in $remove_dirs; do echo $r; done | sort -r -u)
183
184   for d in $remove_dirs
185   do
186     if [ "$d" = "." ]; then
187      d=
188     fi
189     rd=$(echo $d | sed -e 's/\//\\/g' -e 's/\/$//')
190     echo "  RMDir \"\$INSTDIR\\$rd\"" >> $of
191   done
192
193   echo " !endif" >> $of
194   echo "!macroend" >> $of
195
196   rtems_binary=$rpm_topdir/mingw32/exe/$p
197   echo "mkdir -p $rtems_binary"
198   $mkdir -p $rtems_binary
199   check "make the RTEMS binary install point: $rtems_binary"
200
201   of=$relocation/rtems.nsi
202   echo "!define RTEMS_TARGET \"$t\"" > $of
203   echo "!define RTEMS_VERSION \"$version\"" >> $of
204   echo "!define RTEMS_BUILD_VERSION \"$tool_build\"" >> $of
205   echo "!define RTEMS_PREFIX \"rtems-tools\"" >> $of
206   echo "!define RTEMS_SOURCE \"$source\"" >> $of
207   echo "!define RTEMS_RELOCATION \"$relocation\"" >> $of
208   echo "!define RTEMS_LOGO \"$source/rtems_logo.bmp\"" >> $of
209   echo "!define RTEMS_BINARY \"$rtems_binary\"" >> $of
210   echo "!define RTEMS_LICENSE_FILE \"$source/rtems-license.rtf\"" >> $of
211   echo "!include \"$relocation/rtems-files.nsi\"" >> $of
212   echo "!include \"$source/rtems-tools.nsi\"" >> $of
213
214   echo "cp $source/rtems.ini $relocation/rtems.ini"
215   $cp $source/rtems.ini $relocation/rtems.ini
216   check "coping the dialog definition file: $relocation/rtems.ini"
217
218   echo "makensis $of"
219   $makensis $of
220   check "making the installer: $of"
221
222  fi
223 done
224done
Note: See TracBrowser for help on using the repository browser.