#
# spec file for package slang
#
# Copyright (c) 2018 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           slang
Version:        2.3.1a
Release:        6.1
Summary:        Programming Library and Embeddable Extension Language
License:        GPL-2.0-or-later
Group:          Development/Libraries/C and C++
Url:            http://www.jedsoft.org/
Source0:        http://www.jedsoft.org/releases/slang/slang-%{version}.tar.bz2
Source1:        http://www.jedsoft.org/releases/slang/slang-%{version}.tar.bz2.asc
Source2:        %{name}.keyring
Source3:        baselibs.conf
Patch0:         slang.patch
Patch1:         slang-autoconf.patch
Patch2:         slang-fsuid.patch
# PATCH-FIX-UPSTREAM
Patch5:         git-6dd5ade9a97b52ace4ac033779a6d3c1c51db4d1.patch
Patch6:         overflow.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  pcre-devel
BuildRequires:  pkg-config
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1210
BuildRequires:  oniguruma-devel >= 5.9.0
%endif
BuildRequires:  libpng-devel

%description
S-Lang is a programming library for creating multi-platform software.
It provides display/screen management, keyboard input, keymaps, etc.
Another feature is the interpreter for the S-Lang extension language
which can be embedded into an application to make it extensible. With
slsh, a standalone interpreter is available as well.

%package slsh
Summary:        Interpreter for S-Lang Scripts
Group:          Development/Languages/Other
Provides:       slang = %{version}
Obsoletes:      slang <= 2.1.1

%description slsh
slsh is a standalone interpreter of the S-Lang language. It can be used to
execute scripts, or be run interactively.

%package -n libslang2
Summary:        Programming Library and Embeddable Extension Language
Group:          System/Libraries

%description -n libslang2
S-Lang is a programming library for creating multi-platform software.
It provides display/screen management, keyboard input, keymaps, etc.
Another feature is the interpreter for the S-Lang extension language
which can be embedded into an application to make it extensible. With
slsh, a standalone interpreter is available as well.

%package devel
Summary:        Programming Library and Embeddable Extension Language - Development Package
Group:          Development/Languages/C and C++
Requires:       libslang2 = %{version}
Provides:       slang:%{_includedir}/slang.h

%description devel
S-Lang is a programming library for creating multi-platform software.
It provides display/screen management, keyboard input, keymaps, etc.
Another feature is the interpreter for the S-Lang extension language
which can be embedded into an application to make it extensible. With
slsh, a standalone interpreter is available as well.

This package contains all necessary include files and libraries needed to
develop applications that require it.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch5 -p0
%patch6 -p1

%build
mv autoconf/configure.ac .
mv autoconf/aclocal.m4 autoconf/acinclude.m4
#autoheader -I autoconf
aclocal -I autoconf --output=autoconf/aclocal.m4
autoconf -I autoconf
export CFLAGS="%{optflags} -fno-strict-aliasing -fstack-protector"
export ELF_CFLAGS="$CFLAGS"
%configure \
    --docdir=%{_docdir}/slang-devel \
    --with-pcre \
    --with-z
#    --with-onig
# parallel make still broken in 2.2.2
make --jobs 1
make  static --jobs 1

%install
make DESTDIR=%{buildroot} install install-static 

rm -rf %{buildroot}%{_datadir}/doc/

%check
%ifnarch i586
%ifnarch s390
%ifnarch s390x
make check
%endif
%endif
%endif

%post -n libslang2 -p /sbin/ldconfig

%postun -n libslang2 -p /sbin/ldconfig

%files slsh
%defattr(-,root,root)
%doc COPYING slsh/README
%doc slsh/doc/html/
%config(noreplace) %{_sysconfdir}/slsh.rc
%{_bindir}/slsh
%{_libdir}/slang/
%{_datadir}/slsh/
%{_mandir}/man1/slsh.1*

%files -n libslang2
%defattr(-,root,root)
%{_libdir}/libslang.so.*

