@@ -1056,54 +1056,8 @@ def configure
10561056 find_header ( "nokogiri_gumbo.h" ) || abort ( "nokogiri_gumbo.h not found" )
10571057else
10581058 libgumbo_recipe = process_recipe ( "libgumbo" , "1.0.0-nokogiri" , static_p , cross_build_p , false ) do |recipe |
1059- recipe . configure_options = [ ]
1060-
1061- class << recipe
1062- def downloaded?
1063- true
1064- end
1065-
1066- def extract
1067- target = File . join ( tmp_path , "gumbo-parser" )
1068- output ( "Copying gumbo-parser files into #{ target } ..." )
1069- FileUtils . mkdir_p ( target )
1070- FileUtils . cp ( Dir . glob ( File . join ( PACKAGE_ROOT_DIR , "gumbo-parser/src/*" ) ) , target )
1071- end
1072-
1073- def configured?
1074- true
1075- end
1076-
1077- def install
1078- lib_dir = File . join ( port_path , "lib" )
1079- inc_dir = File . join ( port_path , "include" )
1080- FileUtils . mkdir_p ( [ lib_dir , inc_dir ] )
1081- FileUtils . cp ( File . join ( work_path , "libgumbo.a" ) , lib_dir )
1082- FileUtils . cp ( Dir . glob ( File . join ( work_path , "*.h" ) ) , inc_dir )
1083- end
1084-
1085- def compile
1086- cflags = concat_flags ( ENV [ "CFLAGS" ] , "-fPIC" , "-O2" , "-g" )
1087-
1088- env = { "CC" => gcc_cmd , "CFLAGS" => cflags }
1089- if config_cross_build?
1090- if host . include? ( "darwin" )
1091- env [ "AR" ] = "#{ host } -libtool"
1092- env [ "ARFLAGS" ] = "-o"
1093- else
1094- env [ "AR" ] = "#{ host } -ar"
1095- end
1096- env [ "RANLIB" ] = "#{ host } -ranlib"
1097- end
1098-
1099- execute ( "compile" , make_cmd , { env : env } )
1100- end
1101- end
1059+ recipe . source_directory = File . join ( PACKAGE_ROOT_DIR , "gumbo-parser" )
11021060 end
1103- append_cppflags ( "-I#{ File . join ( libgumbo_recipe . path , "include" ) } " )
1104- $libs = $libs + " " + File . join ( libgumbo_recipe . path , "lib" , "libgumbo.a" )
1105- $LIBPATH = $LIBPATH | [ File . join ( libgumbo_recipe . path , "lib" ) ]
1106- ensure_func ( "gumbo_parse_with_options" , "nokogiri_gumbo.h" )
11071061end
11081062
11091063have_func ( "xmlHasFeature" ) || abort ( "xmlHasFeature() is missing." ) # introduced in libxml 2.6.21
@@ -1142,11 +1096,23 @@ def compile
11421096 File . open ( "Makefile" , "at" ) do |mk |
11431097 mk . print ( <<~EOF )
11441098
1099+ .PHONY: clean-ports
11451100 all: clean-ports
11461101 clean-ports: $(DLLIB)
11471102 \t -$(Q)$(RUBY) $(srcdir)/extconf.rb --clean --#{ static_p ? "enable" : "disable" } -static
11481103 EOF
11491104 end
1105+ File . open ( "Makefile" , "at" ) do |mk |
1106+ mk . print ( <<~EOF )
1107+
1108+ .PHONY: rebuild-libgumbo
1109+
1110+ $(TARGET_SO): rebuild-libgumbo
1111+ rebuild-libgumbo:
1112+ \t -$(Q)$(MAKE) -C tmp/#{ libgumbo_recipe . host } /ports/libgumbo/1.0.0-nokogiri/libgumbo-1.0.0-nokogiri install
1113+ EOF
1114+ end
1115+
11501116end
11511117
11521118# rubocop:enable Style/GlobalVars
0 commit comments