diff --git a/curses.const.patch b/curses.const.patch new file mode 100644 index 0000000..54fdacf --- /dev/null +++ b/curses.const.patch @@ -0,0 +1,11 @@ +--- a/ml_curses.c ++++ b/ml_curses.c +@@ -74,7 +74,7 @@ + Store_field(ret,2,Val_int(z)); \ + CAMLreturn(ret); } + #define r_string(f) \ +- { char *ret=f; \ ++ { const char *ret=f; \ + if(ret==NULL) failwith("Null pointer"); \ + CAMLreturn(copy_string(ret)); } + diff --git a/curses.getsyx.patch b/curses.getsyx.patch new file mode 100644 index 0000000..ada6dd3 --- /dev/null +++ b/curses.getsyx.patch @@ -0,0 +1,11 @@ +--- a/functions.c ++++ b/functions.c +@@ -383,7 +383,7 @@ ML0(reset_shell_mode,unit) + ML0(resetty,unit) + ML0(savetty,unit) + ML0d(getsyx,int*int) +-BEG0 int x,y; getsyx(y,x); r_int_int(y,x); END ++BEG0 int x=0,y=0; getsyx(y,x); r_int_int(y,x); END + ML2(setsyx,unit,int,int) + ML1(curs_set,err,int) + ML1(napms,unit,int) diff --git a/ocaml-curses.changes b/ocaml-curses.changes index e9d2957..c214595 100644 --- a/ocaml-curses.changes +++ b/ocaml-curses.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed May 10 08:23:44 UTC 2017 - ohering@suse.de + +- use oasis instead of autotools to fix bytecode (bsc#1031359) + add curses.const.patch + add curses.getsyx.patch + ------------------------------------------------------------------- Mon May 30 06:39:17 UTC 2016 - ohering@suse.de diff --git a/ocaml-curses.spec b/ocaml-curses.spec index 5387daa..8d4f6e0 100644 --- a/ocaml-curses.spec +++ b/ocaml-curses.spec @@ -1,7 +1,7 @@ # # spec file for package ocaml-curses # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,15 +25,13 @@ License: LGPL-2.1+ Group: Development/Libraries/Other Url: http://savannah.nongnu.org/projects/ocaml-tmk/ Source0: http://download.savannah.gnu.org/releases/ocaml-tmk/%{name}-%{version}.tar.gz -# Doesn't include a configure script, so we have to make one. -BuildRequires: autoconf -BuildRequires: automake -BuildRequires: gawk -BuildRequires: libtool +Patch0: curses.const.patch +Patch1: curses.getsyx.patch BuildRequires: ncurses-devel -BuildRequires: ocaml >= 4.00.1 -BuildRequires: ocaml-rpm-macros >= 4.02.1 -BuildRequires: ocaml-findlib-devel >= 1.3.3-3 +BuildRequires: ocaml +BuildRequires: ocaml-oasis +BuildRequires: ocaml-ocamldoc +BuildRequires: ocaml-rpm-macros >= 4.03 BuildRoot: %{_tmppath}/%{name}-%{version}-build # ocaml autodep start for pkg: ocaml-curses # hardcoded rpm dependency for pre 12.1 to compensate for lack of ocaml() provides/requires @@ -56,32 +54,60 @@ developing applications that use %{name}. %prep %setup -q - +%patch0 -p1 +%patch1 -p1 %build -autoreconf -# Parallel builds don't work (with bytecode) -%configure --enable-widec -make all -%if %{ocaml_native_compiler} -make opt -%endif +sed 's/@BOOL_WIDE_CURSES@/true/' config.ml.in | tee config.ml +gcc -x c -E curses.ml | tee curses.ml~ +mv -v curses.ml~ curses.ml +tee -a config.h <<_EOF_ +#define CURSES_HEADER +#define CURSES_TERM_H +#define HAVE_TERMIOS_H 1 +#define HAVE_SYS_IOCTL_H 1 +_EOF_ +rm -fv setup.ml myocamlbuild.ml META* _* */_* +# obs service changes every ^Version line ... +sh -c "sed 's/^Version.*/Version: %{version}/' | tee _oasis" <<_EOF_ +OASISFormat: 0.4 +Name: curses +Version: 0 +Synopsis: OCaml bindings for ncurses +Authors: Paul Pelzl +License: LGPL-2.1+ +LicenseFile: LICENSE +Plugins: META(`oasis version`) +BuildTools: ocamlbuild +Library curses + Path: . + Install: true + Modules: Curses + CSources: ml_curses.c, config.h + CCOpt: -Wall -O2 -g -I$PWD -Werror -D_GNU_SOURCE -DHAVE_CONFIG_H + CCLib: -lncursesw + +Document curses + Title: API reference for curses + Type: ocamlbuild + BuildTools+: ocamldoc + InstallDir: \$htmldir + Install: true + XOCamlbuildPath: . + XOCamlbuildLibraries: curses +_EOF_ +%oasis_setup +%ocaml_oasis_configure --enable-docs +%ocaml_oasis_build +%ocaml_oasis_doc %install - -export DESTDIR=%{buildroot} -export OCAMLFIND_DESTDIR=%{buildroot}%{_libdir}/ocaml -mkdir -p $OCAMLFIND_DESTDIR $OCAMLFIND_DESTDIR/stublibs -export OCAMLFILES="curses META *.cmi *.cma *.so *.mli" -%if %{ocaml_native_compiler} -export OCAMLFILES="$OCAMLFILES *.cmx *.cmxa *.a" -%endif -ocamlfind install $OCAMLFILES +%ocaml_oasis_findlib_install # mkdir -vp %{buildroot}/etc/ld.so.conf.d/ tee %{buildroot}/etc/ld.so.conf.d/%{name}-stub.conf <<_EOF_ -%{_libdir}/ocaml/stublibs +%{_libdir}/ocaml/curses _EOF_ # @@ -89,28 +115,31 @@ _EOF_ %postun -p /sbin/ldconfig - %files %defattr(-,root,root,-) %doc COPYING /etc/ld.so.conf.d/*.conf -%dir %{_libdir}/ocaml %dir %{_libdir}/ocaml/* +%if %{ocaml_native_compiler} +%{_libdir}/ocaml/*/*.cmxs +%endif %{_libdir}/ocaml/*/*.so -%{_libdir}/ocaml/*/*.so.owner %files devel %defattr(-,root,root,-) %doc COPYING -%dir %{_libdir}/ocaml +%{oasis_docdir_html} %dir %{_libdir}/ocaml/* -%if %{ocaml_native_compiler} %{_libdir}/ocaml/*/*.a +%if %{ocaml_native_compiler} %{_libdir}/ocaml/*/*.cmx %{_libdir}/ocaml/*/*.cmxa %endif +%{_libdir}/ocaml/*/*.annot %{_libdir}/ocaml/*/*.cma %{_libdir}/ocaml/*/*.cmi +%{_libdir}/ocaml/*/*.cmt +%{_libdir}/ocaml/*/*.cmti %{_libdir}/ocaml/*/*.mli %{_libdir}/ocaml/*/META