1 | #!/bin/sh |
---|
2 | # |
---|
3 | # Usage: mktoolspec CPU |
---|
4 | # |
---|
5 | |
---|
6 | RTEMS_DIR=`dirname $0` |
---|
7 | RTEMS_VERSION=`grep Version ${RTEMS_DIR}/../VERSION | \ |
---|
8 | sed -e 's%RTEMS[ ]*Version[ ]*\(.*\)[ ]*%\1%g'` |
---|
9 | |
---|
10 | # target_alias=$1 |
---|
11 | TARGETS="i386-rtems sparc-rtems" |
---|
12 | # should be $* |
---|
13 | |
---|
14 | release=0 |
---|
15 | |
---|
16 | # Some linux distributions use /usr/src/packages |
---|
17 | # redhat uses /usr/src/redhat |
---|
18 | # others might use /usr/src |
---|
19 | if test -d /usr/src/packages/SPECS; |
---|
20 | then |
---|
21 | dst=/usr/src/packages/SPECS; |
---|
22 | elif test -d /usr/src/redhat/SPECS; |
---|
23 | then |
---|
24 | dst=/usr/src/redhat/SPECS; |
---|
25 | elif test -d /usr/src/SPECS/; |
---|
26 | then |
---|
27 | dst=/usr/src/SPECS; |
---|
28 | fi |
---|
29 | |
---|
30 | # sed -e "s%@Version@%${RTEMS_VERSION}%g" \ |
---|
31 | # -e "s%@bsp@%${bsp}%g" \ |
---|
32 | # -e "s%@Release@%${release}%g" \ |
---|
33 | # -e "s%@target_alias@%${target_alias}%g" \ |
---|
34 | # < ${RTEMS_DIR}/binutils.spec.in \ |
---|
35 | # > ${dst}/$target_alias-binutils.spec |
---|
36 | |
---|
37 | ( |
---|
38 | echo "#" |
---|
39 | echo "# spec file for package rtems" |
---|
40 | echo "# " |
---|
41 | echo "# Copyright (c) 1999 OARCorp, Huntsville, AL" |
---|
42 | echo "#" |
---|
43 | echo "# please send bugfixes or comments to joel@OARcorp.com" |
---|
44 | echo "#" |
---|
45 | echo "" |
---|
46 | # echo "# neededforbuild @target_alias@-binutils @target_alias@-gcc" |
---|
47 | echo "" |
---|
48 | echo "Vendor: OAR Corporation" |
---|
49 | echo "Distribution: Linux" |
---|
50 | echo "Name: rtems-binutils" |
---|
51 | echo "Release: ${release}" |
---|
52 | echo "Copyright: 1999 OARCorp" |
---|
53 | echo "Group: unsorted" |
---|
54 | echo "Provides: binutils for RTEMS" |
---|
55 | echo "" |
---|
56 | echo "Autoreqprov: on" |
---|
57 | echo "Packager: corsepiu@faw.uni-ulm.de and joel@OARcorp.com" |
---|
58 | echo "" |
---|
59 | echo "Version: ${RTEMS_VERSION}" |
---|
60 | echo "Summary: binutils for RTEMS" |
---|
61 | echo "Source0: binutils-990901.tar.gz" |
---|
62 | echo "Patch0: binutils-990901-rtems-19991015.diff" |
---|
63 | echo "" |
---|
64 | echo "Buildroot: /tmp" |
---|
65 | echo "# Patch:" |
---|
66 | echo "%description" |
---|
67 | echo "RTEMS is an open source operating system for embedded systems." |
---|
68 | echo "" |
---|
69 | echo "This is the GNU binutils for RTEMS targetting ${target_alias}." |
---|
70 | echo "" |
---|
71 | echo "Authors:" |
---|
72 | echo "--------" |
---|
73 | echo " Joel Sherrill (joel@oarcorp.com)" |
---|
74 | echo " ..." |
---|
75 | echo "" |
---|
76 | |
---|
77 | # |
---|
78 | # This has to be unrolled in the file |
---|
79 | for target_alias in ${TARGETS} |
---|
80 | do |
---|
81 | echo "%package ${target_alias}" |
---|
82 | echo "Summary: binutils for ${target_alias}" |
---|
83 | echo "Group: unsorted" |
---|
84 | echo "" |
---|
85 | echo "%description ${target_alias}" |
---|
86 | echo "binutils for ${target_alias}" |
---|
87 | echo "" |
---|
88 | done |
---|
89 | |
---|
90 | echo "%prep" |
---|
91 | echo "# untar the sources inside binutils-rtems" |
---|
92 | echo "%setup -c -n binutils-rtems -a 0" |
---|
93 | echo "" |
---|
94 | echo "%patch0 -p0" |
---|
95 | echo "" |
---|
96 | |
---|
97 | echo "%build" |
---|
98 | echo "if [ X\${RTEMS_RPM_TARGETS} = X ] ; then" |
---|
99 | echo " RTEMS_RPM_TARGETS=\"${TARGETS}\"" |
---|
100 | echo "fi" |
---|
101 | echo "" |
---|
102 | echo "for target_alias in \${RTEMS_RPM_TARGETS}" |
---|
103 | echo "do" |
---|
104 | echo " test -d build-\${target_alias} || mkdir build-\${target_alias}" |
---|
105 | echo " ( cd build-\${target_alias}" |
---|
106 | echo " ../binutils-990901/configure --target=\${target_alias} \\" |
---|
107 | echo " --verbose --prefix=/opt/rtems " |
---|
108 | echo "" |
---|
109 | echo " test -d $RPM_BUILD_ROOT/opt \\" |
---|
110 | echo " || mkdir $RPM_BUILD_ROOT/opt" |
---|
111 | echo " test -d $RPM_BUILD_ROOT/opt/rtems \\" |
---|
112 | echo " || mkdir $RPM_BUILD_ROOT/opt/rtems" |
---|
113 | echo "" |
---|
114 | echo " make all" |
---|
115 | echo " make info" |
---|
116 | echo " )" |
---|
117 | echo "done" |
---|
118 | echo "" |
---|
119 | |
---|
120 | echo "%install" |
---|
121 | echo "if [ X\${RTEMS_RPM_TARGETS} = X ] ; then" |
---|
122 | echo " RTEMS_RPM_TARGETS=\"${TARGETS}\"" |
---|
123 | echo "fi" |
---|
124 | echo "" |
---|
125 | echo "for target_alias in \${RTEMS_RPM_TARGETS}" |
---|
126 | echo "do" |
---|
127 | echo " ( cd build-\${target_alias}" |
---|
128 | echo " make prefix=\${RPM_BUILD_ROOT}/opt/rtems install" |
---|
129 | echo " make prefix=\${RPM_BUILD_ROOT}/opt/rtems install-info" |
---|
130 | echo " )" |
---|
131 | echo "done" |
---|
132 | echo "" |
---|
133 | |
---|
134 | for target_alias in ${TARGETS} |
---|
135 | do |
---|
136 | echo "%files ${target_alias}" |
---|
137 | echo "%doc /opt/rtems/info/as.info*" |
---|
138 | echo "%doc /opt/rtems/info/bfd.info*" |
---|
139 | echo "%doc /opt/rtems/info/binutils.info*" |
---|
140 | echo "%doc /opt/rtems/info/ld.info*" |
---|
141 | echo "%doc /opt/rtems/info/standards.info*" |
---|
142 | echo "%doc /opt/rtems/man/man1/${target_alias}-ar.1" |
---|
143 | echo "%doc /opt/rtems/man/man1/${target_alias}-nm.1" |
---|
144 | echo "%doc /opt/rtems/man/man1/${target_alias}-objdump.1" |
---|
145 | echo "%doc /opt/rtems/man/man1/${target_alias}-ranlib.1" |
---|
146 | echo "%doc /opt/rtems/man/man1/${target_alias}-size.1" |
---|
147 | echo "%doc /opt/rtems/man/man1/${target_alias}-strings.1" |
---|
148 | echo "%doc /opt/rtems/man/man1/${target_alias}-strip.1" |
---|
149 | echo "%doc /opt/rtems/man/man1/${target_alias}-objcopy.1" |
---|
150 | echo "%doc /opt/rtems/man/man1/${target_alias}-addr2line.1" |
---|
151 | echo "%doc /opt/rtems/man/man1/${target_alias}-nlmconv.1" |
---|
152 | echo "%doc /opt/rtems/man/man1/${target_alias}-c++filt.1" |
---|
153 | echo "%doc /opt/rtems/man/man1/${target_alias}-as.1" |
---|
154 | echo "%doc /opt/rtems/man/man1/${target_alias}-ld.1" |
---|
155 | echo "" |
---|
156 | echo "/opt/rtems/bin/${target_alias}-addr2line" |
---|
157 | echo "/opt/rtems/bin/${target_alias}-ar" |
---|
158 | echo "/opt/rtems/bin/${target_alias}-as" |
---|
159 | echo "/opt/rtems/bin/${target_alias}-c++filt" |
---|
160 | echo "/opt/rtems/bin/${target_alias}-gasp" |
---|
161 | echo "/opt/rtems/bin/${target_alias}-ld" |
---|
162 | echo "/opt/rtems/bin/${target_alias}-nm" |
---|
163 | echo "/opt/rtems/bin/${target_alias}-objcopy" |
---|
164 | echo "/opt/rtems/bin/${target_alias}-objdump" |
---|
165 | echo "/opt/rtems/bin/${target_alias}-ranlib" |
---|
166 | echo "/opt/rtems/bin/${target_alias}-readelf" |
---|
167 | echo "/opt/rtems/bin/${target_alias}-size" |
---|
168 | echo "/opt/rtems/bin/${target_alias}-strings" |
---|
169 | echo "/opt/rtems/bin/${target_alias}-strip" |
---|
170 | echo "/opt/rtems/include/bfd.h" |
---|
171 | echo "/opt/rtems/include/ansidecl.h" |
---|
172 | echo "/opt/rtems/include/bfdlink.h" |
---|
173 | echo "/opt/rtems/lib/libbfd*" |
---|
174 | echo "/opt/rtems/lib/libiberty*" |
---|
175 | echo "/opt/rtems/lib/libopcodes*" |
---|
176 | echo "/opt/rtems/${target_alias}/bin/ar" |
---|
177 | echo "/opt/rtems/${target_alias}/bin/as" |
---|
178 | echo "/opt/rtems/${target_alias}/bin/ld" |
---|
179 | echo "/opt/rtems/${target_alias}/bin/nm" |
---|
180 | echo "/opt/rtems/${target_alias}/bin/ranlib" |
---|
181 | echo "/opt/rtems/${target_alias}/bin/strip" |
---|
182 | echo "/opt/rtems/${target_alias}/lib/ldscripts" |
---|
183 | echo "" |
---|
184 | done |
---|
185 | ) > ${dst}/rtems-binutils.spec |
---|
186 | |
---|
187 | echo Generated ${dst}/rtems-binutils.spec. |
---|