Skip to content

Commit

Permalink
Add rubygem-llhttp-ffi package
Browse files Browse the repository at this point in the history
  • Loading branch information
ochnerd committed Aug 23, 2024
1 parent b47d393 commit 2477910
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
2 changes: 2 additions & 0 deletions comps/comps-foreman-plugins-el8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
<packagereq type="default">rubygem-jquery-matchheight-rails</packagereq>
<packagereq type="default">rubygem-jsonpath</packagereq>
<packagereq type="default">rubygem-kubeclient</packagereq>
<packagereq type="default">rubygem-llhttp-ffi</packagereq>
<packagereq type="default">rubygem-logify</packagereq>
<packagereq type="default">rubygem-mqtt</packagereq>
<packagereq type="default">rubygem-ms_rest</packagereq>
Expand Down Expand Up @@ -315,6 +316,7 @@
<packagereq type="default">rubygem-jquery-matchheight-rails-doc</packagereq>
<packagereq type="default">rubygem-jsonpath-doc</packagereq>
<packagereq type="default">rubygem-kubeclient-doc</packagereq>
<packagereq type="default">rubygem-llhttp-ffi-doc</packagereq>
<packagereq type="default">rubygem-logify-doc</packagereq>
<packagereq type="default">rubygem-mqtt-doc</packagereq>
<packagereq type="default">rubygem-ms_rest_azure-doc</packagereq>
Expand Down
1 change: 1 addition & 0 deletions package_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ foreman_plugin_packages_tier2:
rubygem-foreman_webhooks: {}
rubygem-foreman_vmwareannotations: {}
rubygem-foreman_wreckingball: {}
rubygem-llhttp-ffi: {}
rubygem-puppetdb_foreman: {}

fdi_plugin_packages:
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/rubygem-llhttp-ffi/llhttp-ffi-0.5.0.gem
93 changes: 93 additions & 0 deletions packages/plugins/rubygem-llhttp-ffi/rubygem-llhttp-ffi.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# template: default
#
# PLEASE UPDATE WITH CARE!
# The directory structure is very special and
# does not really align with any other package
#
%global gem_name llhttp-ffi
%global gem_require_name llhttp
%global debug_package %{nil}

Name: rubygem-%{gem_name}
Version: 0.5.0
Release: 1%{?dist}
Summary: Ruby FFI bindings for llhttp
License: MPL-2.0
URL: https://github.com/bryanp/llhttp/
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem

# start specfile generated dependencies
Requires: ruby >= 2.5.0
BuildRequires: ruby-devel >= 2.5.0
BuildRequires: rubygems-devel
BuildRequires: (rubygem(ffi-compiler) >= 1.0 with rubygem(ffi-compiler) < 2)
BuildRequires: (rubygem(rake) >= 13.0 with rubygem(rake) < 14)
# Compiler is required for build of gem binary extension.
# https://fedoraproject.org/wiki/Packaging:C_and_C++#BuildRequires_and_Requires
BuildRequires: gcc
# end specfile generated dependencies

%description
Ruby FFI bindings for llhttp.


%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch

%description doc
Documentation for %{name}.

%prep
%setup -q -n %{gem_name}-%{version}

%build
# Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec

# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/

mkdir -p %{buildroot}%{gem_extdir_mri}/%{gem_name}
cp -a .%{gem_extdir_mri}/gem.build_complete %{buildroot}%{gem_extdir_mri}/
cp -a %{buildroot}%{gem_instdir}/ext/%{_arch}-%{_target_os}/*.so %{buildroot}%{gem_extdir_mri}/%{gem_name}

# Prevent dangling symlink in -debuginfo (rhbz#878863).
#rm -rf %{buildroot}%{gem_instdir}/ext/

%check
# Ideally, this would be something like this:
# GEM_PATH="%{buildroot}%{gem_dir}:$GEM_PATH" ruby -e "require '%{gem_require_name}'"
# But that fails to find native extensions on EL8, so we fake the structure that ruby expects
mkdir gem_ext_test
cp -a %{buildroot}%{gem_dir} gem_ext_test/
mkdir -p gem_ext_test/gems/extensions/%{_arch}-%{_target_os}/$(ruby -r rbconfig -e 'print RbConfig::CONFIG["ruby_version"]')/
cp -a %{buildroot}%{gem_extdir_mri} gem_ext_test/gems/extensions/%{_arch}-%{_target_os}/$(ruby -r rbconfig -e 'print RbConfig::CONFIG["ruby_version"]')/
GEM_PATH="./gem_ext_test/gems:$GEM_PATH" ruby -e "require '%{gem_require_name}'"
rm -rf gem_ext_test

%files
%dir %{gem_instdir}
%{gem_extdir_mri}
%license %{gem_instdir}/LICENSE
%{gem_instdir}/ext
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/CHANGELOG.md
%doc %{gem_instdir}/README.md

%changelog
* Fri Aug 23 2024 David Ochner <[email protected]> 0.5.0-1
- Add rubygem-llhttp-ffi generated by gem2rpm using the default template

0 comments on commit 2477910

Please sign in to comment.