Added ocaml-findlib for cross-compiler environment.
[fedora-mingw.git] / ocaml-findlib / mingw32-ocaml-findlib.spec
1 %define __strip %{_mingw32_strip}
2 %define __objdump %{_mingw32_objdump}
3 %define _use_internal_dependency_generator 0
4 %define __find_requires %{_mingw32_findrequires}
5 %define __find_provides %{_mingw32_findprovides}
6
7 %define debug_package %{nil}
8
9 # Findlib is a build tool, and we don't need to cross-compile it
10 # (except arguably the findlib library, but no one really uses that).
11 # However we do need the MinGW-specific META files in the right
12 # places, and that is what this package contains.
13 #
14 # To use ocamlfind with the MinGW META files, do:
15 #
16 # OCAMLFIND_CONF=/etc/i686-pc-mingw32-ocamlfind.conf \
17 #   ocamlfind cmd ...
18
19 Name:           mingw32-findlib
20 Version:        1.2.2
21 Release:        3%{?dist}
22 Summary:        MinGW Windows Objective CAML package manager and build helper
23
24 License:        BSD
25 Group:          Development/Libraries
26
27 URL:            http://projects.camlcity.org/projects/findlib.html
28 Source0:        http://download.camlcity.org/download/findlib-%{version}.tar.gz
29 Source1000:     ocamlfind.conf.in
30
31 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
32 BuildArch:      noarch
33
34 BuildRequires:  mingw32-filesystem >= 35
35 BuildRequires:  mingw32-gcc
36 BuildRequires:  mingw32-binutils
37 BuildRequires:  ocaml
38 BuildRequires:  mingw32-ocaml
39 BuildRequires:  m4
40 BuildRequires:  gawk
41
42
43 %description
44 Objective CAML package manager and build helper.
45
46
47 %prep
48 %setup -q -n findlib-%{version}
49
50
51 %build
52 %{_mingw32_target}-ocamlopt -version
53 %{_mingw32_target}-ocamlopt -where
54 (cd tools/extract_args && make)
55 tools/extract_args/extract_args -o src/findlib/ocaml_args.ml \
56   %{_mingw32_target}-ocamlc \
57   %{_mingw32_target}-ocamlcp \
58   %{_mingw32_target}-ocamlmktop \
59   %{_mingw32_target}-ocamlopt \
60   %{_mingw32_target}-ocamldep \
61   %{_mingw32_target}-ocamldoc ||:
62 cat src/findlib/ocaml_args.ml
63 ./configure -config %{_sysconfdir}/%{_mingw32_target}-ocamlfind.conf \
64   -bindir %{_bindir} \
65   -sitelib `%{_mingw32_target}-ocamlopt -where` \
66   -mandir %{_mandir} \
67   -with-toolbox
68 make all
69 make opt
70 rm doc/guide-html/TIMESTAMP
71
72
73
74 %install
75 rm -rf $RPM_BUILD_ROOT
76
77 mkdir -p $RPM_BUILD_ROOT%{_bindir}
78 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
79
80 make install prefix=$RPM_BUILD_ROOT OCAMLFIND_BIN=$RPM_BUILD_ROOT%{_bindir}
81 mv $RPM_BUILD_ROOT/$RPM_BUILD_ROOT%{_bindir}/* $RPM_BUILD_ROOT%{_bindir}
82
83 # Remove documentation which is already available
84 # in the Fedora native package.
85 rm -r $RPM_BUILD_ROOT%{_mandir}/man[15]/
86
87 # Remove ocamlfind binary - we will use the native version.
88 rm $RPM_BUILD_ROOT%{_bindir}/ocamlfind
89 rm $RPM_BUILD_ROOT%{_bindir}/safe_camlp4
90
91 # Remove findlib & num-top libs: if anything uses these we can
92 # add them back later.
93 rm -r $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/findlib
94 rm -r $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/num-top
95
96 # XXX topfind gets installed as %{_libdir}/ocaml - not sure why
97 # but delete it anyway.
98 rm $RPM_BUILD_ROOT%{_libdir}/ocaml
99
100 # Override /etc/%{_mingw32_target}-ocamlfind.conf with our
101 # own version.
102 rm $RPM_BUILD_ROOT%{_sysconfdir}/%{_mingw32_target}-ocamlfind.conf
103 sed \
104   -e 's,@libdir@,%{_libdir},g' \
105   -e 's,@target@,%{_mingw32_target},g' \
106   < %{SOURCE1000} \
107   > $RPM_BUILD_ROOT%{_sysconfdir}/%{_mingw32_target}-ocamlfind.conf
108
109
110 %clean
111 rm -rf $RPM_BUILD_ROOT
112
113
114 %files
115 %defattr(-,root,root)
116 %config %{_sysconfdir}/%{_mingw32_target}-ocamlfind.conf
117 %{_libdir}/%{_mingw32_target}-ocaml/bigarray/META
118 %{_libdir}/%{_mingw32_target}-ocaml/camlp4/META
119 %{_libdir}/%{_mingw32_target}-ocaml/dbm/META
120 %{_libdir}/%{_mingw32_target}-ocaml/dynlink/META
121 %{_libdir}/%{_mingw32_target}-ocaml/graphics/META
122 %{_libdir}/%{_mingw32_target}-ocaml/labltk/META
123 %{_libdir}/%{_mingw32_target}-ocaml/num/META
124 %{_libdir}/%{_mingw32_target}-ocaml/stdlib/META
125 %{_libdir}/%{_mingw32_target}-ocaml/str/META
126 %{_libdir}/%{_mingw32_target}-ocaml/threads/META
127 %{_libdir}/%{_mingw32_target}-ocaml/unix/META
128
129
130 %changelog
131 * Sun Nov 16 2008 Richard W.M. Jones <rjones@redhat.com> - 1.2.2-3
132 - Initial RPM release.