Files
libguestfs/perl/Build.PL.in
Richard W.M. Jones be06cb048b perl: Pass @CFLAGS@ through extra_linker_flags
The documentation for Module::Build is completely opaque on how you're
supposed to pass @CFLAGS@ correctly.  However I noticed that we were
not passing -g through when generating Guestfs.so:

gcc -lpthread -shared -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now '-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' '-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1' '-Wl,--build-id=sha1' -L/usr/local/lib -fstack-protector-strong -lperl -o blib/arch/auto/Sys/Guestfs/Guestfs.so lib/Sys/Guestfs.o -L../lib/.libs -lguestfs

This debuginfo was not always being generated correctly.  (For some
reason it still manages to be generated in Fedora and RHEL 9, but not
in RHEL 10, this part is still unclear to me.)

Anyway it seems we ought to pass at least -g to the linker, and we
might as well pass the full set of @CFLAGS@, hence this change.
2024-06-28 12:37:11 +01:00

76 lines
2.1 KiB
Perl
Executable File

#!/usr/bin/env perl
# libguestfs Perl bindings
# Copyright (C) 2009-2023 Red Hat Inc.
# @configure_input@
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use warnings;
use strict;
use Module::Build;
# The Perl module version doesn't (and can't) use the libguestfs
# version. It uses '0.<max_proc_nr>' instead. However it's nice to
# set the release_status correctly here based on the libguestfs minor
# number (see configure.ac for how this works).
my $release_status;
if ('@BRANCH_TYPE@' eq 'stable') { $release_status = "stable" }
else { $release_status = "testing" }
my $build = Module::Build->new (
module_name => 'Sys::Guestfs',
release_status => $release_status,
license => 'lgpl', # See COPYING.LIB
configure_requires => {
'Module::Build' => '0.4004', # test_requires
},
build_requires => {
'ExtUtils::CBuilder' => 0,
},
requires => {
perl => '5.6.0',
},
test_requires => {
'Test::More' => 0,
},
create_packlist => 0,
needs_compiler => 1,
extra_compiler_flags => [
'-DGUESTFS_PRIVATE=1',
split (' ', '@CFLAGS@'),
],
include_dirs => [
'@top_builddir@/lib',
'@top_srcdir@/lib',
'@top_srcdir@/include',
],
extra_linker_flags => [
'-DGUESTFS_PRIVATE=1',
split (' ', '@CFLAGS@'),
'-L@top_builddir@/lib/.libs',
'-lguestfs',
],
);
$build->create_build_script;