Date: Sunday, October 24, 2021 @ 12:18:01
  Author: arojas
Revision: 426497

Properly disable static libs (FS#72315)

Added:
  libupnp/trunk/libupnp-optional-static.patch
Modified:
  libupnp/trunk/PKGBUILD

-------------------------------+
 PKGBUILD                      |   15 ++-
 libupnp-optional-static.patch |  187 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 198 insertions(+), 4 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2021-10-24 09:00:16 UTC (rev 426496)
+++ PKGBUILD    2021-10-24 12:18:01 UTC (rev 426497)
@@ -6,7 +6,7 @@
 _name=pupnp
 pkgname=libupnp
 pkgver=1.14.12
-pkgrel=1
+pkgrel=2
 pkgdesc='Portable Open Source UPnP Development Kit'
 url="https://pupnp.sourceforge.io/";
 arch=('x86_64')
@@ -14,12 +14,18 @@
 depends=('glibc')
 makedepends=('cmake')
 provides=('libixml.so' 'libupnp.so')
-source=("${pkgname}-${pkgver}.tar.gz::https://github.com/${_name}/${_name}/archive/release-${pkgver}.tar.gz";)
-sha512sums=('aab17aa12f15d110bfab20cbcbae5f54926b6ca7a30bce10b9287cd39919a06a5e9f1493405e1d561c0d58ba46926f87009df891e4e4f37097df1c3c67635ca9')
-b2sums=('721c10f9fa4ffc60743b4ebf8be566ea595931cb1f2a2448d8e3cecfc787abfb855cb16256eaaa10ce6a901cd5e5b3d14672610841b2a718d5dd003ccfd3c2f0')
+source=("${pkgname}-${pkgver}.tar.gz::https://github.com/${_name}/${_name}/archive/release-${pkgver}.tar.gz";
+         libupnp-optional-static.patch)
+sha512sums=('aab17aa12f15d110bfab20cbcbae5f54926b6ca7a30bce10b9287cd39919a06a5e9f1493405e1d561c0d58ba46926f87009df891e4e4f37097df1c3c67635ca9'
+            
'7bae244c522f35261fdc07f0036a56eb319d6bff5a88d690e7563369184f7f39c30330e0d88967a84db8c22a1e9d1335dbc66d8758855fd8f9981c4f9ca28ddc')
+b2sums=('721c10f9fa4ffc60743b4ebf8be566ea595931cb1f2a2448d8e3cecfc787abfb855cb16256eaaa10ce6a901cd5e5b3d14672610841b2a718d5dd003ccfd3c2f0'
+        
'ef0d9e17d45fe378ef9f7b07c1b679ee4dbe6d9f1aee540123d08c709b092a4824218a863e0a3077e728c17131ae6d817295e44b4fc0cbbc75d372e62c7319f3')
 
 prepare() {
   mv -v ${_name}-release-${pkgver} ${pkgname}-${pkgver}
+
+# Make static libraries optional, partial backport of 
https://github.com/pupnp/pupnp/commit/a0622cb0199be1b5f86317fb3c9b4de59d3ac893
+  patch -d ${pkgname}-${pkgver} -p1 < libupnp-optional-static.patch
 }
 
 build() {
@@ -26,6 +32,7 @@
   cd ${pkgname}-${pkgver}
   cmake -DCMAKE_INSTALL_PREFIX=/usr \
         -DCMAKE_BUILD_TYPE='None' \
+        -DUPNP_BUILD_STATIC=OFF \
         -Wno-dev \
         -B build \
         -S .

Added: libupnp-optional-static.patch
===================================================================
--- libupnp-optional-static.patch                               (rev 0)
+++ libupnp-optional-static.patch       2021-10-24 12:18:01 UTC (rev 426497)
@@ -0,0 +1,187 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 55653f12..d35b499d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -95,6 +95,8 @@ if (WIN32)
+       set (STATIC_POSTFIX s)
+ endif()
+ 
++option (UPNP_BUILD_SHARED "Build shared libraries" ON)
++option (UPNP_BUILD_STATIC "Build static libraries" ON)
+ option (BUILD_TESTING "Run Tests after compile" ON)
+ 
+ if (BUILD_TESTING)
+diff --git a/ixml/CMakeLists.txt b/ixml/CMakeLists.txt
+index e33a561e..184f65d0 100644
+--- a/ixml/CMakeLists.txt
++++ b/ixml/CMakeLists.txt
+@@ -15,6 +15,7 @@ set (IXML_SOURCES
+       src/nodeList.c
+ )
+ 
++if (UPNP_BUILD_SHARED)
+ add_library (ixml_shared SHARED
+       ${IXML_SOURCES}
+ )
+@@ -54,7 +55,9 @@ install (TARGETS ixml_shared
+       INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
+       PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
+ )
++endif()
+ 
++if (UPNP_BUILD_STATIC)
+ add_library (ixml_static STATIC
+       ${IXML_SOURCES}
+ )
+@@ -93,6 +96,7 @@ install (TARGETS ixml_static
+       DESTINATION ${CMAKE_INSTALL_LIBDIR}
+       INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
+ )
++endif()
+ 
+ install (EXPORT IXML
+       DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/IXML
+diff --git a/ixml/test/CMakeLists.txt b/ixml/test/CMakeLists.txt
+index 7dea06eb..1241e856 100644
+--- a/ixml/test/CMakeLists.txt
++++ b/ixml/test/CMakeLists.txt
+@@ -2,6 +2,7 @@ FILE (GLOB XML_FILES
+       ${CMAKE_CURRENT_SOURCE_DIR}/testdata/*.xml
+ )
+ 
++if (UPNP_BUILD_SHARED)
+ ADD_EXECUTABLE (test-ixml-shared
+       test_document.c
+ )
+@@ -17,7 +18,9 @@ ADD_TEST (NAME test-ixml
+ SET_TESTS_PROPERTIES (test-ixml PROPERTIES
+       ENVIRONMENT "PATH=$<TARGET_FILE_DIR:ixml_shared>\;%PATH%"
+ )
++endif()
+ 
++if (UPNP_BUILD_STATIC)
+ ADD_EXECUTABLE (test-ixml-static
+       test_document.c
+ )
+@@ -29,3 +32,4 @@ TARGET_LINK_LIBRARIES (test-ixml-static
+ ADD_TEST (NAME test-ixml-static
+       COMMAND test-ixml-static ${XML_FILES}
+ )
++endif()
+diff --git a/upnp/CMakeLists.txt b/upnp/CMakeLists.txt
+index d10336f9..c9d19f8d 100644
+--- a/upnp/CMakeLists.txt
++++ b/upnp/CMakeLists.txt
+@@ -83,6 +83,7 @@ if (uuid)
+       )
+ endif()
+ 
++if (UPNP_BUILD_SHARED)
+ add_library (upnp_shared SHARED
+       ${UPNP_SOURCES}
+ )
+@@ -182,7 +183,9 @@ install (TARGETS upnp_shared
+       INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
+       PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
+ )
++endif()
+ 
++if (UPNP_BUILD_STATIC)
+ add_library (upnp_static STATIC
+       ${UPNP_SOURCES}
+ )
+@@ -233,6 +236,7 @@ install (TARGETS upnp_static
+       DESTINATION ${CMAKE_INSTALL_LIBDIR}
+       INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/upnp
+ )
++endif()
+ 
+ install (EXPORT UPNP
+       DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/UPNP
+diff --git a/upnp/test/CMakeLists.txt b/upnp/test/CMakeLists.txt
+index 741f9a57..745f2148 100644
+--- a/upnp/test/CMakeLists.txt
++++ b/upnp/test/CMakeLists.txt
+@@ -4,6 +4,7 @@ if (WIN32)
+       string (APPEND TEST_ENV "%PATH%")
+ endif()
+ 
++if (UPNP_BUILD_SHARED)
+ add_executable (test-upnp-init ${WIN_EXE}
+       test_init.c
+ )
+@@ -23,7 +24,9 @@ add_test (NAME test-upnp-init
+ set_tests_properties (test-upnp-init PROPERTIES
+       ENVIRONMENT "${TEST_ENV}"
+ )
++endif()
+ 
++if (UPNP_BUILD_STATIC)
+ add_executable (test-upnp-init-static
+       test_init.c
+ )
+@@ -39,7 +42,9 @@ target_compile_definitions (test-upnp-init-static
+ add_test (NAME test-upnp-init-static
+       COMMAND test-upnp-init-static
+ )
++endif()
+ 
++if (UPNP_BUILD_SHARED)
+ add_executable (test-upnp-list
+       test_list.c
+ )
+@@ -55,7 +60,9 @@ set_tests_properties (test-upnp-list PROPERTIES
+ target_link_libraries (test-upnp-list
+       upnp_shared
+ )
++endif()
+ 
++if (UPNP_BUILD_STATIC)
+ add_executable (test-upnp-list-static
+       test_list.c
+ )
+@@ -67,7 +74,9 @@ target_link_libraries (test-upnp-list-static
+ add_test (NAME test-upnp-list-static
+       COMMAND test-upnp-list-static
+ )
++endif()
+ 
++if (UPNP_BUILD_SHARED)
+ add_executable (test-upnp-log
+       test_log.c
+ )
+@@ -87,7 +96,9 @@ add_test (NAME test-upnp-log
+ set_tests_properties (test-upnp-log PROPERTIES
+       ENVIRONMENT "${TEST_ENV}"
+ )
++endif()
+ 
++if (UPNP_BUILD_STATIC)
+ add_executable (test-upnp-log-static
+       test_log.c
+ )
+@@ -103,7 +114,9 @@ target_link_libraries (test-upnp-log-static
+ add_test (NAME test-upnp-log-static
+       COMMAND test-upnp-log-static
+ )
++endif()
+ 
++if (UPNP_BUILD_SHARED)
+ add_executable (test-upnp-url
+       test_url.c
+ )
+@@ -119,7 +132,9 @@ add_test (NAME test-upnp-url
+ set_tests_properties (test-upnp-url PROPERTIES
+       ENVIRONMENT "${TEST_ENV}"
+ )
++endif()
+ 
++if (UPNP_BUILD_STATIC)
+ add_executable (test-upnp-url-static
+       test_url.c
+ )
+@@ -131,3 +146,4 @@ target_link_libraries (test-upnp-url-static
+ add_test (NAME test-upnp-url-static
+       COMMAND test-upnp-url-static
+ )
++endif()

Reply via email to