source: rtems/contrib/mingw/build-exes.sh @ 896247d

4.104.114.84.95
Last change on this file since 896247d was 896247d, checked in by Chris Johns <chrisj@…>, on Aug 27, 2006 at 12:46:13 PM

Handle the noarch rpms. Dump the file list.

  • Property mode set to 100755
File size: 4.6 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
11source=$(dirname $0)
12
13terminate()
14{
15  echo "error: $*" >&2
16  exit 1
17}
18
19check()
20{
21 if [ $? -ne 0 ]; then
22  terminate
23 fi
24}
25
26version=4.7
27tool_build=3
28
29target_list=$(cat $source/targets)
30
31mingw32_cpu_list="i686"
32
33rpm_topdir=$(rpm --eval "%{_topdir}")
34
35common_label="common"
36local_rpm_database=yes
37targets=$target_list
38run_prefix=
39relocation=
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 noarch auto) $(get_rpm_list $p $common_label)"
121 check "getting the autotools and 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
143   echo "$files" > $relocation/files.txt
144
145   check "find the file list"
146
147   of=$relocation/rtems-files.nsi
148
149   echo "!macro RTEMS_INSTALL_FILES" > $of
150   echo " !ifndef EMPTY_INSTALLER" >> $of
151
152   install_dir=
153
154   for f in $files
155   do
156    d=$(dirname $f)
157    if [ "$install_dir" != "$d" ]; then
158     id=$(echo $d | sed -e 's/\//\\/g' -e 's/\/$//')
159     echo "  SetOutPath \"\$INSTDIR\\$id\"" >> $of
160     install_dir=$d
161    fi
162    echo "  File \"$relocation/$f\"" >> $of
163   done
164
165   echo " !endif" >> $of
166   echo "!macroend" >> $of
167
168   echo "!macro RTEMS_DELETE_FILES" >> $of
169   echo " !ifndef EMPTY_INSTALLER" >> $of
170
171   remove_dirs=
172   remove_dir=
173
174   for f in $files
175   do
176    d=$(dirname $f)
177    if [ "$remove_dir" != "$d" ]; then
178     remove_dirs="$remove_dirs $d"
179     remove_dir=$d
180    fi
181    rf=$(echo $f | sed -e 's/\//\\/g' -e 's/\/$//')
182    echo "  Delete \"\$INSTDIR\\$rf\"" >> $of
183   done
184
185   remove_dirs=$(for r in $remove_dirs; do echo $r; done | sort -r -u)
186
187   for d in $remove_dirs
188   do
189     if [ "$d" = "." ]; then
190      d=
191     fi 
192     rd=$(echo $d | sed -e 's/\//\\/g' -e 's/\/$//')
193     echo "  RMDir \"\$INSTDIR\\$rd\"" >> $of
194   done
195
196   echo " !endif" >> $of
197   echo "!macroend" >> $of
198
199   rtems_binary=$rpm_topdir/mingw32/exe/$p
200   echo "mkdir -p $rtems_binary"
201   $mkdir -p $rtems_binary
202   check "make the RTEMS binary install point: $rtems_binary"
203
204   of=$relocation/rtems.nsi
205   echo "!define RTEMS_TARGET \"$t\"" > $of
206   echo "!define RTEMS_VERSION \"$version\"" >> $of
207   echo "!define RTEMS_BUILD_VERSION \"$tool_build\"" >> $of
208   echo "!define RTEMS_PREFIX \"rtems-tools\"" >> $of
209   echo "!define RTEMS_SOURCE \"$source\"" >> $of
210   echo "!define RTEMS_RELOCATION \"$relocation\"" >> $of
211   echo "!define RTEMS_LOGO \"$source/rtems_logo.bmp\"" >> $of
212   echo "!define RTEMS_BINARY \"$rtems_binary\"" >> $of
213   echo "!define RTEMS_LICENSE_FILE \"$source/rtems-license.rtf\"" >> $of
214   echo "!define TOOL_PREFIX \"$prefix\"" >> $of
215   echo "!include \"$relocation/rtems-files.nsi\"" >> $of
216   echo "!include \"$source/rtems-tools.nsi\"" >> $of
217
218   echo "cp $source/rtems.ini $relocation/rtems.ini"
219   $cp $source/rtems.ini $relocation/rtems.ini
220   check "coping the dialog definition file: $relocation/rtems.ini"
221
222   echo "makensis $of"
223   $makensis $of
224   check "making the installer: $of"
225
226  fi
227 done
228done
Note: See TracBrowser for help on using the repository browser.