libproxy/libproxy-perl-cflags.patch

48 lines
1.7 KiB
Diff

From 4d7b2a237b206492cd63d0e96c0c1caf89902352 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Tue, 21 Jun 2022 10:45:50 +0200
Subject: [PATCH] bindings: perl: Use ccflags from %Config for libproxy module
compilation
This is needed to achieve (binary and source) compatibility. Unfortunately
there doesn't appear to be a more official way, even PERL_EXTRA_C_FLAGS is not
complete.
Fixes #182
---
bindings/perl/CMakeLists.txt | 7 +++++++
bindings/perl/src/CMakeLists.txt | 1 +
2 files changed, 8 insertions(+)
diff --git a/bindings/perl/CMakeLists.txt b/bindings/perl/CMakeLists.txt
index 4db28e1a..368bc56a 100644
--- a/bindings/perl/CMakeLists.txt
+++ b/bindings/perl/CMakeLists.txt
@@ -33,6 +33,13 @@ if(PERL_FOUND AND PERLLIBS_FOUND)
OUTPUT_VARIABLE PX_PERL_ARCH)
set (PX_PERL_LIB ${PERL_SITELIB})
endif()
+
+ # PERL_EXTRA_C_FLAGS is not complete, we need full flags (including e.g.
+ # _FILE_OFFSET_BITS=64) for compatibility.
+ EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{ccflags}"
+ OUTPUT_VARIABLE PX_PERL_CCFLAGS)
+ # Convert it to a "list" suitable for target_compile_options.
+ string(REPLACE " " ";" PX_PERL_CCFLAGS ${PX_PERL_CCFLAGS})
endif()
add_subdirectory(lib)
diff --git a/bindings/perl/src/CMakeLists.txt b/bindings/perl/src/CMakeLists.txt
index 29e656d4..2800a85c 100644
--- a/bindings/perl/src/CMakeLists.txt
+++ b/bindings/perl/src/CMakeLists.txt
@@ -18,6 +18,7 @@ if(PERL_LINK_LIBPERL)
endif()
target_link_libraries(PLlibproxy ${PLlibproxy_LIB_DEPENDENCIES})
+target_compile_options(PLlibproxy PRIVATE ${PX_PERL_CCFLAGS})
set_target_properties(PLlibproxy PROPERTIES OUTPUT_NAME "Libproxy")
set_target_properties(PLlibproxy PROPERTIES PREFIX "")