openwsman/openwsman-2.4.12-ruby-binding-build.patch
Vitezslav Crhonek 1d7254a1b4 Update to openwsman-2.8.1
Resolves: RHEL-99191
2025-10-23 13:57:52 +02:00

43 lines
2.2 KiB
Diff

diff -up openwsman-2.8.1/bindings/ruby/extconf.rb.orig openwsman-2.8.1/bindings/ruby/extconf.rb
--- openwsman-2.8.1/bindings/ruby/extconf.rb.orig 2025-01-23 10:23:52.000000000 +0100
+++ openwsman-2.8.1/bindings/ruby/extconf.rb 2025-10-20 11:47:23.507060616 +0200
@@ -5,16 +5,27 @@
require 'mkmf'
# $CFLAGS = "#{$CFLAGS} -Werror"
+# libwsman requires 'int facility' to be defined by the application
+# Add syslog.h for LOG_DAEMON constant
+$CFLAGS = "#{$CFLAGS} -include syslog.h"
+
# requires wsman, wsman_client, and libxml2
+# Add build directory to library search path
+$LDFLAGS = "#{$LDFLAGS} -L/builddir/build/BUILD/openwsman-2.8.1/build/src/lib"
+
+# Add build directory to include path
+$CPPFLAGS = "#{$CPPFLAGS} -I/builddir/build/BUILD/openwsman-2.8.1/include"
-unless have_library('wsman', 'wsman_create_doc')
+# Custom test for libwsman that includes facility definition
+unless try_link("#include <syslog.h>\n#include <wsman-soap-envelope.h>\nint facility = LOG_DAEMON;\nint main() {\n wsman_create_doc(\"test\");\n return 0;\n}", '-lwsman')
STDERR.puts "Cannot find wsman_create_doc() in libwsman"
STDERR.puts "Is openwsman-devel installed ?"
exit 1
end
find_header 'wsman-xml-api.h', '/usr/include/openwsman'
-unless have_library('wsman_client', 'wsmc_create')
+# Custom test for libwsman_client that includes facility definition
+unless try_link("#include <syslog.h>\n#include <wsman-client-api.h>\nint facility = LOG_DAEMON;\nint main() {\n wsmc_create(\"localhost\", 80, \"/wsman\", \"http\", \"user\", \"pass\");\n return 0;\n}", '-lwsman_client -lwsman')
STDERR.puts "Cannot find wsmc_create() in libwsman_client"
STDERR.puts "Is openwsman-devel installed ?"
exit 1
@@ -32,7 +43,7 @@ swig = find_executable("swig")
raise "SWIG not found" unless swig
major, minor, path = RUBY_VERSION.split(".")
-raise "SWIG failed to run" unless system("#{swig} -ruby -autorename -DRUBY_VERSION=#{major}#{minor} -I. -I/usr/include/openwsman -o openwsman_wrap.c openwsman.i")
+raise "SWIG failed to run" unless system("#{swig} -ruby -autorename -DRUBY_VERSION=#{major}#{minor} -I. -I/usr/include/openwsman -I/builddir/build/BUILD/openwsman-2.8.1/include -o openwsman_wrap.c openwsman.i")
$CPPFLAGS = "-I/usr/include/openwsman -I.."