%files devel
%defattr(-,root,root)
%doc changes.txt COPYING NEWS README UPGRADE.txt demo/ examples/
%doc doc/grammar.txt doc/text/
%{_includedir}/*
%{_libdir}/pkgconfig/slang.pc
%{_libdir}/libslang.a
%{_libdir}/libslang.so

%changelog
* Mon Sep 24 2018 schwab@suse.de
- overflow.patch: fix overflow checks not to depend on undefined behaviour
* Thu Mar 15 2018 ro@suse.de
- handle s390 like s390x
* Fri Mar  2 2018 crrodriguez@opensuse.org
- BuildRequire default libpng on the system, builds and test
  pass fine. (drops slang-libpng12-linker-flag.patch)
* Fri Feb  9 2018 werner@suse.de
- Add upstream commit 6dd5ade9a97b52ace4ac033779a6d3c1c51db4d1 as
  patch git-6dd5ade9a97b52ace4ac033779a6d3c1c51db4d1.patch (boo#1079543)
  * Added support for the new ncurses 32-bit terminfo database entries
* Fri Jun  9 2017 jengelh@inai.de
- Rectify RPM groups. Trim filler wording from description.
* Wed May  3 2017 astieger@suse.com
- slang 2.3.1a:
  * 24 bitcolor support for 64 bit systems
  * various bug fixes and improvements
- disable failing tests on i586 and s390x
* Sat Feb 28 2015 mpluskal@suse.com
- Cleanup spec file with spec-cleaner
- Add gpg signature
- Remove upstreamed patch
  * sprintf-bug-concerning-c-for-8-bit-character-in-non-.patch
- Update to 2.3.0
  * numerous changes, see included changes.txt for a detailed
    list
* Tue Aug 26 2014 fcrozat@suse.com
- Add obsoletes/provides to baselibs.conf.
* Wed Jul  2 2014 kkaempf@suse.com
- fix for running in non-utf-8 environments (bnc#885624)
  add sprintf-bug-concerning-c-for-8-bit-character-in-non-.patch
- drop slang-2.2.2-makefile.patch, obsolete
* Thu May 24 2012 gber@opensuse.org
- update to version 2.2.4
  - numerous changes, see the included changes.txt for a detailed
    list
- rebased slang-2.2.2.dif and renamed to slang.patch
- rebased slang-2.2.2-autoconf.dif and renamed to
  slang-autoconf.patch
- rebased slang-2.2.2-libpng12-linker-flag.patch and renamed to
  slang-libpng12-linker-flag.patch
- rebased slang-2.2.2-fsuid.dif and renamed to slang-fsuid.patch
- build oniguruma module on >= 12.1
* Fri Dec  2 2011 jengelh@medozas.de
- Remove redundant/unwanted tags/section (cf. specfile guidelines)
* Fri Dec  2 2011 coolo@suse.com
- add automake as buildrequire to avoid implicit dependency
* Mon Sep 13 2010 coolo@novell.com
- fix baselibs.conf
* Tue Aug 17 2010 gber@opensuse.org
- disabled parallel build again, still broken
* Sat Aug 14 2010 gber@opensuse.org
- updated to version 2.2.2
  + new languag features
  * ternary expressions
  * break and condition statements can now work on several levels
    of loops
  * multiline strings
  * List_Type objects can now also be indexed using an array of
    indices
  + new modules: zlib, fork, sysconf
  + new intrinsic functions: sumsq, expm1, log1p, list_to_array,
    string_matches, _close, _fileno, dup2, getsid, killpg,
    getpriority, setpriority, ldexp, frexp
  + provides pkg-info file
  + many bugfixes
- split package to conform to library naming policy
- rebased patches, removed obsolete slang-2.2.1-format.patch
- added patch slang-2.2.2-makefile.patch from Fedora which fixes
  shared libs permissions, the slang shared library symlink, and
  parallel build dependency issues and removes rpath
- build pcre, png, and zlib modules
- removed incorrect license information
- more accurate summary and description
- further cleanup
* Thu Apr  8 2010 meissner@suse.de
- unbreak occasional build failures by disabling parallel make.
* Wed Jan 13 2010 meissner@suse.de
- fixed better
* Tue Jan 12 2010 coolo@novell.com
- include headers to fix build
* Sat Dec 19 2009 jengelh@medozas.de
- add baselibs.conf as a source
- enable parallel build
* Wed Jan  7 2009 olh@suse.de
- obsolete old -XXbit packages (bnc#437293)
* Fri Jun 27 2008 schwab@suse.de
- Work around autoconf limitation.
* Thu Apr 10 2008 ro@suse.de
- added baselibs.conf file to build xxbit packages
  for multilib support
* Wed Jul 11 2007 nadvornik@suse.cz
- updated to 2.1.1:
  * interpreter syntax enhancements
  * many bugfixes
- fixed some rpmlint warnings
* Mon May 28 2007 nadvornik@suse.cz
- do not package binaries in documentation directory
* Tue Jan 31 2006 nadvornik@suse.cz
- fixed typo in locale code [#146603]
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Thu Jan 12 2006 nadvornik@suse.cz
- compile with -fstack-protector
* Tue Jan  3 2006 nadvornik@suse.cz
- updated to 2.0.5
- fixed output of multibyte chars to bottom right corner [#134037]
* Mon Oct 17 2005 nadvornik@suse.cz
- fixed filelist
* Thu Oct 13 2005 nadvornik@suse.cz
- updated documentation, specfile fixes
* Tue Oct 11 2005 nadvornik@suse.cz
- updated to 2.0.4
  * upstream UTF-8 support
* Wed Feb 16 2005 nadvornik@suse.cz
- fixed segfault in SLsmg_write_nwchars
* Thu Jan  6 2005 nadvornik@suse.cz
- fixed segfault on negative column value
* Wed Mar 10 2004 nadvornik@suse.cz
- removed symlinks pointing nowhere [#34927]
* Fri Feb 20 2004 nadvornik@suse.cz
- used libdir macro
* Wed Feb 18 2004 sbrabec@suse.cz
- Added all available UTF-8 patches from Debian and Redhat.
* Tue Feb 10 2004 nadvornik@suse.cz
- compiled with -fno-strict-aliasing
* Sat Jan 10 2004 adrian@suse.de
- add %%defattr and %%run_ldconfig
* Fri Jul 25 2003 nadvornik@suse.cz
- updated to 1.4.9
* Wed May 28 2003 nadvornik@suse.cz
- remove unpackaged files from buildroot
* Thu Feb 13 2003 nadvornik@suse.cz
- updated to 1.4.8
* Mon Jan 13 2003 nadvornik@suse.cz
- updated to 1.4.7
* Mon Sep 23 2002 nadvornik@suse.cz
- removed the utf8 patch [#19941]
* Mon Sep 16 2002 pthomas@suse.de
- Check for availability of setfsuid/setfsgid and abort configuration
  if not found. Include sys/fsuid.h to get setfsuid/setfsgid declared.
- Redo the utf8 patch to also define _GNU_SOURCE to get wcwidth
  declared.
- Change configure.in to make the use of autoheader possible.
- Make configure use a passed in ELF_CFLAGS.
- Remove the unneeded -fno-strength-reduce from CFLAGS and ELF_CFLAGS.
- devel package requires base package of same version.
* Tue Jul  9 2002 nadvornik@suse.cz
- fixed macro SLSMG_BUILD_CHAR in utf8 patch, it fixes the crash
  of xjed [bug #16823]
* Fri May 31 2002 nadvornik@suse.cz
- updated to 1.4.5
- created devel subpackage [bug #16241]
- added html doc
* Wed Feb 20 2002 nadvornik@suse.cz
- fixed color handling for tab character
* Wed Jan 30 2002 nadvornik@suse.cz
- fixed conversion of control characters to printable form in
  UTF-8 patch [bug #12894]
* Thu Jan 10 2002 nadvornik@suse.cz
- used macros %%{_lib} and %%{_libdir}
* Fri Oct 26 2001 pmladek@suse.cz
- fixed displaying of long lines (#11919)
  * the begin of the visible part of the line is tested now
* Wed Jun 13 2001 schwab@suse.de
- Fix use of %%suse_update_config.
* Thu Jun  7 2001 bjacke@suse.de
- apply UTF-8 patch from http://www.rano.org/mutt/
* Wed Jun  6 2001 nadvornik@suse.cz
- fixed to compile with new autoconf
* Mon Feb 26 2001 nadvornik@suse.cz
- update to 1.4.4
* Mon Oct  9 2000 nadvornik@suse.cz
- fixed Copyright
* Fri Sep 15 2000 nadvornik@suse.cz
- update to 1.4.2
- used suse_update_config
* Wed Jul 19 2000 nadvornik@suse.cz
- added libslang.so.1 symlink (Bug#: 3545)
* Thu May 18 2000 nadvornik@suse.cz
- changed Group tag
* Fri Mar 24 2000 nadvornik@suse.cz
- added URL
* Mon Mar 13 2000 nadvornik@suse.cz
- upgrade to version 1.4.0
- removed Makefile.Linux
- added BuildRoot
* Thu Oct  7 1999 fehr@suse.de
- recognize alternat xterm cursor sequences when doing line editing
* Mon Sep 13 1999 bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Wed Jul 21 1999 fehr@suse.de
- changed one patch slightly
* Tue Jun 30 1998 fehr@suse.de
- integrate setuid security patches from Alan Cox in dif-file
- change to version 1.2.2
* Tue Jun 30 1998 fehr@suse.de
- add security patches from Alan Cox (overflow, setuid, termdir)
- add dynamic version of slang library
- install documentation to /usr/doc/packages/slang
* Wed Jan 22 1997 florian@suse.de
- update to version 0.99-38
* Thu Jan  2 1997 florian@suse.de
- update to version 0.99-37
* Thu Jan  2 1997 florian@suse.de
- update to version 0.99-36 and add bug-fixes from mutt
* Thu Jan  2 1997 florian@suse.de
- update to new version 0.99-35