guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: gnu: pugixml: Build as shared library.


From: guix-commits
Subject: 03/03: gnu: pugixml: Build as shared library.
Date: Sun, 10 Mar 2019 16:44:59 -0400 (EDT)

mbakke pushed a commit to branch master
in repository guix.

commit 7fda7b8fad5ed47ef36d7d00d8e0652d6c43c268
Author: Marius Bakke <address@hidden>
Date:   Sun Mar 10 20:43:54 2019 +0100

    gnu: pugixml: Build as shared library.
    
    * gnu/packages/patches/pugixml-versioned-libdir.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Adjust accordingly.
    * gnu/packages/xml.scm (pugixml)[source](patches): New field.
    [arguments]: Instruct the build system to create a shared rather than static
    library.
    [native-inputs]: Add PKG-CONFIG.
---
 gnu/local.mk                                       |  1 +
 .../patches/pugixml-versioned-libdir.patch         | 61 ++++++++++++++++++++++
 gnu/packages/xml.scm                               |  8 +--
 3 files changed, 67 insertions(+), 3 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 63857d9..af2bf87 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1154,6 +1154,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/psm-arch.patch                          \
   %D%/packages/patches/psm-ldflags.patch                       \
   %D%/packages/patches/psm-repro.patch                         \
+  %D%/packages/patches/pugixml-versioned-libdir.patch          \
   %D%/packages/patches/pulseaudio-fix-mult-test.patch          \
   %D%/packages/patches/pulseaudio-longer-test-timeout.patch    \
   %D%/packages/patches/pybugz-encode-error.patch               \
diff --git a/gnu/packages/patches/pugixml-versioned-libdir.patch 
b/gnu/packages/patches/pugixml-versioned-libdir.patch
new file mode 100644
index 0000000..7cd23b1
--- /dev/null
+++ b/gnu/packages/patches/pugixml-versioned-libdir.patch
@@ -0,0 +1,61 @@
+This patch makes pugixml install its headers to a standard location when
+built as a shared library.
+
+Taken from this upstream commit:
+https://github.com/zeux/pugixml/commit/daeb8013b20f9c47e85730faaa4131064a1f9c2e
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 90fa6793..d7bc1b20 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -4,7 +4,7 @@ project(pugixml)
+ 
+ option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
+ option(BUILD_TESTS "Build tests" OFF)
+-option(BUILD_PKGCONFIG "Build in PKGCONFIG mode" OFF)
++option(USE_VERSIONED_LIBDIR "Use a private subdirectory to install the 
headers and libs" OFF)
+ 
+ set(BUILD_DEFINES "" CACHE STRING "Build defines")
+ 
+@@ -55,7 +55,7 @@ endif()
+ set_target_properties(pugixml PROPERTIES VERSION 1.9 SOVERSION 1)
+ get_target_property(PUGIXML_VERSION_STRING pugixml VERSION)
+ 
+-if(BUILD_PKGCONFIG)
++if(USE_VERSIONED_LIBDIR)
+       # Install library into its own directory under LIBDIR
+       set(INSTALL_SUFFIX /pugixml-${PUGIXML_VERSION_STRING})
+ endif()
+@@ -71,10 +71,8 @@ install(TARGETS pugixml EXPORT pugixml-config
+ install(FILES ${HEADERS} DESTINATION 
${CMAKE_INSTALL_INCLUDEDIR}${INSTALL_SUFFIX})
+ install(EXPORT pugixml-config DESTINATION 
${CMAKE_INSTALL_LIBDIR}/cmake/pugixml)
+ 
+-if(BUILD_PKGCONFIG)
+-      configure_file(scripts/pugixml.pc.in ${PROJECT_BINARY_DIR}/pugixml.pc 
@ONLY)
+-      install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc DESTINATION 
${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
+-endif()
++configure_file(scripts/pugixml.pc.in ${PROJECT_BINARY_DIR}/pugixml.pc @ONLY)
++install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc DESTINATION 
${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
+ 
+ if(BUILD_TESTS)
+       file(GLOB TEST_SOURCES tests/*.cpp)
+diff --git a/scripts/pugixml.pc.in b/scripts/pugixml.pc.in
+index 3c97c28d..804c4d38 100644
+--- a/scripts/pugixml.pc.in
++++ b/scripts/pugixml.pc.in
+@@ -1,11 +1,11 @@
+ address@hidden@
+ exec_prefix=${prefix}
+-includedir=${prefix}/include/address@hidden@
+-libdir=${exec_prefix}/lib/address@hidden@
++includedir=${prefix}/address@hidden@
++libdir=${exec_prefix}/address@hidden@
+ 
+ Name: pugixml
+ Description: Light-weight, simple and fast XML parser for C++ with XPath 
support.
+ URL: http://pugixml.org/
+ Version: @PUGIXML_VERSION_STRING@
+ Cflags: -I${includedir}
+-Libs: -L${libdir} -lpugixml
+\ No newline at end of file
++Libs: -L${libdir} -lpugixml
diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index c80dfb1..0ba23bc 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -861,14 +861,16 @@ the form of functions.")
       (method url-fetch)
       (uri (string-append "https://github.com/zeux/pugixml/releases/download/v";
                           version "/pugixml-" version ".tar.gz"))
+      (patches (search-patches "pugixml-versioned-libdir.patch"))
       (sha256
        (base32
         "19nv3zhik3djp4blc4vrjwrl8dfhzmal8b21sq7y907nhddx6mni"))))
     (build-system cmake-build-system)
     (arguments
-     `(#:configure-flags '("-DCMAKE_CXX_FLAGS=-shared -fPIC"
-                           "-DCMAKE_C_FLAGS=-shared -fPIC")
-       #:tests? #f))                    ; no tests
+     `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
+       #:tests? #f))                     ;no tests
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
     (home-page "https://pugixml.org";)
     (synopsis "Light-weight, simple and fast XML parser for C++ with XPath 
support")
     (description



reply via email to

[Prev in Thread] Current Thread [Next in Thread]