Added mingw32-ocaml-curses.
authorRichard W.M. Jones <rjones@redhat.com>
Sat, 15 Nov 2008 23:15:16 +0000 (23:15 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Sat, 15 Nov 2008 23:15:16 +0000 (23:15 +0000)
.hgignore
ocaml-curses/mingw32-ocaml-curses-0.1-build.patch [new file with mode: 0644]
ocaml-curses/mingw32-ocaml-curses-0.1-win32-functions.patch [new file with mode: 0644]
ocaml-curses/mingw32-ocaml-curses.spec [new file with mode: 0644]
ocaml/mingw32-ocaml.spec

index 2d5aca2..6cd768a 100644 (file)
--- a/.hgignore
+++ b/.hgignore
@@ -81,6 +81,7 @@ ocaml/*.cmi
 ocaml/*.cmx
 ocaml/*.o
 ocaml-csv/ocaml-csv-1.1.7.tar.gz
+ocaml-curses/ocaml-curses-20020319.tar.gz
 ocaml-extlib/extlib-1.5.1.tar.gz
 ocaml-extlib/NUL
 ocaml-extlib/test1
diff --git a/ocaml-curses/mingw32-ocaml-curses-0.1-build.patch b/ocaml-curses/mingw32-ocaml-curses-0.1-build.patch
new file mode 100644 (file)
index 0000000..83cbeeb
--- /dev/null
@@ -0,0 +1,27 @@
+Split up the all and opt (native code) rules, and allow the curses
+library to be specified explicitly.
+
+diff -ur mingw32-ocaml-curses-20020319.orig/curses/Makefile mingw32-ocaml-curses-20020319.mingw/curses/Makefile
+--- mingw32-ocaml-curses-20020319.orig/curses/Makefile 2002-03-19 13:07:47.000000000 +0000
++++ mingw32-ocaml-curses-20020319.mingw/curses/Makefile        2008-11-15 23:03:35.000000000 +0000
+@@ -5,15 +5,17 @@
+ LFLAGS=
+ CPP=cpp
+-CURSES=ncurses
++CURSES=-lncurses
+-all: libmlcurses.a mlcurses.cma mlcurses.cmxa
++all: libmlcurses.a mlcurses.cma
++
++opt: libmlcurses.a mlcurses.cmxa
+ ml_curses.o: ml_curses.c functions.c
+       $(OCAMLC) -ccopt "$(CFLAGS)" -c $<
+ libmlcurses.a: ml_curses.o
+-      $(OCAMLMKLIB) -o mlcurses $< -l$(CURSES)
++      $(OCAMLMKLIB) -o mlcurses $< $(CURSES)
+ mlcurses.cma: curses.cmo
+       $(OCAMLMKLIB) -o mlcurses -linkall $^
diff --git a/ocaml-curses/mingw32-ocaml-curses-0.1-win32-functions.patch b/ocaml-curses/mingw32-ocaml-curses-0.1-win32-functions.patch
new file mode 100644 (file)
index 0000000..67291b9
--- /dev/null
@@ -0,0 +1,65 @@
+Remove functions that aren't supported on Win32 / PDCurses.
+
+diff -ur mingw32-ocaml-curses-20020319.orig/curses/functions.c mingw32-ocaml-curses-20020319.mingw/curses/functions.c
+--- mingw32-ocaml-curses-20020319.orig/curses/functions.c      2002-03-18 01:20:00.000000000 +0000
++++ mingw32-ocaml-curses-20020319.mingw/curses/functions.c     2008-11-15 23:01:46.000000000 +0000
+@@ -449,7 +449,9 @@
+ /* resize */
+ ML3(wresize,err,window,int,int)
++#ifndef WIN32
+ ML2(resizeterm,err,int,int)
++#endif
+ /* scr_dump */
+@@ -526,6 +528,8 @@
+ ML2d(vidputs,err,chtype,(char->unit))
+ BEG2 putc_function=ab;
+   r_err(vidputs(a_chtype(aa),putc_callback)); END
++
++#ifndef WIN32
+ ML2d(tparm,string,string,int array)
+ BEG2 int t[10],i,n=Wosize_val(ab);
+   if(n>10) n=10;
+@@ -554,6 +558,7 @@
+ ML1d(bool_terminfo_variable,string*string*string,int) BEG1 arrayret(bool) END
+ ML1d(num_terminfo_variable,string*string*string,int) BEG1 arrayret(num) END
+ ML1d(str_terminfo_variable,string*string*string,int) BEG1 arrayret(str) END
++#endif
+ /* touch */
+@@ -611,6 +616,7 @@
+ END
+ #undef ca
++#ifndef WIN32
+ /* Du travail pour les esclaves de M$ */
+ ML0d(winch_handler_on,unit)
+ BEG0 signal(SIGWINCH,winch_handler); CAMLreturn(Val_unit); END
+@@ -627,4 +633,4 @@
+   ioctl(a_int(aa),TIOCGWINSZ,&ws);
+   r_int_int(ws.ws_row,ws.ws_col);
+ END
+-
++#endif
+diff -ur mingw32-ocaml-curses-20020319.orig/curses/ml_curses.c mingw32-ocaml-curses-20020319.mingw/curses/ml_curses.c
+--- mingw32-ocaml-curses-20020319.orig/curses/ml_curses.c      2002-03-18 01:20:00.000000000 +0000
++++ mingw32-ocaml-curses-20020319.mingw/curses/ml_curses.c     2008-11-15 22:57:53.000000000 +0000
+@@ -5,12 +5,14 @@
+ #include <caml/fail.h>
+ #include <stdio.h>
+ #include <unistd.h>
+-#include <ncurses.h>
++#include <curses.h>
+ #include <term.h>
+ /* Du travail pour les esclaves de M$ */
+ #include <signal.h>
++#ifndef WIN32
+ #include <termios.h>
+ #include <sys/ioctl.h>
++#endif
+ #define AWB(x) caml__dummy_##x=caml__dummy_##x; /* anti-warning bugware */
diff --git a/ocaml-curses/mingw32-ocaml-curses.spec b/ocaml-curses/mingw32-ocaml-curses.spec
new file mode 100644 (file)
index 0000000..b6b8a8f
--- /dev/null
@@ -0,0 +1,93 @@
+%define __strip %{_mingw32_strip}
+%define __objdump %{_mingw32_objdump}
+%define _use_internal_dependency_generator 0
+%define __find_requires %{_mingw32_findrequires}
+%define __find_provides %{_mingw32_findprovides}
+
+# For versioning, please see the native Fedora package.
+%define alphatag 20020319
+
+Name:           mingw32-ocaml-curses
+Version:        0.1
+Release:        1%{?dist}
+Summary:        MinGW Windows OCaml bindings for ncurses
+
+License:        LGPLv2+
+Group:          Development/Libraries
+
+URL:            http://savannah.nongnu.org/projects/ocaml-tmk/
+Source0:        ocaml-curses-%{alphatag}.tar.gz
+
+# Patches for MinGW:
+Patch1000:      mingw32-ocaml-curses-0.1-build.patch
+Patch1001:      mingw32-ocaml-curses-0.1-win32-functions.patch
+
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch:      noarch
+
+BuildRequires:  mingw32-filesystem >= 35
+BuildRequires:  mingw32-gcc
+BuildRequires:  mingw32-binutils
+BuildRequires:  mingw32-ocaml >= 3.11.0+beta1-6
+BuildRequires:  mingw32-pdcurses
+
+
+%description
+OCaml bindings for curses.
+
+
+%prep
+%setup -q -c -n %{name}-%{alphatag}
+
+%patch1000 -p1
+%patch1001 -p1
+
+
+%build
+cd curses
+
+make \
+  OCAMLC=%{_mingw32_target}-ocamlopt \
+  OCAMLOPT=%{_mingw32_target}-ocamlopt \
+  OCAMLMKLIB=%{_mingw32_target}-ocamlmklib \
+  CURSES=%{_mingw32_libdir}/pdcurses.dll.a opt
+
+cat > META <<EOF
+name = "curses"
+version = "%{version}"
+description = "OCaml bindings for ncurses"
+requires = ""
+archive(byte) = "mlcurses.cma"
+archive(native) = "mlcurses.cmxa"
+EOF
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
+mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/curses
+mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/stublibs
+
+pushd curses
+install mlcurses.cmxa mlcurses.a *.cmi *.cmx *.mli \
+  $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/curses
+# XXX Not really clear if this file is necessary.
+install dllmlcurses.dll \
+  $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/stublibs
+popd
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root)
+%{_libdir}/%{_mingw32_target}-ocaml/curses/
+%{_libdir}/%{_mingw32_target}-ocaml/stublibs/dllmlcurses.dll
+
+
+%changelog
+* Thu Nov 13 2008 Your Name <you@example.com> - 1.2.3-1
+- Initial RPM release.
index 10d47c1..d5dea45 100644 (file)
@@ -10,7 +10,7 @@
 
 Name:           mingw32-ocaml
 Version:        3.11.0+beta1
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        Objective Caml MinGW cross-compiler and programming environment
 
 License:        QPL and (LGPLv2+ with exceptions)
