From 727af8dbef99e98c24e2b9760fc7384f46873da1 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mar 09 2017 22:03:31 +0000 Subject: Switch to meson; Add license file Signed-off-by: Igor Gnatenko --- diff --git a/0001-Add-C-guards-around-generated-headers.patch b/0001-Add-C-guards-around-generated-headers.patch new file mode 100644 index 0000000..6b8f8a8 --- /dev/null +++ b/0001-Add-C-guards-around-generated-headers.patch @@ -0,0 +1,89 @@ +From 3fb4fea6743c660401b78f1f08afda731d32192e Mon Sep 17 00:00:00 2001 +From: Emmanuele Bassi +Date: Fri, 3 Mar 2017 14:41:15 +0000 +Subject: [PATCH 1/6] Add C++ guards around generated headers + +Commit 0625a74d69f762df8d411bc0451927424aee1f2c moved the C++ guards +after the inclusion of the generated headers, which was an unintended +behavioural change and now requires header guards around the inclusion +of Epoxy headers. + +Fixes: #106 +--- + include/epoxy/egl.h | 4 ++-- + include/epoxy/gl.h | 4 ++-- + include/epoxy/glx.h | 4 ++-- + include/epoxy/wgl.h | 4 ++-- + 4 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/include/epoxy/egl.h b/include/epoxy/egl.h +index d5083da..b5f8ee0 100644 +--- a/include/epoxy/egl.h ++++ b/include/epoxy/egl.h +@@ -41,10 +41,10 @@ + #define __eglext_h_ + #endif + +-#include "epoxy/egl_generated.h" +- + EPOXY_BEGIN_DECLS + ++#include "epoxy/egl_generated.h" ++ + EPOXY_PUBLIC bool epoxy_has_egl_extension(EGLDisplay dpy, const char *extension); + EPOXY_PUBLIC int epoxy_egl_version(EGLDisplay dpy); + EPOXY_PUBLIC bool epoxy_has_egl(void); +diff --git a/include/epoxy/gl.h b/include/epoxy/gl.h +index 078ecee..88b9a15 100644 +--- a/include/epoxy/gl.h ++++ b/include/epoxy/gl.h +@@ -84,10 +84,10 @@ + #define GLAPIENTRYP GLAPIENTRY * + #endif + +-#include "epoxy/gl_generated.h" +- + EPOXY_BEGIN_DECLS + ++#include "epoxy/gl_generated.h" ++ + EPOXY_PUBLIC bool epoxy_has_gl_extension(const char *extension); + EPOXY_PUBLIC bool epoxy_is_desktop_gl(void); + EPOXY_PUBLIC int epoxy_gl_version(void); +diff --git a/include/epoxy/glx.h b/include/epoxy/glx.h +index a06b13d..8517063 100644 +--- a/include/epoxy/glx.h ++++ b/include/epoxy/glx.h +@@ -44,10 +44,10 @@ + #define __glxext_h_ + #endif + +-#include "epoxy/glx_generated.h" +- + EPOXY_BEGIN_DECLS + ++#include "epoxy/glx_generated.h" ++ + EPOXY_PUBLIC bool epoxy_has_glx_extension(Display *dpy, int screen, const char *extension); + EPOXY_PUBLIC int epoxy_glx_version(Display *dpy, int screen); + EPOXY_PUBLIC bool epoxy_has_glx(Display *dpy); +diff --git a/include/epoxy/wgl.h b/include/epoxy/wgl.h +index 503f899..7c85dec 100644 +--- a/include/epoxy/wgl.h ++++ b/include/epoxy/wgl.h +@@ -49,10 +49,10 @@ + #define wglUseFontBitmaps wglUseFontBitmapsA + #endif + +-#include "epoxy/wgl_generated.h" +- + EPOXY_BEGIN_DECLS + ++#include "epoxy/wgl_generated.h" ++ + EPOXY_PUBLIC bool epoxy_has_wgl_extension(HDC hdc, const char *extension); + EPOXY_PUBLIC void epoxy_handle_external_wglMakeCurrent(void); + +-- +2.12.0 + diff --git a/0002-Add-z-relro-and-z-now-to-the-GCC-linker-flags.patch b/0002-Add-z-relro-and-z-now-to-the-GCC-linker-flags.patch new file mode 100644 index 0000000..d831207 --- /dev/null +++ b/0002-Add-z-relro-and-z-now-to-the-GCC-linker-flags.patch @@ -0,0 +1,35 @@ +From f19f943a6699d771ef85402998a56743d6dfa3d9 Mon Sep 17 00:00:00 2001 +From: Emmanuele Bassi +Date: Fri, 3 Mar 2017 16:58:46 +0000 +Subject: [PATCH 2/6] Add z,relro and z,now to the GCC linker flags + +These flags are mitigations against memory corruption bugs, and are +typically enabled by Linux distributions hardening rules. + +We only use these flags with GCC, similarly to `-Bsymbolic`. + +More information on relro is available here: + + - http://tk-blog.blogspot.co.uk/2009/02/relro-not-so-well-known-memory.html + - http://mudongliang.github.io/2016/07/11/relro-a-not-so-well-known-memory-corruption-mitigation-technique.html + - https://wiki.debian.org/Hardening#DEB_BUILD_HARDENING_RELRO_.28ld_-z_relro.29 +--- + src/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/meson.build b/src/meson.build +index 3610af3..ecd032a 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -52,7 +52,7 @@ foreach h: headers + endforeach + + if cc.get_id() == 'gcc' +- common_ldflags = [ '-Wl,-Bsymbolic', ] ++ common_ldflags = [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ] + else + common_ldflags = [] + endif +-- +2.12.0 + diff --git a/0003-Add-explicit-version-flags-for-macOS-builds.patch b/0003-Add-explicit-version-flags-for-macOS-builds.patch new file mode 100644 index 0000000..22d4e32 --- /dev/null +++ b/0003-Add-explicit-version-flags-for-macOS-builds.patch @@ -0,0 +1,38 @@ +From d0a1a4e6767da8a2455b8822446978b35813161d Mon Sep 17 00:00:00 2001 +From: Emmanuele Bassi +Date: Tue, 7 Mar 2017 11:52:26 +0000 +Subject: [PATCH 3/6] Add explicit version flags for macOS builds + +Autotools automatically adds version related linker flags on macOS that +are not related to the version information. Since we want to maintain +binary compatibility, we should do the same when building on macOS. + +Fixes: #108 +--- + src/meson.build | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/meson.build b/src/meson.build +index ecd032a..4dbb3eb 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -51,10 +51,14 @@ foreach h: headers + epoxy_headers += join_paths(meson.source_root(), 'include/epoxy/@0@'.format(h)) + endforeach + ++common_ldflags = [] + if cc.get_id() == 'gcc' + common_ldflags = [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ] +-else +- common_ldflags = [] ++endif ++ ++# Maintain compatibility with autotools; see: https://github.com/anholt/libepoxy/issues/108 ++if host_system == 'darwin' ++ common_ldflags += [ '-compatibility_version=1', '-current_version=1.0', ] + endif + + epoxy_deps = [ dl_dep, ] +-- +2.12.0 + diff --git a/0004-Use-some-linker-flags-only-on-Linux.patch b/0004-Use-some-linker-flags-only-on-Linux.patch new file mode 100644 index 0000000..86d43f9 --- /dev/null +++ b/0004-Use-some-linker-flags-only-on-Linux.patch @@ -0,0 +1,29 @@ +From bfd99a94218275361fc3b207e397e93042a0b1b1 Mon Sep 17 00:00:00 2001 +From: Emmanuele Bassi +Date: Tue, 7 Mar 2017 15:32:43 +0000 +Subject: [PATCH 4/6] Use some linker flags only on Linux + +Using GCC is not a guarantee of also having access to the Linux linker; +just like we use specific linker flags on macOS, the symbolic and relro +linker flags are pretty much Linux specific. +--- + src/meson.build | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/meson.build b/src/meson.build +index 4dbb3eb..a3d76db 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -52,7 +52,8 @@ foreach h: headers + endforeach + + common_ldflags = [] +-if cc.get_id() == 'gcc' ++ ++if host_system == 'linux' + common_ldflags = [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ] + endif + +-- +2.12.0 + diff --git a/0005-Add-missing-visibility-compiler-flags.patch b/0005-Add-missing-visibility-compiler-flags.patch new file mode 100644 index 0000000..c9b019e --- /dev/null +++ b/0005-Add-missing-visibility-compiler-flags.patch @@ -0,0 +1,68 @@ +From 4719e586c0f92fa7546fa954115b92d2ae9aee9f Mon Sep 17 00:00:00 2001 +From: Emmanuele Bassi +Date: Thu, 9 Mar 2017 21:21:09 +0000 +Subject: [PATCH 5/6] Add missing visibility compiler flags + +We have been building the shared library for Epoxy without the symbol +visibility flags for the compiler, which means we've been leaking +internal symbols all over the floor. + +Fixes: #111 +--- + meson.build | 10 ++++++---- + src/meson.build | 4 +--- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/meson.build b/meson.build +index 95aac5c..afe576b 100644 +--- a/meson.build ++++ b/meson.build +@@ -140,9 +140,11 @@ foreach cflag: test_cflags + endif + endforeach + +-# Visibility compiler flags +-visibility_cflags = [] +-if get_option('default_library') != 'static' ++libtype = get_option('default_library') ++ ++# Visibility compiler flags; we only use this for shared libraries ++if libtype == 'shared' ++ visibility_cflags = [] + if host_system == 'windows' + conf.set('DLL_EXPORT', true) + if cc.get_id() == 'msvc' +@@ -152,7 +154,7 @@ if get_option('default_library') != 'static' + visibility_cflags += [ '-fvisibility=hidden' ] + endif + else +- conf.set('EPOXY_PUBLIC', '__attribute__((visibility("default")))') ++ conf.set('EPOXY_PUBLIC', '__attribute__((visibility("default"))) extern') + visibility_cflags += [ '-fvisibility=hidden' ] + endif + endif +diff --git a/src/meson.build b/src/meson.build +index a3d76db..ce6fe45 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -68,8 +68,6 @@ if host_system == 'windows' + endif + + # Allow building a static version of epoxy +-libtype = get_option('default_library') +- + if libtype != 'shared' + libepoxy_static = static_library('epoxy', + sources: epoxy_sources + epoxy_headers, +@@ -88,7 +86,7 @@ if libtype != 'static' + install: true, + dependencies: epoxy_deps, + include_directories: libepoxy_inc, +- c_args: common_cflags, ++ c_args: common_cflags + visibility_cflags, + link_args: common_ldflags) + libepoxy = libepoxy_shared + endif +-- +2.12.0 + diff --git a/0006-Prefer-using-pkg-config-files-to-find-GLES.patch b/0006-Prefer-using-pkg-config-files-to-find-GLES.patch new file mode 100644 index 0000000..1891c94 --- /dev/null +++ b/0006-Prefer-using-pkg-config-files-to-find-GLES.patch @@ -0,0 +1,42 @@ +From f7d3671a0fcad0f5371ce60916394e0269c5cee3 Mon Sep 17 00:00:00 2001 +From: Emmanuele Bassi +Date: Thu, 9 Mar 2017 21:28:52 +0000 +Subject: [PATCH 6/6] Prefer using pkg-config files to find GLES + +Just like we do for GL and EGL, we can use pkg-config to find the GLES +v2 and v1 dependencies. + +Fixes: #110 +--- + meson.build | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index afe576b..a513f5f 100644 +--- a/meson.build ++++ b/meson.build +@@ -166,8 +166,19 @@ egl_dep = dependency('egl', required: false) + + # Optional dependencies for tests + x11_dep = dependency('x11', required: false) +-gles1_dep = cc.find_library('libGLESv1_CM', required: false) +-gles2_dep = cc.find_library('libGLESv2', required: false) ++ ++# GLES v2 and v1 may have pkg-config files, courtesy of downstream ++# packagers; let's check those first, and fall back to find_library() ++# if we fail ++gles2_dep = dependency('glesv2', required: false) ++if not gles2_dep.found() ++ gles2_dep = cc.find_library('libGLESv2', required: false) ++endif ++ ++gles1_dep = dependency('glesv1_cm', required: false) ++if not gles1_dep.found() ++ gles1_dep = cc.find_library('libGLESv1_CM', required: false) ++endif + + # On windows, the DLL has to have all of its functions + # resolved at link time, so we have to link directly aginst +-- +2.12.0 + diff --git a/libepoxy.spec b/libepoxy.spec index 9724413..222ea87 100644 --- a/libepoxy.spec +++ b/libepoxy.spec @@ -1,24 +1,24 @@ -#global gitdate 20140411 - -%global commit e2c33af5bfcfc9d168f9e776156dd47c33f428b3 -#global shortcommit %(c=%{commit}; echo ${c:0:7}) - Summary: epoxy runtime library Name: libepoxy Version: 1.4.1 -Release: 1%{?dist} +Release: 2%{?dist} License: MIT URL: http://github.com/anholt/libepoxy -# github url - generated archive -#ource0: https://github.com/anholt/libepoxy/archive/%{commit}/%{name}-%{commit}.tar.gz -Source0: https://github.com/anholt/libepoxy/archive/libepoxy-%{version}.tar.gz - -BuildRequires: automake autoconf libtool -BuildRequires: mesa-libGL-devel -BuildRequires: mesa-libEGL-devel -BuildRequires: mesa-libGLES-devel -BuildRequires: xorg-x11-util-macros -BuildRequires: python3 +Source0: %{url}/archive/%{name}-%{version}.tar.gz + +Patch0001: 0001-Add-C-guards-around-generated-headers.patch +Patch0002: 0002-Add-z-relro-and-z-now-to-the-GCC-linker-flags.patch +Patch0003: 0003-Add-explicit-version-flags-for-macOS-builds.patch +Patch0004: 0004-Use-some-linker-flags-only-on-Linux.patch +Patch0005: 0005-Add-missing-visibility-compiler-flags.patch +Patch0006: 0006-Prefer-using-pkg-config-files-to-find-GLES.patch + +BuildRequires: meson +BuildRequires: gcc +BuildRequires: pkgconfig(gl) +BuildRequires: pkgconfig(egl) +BuildRequires: pkgconfig(glesv2) +BuildRequires: python3 %description A library for handling OpenGL function pointer management. @@ -32,43 +32,37 @@ This package contains libraries and header files for developing applications that use %{name}. %prep -%setup -q +%autosetup -p1 %build -autoreconf -vif || exit 1 -%configure --disable-silent-rules -make %{?_smp_mflags} +%meson +%meson_build %install -make install DESTDIR=$RPM_BUILD_ROOT - -# NOTE: We intentionally don't ship *.la files -find $RPM_BUILD_ROOT -type f -name '*.la' -delete -print +%meson_install %check -# In theory this is fixed in 1.2 but we still see errors on most platforms -# https://github.com/anholt/libepoxy/issues/24 -%ifnarch %{arm} aarch64 %{power64} s390x -make check -%else -make check ||: -%endif +%meson_test %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files +%license COPYING %doc README.md -%{_libdir}/libepoxy.so.0 -%{_libdir}/libepoxy.so.0.0.0 +%{_libdir}/libepoxy.so.0* %files devel -%dir %{_includedir}/epoxy/ -%{_includedir}/epoxy/* +%{_includedir}/epoxy/ %{_libdir}/libepoxy.so %{_libdir}/pkgconfig/epoxy.pc %changelog +* Thu Mar 09 2017 Igor Gnatenko - 1.4.1-2 +- Switch to meson +- Add license file +- Simplify spec + * Thu Mar 09 2017 Dave Airlie - 1.4.1-1 - libepoxy 1.4.1