summaryrefslogtreecommitdiffstats
path: root/scripts/mkbinutils_subpackage_version
blob: 00f42fe928876a2a15b03f256c0f178153055085 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/bin/sh 
#
#  Usage: mktoolspec CPU
#

RTEMS_DIR=`dirname $0`
RTEMS_VERSION=`grep Version ${RTEMS_DIR}/../VERSION | \
sed -e 's%RTEMS[ 	]*Version[ 	]*\(.*\)[ 	]*%\1%g'`

# target_alias=$1
TARGETS="i386-rtems sparc-rtems"
# should be $*

release=0

# Some linux distributions use /usr/src/packages
# redhat uses /usr/src/redhat
# others might use /usr/src
if test -d /usr/src/packages/SPECS; 
then
dst=/usr/src/packages/SPECS;
elif test -d /usr/src/redhat/SPECS;
 then
dst=/usr/src/redhat/SPECS;
elif test -d /usr/src/SPECS/; 
then
dst=/usr/src/SPECS;
fi

#  sed -e "s%@Version@%${RTEMS_VERSION}%g" \
#  -e "s%@bsp@%${bsp}%g" \
#  -e "s%@Release@%${release}%g" \
#  -e "s%@target_alias@%${target_alias}%g" \
#  < ${RTEMS_DIR}/binutils.spec.in \
#  > ${dst}/$target_alias-binutils.spec

(
echo "#"
echo "# spec file for package rtems"
echo "# "
echo "# Copyright  (c)  1999  OARCorp, Huntsville, AL"
echo "#"
echo "# please send bugfixes or comments to joel@OARcorp.com"
echo "#"
echo ""
# echo "# neededforbuild  @target_alias@-binutils @target_alias@-gcc"
echo ""
echo "Vendor:       OAR Corporation"
echo "Distribution: Linux"
echo "Name:         rtems-binutils"
echo "Release:      ${release}"
echo "Copyright:    1999 OARCorp"
echo "Group:        unsorted"
echo "Provides:     binutils for RTEMS"
echo ""
echo "Autoreqprov:  on"
echo "Packager:     corsepiu@faw.uni-ulm.de and joel@OARcorp.com"
echo ""
echo "Version:      ${RTEMS_VERSION}"
echo "Summary:      binutils for RTEMS"
echo "Source0:      	binutils-990901.tar.gz"
echo "Patch0:		binutils-990901-rtems-19991015.diff"
echo ""
echo "Buildroot:    /tmp"
echo "# Patch:"
echo "%description"
echo "RTEMS is an open source operating system for embedded systems."
echo ""
echo "This is the GNU binutils for RTEMS targetting ${target_alias}."
echo ""
echo "Authors:"
echo "--------"
echo "    Joel Sherrill (joel@oarcorp.com)"
echo "    ..."
echo ""

#
#  This has to be unrolled in the file
for target_alias in ${TARGETS}
do
  echo "%package ${target_alias}"
  echo "Summary: binutils for ${target_alias}"
  echo "Group:        unsorted"
  echo ""
  echo "%description ${target_alias}"
  echo "binutils for ${target_alias}"
  echo ""
done

echo "%prep"
  echo "# untar the sources inside binutils-rtems"
  echo "%setup -c -n binutils-rtems -a 0"
  echo ""
  echo "%patch0 -p0"
  echo ""

echo "%build"
  echo "if [ X\${RTEMS_RPM_TARGETS} = X ] ; then"
  echo "  RTEMS_RPM_TARGETS=\"${TARGETS}\""
  echo "fi"
  echo ""
  echo "for target_alias in \${RTEMS_RPM_TARGETS}"
  echo "do"
  echo "  test -d build-\${target_alias} || mkdir build-\${target_alias}"
  echo "  ( cd build-\${target_alias}"
  echo "    ../binutils-990901/configure --target=\${target_alias} \\"
  echo "      --verbose --prefix=/opt/rtems "
  echo ""
  echo "    test -d $RPM_BUILD_ROOT/opt \\"
  echo "      || mkdir $RPM_BUILD_ROOT/opt"
  echo "    test -d $RPM_BUILD_ROOT/opt/rtems \\"
  echo "      || mkdir $RPM_BUILD_ROOT/opt/rtems"
  echo ""
  echo "    make all"
  echo "    make info"
  echo "  )"
  echo "done"
  echo ""

echo "%install"
  echo "if [ X\${RTEMS_RPM_TARGETS} = X ] ; then"
  echo "  RTEMS_RPM_TARGETS=\"${TARGETS}\""
  echo "fi"
  echo ""
  echo "for target_alias in \${RTEMS_RPM_TARGETS}"
  echo "do"
  echo "  ( cd build-\${target_alias}"
  echo "    make prefix=\${RPM_BUILD_ROOT}/opt/rtems install"
  echo "    make prefix=\${RPM_BUILD_ROOT}/opt/rtems install-info"
  echo "  )"
  echo "done"
  echo ""

for target_alias in ${TARGETS}
do
  echo "%files ${target_alias}"
  echo "%doc /opt/rtems/info/as.info*"
  echo "%doc /opt/rtems/info/bfd.info*"
  echo "%doc /opt/rtems/info/binutils.info*"
  echo "%doc /opt/rtems/info/ld.info*"
  echo "%doc /opt/rtems/info/standards.info*"
  echo "%doc /opt/rtems/man/man1/${target_alias}-ar.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-nm.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-objdump.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-ranlib.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-size.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-strings.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-strip.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-objcopy.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-addr2line.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-nlmconv.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-c++filt.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-as.1"
  echo "%doc /opt/rtems/man/man1/${target_alias}-ld.1"
  echo ""
  echo "/opt/rtems/bin/${target_alias}-addr2line"
  echo "/opt/rtems/bin/${target_alias}-ar"
  echo "/opt/rtems/bin/${target_alias}-as"
  echo "/opt/rtems/bin/${target_alias}-c++filt"
  echo "/opt/rtems/bin/${target_alias}-gasp"
  echo "/opt/rtems/bin/${target_alias}-ld"
  echo "/opt/rtems/bin/${target_alias}-nm"
  echo "/opt/rtems/bin/${target_alias}-objcopy"
  echo "/opt/rtems/bin/${target_alias}-objdump"
  echo "/opt/rtems/bin/${target_alias}-ranlib"
  echo "/opt/rtems/bin/${target_alias}-readelf"
  echo "/opt/rtems/bin/${target_alias}-size"
  echo "/opt/rtems/bin/${target_alias}-strings"
  echo "/opt/rtems/bin/${target_alias}-strip"
  echo "/opt/rtems/include/bfd.h"
  echo "/opt/rtems/include/ansidecl.h"
  echo "/opt/rtems/include/bfdlink.h"
  echo "/opt/rtems/lib/libbfd*"
  echo "/opt/rtems/lib/libiberty*"
  echo "/opt/rtems/lib/libopcodes*"
  echo "/opt/rtems/${target_alias}/bin/ar"
  echo "/opt/rtems/${target_alias}/bin/as"
  echo "/opt/rtems/${target_alias}/bin/ld"
  echo "/opt/rtems/${target_alias}/bin/nm"
  echo "/opt/rtems/${target_alias}/bin/ranlib"
  echo "/opt/rtems/${target_alias}/bin/strip"
  echo "/opt/rtems/${target_alias}/lib/ldscripts"
  echo ""
done
)  > ${dst}/rtems-binutils.spec

echo Generated ${dst}/rtems-binutils.spec.