File mingw32-angleproject.spec of Package mingw32-angleproject

#
# spec file for package mingw32-angleproject
#
# Copyright (c) 2014 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/
#


%global svn_revision 2426
%global svn_stamp 20131118
Name:           mingw32-angleproject
Version:        %{svn_revision}
Release:        0
Summary:        Almost Native Graphics Layer Engine
License:        BSD-3-Clause
Group:          Development/Libraries
Url:            http://code.google.com/p/angleproject/
# Upstream hasn't done any official releases yet
# To generate snapshot:
# svn checkout http://angleproject.googlecode.com/svn/trunk/ angleproject
# tar --exclude-vcs -cjvpf angleproject-r$(svnversion angleproject).tar.bz2 angleproject
Source:         angleproject-r%{svn_revision}.tar.bz2
Source1:        egl.pc.in
Source2:        glesv2.pc.in
# File names are case-sensitive on Linux
Patch0:         angleproject-fix-case-sensitive-include.patch
# Make sure an import library is created and the correct .def file is used during the build
Patch2:         angleproject-include-import-library-and-use-def-file.patch
# .def pieces taken from http://qt.gitorious.org/qt/qtbase/commit/b2c44985e740d0a0ea86b7b9f4cc849258ac2340
Patch3:         angleproject-fix-mingw-compatibility.patch
# http://qt.gitorious.org/qt/qtbase/commit/dc2bfb6f8977732e1cd5ed9faac5a32870e2967a
# Fix typedefs for Win64
# The long int type is incorrect for Windows 64-bit as LLP64 is used there.
Patch4:         angleproject-fix-typedefs-for-win64.patch
# WebKit depends on symbols which are used in the static library called translator_hlsl
# This static library is linked into the libGLESv2 shared library
# To allow building WebKit export the required symbols in the libGLESv2 shared library
Patch5:         angleproject-export-shader-symbols.patch

# Automatically LoadLibrary("d3dcompiler_43.dll") when no other D3D compiler is already loaded yet
Patch6:         angleproject-auto-load-d3dcompiler-library.patch
# Fix invalid type
Patch7:         angleproject-gcc11-compile-fix.patch

BuildRequires:  gyp
BuildRequires:  mingw32-cross-binutils
BuildRequires:  mingw32-cross-gcc
BuildRequires:  mingw32-cross-gcc-c++
BuildRequires:  mingw32-filesystem
%_mingw32_package_header_debug
BuildArch:      noarch
#!BuildIgnore: post-build-checks

%description
ANGLE is a conformant implementation of the OpenGL ES 2.0 specification that
is hardware‐accelerated via Direct3D. ANGLE v1.0.772 was certified compliant
by passing the ES 2.0.3 conformance tests in October 2011. ANGLE also provides
an implementation of the EGL 1.4 specification.

ANGLE is used as the default WebGL backend for both Google Chrome and
Mozilla Firefox on Windows platforms. Chrome uses ANGLE for all graphics
rendering on Windows, including the accelerated Canvas2D implementation
and the Native Client sandbox environment.

Portions of the ANGLE shader compiler are used as a shader validator and
translator by WebGL implementations across multiple platforms. It is used
on Mac OS X, Linux, and in mobile variants of the browsers. Having one shader
validator helps to ensure that a consistent set of GLSL ES shaders are
accepted across browsers and platforms. The shader translator can be used
to translate shaders to other shading languages, and to optionally apply
shader modifications to work around bugs or quirks in the native graphics
drivers. The translator targets Desktop GLSL, Direct3D HLSL, and even ESSL
for native GLES2 platforms.

%package devel
Summary:        Files for Developing with angleproject
Group:          Development/Libraries

%description devel
ANGLE is a conformant implementation of the OpenGL ES 2.0 specification that
is hardware‐accelerated via Direct3D. ANGLE v1.0.772 was certified compliant
by passing the ES 2.0.3 conformance tests in October 2011. ANGLE also provides
an implementation of the EGL 1.4 specification.

ANGLE is used as the default WebGL backend for both Google Chrome and
Mozilla Firefox on Windows platforms. Chrome uses ANGLE for all graphics
rendering on Windows, including the accelerated Canvas2D implementation
and the Native Client sandbox environment.

Portions of the ANGLE shader compiler are used as a shader validator and
translator by WebGL implementations across multiple platforms. It is used
on Mac OS X, Linux, and in mobile variants of the browsers. Having one shader
validator helps to ensure that a consistent set of GLSL ES shaders are
accepted across browsers and platforms. The shader translator can be used
to translate shaders to other shading languages, and to optionally apply
shader modifications to work around bugs or quirks in the native graphics
drivers. The translator targets Desktop GLSL, Direct3D HLSL, and even ESSL
for native GLES2 platforms.

%_mingw32_debug_package

%prep
%setup -q -n angleproject
%patch -P 0
%patch -P 2
%patch -P 3
%patch -P 4 -p4
%patch -P 5
%patch -P 6 -p1
%patch -P 7 -p1

# create pkgconfig file
sed 's,@VERSION@,%{version},g' %{SOURCE1} > egl.pc
sed 's,@VERSION@,%{version},g' %{SOURCE2} > glesv2.pc

%build
unset RPM_OPT_FLAGS

export CXX=%{_mingw32_cxx}
export AR=%{_mingw32_ar}

gyp -D OS=win -D TARGET=mingw32 --depth . -I build/common.gypi src/build_angle.gyp

# Make sure the correct libraries are linked in
sed -i s@'^LIBS :='@'LIBS := -ld3d9'@ src/libGLESv2.target.mk
sed -i s@'^LIBS :='@'LIBS := -ld3d9 -ldxguid -L. -lGLESv2'@ src/libEGL.target.mk

make %{?_smp_mflags} V=1 CXXFLAGS="-std=c++11 -msse2 -DUNICODE -D_UNICODE"

%install
# The gyp build system doesn't know how to install files
# and gives libraries invalid filenames.. *sigh*
mkdir -p %{buildroot}%{_mingw32_bindir} %{buildroot}%{_mingw32_libdir} %{buildroot}%{_mingw32_includedir}

install out/Debug/obj.target/src/libGLESv2.so %{buildroot}%{_mingw32_bindir}/libGLESv2.dll
install out/Debug/obj.target/src/libEGL.so %{buildroot}%{_mingw32_bindir}/libEGL.dll
install -m0644 libGLESv2.dll.a %{buildroot}%{_mingw32_libdir}
install -m0644 libEGL.dll.a %{buildroot}%{_mingw32_libdir}

cp -Rv include/* %{buildroot}%{_mingw32_includedir}

# conflicts with mingw32-headers
rm -rf %{buildroot}%{_mingw32_includedir}/KHR

mkdir -p %{buildroot}%{_mingw32_libdir}/pkgconfig

# install pkgconfig file
install -m0644 egl.pc %{buildroot}%{_mingw32_libdir}/pkgconfig/egl.pc
install -m0644 glesv2.pc %{buildroot}%{_mingw32_libdir}/pkgconfig/glesv2.pc


%files
%defattr(-,root,root)
%{_mingw32_bindir}/libEGL.dll
%{_mingw32_bindir}/libGLESv2.dll

%files devel
%defattr(-,root,root)
%{_mingw32_includedir}/EGL
%{_mingw32_includedir}/GLES2
%{_mingw32_includedir}/GLSLANG
%{_mingw32_libdir}/libEGL.dll.a
%{_mingw32_libdir}/libGLESv2.dll.a
%{_mingw32_libdir}/pkgconfig

%changelog
openSUSE Build Service is sponsored by