- use oasis instead of autotools to fix bytecode (bsc#1031359)

add curses.const.patch
  ad  curses.getsyx.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:ocaml/ocaml-curses?expand=0&rev=13
This commit is contained in:
Olaf Hering 2017-05-10 08:38:41 +00:00 committed by Git OBS Bridge
parent c772198a5a
commit ca063cba5b
4 changed files with 90 additions and 32 deletions

11
curses.const.patch Normal file
View File

@ -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)); }

11
curses.getsyx.patch Normal file
View File

@ -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)

View File

@ -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
ad curses.getsyx.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Mon May 30 06:39:17 UTC 2016 - ohering@suse.de Mon May 30 06:39:17 UTC 2016 - ohering@suse.de

View File

@ -1,7 +1,7 @@
# #
# spec file for package ocaml-curses # 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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -25,15 +25,13 @@ License: LGPL-2.1+
Group: Development/Libraries/Other Group: Development/Libraries/Other
Url: http://savannah.nongnu.org/projects/ocaml-tmk/ Url: http://savannah.nongnu.org/projects/ocaml-tmk/
Source0: http://download.savannah.gnu.org/releases/ocaml-tmk/%{name}-%{version}.tar.gz 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. Patch0: curses.const.patch
BuildRequires: autoconf Patch1: curses.getsyx.patch
BuildRequires: automake
BuildRequires: gawk
BuildRequires: libtool
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
BuildRequires: ocaml >= 4.00.1 BuildRequires: ocaml
BuildRequires: ocaml-rpm-macros >= 4.02.1 BuildRequires: ocaml-oasis
BuildRequires: ocaml-findlib-devel >= 1.3.3-3 BuildRequires: ocaml-ocamldoc
BuildRequires: ocaml-rpm-macros >= 4.03
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
# ocaml autodep start for pkg: ocaml-curses # ocaml autodep start for pkg: ocaml-curses
# hardcoded rpm dependency for pre 12.1 to compensate for lack of ocaml() provides/requires # 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 %prep
%setup -q %setup -q
%patch0 -p1
%patch1 -p1
%build %build
autoreconf sed 's/@BOOL_WIDE_CURSES@/true/' config.ml.in | tee config.ml
# Parallel builds don't work (with bytecode) gcc -x c -E curses.ml | tee curses.ml~
%configure --enable-widec mv -v curses.ml~ curses.ml
make all tee -a config.h <<_EOF_
%if %{ocaml_native_compiler} #define CURSES_HEADER <ncursesw/curses.h>
make opt #define CURSES_TERM_H <ncursesw/term.h>
%endif #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 %install
%ocaml_oasis_findlib_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
# #
mkdir -vp %{buildroot}/etc/ld.so.conf.d/ mkdir -vp %{buildroot}/etc/ld.so.conf.d/
tee %{buildroot}/etc/ld.so.conf.d/%{name}-stub.conf <<_EOF_ tee %{buildroot}/etc/ld.so.conf.d/%{name}-stub.conf <<_EOF_
%{_libdir}/ocaml/stublibs %{_libdir}/ocaml/curses
_EOF_ _EOF_
# #
@ -89,28 +115,31 @@ _EOF_
%postun -p /sbin/ldconfig %postun -p /sbin/ldconfig
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc COPYING %doc COPYING
/etc/ld.so.conf.d/*.conf /etc/ld.so.conf.d/*.conf
%dir %{_libdir}/ocaml
%dir %{_libdir}/ocaml/* %dir %{_libdir}/ocaml/*
%if %{ocaml_native_compiler}
%{_libdir}/ocaml/*/*.cmxs
%endif
%{_libdir}/ocaml/*/*.so %{_libdir}/ocaml/*/*.so
%{_libdir}/ocaml/*/*.so.owner
%files devel %files devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc COPYING %doc COPYING
%dir %{_libdir}/ocaml %{oasis_docdir_html}
%dir %{_libdir}/ocaml/* %dir %{_libdir}/ocaml/*
%if %{ocaml_native_compiler}
%{_libdir}/ocaml/*/*.a %{_libdir}/ocaml/*/*.a
%if %{ocaml_native_compiler}
%{_libdir}/ocaml/*/*.cmx %{_libdir}/ocaml/*/*.cmx
%{_libdir}/ocaml/*/*.cmxa %{_libdir}/ocaml/*/*.cmxa
%endif %endif
%{_libdir}/ocaml/*/*.annot
%{_libdir}/ocaml/*/*.cma %{_libdir}/ocaml/*/*.cma
%{_libdir}/ocaml/*/*.cmi %{_libdir}/ocaml/*/*.cmi
%{_libdir}/ocaml/*/*.cmt
%{_libdir}/ocaml/*/*.cmti
%{_libdir}/ocaml/*/*.mli %{_libdir}/ocaml/*/*.mli
%{_libdir}/ocaml/*/META %{_libdir}/ocaml/*/META