File neko.spec of Package neko

#
# spec file for package neko
#
# Copyright (c) 2015 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:           neko
Version:        2.0.0
Release:        0
Summary:        A cross-platform lightweight virtual machine and language
License:        MIT
Group:          Development/Languages/Other
Url:            http://nekovm.org
Source0:        http://nekovm.org/_media/neko-%{version}.tar.gz
Patch0:         0001-library-paths.patch
Patch1:         0002-ndll-paths.patch
Patch2:         0003-no-apache.patch
Patch3:         0004-no-mod_tora.patch
Patch4:         0005-set-soname.patch
Patch5:         0006-libmysqlclient.patch
Patch6:         0007-extra-cflags.patch
Patch7:         0008-jit.patch
BuildRequires:  apache2-devel
BuildRequires:  gc-devel
BuildRequires:  gtk2-devel
BuildRequires:  libmysqlclient-devel
BuildRequires:  pcre-devel-static
BuildRequires:  sqlite3-devel
BuildRequires:  zlib-devel-static
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       libneko1 = %{version}
Provides:       nekovm = %version
Obsoletes:      nekovm < %version

%description
Neko VM is a virtual machine and dynamic language that is both lightweight and efficient.

%package devel
Summary:        Development files for the neko virtual machine
License:        MIT
Group:          Development/Languages/Other
Requires:       libneko1 = %{version}
Provides:       nekovm-devel = %version
Obsoletes:      nekovm-devel < %version

%description devel
Development files and headers for the neko virtual machine

%package -n libneko1
Summary:        Neko virtual machine shared library
License:        MIT
Group:          System/Libraries

%description -n libneko1
Shared library for the Neko virtual machine

%package mysql
Summary:        Neko virtual machine MySQL library
License:        GPL-2.0+
Group:          System/Libraries
Requires:       %{name} = %{version}
Provides:       nekovm-mysql = %version
Obsoletes:      nekovm-mysql < %version

%description mysql
MySQL library for the Neko virtual machine

%prep
%setup -q -n neko-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1

%build
# don't use parallel build
make EXTRA_CFLAGS="%{optflags} -fno-strict-aliasing"

%check
make test

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_prefix}/lib
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_includedir}

make INSTALL_PREFIX=%{buildroot}%{_prefix} install

# Put the lib files in _libdir:
if [ %{_prefix}/lib != %{_libdir} ]; then
  mv %{buildroot}%{_prefix}/lib/* %{buildroot}%{_libdir}
  rmdir %{buildroot}%{_prefix}/lib
fi

# for some reason libneko.so does not end being a symlink
# resulting in -devel package providing libneko.so.1()(64bit)
rm -f %{buildroot}%{_libdir}/libneko.so
rm -f %{buildroot}%{_libdir}/libneko.so
ln -s %{_libdir}/libneko.so.1 %{buildroot}%{_libdir}/libneko.so

# also provide .so.0 for compatibility with Debian
# PS. the .so.0 in Debian is exactly the same as our .so.1
ln -s %{_libdir}/libneko.so.1 %{buildroot}%{_libdir}/libneko.so.0

# Remove nekoml.std
# https://github.com/HaxeFoundation/neko/issues/97
rm -f %{buildroot}%{_bindir}/nekoml.std

%post -n libneko1 -p /sbin/ldconfig

%postun -n libneko1 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%{_bindir}/*
%dir %{_libdir}/neko
%{_libdir}/neko/regexp.ndll
%{_libdir}/neko/sqlite.ndll
%{_libdir}/neko/std.ndll
%{_libdir}/neko/ui.ndll
%{_libdir}/neko/zlib.ndll
%doc LICENSE CHANGES

%files mysql
%defattr(-,root,root)
%{_libdir}/neko/mysql.ndll
%{_libdir}/neko/mysql5.ndll
%doc LICENSE CHANGES

%files -n libneko1
%defattr(-,root,root)
%{_libdir}/*.so.*
%doc LICENSE CHANGES

%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/*.so
%doc LICENSE CHANGES

%changelog
openSUSE Build Service is sponsored by