mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
The Hack used to build the libapparmor swig interface for ruby fails with ruby 3.1. Instead of trying to do black magic in ruby to rename the generated Makefile to Makefile.new, just save off the Makefile and restore after ruby's setup has been called. Fixes: https://gitlab.com/apparmor/apparmor/-/issues/206 Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Christian Boltz <apparmor@cboltz.de>
30 lines
721 B
Ruby
30 lines
721 B
Ruby
#!/usr/bin/env ruby
|
|
|
|
require 'mkmf'
|
|
|
|
# hack 1: Before extconf.rb gets called, Makefile gets backed up, and
|
|
# restored afterwards (see Makefile.am)
|
|
|
|
if ENV['PREFIX']
|
|
prefix = CONFIG['prefix']
|
|
%w[ prefix sitedir datadir infodir mandir oldincludedir ].each do |key|
|
|
CONFIG[key] = CONFIG[key].sub(/#{prefix}/, ENV['PREFIX'])
|
|
end
|
|
end
|
|
|
|
dir_config('LibAppArmor')
|
|
if find_library('apparmor', 'parse_record', '../../src/.libs') and
|
|
have_header('aalogparse.h')
|
|
create_makefile('LibAppArmor')
|
|
|
|
# hack 2: strip all rpath references
|
|
open('Makefile.ruby', 'w') do |out|
|
|
IO.foreach('Makefile') do |line|
|
|
out.puts line.gsub(/-Wl,-R'[^']*'/, '')
|
|
end
|
|
end
|
|
else
|
|
puts 'apparmor lib not found'
|
|
end
|
|
|