From 64fd0c0d0c9b14bd3757baad456f691dbec040458380d36ae69624467a3651ee Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 8 Jun 2017 15:26:37 +0000 Subject: [PATCH] - Use meson to build raylib: * Takes care of creating proper so versioning * Install works (where their makefiles didnt) - Add root-meson.build - Add src-meson.build Meson files will be in next release, see: https://github.com/raysan5/raylib/pull/297 See: https://github.com/raysan5/raylib/pull/295 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/raylib?expand=0&rev=2 --- raylib.changes | 12 ++++++++++++ raylib.spec | 39 +++++++++++++++++++++++++++++---------- root-meson.build | 14 ++++++++++++++ src-meson.build | 22 ++++++++++++++++++++++ 4 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 root-meson.build create mode 100644 src-meson.build diff --git a/raylib.changes b/raylib.changes index b2b036a..5328c7f 100644 --- a/raylib.changes +++ b/raylib.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Thu Jun 8 15:14:33 UTC 2017 - mvetter@suse.com + +- Use meson to build raylib: + * Takes care of creating proper so versioning + * Install works (where their makefiles didnt) +- Add root-meson.build +- Add src-meson.build + Meson files will be in next release, see: + https://github.com/raysan5/raylib/pull/297 + ------------------------------------------------------------------- Sun Jun 4 19:36:11 UTC 2017 - mvetter@suse.com @@ -14,6 +25,7 @@ Mon May 29 16:47:32 UTC 2017 - mvetter@suse.com - Add OpenAL to BuildRequires - Add raylig-use-optflags.patch: allow passing of optflags + See: https://github.com/raysan5/raylib/pull/295 ------------------------------------------------------------------- Mon May 29 10:26:46 UTC 2017 - mvetter@suse.com diff --git a/raylib.spec b/raylib.spec index c950c00..dda0c22 100644 --- a/raylib.spec +++ b/raylib.spec @@ -15,17 +15,23 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + Name: raylib Version: 1.7.0 Release: 0 Summary: C library to learn videogames programming License: Zlib -Group: Development/Libraries +Group: Development/Libraries/C and C++ Url: http://www.raylib.com Source: https://github.com/raysan5/%{name}/archive/%{version}.tar.gz +# Will be in next release: https://github.com/raysan5/raylib/pull/297 +Source1: root-meson.build +Source2: src-meson.build +# https://github.com/raysan5/raylib/pull/295 Patch0: raylig-use-optflags.patch BuildRequires: Mesa-libGL-devel BuildRequires: libglfw-devel +BuildRequires: meson >= 0.39.1 BuildRequires: openal-soft-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -35,27 +41,40 @@ raylib is highly inspired by Borland BGI graphics lib and by XNA framework. %package -n raylib-devel Summary: Development files for %{name} -Group: Development/Libraries +Group: Development/Libraries/C and C++ Requires: openal-soft-devel +Requires: libraylib1 = %{version} %description -n raylib-devel Development files and headers for %{name} +%package -n libraylib1 +Summary: Development files for %{name} +Group: Development/Libraries/C and C++ + +%description -n libraylib1 +C library to learn videogames programming + %prep %setup -q %patch0 -p1 +cp %{SOURCE1} meson.build +cp %{SOURCE2} src/meson.build %build -cd src -CFLAGS="%optflags" make %{?_smp_mflags} PLATFORM=PLATFORM_DESKTOP SHARED_RAYLIB=YES +%{meson} +%{meson_build} %install -cd src -# for some reason that doesnt work -#%make_install SHARED_RAYLIB=YES -# so lets install manually -install -Dm 0755 ../release/linux/libraylib.so %{buildroot}%{_libdir}/libraylib.so -install -Dm 0644 ../release/linux/raylib.h %{buildroot}%{_includedir}/raylib.h +%{meson_install} + +%post -n libraylib1 -p /sbin/ldconfig +%postun -n libraylib1 -p /sbin/ldconfig + +%files -n libraylib1 +%defattr(-,root,root) +%{_libdir}/libraylib.so.1 +%{_libdir}/libraylib.so.1.7.0 %files -n raylib-devel %defattr(-,root,root) diff --git a/root-meson.build b/root-meson.build new file mode 100644 index 0000000..0760c36 --- /dev/null +++ b/root-meson.build @@ -0,0 +1,14 @@ +project('raylib', 'c', version: '1.7.0', + license: 'zlib', + meson_version: '>= 0.39.1') + +cc = meson.get_compiler('c') + +glfw_dep = dependency('glfw3') +gl_dep = dependency('gl') +openal_dep = dependency('openal') +x11_dep = dependency('x11') +m_dep = cc.find_library('m', required : false) + +subdir('src') + diff --git a/src-meson.build b/src-meson.build new file mode 100644 index 0000000..2ece4ea --- /dev/null +++ b/src-meson.build @@ -0,0 +1,22 @@ +install_headers('raylib.h') + +source_c = [ + 'audio.c', + 'core.c', + 'models.c', + 'rlgl.c', + 'shapes.c', + 'text.c', + 'textures.c', + 'utils.c', + 'external/stb_vorbis.c', +] + +# use 'meson --default-library=static builddir' to build as static, if no builddir yet exists +# use 'mesonconf -Ddefault_library=static builddir' to change the type +raylib = library('raylib', + source_c, + dependencies : [ glfw_dep, gl_dep, openal_dep, m_dep, x11_dep], + install : true, + version : '1.7.0') +