File mingw32-mongoose.spec of Package mingw32-mongoose

#
# spec file for package mongoose
#
# Copyright (c) 2013 SUSE LINUX Products 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:			mingw32-mongoose
Summary:		Embedded Web Server / Embedded Networking Library
License:		GPL-2.0
Group:			Development/Libraries/C and C++
Version:		6.18
Release:		0

Url:			https://github.com/cesanta/mongoose

Source0:		mongoose-%{version}.tar.xz
Source1:		CMakeLists.txt
Source2:		package.pc.in

BuildRequires:	autoconf
BuildRequires:	automake
BuildRequires:	cmake
BuildRequires:	mingw32-cross-binutils
BuildRequires:	mingw32-cross-gcc-c++
BuildRequires:	mingw32-cross-pkg-config
BuildRequires:	mingw32-filesystem
BuildRequires:	mingw32-gcc-c++
BuildRequires:	mingw32-libopenssl-devel

# Build changes:

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%define MAJOR_VERSION %(echo %{version} | cut -d. -f1)
%define MINOR_VERSION %(echo %{version} | cut -d. -f2 | cut -d+ -f1)

%description
Mongoose is ideal for embedded environments. It has been designed for
connecting devices and bringing them online. On the market since 2004,
used by vast number of open source and commercial products - it even
runs on space stations! Mongoose makes embedded network programming
fast, robust, and easy.

%package -n mingw32-libmongoose
Summary: Shared Object for applications that use %{name} embedded
Group: Development/Libraries/C and C++

%description -n mingw32-libmongoose
This package contains the shared library required by applications that
are using %{name}'s embeddable API to provide web services. 

%package devel
Summary:        Header files and development libraries for %{name}
Group:          Development/Libraries/C and C++
Requires:       mingw32-libmongoose = %{version}-%{release}

%description devel
This package contains the header files and development libraries
for %{name}. If you like to develop programs embedding %{name} on them,
you will need to install %{name}-devel and check %{name}'s API at its
comprisable header file.

%prep
%setup -q -n mongoose-%{version}
%{__install} -p -m 0644  %{SOURCE1} .
%{__install} -p -m 0644  %{SOURCE2} .

rm -rf build
mkdir build
cd build

%{_mingw32_cmake} \
  -DMONGOOSE_VERSION=%{MAJOR_VERSION}.%{MINOR_VERSION}.0 \
  -DCMAKE_VERBOSE_MAKEFILE=TRUE \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_FLAGS_RELEASE:STRING="$RPM_OPT_FLAGS" \
  ..

%build
cd build
make all %{?_smp_mflags}

%install
cd build
%make_install

# Fix paths
mkdir -p %{buildroot}%{_mingw32_bindir}
mv \
  %{buildroot}%{_mingw32_libdir}/*.dll \
  %{buildroot}%{_mingw32_bindir}

%files -n mingw32-libmongoose
%defattr(-,root,root,-)
%doc README.md
%license LICENSE
%{_mingw32_bindir}/*.dll

%files devel
%defattr(-,root,root,-)
%doc README.md
%{_mingw32_includedir}/*.h
%{_mingw32_libdir}/pkgconfig/*.pc
%{_mingw32_libdir}/*.a

%changelog

openSUSE Build Service is sponsored by