summaryrefslogtreecommitdiffstats
path: root/contrib/crossrpms/freebsd8.2/i586/i586-pc-freebsd8.2-binutils.spec
blob: 069264b51a094937afbfee7c5f56b4550159e2e8 (plain) (blame)
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
#
# Please send bugfixes or comments to
# 	http://www.rtems.org/bugzilla
#


%ifos cygwin cygwin32 mingw mingw32
%define _exeext .exe
%define debug_package           %{nil}
%define _libdir                 %{_exec_prefix}/lib
%else
%define _exeext %{nil}
%endif

%ifos cygwin cygwin32
%define optflags -O3 -pipe -march=i486 -funroll-loops
%endif

%ifos mingw mingw32
%if %{defined _mingw32_cflags}
%define optflags %{_mingw32_cflags}
%else
%define optflags -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -mms-bitfields
%endif
%endif

%if "%{_build}" != "%{_host}"
%define _host_rpmprefix %{_host}-
%else
%define _host_rpmprefix %{nil}
%endif

%define binutils_pkgvers 2.22
%define binutils_version 2.22
%define binutils_rpmvers %{expand:%(echo "2.22" | tr - _ )}

Name:		i586-pc-freebsd8.2-binutils
Summary:	Binutils for target i586-pc-freebsd8.2
Group:		Development/Tools
Version:	%{binutils_rpmvers}
Release:	0.20111122.0%{?dist}
License:	GPL/LGPL
URL: 		http://sources.redhat.com/binutils
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:	%{_host_rpmprefix}gcc

%if "%{binutils_version}" >= "2.18"
# Bug in bfd: Doesn't build without texinfo installed
BuildRequires:	texinfo >= 4.2
%else
%endif
BuildRequires:	flex
BuildRequires:	bison

Source0: http://ftp.gnu.org/gnu/binutils/binutils-%{binutils_pkgvers}.tar.bz2

%description
Cross binutils for target i586-pc-freebsd8.2
%prep
%setup -q -c -T -n %{name}-%{version}

%setup -q -D -T -n %{name}-%{version} -a0
cd binutils-%{binutils_pkgvers}
%{?PATCH0:%patch0 -p1}
cd ..

%build
  mkdir -p build
  cd build
%if "%{_build}" != "%{_host}"
  CFLAGS_FOR_BUILD="-g -O2 -Wall" \
%endif
  CFLAGS="$RPM_OPT_FLAGS" \
  ../binutils-%{binutils_pkgvers}/configure \
    --build=%_build --host=%_host \
    --target=i586-pc-freebsd8.2 \
    --verbose --disable-nls \
    --without-included-gettext \
    --disable-win32-registry \
    --disable-werror \
    --with-sysroot=%{_prefix}/i586-pc-freebsd8.2/sys-root \
    --prefix=%{_prefix} --bindir=%{_bindir} \
    --exec-prefix=%{_exec_prefix} \
    --includedir=%{_includedir} --libdir=%{_libdir} \
    --mandir=%{_mandir} --infodir=%{_infodir}

  make %{?_smp_mflags} all
  cd ..

%install
  rm -rf $RPM_BUILD_ROOT

  cd build
  make DESTDIR=$RPM_BUILD_ROOT install


# Conflict with a native binutils' infos
  rm -rf $RPM_BUILD_ROOT%{_infodir}

# We don't ship host files
  rm -f ${RPM_BUILD_ROOT}%{_libdir}/libiberty*

# manpages without corresponding tools
  if test ! -f ${RPM_BUILD_ROOT}%{_bindir}/i586-pc-freebsd8.2-dlltool%{_exeext}; then 
    rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/i586-pc-freebsd8.2-dlltool*
  fi
  if test ! -f ${RPM_BUILD_ROOT}%{_bindir}/i586-pc-freebsd8.2-nlmconv%{_exeext}; then 
    rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/i586-pc-freebsd8.2-nlmconv*
  fi
  if test ! -f ${RPM_BUILD_ROOT}%{_bindir}/i586-pc-freebsd8.2-windres%{_exeext}; then 
    rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/i586-pc-freebsd8.2-windres*
  fi
  if test ! -f ${RPM_BUILD_ROOT}%{_bindir}/i586-pc-freebsd8.2-windmc%{_exeext}; then 
    rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/i586-pc-freebsd8.2-windmc*
  fi

  cd ..

# Extract %%__os_install_post into os_install_post~
cat << \EOF > os_install_post~
%__os_install_post
EOF

# Generate customized brp-*scripts
cat os_install_post~ | while read a x y; do
case $a in
# Prevent brp-strip* from trying to handle foreign binaries
*/brp-strip*)
  b=$(basename $a)
  sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b
  chmod a+x $b
  ;;
esac
done

sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \
< os_install_post~ > os_install_post 
%define __os_install_post . ./os_install_post

%clean
  rm -rf $RPM_BUILD_ROOT

# ==============================================================
# i586-pc-freebsd8.2-binutils
# ==============================================================
# %package -n i586-pc-freebsd8.2-binutils
# Summary:      rtems binutils for i586-pc-freebsd8.2
# Group: Development/Tools
# %if %build_infos
# Requires: binutils-common
# %endif

%description -n i586-pc-freebsd8.2-binutils
GNU binutils targetting i586-pc-freebsd8.2.

%files -n i586-pc-freebsd8.2-binutils
%defattr(-,root,root)

%{_mandir}/man1/i586-pc-freebsd8.2-*.1*

%{_bindir}/i586-pc-freebsd8.2-*

%dir %{_exec_prefix}/i586-pc-freebsd8.2
%dir %{_exec_prefix}/i586-pc-freebsd8.2/bin
%{_exec_prefix}/i586-pc-freebsd8.2/bin/*

%dir %{_exec_prefix}/i586-pc-freebsd8.2/lib
%{_exec_prefix}/i586-pc-freebsd8.2/lib/ldscripts