summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorModestas Vainius <modax@debian.org>2011-05-24 22:14:39 +0300
committerModestas Vainius <modax@debian.org>2011-05-25 01:32:40 +0300
commit71f1f44845b8bd69dfd5752a284fc02eda7078de (patch)
treec7936f708f865c2d6ec3e964c050e4d69b4a84bd
parent7a925b899cb6441918f5212860d125cd40332f55 (diff)
downloadpkg-kde-tools-71f1f44845b8bd69dfd5752a284fc02eda7078de.tar.gz
Do not use Debian "branded" names in DLRestrictions.
Like e.g. debian_dlrestrictions special symbol.
-rw-r--r--debian/changelog2
-rw-r--r--dlrestrictions/dlrestrictions-config.cmake50
-rw-r--r--dlrestrictions/dlrestrictions-symbol.c.cmake2
-rw-r--r--dlrestrictions/dlrestrictions.h2
-rw-r--r--t/dlrestrictions/CMakeLists.txt4
5 files changed, 32 insertions, 28 deletions
diff --git a/debian/changelog b/debian/changelog
index a3eb033..ca2f76e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,7 @@
pkg-kde-tools (0.14.0~pre1) UNRELEASED; urgency=low
+ * Do not use Debian "branded" names in DLRestrictions (like e.g.
+ debian_dlrestrictions special symbol).
-- Modestas Vainius <modax@debian.org> Tue, 24 May 2011 21:47:52 +0300
diff --git a/dlrestrictions/dlrestrictions-config.cmake b/dlrestrictions/dlrestrictions-config.cmake
index c2d0d24..382506e 100644
--- a/dlrestrictions/dlrestrictions-config.cmake
+++ b/dlrestrictions/dlrestrictions-config.cmake
@@ -1,38 +1,40 @@
-set(DEBIAN_DLRESTRICTIONS "" CACHE STRING
+set(DEFAULT_DLRESTRICTIONS "" CACHE STRING
"Enable generation of the DLRestrictions symbol with such a value by default.")
-define_property(TARGET PROPERTY DEBIAN_DLRESTRICTIONS
+define_property(TARGET PROPERTY DLRESTRICTIONS
BRIEF_DOCS "Value of the DLRestrictions symbol for this target."
FULL_DOCS "Define DLRestrictions symbol for this target with a value of this property.
- Overrides global DEBIAN_DLRESTRICTIONS. Set to empty string in order to turn off
- symbol generation for the target.")
+ Overrides global DEFAULT_DLRESTRICTIONS. Set to empty string in order to turn
+ off symbol generation for the target.")
-set(DLRESTRICTIONS_SYMBOL_C "${DLRestrictions_DIR}/dlrestrictions-symbol.c.cmake")
-set(DLRESTRICTIONS_EXPORT_FILE ${DLRestrictions_DIR}/dlrestrictions-export.cmake)
+set(DLRESTRICTIONS_SYMBOL_SOURCE_FILE "${DLRestrictions_DIR}/dlrestrictions-symbol.c.cmake")
+set(DLRESTRICTIONS_EXPORT_FILE "${DLRestrictions_DIR}/dlrestrictions-export.cmake")
+# Export file might not exist if DLRestrictions is referred from the unit tests
if (EXISTS "${DLRESTRICTIONS_EXPORT_FILE}")
# Include export file
include(${DLRESTRICTIONS_EXPORT_FILE})
endif (EXISTS "${DLRESTRICTIONS_EXPORT_FILE}")
-function(DEBIAN_ADD_DLRESTRICTIONS_SYMBOL)
+function(DLRESTRICTIONS_PROCESS_TARGETS)
foreach(target ${ARGN})
- get_target_property(value "${target}" DEBIAN_DLRESTRICTIONS)
- if (value MATCHES "NOTFOUND$" AND DEBIAN_DLRESTRICTIONS)
- set(value "${DEBIAN_DLRESTRICTIONS}")
- endif (value MATCHES "NOTFOUND$" AND DEBIAN_DLRESTRICTIONS)
+ get_target_property(dlr_expression "${target}" DLRESTRICTIONS)
+ if (dlr_expression MATCHES "NOTFOUND$" AND DEFAULT_DLRESTRICTIONS)
+ set(dlr_expression "${DEFAULT_DLRESTRICTIONS}")
+ endif (dlr_expression MATCHES "NOTFOUND$" AND DEFAULT_DLRESTRICTIONS)
- if (value)
+ if (dlr_expression)
# Add symbol to the library
- set(sc_target "dlrestrictions_${target}")
- set(sc_source_file "${CMAKE_CURRENT_BINARY_DIR}/${sc_target}.c")
- configure_file("${DLRESTRICTIONS_SYMBOL_C}" "${sc_source_file}" @ONLY)
- add_library(${sc_target} STATIC "${sc_source_file}")
- get_property(target_type TARGET ${target} PROPERTY TYPE)
- if (${target_type} STREQUAL "SHARED_LIBRARY")
- set_property(SOURCE ${sc_target} PROPERTY COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}" APPEND)
- endif (${target_type} STREQUAL "SHARED_LIBRARY")
- set_property(TARGET ${sc_target} PROPERTY EchoString "Adding DLRestrictions symbol (=${value}) for ${target}")
- target_link_libraries(${target} -Wl,--whole-archive ${sc_target} -Wl,--no-whole-archive)
- endif (value)
+ set(dlr_target "dlrestrictions_${target}")
+ set(dlr_target_file "${CMAKE_CURRENT_BINARY_DIR}/${dlr_target}.c")
+ configure_file("${DLRESTRICTIONS_SYMBOL_SOURCE_FILE}" "${dlr_target_file}" @ONLY)
+ add_library(${dlr_target} STATIC "${dlr_target_file}")
+ get_property(dlr_target_type TARGET ${target} PROPERTY TYPE)
+ if (${dlr_target_type} STREQUAL "SHARED_LIBRARY")
+ set_property(TARGET ${dlr_target} PROPERTY COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}" APPEND)
+ endif (${dlr_target_type} STREQUAL "SHARED_LIBRARY")
+ set_property(TARGET ${dlr_target} PROPERTY EchoString "Adding DLRestrictions (=${dlr_expression}) for ${target}")
+ # FIXME: not portable
+ target_link_libraries(${target} "-Wl,--whole-archive" ${dlr_target} "-Wl,--no-whole-archive")
+ endif (dlr_expression)
endforeach(target ${ARGN})
-endfunction(DEBIAN_ADD_DLRESTRICTIONS_SYMBOL)
+endfunction(DLRESTRICTIONS_PROCESS_TARGETS)
diff --git a/dlrestrictions/dlrestrictions-symbol.c.cmake b/dlrestrictions/dlrestrictions-symbol.c.cmake
index 0f2d48a..da99618 100644
--- a/dlrestrictions/dlrestrictions-symbol.c.cmake
+++ b/dlrestrictions/dlrestrictions-symbol.c.cmake
@@ -1,2 +1,2 @@
#include <dlrestrictions.h>
-DLR_EXPORT_SYMBOL("@value@");
+DLR_EXPORT_SYMBOL("@dlr_expression@");
diff --git a/dlrestrictions/dlrestrictions.h b/dlrestrictions/dlrestrictions.h
index ba58aad..6467288 100644
--- a/dlrestrictions/dlrestrictions.h
+++ b/dlrestrictions/dlrestrictions.h
@@ -27,7 +27,7 @@
#define DLR_STRINGIFY(s) #s
#define DLR_STRINGIFY2(s) DLR_STRINGIFY(s)
-#define DLR_SYMBOL debian_dlrestrictions
+#define DLR_SYMBOL dlrestrictions_data
#define DLR_SYMBOL_NAME DLR_STRINGIFY2(DLR_SYMBOL)
#define DLR_SYMBOL_MAGIC "DLR_SYMBOL_V1:"
#define MAX_DLR_EXPRESSION_LENGTH 4096
diff --git a/t/dlrestrictions/CMakeLists.txt b/t/dlrestrictions/CMakeLists.txt
index 4ed85e4..653653b 100644
--- a/t/dlrestrictions/CMakeLists.txt
+++ b/t/dlrestrictions/CMakeLists.txt
@@ -18,10 +18,10 @@ set_target_properties(testdlr_lib1 PROPERTIES
OUTPUT_NAME "testdlr_lib"
SOVERSION 1
VERSION 1.0.0
- DEBIAN_DLRESTRICTIONS "REJECT:OTHERSOVERSION"
+ DLRESTRICTIONS "REJECT:OTHERSOVERSION"
)
target_link_libraries(testdlr_lib1 testdlr_deeplib1)
-debian_add_dlrestrictions_symbol(testdlr_lib1)
+dlrestrictions_process_targets(testdlr_lib1)
add_library(testdlr_deeplib2 SHARED testdlr_deeplib2.c)
set_target_properties(testdlr_deeplib2 PROPERTIES