@@ -157,20 +157,30 @@ make %{makevars} -C stdlib install
 for i in %{otherlibraries}; do
   make %{makevars} -C otherlibs/$i install
 done
+make %{makevars} -C tools install
 make %{makevars} installopt
 
 cp config/Makefile \
    $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/Makefile.config
 
-# Rename the binaries so they don't clash with base OCaml package.
-mv $RPM_BUILD_ROOT%{_bindir}/ocamlrun \
-  $RPM_BUILD_ROOT%{_bindir}/%{_mingw32_target}-ocamlrun
-echo '#!%{_bindir}/%{_mingw32_target}-ocamlrun' \
-  > $RPM_BUILD_ROOT%{_bindir}/%{_mingw32_target}-ocamlopt
-tail -n +2 $RPM_BUILD_ROOT%{_bindir}/ocamlopt \
-  >> $RPM_BUILD_ROOT%{_bindir}/%{_mingw32_target}-ocamlopt
-chmod 0755 $RPM_BUILD_ROOT%{_bindir}/%{_mingw32_target}-ocamlopt
-rm $RPM_BUILD_ROOT%{_bindir}/ocamlopt
+# For bytecode binaries, change the bang-path to point to the locally
+# installed ocamlrun.
+pushd $RPM_BUILD_ROOT%{_bindir}
+for f in ocamlcp ocamldep ocamlmklib ocamlopt ocamlprof; do
+  mv $f $f.old
+  echo '#!%{_bindir}/%{_mingw32_target}-ocamlrun' > $f
+  tail -n +2 $f.old >> $f
+  chmod +x $f
+  rm $f.old
+done
+popd
+
+# Rename all the binaries to target-binary.
+pushd $RPM_BUILD_ROOT%{_bindir}
+for f in ocamlcp ocamldep ocamlmklib ocamlmktop ocamlopt ocamlprof ocamlrun; do
+  mv $f %{_mingw32_target}-$f
+done
+popd
 
 
 %clean
@@ -179,12 +189,20 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(-,root,root)
-%{_bindir}/%{_mingw32_target}-ocamlrun
+%{_bindir}/%{_mingw32_target}-ocamlcp
+%{_bindir}/%{_mingw32_target}-ocamldep
+%{_bindir}/%{_mingw32_target}-ocamlmklib
+%{_bindir}/%{_mingw32_target}-ocamlmktop
+%{_bindir}/%{_mingw32_target}-ocamlprof
 %{_bindir}/%{_mingw32_target}-ocamlopt
+%{_bindir}/%{_mingw32_target}-ocamlrun
 %{_libdir}/%{_mingw32_target}-ocaml/
 
 
 %changelog
+* Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-6
+- Install tools, particularly ocamlmklib.
+
 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-5
 - +Requires mingw32-flexdll and the cross-compiler.