Skip to content

Commit

Permalink
fixes #13296 - fix missing mysql2.so and gem.build_complete
Browse files Browse the repository at this point in the history
Refreshed the style of the spec file to match Fedora, cleaned up badly
placed binaries (under share/ not arch dirs), unnecessary C source and
build files, and duplicate .so files under ext/ and lib/.
  • Loading branch information
Dominic Cleal committed Feb 4, 2016
1 parent b4ec69d commit 331e23f
Showing 1 changed file with 50 additions and 24 deletions.
74 changes: 50 additions & 24 deletions rubygem-mysql2/rubygem-mysql2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@

%define version 0.3.19

%if 0%{?scl:1}
%{!?gem_extdir_mri:%global gem_extdir_mri %{gem_extdir}}
%global gem_extdir_mri_lib %{gem_extdir_mri}
%else
%if 0%{?el6}
%{!?gem_extdir_mri:%global gem_extdir_mri %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")}
%global gem_extdir_mri_lib %{gem_extdir_mri}
%else # el7
%{!?gem_extdir_mri:%global gem_extdir_mri %{gem_extdir}}
%global gem_extdir_mri_lib %{gem_extdir_mri}/lib
%endif
%endif

Summary: A simple, fast Mysql library for Ruby, binding to libmysql
Name: %{?scl_prefix}rubygem-%{gem_name}

Expand All @@ -28,8 +41,6 @@ Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}
%{?scl:Obsoletes: ruby193-rubygem-%{gem_name}}


%define gem_builddir %{buildroot}%{gem_dir}

%description
This is the MySQL API module for Ruby. It provides the same functions for Ruby
programs that the MySQL C API provides for C programs.
Expand All @@ -47,51 +58,66 @@ This package contains documentation for rubygem-%{gem_name}.


%prep
%setup -T -c -q
%{?scl:scl enable %{scl} - <<EOF}
gem unpack %{SOURCE0}
%{?scl:EOF}
%setup -q -D -T -n %{gem_name}-%{version}
%{?scl:scl enable %{scl} - <<EOF}
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%{?scl:EOF}
%build
%{__rm} -rf %{buildroot}
mkdir -p ./%{gem_dir}
%{?scl:scl enable %{scl} "}
gem install --local --install-dir ./%{gem_dir} -V --force %{SOURCE0}
%{?scl:"}
# Create the gem as gem install only works on a gem file
%{?scl:scl enable %{scl} - <<EOF}
gem build %{gem_name}.gemspec
%{?scl:EOF}
# %%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
%{?scl:scl enable %{scl} - <<EOF}
%gem_install
%{?scl:EOF}
%install
%{__rm} -rf %{buildroot}
mkdir -p %{gem_builddir}
cp -a ./%{gem_dir}/* %{buildroot}/%{gem_dir}
rm -rf %{gem_builddir}/gems/%{gem_name}-%{version}/ext/%{gem_name}/%{gem_name}.so
mkdir -p %{buildroot}%{gem_dir}
cp -pa .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
find .
mkdir -p %{buildroot}%{gem_extdir_mri_lib}/mysql2/
cp -a .%{gem_instdir}/ext/mysql2/mysql2.so %{buildroot}%{gem_extdir_mri_lib}/mysql2/
%{?scl:cp -a .%{gem_extdir_mri}/gem.build_complete %{buildroot}%{gem_extdir_mri_lib}/}
# ruby 2.0.0 mkmf issue, fixed by r40280
rm -rf %{gem_builddir}/gems/%{gem_name}-%{version}/ext/%{gem_name}/.RUBYARCHDIR.time
# rubygems 2.0.3 stray temp file issue, PR #587
rm -rf %{gem_builddir}/gems/%{gem_name}-%{version}/ext/%{gem_name}/siteconf*.rb
# Prevent dangling symlink in -debuginfo.
rm -rf %{buildroot}%{gem_instdir}/ext
# remove non-stripped object files
find %{buildroot} -type f -name *.o -exec rm -f {} +
%clean
%{__rm} -rf %{buildroot}
# Remove some droppings
rm -f %{buildroot}%{gem_instdir}/{.gitignore,.rspec,.rvmrc,.travis.yml}
rm -rf %{buildroot}%{gem_instdir}/spec
rm -f %{buildroot}%{gem_libdir}/mysql2/*.so
%files
%defattr(-, root, root)
%doc %{gem_instdir}/LICENSE
%{gem_instdir}/ext/mysql2
%{gem_libdir}
%{gem_instdir}/support
%{?scl:%{gem_extdir_mri}/gem.build_complete}
%{gem_extdir_mri_lib}/mysql2
%exclude %{gem_cache}
%{gem_spec}
%exclude %{gem_instdir}/support
%files doc
%{gem_docdir}
%{gem_instdir}/README.md
%{gem_instdir}/examples
%{gem_instdir}/spec
%changelog
* Tue Dec 22 2015 Dominic Cleal <dcleal@redhat.com> 0.3.19-4
-
- Rebuild for rh-ruby22 (dcleal@redhat.com)
* Tue Nov 10 2015 Dominic Cleal <dcleal@redhat.com> 0.3.19-3
- Remove version dependency on rubygems (ewoud@kohlvanwijngaarden.nl)
Expand Down

0 comments on commit 331e23f

Please sign in to comment.