diff --git a/rubygem-nokogiri.spec b/rubygem-nokogiri.spec index 829e6b2..08bb4bd 100644 --- a/rubygem-nokogiri.spec +++ b/rubygem-nokogiri.spec @@ -20,6 +20,7 @@ Release: %{?prever:0.}%{mainrel}%{?prever:.%{prerpmver}}%{?dist} # see gumbo-parser/src/attribute.c and ext/nokogiri/gumbo.c # also lib/nokogiri/html5 is licensed under ASL 2.0 License: MIT and ASL 2.0 +Provides: bundled(gumbo-parser) = 0.10.1 URL: https://nokogiri.org Source0: https://rubygems.org/gems/%{gem_name}-%{mainver}%{?prever}.gem @@ -46,8 +47,6 @@ BuildRequires: glibc-all-langpacks BuildRequires: gcc BuildRequires: libxml2-devel BuildRequires: libxslt-devel -# From 1.12.0 need this to compile internal gumbo -BuildRequires: rubygem(mini_portile2) >= 2.6 BuildRequires: ruby-devel # ruby27 needs this explicitly BuildRequires: rubygem(racc) @@ -107,33 +106,40 @@ sed -i \ lib/nokogiri/extension.rb \ -e 's@require_relative "@require "nokogiri/@' -# Don't clean up files used when building bundled gumbo, -# otherwise debuginfo rpm will become imcomplete +# Don't use mini_portile2, but build libgumbo.a first and +# tell extconf.rb the path to the archive sed -i \ ext/nokogiri/extconf.rb \ - -e '\@Pathname\.glob.*ports@s@ports@ports_ignore@' - -# Make gumbo build process verbose -sed -i \ - ext/nokogiri/extconf.rb \ - -e '\@execute.*compile.*make_cmd@s@env: env@env: env, debug: true@' + -e "s@^\(def process_recipe.*\)\$@\1 ; return true@" \ + -e "s@^\(append_cppflags\).*gumbo.*\$@\1(\"-I$(pwd)/gumbo-parser/src\")@" \ + -e "\@libs.*gumbo@s@File\.join.*@\"$(pwd)/gumbo-parser/src/libgumbo.a\"@" \ + -e "\@LIBPATH.*gumbo@s|^\(.*\)\$|# \1|" \ + %{nil} # #line directive can confuse debuginfo, removing for now sed -i \ gumbo-parser/src/char_ref.c \ -e '\@^#line [0-9]@s|^\(.*\)$|// \1|' +# Compile libgumbo.a with -fPIC +sed -i \ + gumbo-parser/src/Makefile \ + -e 's|^\(CFLAGS.*=.*\)$|\1 -fPIC|' + # Ummm... env LANG=C.UTF-8 gem build %{gem_name}-%{version}.gemspec %build # 1.6.0 needs this export NOKOGIRI_USE_SYSTEM_LIBRARIES=yes -export V=1 %set_build_flags +# First build libgumbo.a +pushd gumbo-parser/src/ +make libgumbo.a +popd + %gem_install -find . -name compile.log | xargs cat # Permission chmod 0644 .%{gem_dir}/cache/%{gem_name}-%{mainver}%{?prever}.gem @@ -148,6 +154,9 @@ rm -rf .%{gem_instdir}/ext/java mkdir -p %{buildroot}%{gem_dir} cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir} +# Also first copy these, clean up later +cp -a ./gumbo-parser %{buildroot}%{gem_instdir}/ + # Remove backup file find %{buildroot} -name \*.orig_\* | xargs rm -vf @@ -197,8 +206,6 @@ find src -type f | \ popd rm -f %{buildroot}%{gem_cache} -# Remove bundled gumbo parser - %check # Ah.... # test_exslt(TestXsltTransforms) [./test/test_xslt_transforms.rb:93]