Build odcctools with 32 bit compiler, because the code makes lots of
[fedora-mingw.git] / darwinx-odcctools / darwinx-odcctools.spec
1 # Note about the source for these tools:
2 #
3 # Apple distributes a set of tools called cctools under the APSL2.0
4 # license.  You can get it from
5 # http://www.opensource.apple.com/darwinsource/Current/
6 # but you will need an Apple ID (although it's still open source).
7 #
8 # These are the OpenDarwin odcctools, which are an enhanced version of
9 # an older version of cctools.
10 #
11 # OpenDarwin is dead.  It was replaced first by DarwinPorts, which has
12 # not released anything for more than two years.
13 #
14 # There are various other potential upstreams for these tools.  Most
15 # promising is: http://code.google.com/p/iphone-dev/
16 #
17 #   odcctools version    based on cctools    source
18 #   -----------------------------------------------------------
19 #   20060413             590.36              OpenDarwin (dead)
20 #   20061117             ?                       ""
21 #   20070629             ?                   Shipped by Gentoo
22 #   up to 2008           622.3 or 667.8.0    Google code: iphone-dev
23 #
24 # odcctools DOES NOT compile on 64 bit platforms.  The code contains
25 # fundamental 32 bit assumptions, for example that the return value
26 # from calloc can fit into a 32 bit integer.  Therefore on 64 bit
27 # platforms we have to compile with 'gcc -m32'.
28
29 %define odcc_version 590.36
30 %define odcc_stamp 20060413
31
32 Name:           darwinx-odcctools
33 Version:        %{odcc_version}
34 Release:        0.%{odcc_stamp}.5%{?dist}
35 Summary:        Darwin (Mac OS X) cross-compiler tools
36
37 License:        APSL 2.0
38 Group:          Development/Libraries
39
40 URL:            http://odcctools.darwinports.com/
41 Source0:        odcctools-%{odcc_stamp}.tar.bz2
42
43 Patch1:         odcctools-headers.patch
44 Patch2:         odcctools-ofile.patch
45
46 # These two patches were an attempt to get the code to compile
47 # on 64 bit architectures.  However the 32 bit assumptions in the
48 # code run much deeper than this.
49 #Patch3:         odcctools-lp64.patch
50 #Patch4:         odcctools-x86-64.patch
51
52 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
53
54 BuildRequires:  darwinx-filesystem >= 1
55
56 BuildRequires:  elfutils, kernel-headers, libstdc++-devel
57
58 Requires:       darwinx-filesystem >= 1
59
60
61 %description
62 The odcctools project is geared towards improving the Darwin
63 cctools build system and code base to support Darwin development.
64
65
66 %prep
67 %setup -q -n odcctools-%{odcc_stamp}
68
69 %patch1 -p1
70 %patch2 -p1
71
72 #%patch3 -p1
73 #%patch4 -p1
74
75
76 %build
77 for arch in powerpc i386; do
78   mkdir build-$arch
79   pushd build-$arch
80
81 #%if %{__isa_bits} 64  <-- how to write this with RPM? XXX
82   CFLAGS="-m32" LDFLAGS="-m32" \
83   ../configure \
84     --target=$arch-apple-darwin8 \
85     --prefix=%{_prefix} \
86     --libdir=%{_libdir} \
87     --datadir=%{_datadir} \
88     --mandir=%{_mandir} \
89     --libexecdir=%{_libexecdir}
90
91   make %{?_smp_mflags}
92
93   popd
94 done
95
96 %install
97 rm -rf $RPM_BUILD_ROOT
98
99 for arch in powerpc i386; do
100   make -C build-$arch DESTDIR=$RPM_BUILD_ROOT install
101 done
102
103 # Rename the manual pages so they don't conflict with the
104 # ones for the native tools.
105 for f in $RPM_BUILD_ROOT%{_mandir}/*/*; do
106   d=$(dirname $f); b=$(basename $f)
107   mv $f $d/i386-apple-darwin8-$b
108   ln $d/i386-apple-darwin8-$b $d/powerpc-apple-darwin8-$b
109 done
110
111
112 %clean
113 rm -rf $RPM_BUILD_ROOT
114
115
116 %files
117 %defattr(-,root,root)
118 %doc APPLE_LICENSE
119 %{_bindir}/i386-apple-darwin8-*
120 %{_bindir}/powerpc-apple-darwin8-*
121 %{_includedir}/mach-o/
122 %{_libexecdir}/as/
123 %{_libdir}/libmacho.a
124 %{_mandir}/man1/i386-apple-darwin8-*.1*
125 %{_mandir}/man1/powerpc-apple-darwin8-*.1*
126 %{_mandir}/man3/i386-apple-darwin8-*.3*
127 %{_mandir}/man3/powerpc-apple-darwin8-*.3*
128 %{_mandir}/man5/i386-apple-darwin8-*.5*
129 %{_mandir}/man5/powerpc-apple-darwin8-*.5*
130
131
132 %changelog
133 * Sun Feb 15 2009 Richard W.M. Jones <rjones@redhat.com> - 590.36-0.20060413.5
134 - Build as a 32 bit binary.
135 - Add note about upstream versions.
136
137 * Sun Feb  8 2009 Richard W.M. Jones <rjones@redhat.com> - 590.36-0.20060413.4
138 - Initial RPM release for Fedora.
139
140 * Tue Mar 28 2006 Benjamin Reed <rangerrick@befunk.com> - 590.36-1
141 - fixed build to just use srcdir != builddir, changed to 10.3/10.4-specific
142
143 * Sun Feb 26 2006 Benjamin Reed <rangerrick@befunk.com> - 590.23.2od12-1
144 - initial release