15
15
REQUIRED_LIBXML_VERSION = "2.6.21"
16
16
RECOMMENDED_LIBXML_VERSION = "2.9.3"
17
17
18
- REQUIRED_MINI_PORTILE_VERSION = "~> 2.8.2 " # keep this version in sync with the one in the gemspec
18
+ REQUIRED_MINI_PORTILE_VERSION = "2.8.5.rc2 " # keep this version in sync with the one in the gemspec
19
19
REQUIRED_PKG_CONFIG_VERSION = "~> 1.1"
20
20
21
21
# Keep track of what versions of what libraries we build against
@@ -429,7 +429,6 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p = true)
429
429
require "rubygems"
430
430
gem ( "mini_portile2" , REQUIRED_MINI_PORTILE_VERSION ) # gemspec is not respected at install time
431
431
require "mini_portile2"
432
- message ( "Using mini_portile version #{ MiniPortile ::VERSION } \n " )
433
432
434
433
unless [ "libxml2" , "libxslt" ] . include? ( name )
435
434
OTHER_LIBRARY_VERSIONS [ name ] = version
@@ -540,7 +539,6 @@ def recipe.port_path
540
539
chdir_for_build { recipe . cook }
541
540
FileUtils . touch ( checkpoint )
542
541
end
543
- recipe . activate
544
542
end
545
543
end
546
544
@@ -804,6 +802,9 @@ def configure
804
802
end
805
803
end
806
804
805
+ zlib_recipe . mkmf_config ( pkg : "zlib" , static : ( static_p && "z" ) )
806
+ ensure_func ( "gzdopen" , "zlib.h" )
807
+
807
808
unless nix?
808
809
libiconv_recipe = process_recipe (
809
810
"libiconv" ,
@@ -829,7 +830,12 @@ def configure
829
830
"LDFLAGS=" ,
830
831
]
831
832
end
833
+
834
+ # libiconv does not ship with a pkg-config file
835
+ libiconv_recipe . mkmf_config ( static : ( static_p && "iconv" ) )
836
+ ensure_func ( "iconv_open" , "iconv.h" )
832
837
end
838
+
833
839
elsif darwin? && !have_header ( "iconv.h" )
834
840
abort ( <<~EOM . chomp )
835
841
-----
@@ -845,30 +851,6 @@ def configure
845
851
EOM
846
852
end
847
853
848
- if zlib_recipe
849
- append_cppflags ( "-I#{ zlib_recipe . path } /include" )
850
- $LIBPATH = [ "#{ zlib_recipe . path } /lib" ] | $LIBPATH
851
- ensure_package_configuration (
852
- opt : "zlib" ,
853
- pc : "zlib" ,
854
- lib : "z" ,
855
- headers : "zlib.h" ,
856
- func : "gzdopen" ,
857
- )
858
- end
859
-
860
- if libiconv_recipe
861
- append_cppflags ( "-I#{ libiconv_recipe . path } /include" )
862
- $LIBPATH = [ "#{ libiconv_recipe . path } /lib" ] | $LIBPATH
863
- ensure_package_configuration (
864
- opt : "iconv" ,
865
- pc : "iconv" ,
866
- lib : "iconv" ,
867
- headers : "iconv.h" ,
868
- func : "iconv_open" ,
869
- )
870
- end
871
-
872
854
libxml2_recipe = process_recipe ( "libxml2" , dependencies [ "libxml2" ] [ "version" ] , static_p , cross_build_p ) do |recipe |
873
855
source_dir = arg_config ( "--with-xml2-source-dir" )
874
856
if source_dir
@@ -924,6 +906,9 @@ def configure
924
906
]
925
907
end
926
908
909
+ libxml2_recipe . mkmf_config ( pkg : "libxml-2.0" , static : ( static_p && "xml2" ) )
910
+ ensure_func ( "xmlParseDoc" , "libxml/parser.h" )
911
+
927
912
libxslt_recipe = process_recipe ( "libxslt" , dependencies [ "libxslt" ] [ "version" ] , static_p , cross_build_p ) do |recipe |
928
913
source_dir = arg_config ( "--with-xslt-source-dir" )
929
914
if source_dir
@@ -963,72 +948,27 @@ def configure
963
948
]
964
949
end
965
950
966
- append_cppflags ( "-DNOKOGIRI_PACKAGED_LIBRARIES" )
967
- append_cppflags ( "-DNOKOGIRI_PRECOMPILED_LIBRARIES" ) if cross_build_p
951
+ libxslt_recipe . mkmf_config ( pkg : "libxslt" , static : ( static_p && "xslt" ) )
952
+ ensure_func ( "xsltParseStylesheetDoc" , "libxslt/xslt.h" )
968
953
969
- $libs = $libs. shellsplit . tap do |libs |
970
- [ libxml2_recipe , libxslt_recipe ] . each do |recipe |
971
- libname = recipe . name [ /\A lib(.+)\z / , 1 ]
972
- config_basename = "#{ libname } -config"
973
- File . join ( recipe . path , "bin" , config_basename ) . tap do |config |
974
- # call config scripts explicit with 'sh' for compat with Windows
975
- cflags = %x(sh #{ config } --cflags) . strip
976
- message ( "#{ config_basename } cflags: #{ cflags } \n " )
977
- $CPPFLAGS = concat_flags ( cflags , $CPPFLAGS) # prepend
978
-
979
- %x(sh #{ config } --libs) . strip . shellsplit . each do |arg |
980
- case arg
981
- when /\A -L(.+)\z /
982
- # Prioritize ports' directories
983
- $LIBPATH = if Regexp . last_match ( 1 ) . start_with? ( PACKAGE_ROOT_DIR + "/" )
984
- [ Regexp . last_match ( 1 ) ] | $LIBPATH
985
- else
986
- $LIBPATH | [ Regexp . last_match ( 1 ) ]
987
- end
988
- when /\A -l./
989
- libs . unshift ( arg )
990
- else
991
- $LDFLAGS << " " << arg . shellescape
992
- end
993
- end
994
- end
954
+ libxslt_recipe . mkmf_config ( pkg : "libexslt" , static : ( static_p && "exslt" ) )
955
+ ensure_func ( "exsltFuncRegister" , "libexslt/exslt.h" )
995
956
996
- patches_string = recipe . patch_files . map { |path | File . basename ( path ) } . join ( " " )
997
- append_cppflags ( %[-DNOKOGIRI_#{ recipe . name . upcase } _PATCHES="\\ "#{ patches_string } \\ ""] )
957
+ if windows? && static_p
958
+ append_cppflags ( "-DLIBXSLT_STATIC -DLIBEXSLT_STATIC" ) # https://gitlab.gnome.org/GNOME/libxslt/-/merge_requests/66
959
+ end
998
960
999
- case libname
1000
- when "xml2"
1001
- # xslt-config --libs or pkg-config libxslt --libs does not include
1002
- # -llzma, so we need to add it manually when linking statically.
1003
- if static_p && preserving_globals { local_have_library ( "lzma" ) }
1004
- # Add it at the end; GH #988
1005
- libs << "-llzma"
1006
- end
1007
- when "xslt"
1008
- # xslt-config does not have a flag to emit options including
1009
- # -lexslt, so add it manually.
1010
- libs . unshift ( "-lexslt" )
1011
- end
1012
- end
1013
- end . shelljoin
1014
-
1015
- if static_p
1016
- static_archive_ld_flag = needs_darwin_linker_hack ? [ "-load_hidden" ] : [ ]
1017
- $libs = $libs. shellsplit . map do |arg |
1018
- case arg
1019
- when "-lxml2"
1020
- static_archive_ld_flag + [ File . join ( libxml2_recipe . path , "lib" , libflag_to_filename ( arg ) ) ]
1021
- when "-lxslt" , "-lexslt"
1022
- static_archive_ld_flag + [ File . join ( libxslt_recipe . path , "lib" , libflag_to_filename ( arg ) ) ]
1023
- else
1024
- arg
1025
- end
1026
- end . flatten . shelljoin
961
+ # Nokogiri::VERSION_INFO metadata
962
+ append_cppflags ( "-DNOKOGIRI_PACKAGED_LIBRARIES" )
963
+ append_cppflags ( "-DNOKOGIRI_PRECOMPILED_LIBRARIES" ) if cross_build_p
964
+ [ libxml2_recipe , libxslt_recipe ] . each do |recipe |
965
+ patches_string = recipe . patch_files . map { |path | File . basename ( path ) } . join ( " " )
966
+ append_cppflags ( %[-DNOKOGIRI_#{ recipe . name . upcase } _PATCHES="\\ "#{ patches_string } \\ ""] )
1027
967
end
1028
968
1029
- ensure_func ( "xmlParseDoc" , "libxml/parser.h" )
1030
- ensure_func ( "xsltParseStylesheetDoc" , "libxslt/xslt.h" )
1031
- ensure_func ( "exsltFuncRegister" , "libexslt/exslt.h" )
969
+ # if static_p
970
+ # static_archive_ld_flag = needs_darwin_linker_hack ? ["-load_hidden"] : []
971
+ # end
1032
972
end
1033
973
1034
974
libgumbo_recipe = process_recipe ( "libgumbo" , "1.0.0-nokogiri" , static_p , cross_build_p , false ) do |recipe |
0 commit comments