From 2de8902bd0e20dadf6a30cf3e3445c689935a9c4 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 23 Feb 2023 17:53:17 +0000 Subject: [PATCH] Initial import (#2172444) --- .gitignore | 1 + libdex-0.1.0-doc-dir.patch | 31 ++++++++++ libdex-0.1.0-soversion.patch | 112 +++++++++++++++++++++++++++++++++++ libdex.spec | 82 +++++++++++++++++++++++++ sources | 1 + 5 files changed, 227 insertions(+) create mode 100644 .gitignore create mode 100644 libdex-0.1.0-doc-dir.patch create mode 100644 libdex-0.1.0-soversion.patch create mode 100644 libdex.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cb4e0bb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/libdex-0.1.0.tar.xz diff --git a/libdex-0.1.0-doc-dir.patch b/libdex-0.1.0-doc-dir.patch new file mode 100644 index 0000000..cfcc9f7 --- /dev/null +++ b/libdex-0.1.0-doc-dir.patch @@ -0,0 +1,31 @@ +From f810f6175c0171f29e9c23ab4454c5a437b0bef8 Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Mon, 23 Jan 2023 15:15:35 -0800 +Subject: [PATCH] build: place docs in docdir/libdex-1 + +--- + docs/meson.build | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/docs/meson.build b/docs/meson.build +index 5d2104a..1999e68 100644 +--- a/docs/meson.build ++++ b/docs/meson.build +@@ -23,12 +23,12 @@ source_toml = configure_file( + output: 'Dex.toml', + configuration: toml_conf, + install: true, +- install_dir: docs_dir / 'dex', ++ install_dir: docs_dir / 'libdex-@0@'.format(api_version), + ) + + custom_target('dex-doc', + input: [ source_toml, libdex_gir[0] ], +- output: 'dex', ++ output: 'libdex-@0@'.format(api_version), + command: [ + gidocgen, + 'generate', +-- +GitLab + diff --git a/libdex-0.1.0-soversion.patch b/libdex-0.1.0-soversion.patch new file mode 100644 index 0000000..dd10bd0 --- /dev/null +++ b/libdex-0.1.0-soversion.patch @@ -0,0 +1,112 @@ +From bb93ebb64f2d468819c7bb3732f25f40dbcdb4af Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Tue, 21 Feb 2023 11:54:03 -0800 +Subject: [PATCH] build: fix library versioning + +This also undoes some of the build cleanups that were done previously +because they were too difficult for me to unwrap and see exactly how +settings are getting inherited. + +Fixes #3 +--- + meson.build | 3 --- + src/meson.build | 41 ++++++++++++++++++++--------------------- + 2 files changed, 20 insertions(+), 24 deletions(-) + +diff --git a/meson.build b/meson.build +index 94e60b9..3b83b00 100644 +--- a/meson.build ++++ b/meson.build +@@ -126,7 +126,6 @@ endforeach + add_project_arguments(project_c_args, language: 'c') + + # Detect and set symbol visibility +-hidden_visibility_args = [] + if get_option('default_library') != 'static' + if host_machine.system() == 'windows' + config_h.set('DLL_EXPORT', true) +@@ -134,11 +133,9 @@ if get_option('default_library') != 'static' + config_h.set('_DEX_EXTERN', '__declspec(dllexport) extern') + elif cc.has_argument('-fvisibility=hidden') + config_h.set('_DEX_EXTERN', '__attribute__((visibility("default"))) __declspec(dllexport) extern') +- hidden_visibility_args = ['-fvisibility=hidden'] + endif + elif cc.has_argument('-fvisibility=hidden') + config_h.set('_DEX_EXTERN', '__attribute__((visibility("default"))) extern') +- hidden_visibility_args = ['-fvisibility=hidden'] + endif + endif + +diff --git a/src/meson.build b/src/meson.build +index 3f0fd8a..04f6e29 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -117,26 +117,31 @@ endif + + libdex_c_args = [ + deprecated_c_args, +- hidden_visibility_args, ++ release_args, + '-DG_LOG_DOMAIN="Dex"', + '-DDEX_COMPILATION', + ] + +-libdex = library('dex-@0@'.format(api_version), libdex_sources, +- dependencies: libdex_deps, +- c_args: libdex_c_args, +- install: true, ++libdex_static = static_library('dex-@0@'.format(api_version), libdex_sources, ++ dependencies: libdex_deps, ++ gnu_symbol_visibility: 'hidden', ++ c_args: libdex_c_args, + ) + +-if get_option('default_library') == 'shared' +- libdex_static = static_library('dex-@0@'.format(api_version), +- objects: libdex.extract_all_objects(recursive: true), +- ) +-elif get_option('default_library') == 'static' +- libdex_static = libdex +-elif get_option('default_library') == 'both' +- libdex_static = libdex.get_static_lib() +-endif ++libdex_static_dep = declare_dependency( ++ link_whole: libdex_static, ++ include_directories: include_directories('.'), ++ dependencies: libdex_deps, ++) ++ ++libdex = shared_library('dex-@0@'.format(api_version), ++ dependencies: libdex_deps + [libdex_static_dep], ++ c_args: libdex_c_args, ++ install: true, ++ gnu_symbol_visibility: 'hidden', ++ version: '@0@.0.0'.format(api_version), ++ darwin_versions: '1.0', ++) + + libdex_dep_sources = [] + +@@ -152,7 +157,7 @@ pkg.generate( + ) + + if get_option('introspection').enabled() +- libdex_gir = gnome.generate_gir(libdex, ++ libdex_gir = gnome.generate_gir(libdex_static, + sources: [libdex_sources, libdex_headers], + nsversion: api_version, + namespace: 'Dex', +@@ -185,10 +190,4 @@ libdex_dep = declare_dependency( + sources: [libdex_dep_sources], + ) + +-libdex_static_dep = declare_dependency( +- link_whole: libdex_static, +- include_directories: include_directories('.'), +- dependencies: libdex_deps, +-) +- + meson.override_dependency('libdex-' + api_version, libdex_dep) +-- +GitLab + diff --git a/libdex.spec b/libdex.spec new file mode 100644 index 0000000..73ac053 --- /dev/null +++ b/libdex.spec @@ -0,0 +1,82 @@ +Name: libdex +Version: 0.1.0 +Release: %autorelease +Summary: a library supporting "Deferred Execution" for GNOME and GTK + +License: LGPL-2.1-or-later +URL: https://gitlab.gnome.org/chergert/libdex +Source0: https://gitlab.gnome.org/chergert/libdex/uploads/8894d387768d3b8375b5d1121988c35a/%{name}-%{version}.tar.xz +Patch0: libdex-0.1.0-doc-dir.patch +# https://gitlab.gnome.org/chergert/libdex/-/issues/3 +Patch1: libdex-0.1.0-soversion.patch + +BuildRequires: /usr/bin/vapigen +BuildRequires: gcc +BuildRequires: gi-docgen +BuildRequires: libatomic +BuildRequires: meson +BuildRequires: pkgconfig(gio-2.0) +BuildRequires: pkgconfig(gobject-introspection-1.0) +BuildRequires: pkgconfig(liburing) +BuildRequires: pkgconfig(sysprof-capture-4) + +%description +Dex is a library supporting "Deferred Execution" with the explicit goal +of integrating with GNOME and GTK-based applications. +It provides primatives for supporting futures in a variety of ways with both +read-only and writable views. Additionally, integration with existing +asynchronous-based APIs is provided through the use of wrapper promises. +"Fibers" are implemented which allows for writing synchronous looking code +which calls asynchronous APIs from GIO underneath. + +%package devel +Summary: Development files for libdex +Requires: libdex%{?_isa} = %{version}-%{release} + +%description devel +This package contains the libraries and header files that are needed for +writing applications with libdex. + +%package devel-docs +Summary: Developer documentation for libdex +BuildArch: noarch +Requires: libdex = %{version}-%{release} + +%description devel-docs +This package contains developer documentation for writing applications with +libdex. + +%prep +%autosetup -p1 + +%build +%meson \ + -Ddocs=true \ + -Dexamples=false \ + -Dsysprof=true +%meson_build + +%install +%meson_install + +%check +%meson_test + +%files +%license COPYING +%doc NEWS README.md +%{_libdir}/libdex-1.so.1{,.*} +%{_libdir}/girepository-1.0/ + +%files devel +%{_datadir}/gir-1.0/ +%{_datadir}/vala/ +%{_includedir}/libdex-1/ +%{_libdir}/libdex-1.so +%{_libdir}/pkgconfig/libdex-1.pc + +%files devel-docs +%doc %{_docdir}/libdex-1/ + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..2e915c8 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (libdex-0.1.0.tar.xz) = 22c983a01eb838de6ee137a46a1aea54758a069e818a17ae097f58367c5184066cabc5a5a9392c61945ef4484a6bde5753425627b8a03a401e3e656d7dd7c95d