summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Leuenberger <dimstar@opensuse.org>2016-01-20 09:37:33 +0100
committerDominique Leuenberger <dimstar@opensuse.org>2016-01-20 09:37:33 +0100
commitf3cbcdc4d5011eadd0c8f73962e379bb4380b4a5 (patch)
tree2926ece4da80cbd5d3a71ff31d3467baf8c0a35a
parent8d9edfa17374f8c2507ba48373c3d437945bbf29 (diff)
parent22c0fcf24126cfe058626063e97217b5ee2e48e2 (diff)
downloadlibproxy-git-f3cbcdc4d5011eadd0c8f73962e379bb4380b4a5.tar.gz
Merge pull request #14 from rakuco/optionally-link-against-libperl
bindings: perl: Add an option to explicitly link against libperl.so.
-rw-r--r--INSTALL5
-rw-r--r--bindings/perl/CMakeLists.txt13
-rw-r--r--bindings/perl/src/CMakeLists.txt7
3 files changed, 24 insertions, 1 deletions
diff --git a/INSTALL b/INSTALL
index 6bfea2c..8fc0c1a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -84,6 +84,11 @@ PERL_VENDORINSTALL: Default to OFF. Tells cmake to install the perl binding
in the vendor directory, which is the one used by most
packagers.
+PERL_LINK_LIBPERL: Default to ON if PERL_VENDORINSTALL is OFF, default to
+ OFF otherwise. Explicitly links the Perl binding
+ against libperl.so. It must be ON for linking to work
+ when --no-undefined is passed to the linker.
+
WITH_DOTNET: Default to OFF. Enable Mono .NET bindings.
WITH_GNOME: Default to ON. Enable Gnome2/GConf bindings.
diff --git a/bindings/perl/CMakeLists.txt b/bindings/perl/CMakeLists.txt
index 983ca86..4db28e1 100644
--- a/bindings/perl/CMakeLists.txt
+++ b/bindings/perl/CMakeLists.txt
@@ -10,6 +10,19 @@ if(PERL_FOUND AND PERLLIBS_FOUND)
# Some distributions install perl packages in vendor when shipped with the distro.
# Let's make their lifes easier by offering an install flag for this usecase.
option(PERL_VENDORINSTALL "Install Perl package in vendor directory" OFF)
+
+ # Offer an option to explicitly link against libperl.so, with a default
+ # that depends on the value of the PERL_VENDORINSTALL option: if the
+ # binding is installed into a version-independent directory such as
+ # vendor_perl the chances of it needing a rebuild on each Perl update are
+ # lower. Note: not linking against libperl.so does not work if
+ # --no-undefined is passed to the linker.
+ if(PERL_VENDORINSTALL)
+ option(PERL_LINK_LIBPERL "Explicitly link against libperl.so" OFF)
+ else()
+ option(PERL_LINK_LIBPERL "Explicitly link against libperl.so" ON)
+ endif()
+
if(PERL_VENDORINSTALL)
set (PX_PERL_ARCH ${PERL_VENDORARCH})
set (PX_PERL_LIB ${PERL_VENDORLIB})
diff --git a/bindings/perl/src/CMakeLists.txt b/bindings/perl/src/CMakeLists.txt
index fa174de..05176c4 100644
--- a/bindings/perl/src/CMakeLists.txt
+++ b/bindings/perl/src/CMakeLists.txt
@@ -12,7 +12,12 @@ set(Libproxy_LIB_SRCS Libproxy.c)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/perl/blib/arch/auto/Net)
add_library(PLlibproxy SHARED ${Libproxy_LIB_SRCS})
-target_link_libraries(PLlibproxy libproxy pthread)
+set(PLlibproxy_LIB_DEPENDENCIES libproxy pthread)
+if(PERL_LINK_LIBPERL)
+ set(PLlibproxy_LIB_DEPENDENCIES ${PERL_LIBRARY} ${PLlibproxy_LIB_DEPENDENCIES})
+endif()
+
+target_link_libraries(PLlibproxy ${PLlibproxy_LIB_DEPENDENCIES})
set_target_properties(PLlibproxy PROPERTIES OUTPUT_NAME "Libproxy")
set_target_properties(PLlibproxy PROPERTIES PREFIX "")