From 6c9b3c0dc97bbf1b7d2f95f0b761763d3b2daf86 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 31 Mar 2023 15:41:19 +0200
Subject: [PATCH] Use CFLAGS and LDFLAGS from the envirnoment for building
tests
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
Makefile.PL | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 43a1b3e..bde1c2b 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -219,12 +219,15 @@ sub compile_test_libraries {
# else DLL resolution fails...
$prefix = 'lib';
}
+ $c_flags .= ' ' . $ENV{CFLAGS} if exists $ENV{CFLAGS};
+ my $ld_flags = '';
+ $ld_flags = $ENV{LDFLAGS} if exists $ENV{LDFLAGS};
push @commands,
qq(gcc $c_flags -g \\
$cairo_flags{cflags} $cairo_gobject_flags{cflags} $gio_flags{cflags} \\
$testsdir/regress.c \\
- $cairo_flags{libs} $cairo_gobject_flags{libs} $gio_flags{libs} \\
+ $ld_flags $cairo_flags{libs} $cairo_gobject_flags{libs} $gio_flags{libs} \\
-o libregress.$lib_ext $pipe);
push @commands,
qq($gir_cmd \\
@@ -242,7 +245,7 @@ sub compile_test_libraries {
qq(gcc $c_flags -g \\
$gio_flags{cflags} \\
$testsdir/gimarshallingtests.c \\
- $gio_flags{libs} \\
+ $ld_flags $gio_flags{libs} \\
-o libgimarshallingtests.$lib_ext $pipe);
push @commands,
qq($gir_cmd \\
--
2.39.2