Temporary hack to build on smock x86_64
[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 # Temporary hack for smock on x86_64.
59 BuildRequires:  /usr/include/gnu/stubs-32.h
60 BuildRequires:  /usr/lib/gcc/i386-redhat-linux
61
62 Requires:       darwinx-filesystem >= 1
63
64
65 %description
66 The odcctools project is geared towards improving the Darwin
67 cctools build system and code base to support Darwin development.
68
69
70 %prep
71 %setup -q -n odcctools-%{odcc_stamp}
72
73 %patch1 -p1
74 %patch2 -p1
75
76 #%patch3 -p1
77 #%patch4 -p1
78
79
80 %build
81 for arch in powerpc i386; do
82   mkdir build-$arch
83   pushd build-$arch
84
85 #%if %{__isa_bits} 64  <-- how to write this with RPM? XXX
86   CFLAGS="-m32" LDFLAGS="-m32" \
87   ../configure \
88     --target=$arch-apple-darwin8 \
89     --prefix=%{_prefix} \
90     --libdir=%{_libdir} \
91     --datadir=%{_datadir} \
92     --mandir=%{_mandir} \
93     --libexecdir=%{_libexecdir}
94
95   make %{?_smp_mflags}
96
97   popd
98 done
99
100 %install
101 rm -rf $RPM_BUILD_ROOT
102
103 for arch in powerpc i386; do
104   make -C build-$arch DESTDIR=$RPM_BUILD_ROOT install
105 done
106
107 # Rename the manual pages so they don't conflict with the
108 # ones for the native tools.
109 for f in $RPM_BUILD_ROOT%{_mandir}/*/*; do
110   d=$(dirname $f); b=$(basename $f)
111   mv $f $d/i386-apple-darwin8-$b
112   ln $d/i386-apple-darwin8-$b $d/powerpc-apple-darwin8-$b
113 done
114
115
116 %clean
117 rm -rf $RPM_BUILD_ROOT
118
119
120 %files
121 %defattr(-,root,root)
122 %doc APPLE_LICENSE
123 %{_bindir}/i386-apple-darwin8-*
124 %{_bindir}/powerpc-apple-darwin8-*
125 %{_includedir}/mach-o/
126 %{_libexecdir}/as/
127 %{_libdir}/libmacho.a
128 %{_mandir}/man1/i386-apple-darwin8-*.1*
129 %{_mandir}/man1/powerpc-apple-darwin8-*.1*
130 %{_mandir}/man3/i386-apple-darwin8-*.3*
131 %{_mandir}/man3/powerpc-apple-darwin8-*.3*
132 %{_mandir}/man5/i386-apple-darwin8-*.5*
133 %{_mandir}/man5/powerpc-apple-darwin8-*.5*
134
135
136 %changelog
137 * Sun Feb 15 2009 Richard W.M. Jones <rjones@redhat.com> - 590.36-0.20060413.5
138 - Build as a 32 bit binary.
139 - Add note about upstream versions.
140
141 * Sun Feb  8 2009 Richard W.M. Jones <rjones@redhat.com> - 590.36-0.20060413.4
142 - Initial RPM release for Fedora.
143
144 * Tue Mar 28 2006 Benjamin Reed <rangerrick@befunk.com> - 590.36-1
145 - fixed build to just use srcdir != builddir, changed to 10.3/10.4-specific
146
147 * Sun Feb 26 2006 Benjamin Reed <rangerrick@befunk.com> - 590.23.2od12-1
148 - initial release