Skip to content

Commit

Permalink
Merge pull request #14 from rakuco/optionally-link-against-libperl
Browse files Browse the repository at this point in the history
bindings: perl: Add an option to explicitly link against libperl.so.
  • Loading branch information
DimStar77 committed Jan 20, 2016
2 parents 8d9edfa + 22c0fcf commit f3cbcdc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
5 changes: 5 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 13 additions & 0 deletions bindings/perl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
7 changes: 6 additions & 1 deletion bindings/perl/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")

Expand Down

0 comments on commit f3cbcdc

Please sign in to comment.