source: rtems/contrib/mingw/build-exes.sh @ 7eb4d4b

4.104.114.84.95
Last change on this file since 7eb4d4b was be77d1f, checked in by Chris Johns <chrisj@…>, on Jul 21, 2006 at 12:04:20 AM

Add NSIS installer support for MinGW.

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