<commit_before>include (PackagingMacros)

set (PACKAGE_URL "https://www.libelektra.org/")
set (PACKAGE_BUGREPORT "https://bugs.libelektra.org/")
set (PROJECT_VERSION "${KDB_VERSION}")
set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")

if (NOT CPACK_PACKAGE_RELEASE)
	set (CPACK_PACKAGE_RELEASE "1")
endif ()

set (CPACK_OUTPUT_FILE_PREFIX "package")

set (
	PACKAGES
	libelektra${SO_VERSION}
	libelektra${SO_VERSION}-all
	libelektra${SO_VERSION}-full
	libelektra${SO_VERSION}-experimental
	libelektra${SO_VERSION}-extra
	libelektra${SO_VERSION}-augeas
	libelektra${SO_VERSION}-crypto
	libelektra${SO_VERSION}-curl
	libelektra${SO_VERSION}-dbus
	libelektra-dev
	libelektra${SO_VERSION}-gitresolver
	libelektra${SO_VERSION}-java
	libelektra${SO_VERSION}-journald
	libelektra${SO_VERSION}-lua
	libelektra${SO_VERSION}-python
	libelektra${SO_VERSION}-ruby
	libelektra${SO_VERSION}-xerces
	libelektra${SO_VERSION}-xmltool
	libelektra${SO_VERSION}-yajl
	libelektra${SO_VERSION}-yamlcpp
	libelektra${SO_VERSION}-zeromq
	java-elektra
	lua-elektra
	ruby-elektra
	python3-elektra
	elektra-bin
	elektra-bin-extra
	elektra-doc
	elektra-qt-gui
	elektra-tests
	elektra-dbg
	${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})

set (
	COMPONENTS_WITHOUT_DBGSYM
	elektra-doc
	elektra-dbg
	libelektra-dev
	libelektra${SO_VERSION}-all
	elektra-bin-extra
	java-elektra
	ruby-elektra
	${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})

set (ALL_PLUGINS "")
foreach (component ${PACKAGES})
	if (component MATCHES "^libelektra${SO_VERSION}-.*")
		list (APPEND ALL_PLUGINS "${component}")
	endif ()
endforeach ()
string (REPLACE ";" ", " ALL_PLUGINS_STR "${ALL_PLUGINS}")

set (EXCLUDED_COMPONENTS "")

if (CMAKE_BUILD_TYPE MATCHES "Release")
	set (PACKAGE_DEBUGINFO "OFF")
	list (REMOVE_ITEM PACKAGES elektra-dbg)
else ()
	set (PACKAGE_DEBUGINFO "ON")
endif ()

set (
	PACKAGE_DESCRIPTION
	"Elektra provides a universal and secure framework to store configuration parameters in a global, hierarchical key database. The core is a small library implemented in C. The plugin-based framework fulfills many configuration-related tasks to avoid any unnecessary code duplication across applications while it still allows the core to stay without any external dependency.  Elektra abstracts from cross-platform-related issues with an consistent API, and allows applications to be aware of other applications' configurations, leveraging easy application integration."
)
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE_DESCRIPTION}\n.")
set (
	CPACK_SOURCE_IGNORE_FILES
	"/.cvsignore"
	"/.gitignore"
	"/songs/"
	"/build/"
	"/.svn/"
	"/.git/"
	"/osx-utils/"
	"/portage-overlay/")
set (CPACK_PACKAGE_EXECUTABLES kdb)
set (CPACK_SOURCE_GENERATOR "TBZ2")
set (CPACK_GENERATOR "TBZ2")

# needed because otherwise files would be written to system during creating the package
set (CPACK_SET_DESTDIR "ON")

# package is not relocatable:
unset (CPACK_RPM_PACKAGE_RELOCATABLE)
unset (CPACK_RPM_PACKAGE_RELOCATABLE CACHE)

if ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
	set (CPACK_STRIP_FILES TRUE)
endif ("${CMAKE_BUILD_TYPE}" MATCHES "Release")

if (APPLE)
	set (CPACK_GENERATOR "PACKAGEMAKER;OSXX11")
endif (APPLE)
if (UNIX)

	# Try to find architecture
	execute_process (COMMAND uname -m OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE)
	string (STRIP "${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_ARCHITECTURE)

	# Try to find distro name and distro-specific arch
	execute_process (COMMAND bash "-c" "grep \"^NAME=\" /etc/os-release | awk -F= {' print $2'} | sed 's/\"//g'"
			 OUTPUT_VARIABLE OS_NAME)
	execute_process (COMMAND bash "-c" "grep \"^VERSION_ID=\" /etc/os-release | awk -F= {' print $2'} | sed 's/\"//g'"
			 OUTPUT_VARIABLE OS_VERSION_ID)
	execute_process (COMMAND bash "-c" "grep \"^PRETTY_NAME=\" /etc/os-release | awk -F= {' print $2'} | sed 's/\"//g'"
			 OUTPUT_VARIABLE OS_PRETTY_NAME)
	string (STRIP "${OS_NAME}" OS_NAME)
	string (STRIP "${OS_VERSION_ID}" OS_VERSION_ID)
	string (STRIP "${OS_PRETTY_NAME}" OS_PRETTY_NAME)
	set (OS_DISTRIB "${OS_NAME}${OS_VERSION_ID}")<commit_msg>cmake: don't run linux command on macos<commit_after>include (PackagingMacros)

set (PACKAGE_URL "https://www.libelektra.org/")
set (PACKAGE_BUGREPORT "https://bugs.libelektra.org/")
set (PROJECT_VERSION "${KDB_VERSION}")
set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")

if (NOT CPACK_PACKAGE_RELEASE)
	set (CPACK_PACKAGE_RELEASE "1")
endif ()

set (CPACK_OUTPUT_FILE_PREFIX "package")

set (
	PACKAGES
	libelektra${SO_VERSION}
	libelektra${SO_VERSION}-all
	libelektra${SO_VERSION}-full
	libelektra${SO_VERSION}-experimental
	libelektra${SO_VERSION}-extra
	libelektra${SO_VERSION}-augeas
	libelektra${SO_VERSION}-crypto
	libelektra${SO_VERSION}-curl
	libelektra${SO_VERSION}-dbus
	libelektra-dev
	libelektra${SO_VERSION}-gitresolver
	libelektra${SO_VERSION}-java
	libelektra${SO_VERSION}-journald
	libelektra${SO_VERSION}-lua
	libelektra${SO_VERSION}-python
	libelektra${SO_VERSION}-ruby
	libelektra${SO_VERSION}-xerces
	libelektra${SO_VERSION}-xmltool
	libelektra${SO_VERSION}-yajl
	libelektra${SO_VERSION}-yamlcpp
	libelektra${SO_VERSION}-zeromq
	java-elektra
	lua-elektra
	ruby-elektra
	python3-elektra
	elektra-bin
	elektra-bin-extra
	elektra-doc
	elektra-qt-gui
	elektra-tests
	elektra-dbg
	${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})

set (
	COMPONENTS_WITHOUT_DBGSYM
	elektra-doc
	elektra-dbg
	libelektra-dev
	libelektra${SO_VERSION}-all
	elektra-bin-extra
	java-elektra
	ruby-elektra
	${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})

set (ALL_PLUGINS "")
foreach (component ${PACKAGES})
	if (component MATCHES "^libelektra${SO_VERSION}-.*")
		list (APPEND ALL_PLUGINS "${component}")
	endif ()
endforeach ()
string (REPLACE ";" ", " ALL_PLUGINS_STR "${ALL_PLUGINS}")

set (EXCLUDED_COMPONENTS "")

if (CMAKE_BUILD_TYPE MATCHES "Release")
	set (PACKAGE_DEBUGINFO "OFF")
	list (REMOVE_ITEM PACKAGES elektra-dbg)
else ()
	set (PACKAGE_DEBUGINFO "ON")
endif ()

set (
	PACKAGE_DESCRIPTION
	"Elektra provides a universal and secure framework to store configuration parameters in a global, hierarchical key database. The core is a small library implemented in C. The plugin-based framework fulfills many configuration-related tasks to avoid any unnecessary code duplication across applications while it still allows the core to stay without any external dependency.  Elektra abstracts from cross-platform-related issues with an consistent API, and allows applications to be aware of other applications' configurations, leveraging easy application integration."
)
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE_DESCRIPTION}\n.")
set (
	CPACK_SOURCE_IGNORE_FILES
	"/.cvsignore"
	"/.gitignore"
	"/songs/"
	"/build/"
	"/.svn/"
	"/.git/"
	"/osx-utils/"
	"/portage-overlay/")
set (CPACK_PACKAGE_EXECUTABLES kdb)
set (CPACK_SOURCE_GENERATOR "TBZ2")
set (CPACK_GENERATOR "TBZ2")

# needed because otherwise files would be written to system during creating the package
set (CPACK_SET_DESTDIR "ON")

# package is not relocatable:
unset (CPACK_RPM_PACKAGE_RELOCATABLE)
unset (CPACK_RPM_PACKAGE_RELOCATABLE CACHE)

if ("${CMAKE_BUILD_TYPE}" MATCHES "Release")
	set (CPACK_STRIP_FILES TRUE)
endif ("${CMAKE_BUILD_TYPE}" MATCHES "Release")

if (APPLE)
	set (CPACK_GENERATOR "PACKAGEMAKER;OSXX11")
endif (APPLE)
if (UNIX)

	# Try to find architecture
	execute_process (COMMAND uname -m OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE)
	string (STRIP "${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_ARCHITECTURE)

	if (NOT APPLE)
		# Try to find distro name and distro-specific arch
		execute_process (COMMAND bash "-c" "grep \"^NAME=\" /etc/os-release | awk -F= {' print $2'} | sed 's/\"//g'"
				 OUTPUT_VARIABLE OS_NAME)
		execute_process (COMMAND bash "-c" "grep \"^VERSION_ID=\" /etc/os-release | awk -F= {' print $2'} | sed 's/\"//g'"
				 OUTPUT_VARIABLE OS_VERSION_ID)
		execute_process (COMMAND bash "-c" "grep \"^PRETTY_NAME=\" /etc/os-release | awk -F= {' print $2'} | sed 's/\"//g'"
				 OUTPUT_VARIABLE OS_PRETTY_NAME)
		string (STRIP "${OS_NAME}" OS_NAME)
		string (STRIP "${OS_VERSION_ID}" OS_VERSION_ID)
		string (STRIP "${OS_PRETTY_NAME}" OS_PRETTY_NAME)
	endif (NOT APPLE)
	set (OS_DISTRIB "${OS_NAME}${OS_VERSION_ID}")
{'fraction_non_alphanumeric': 0.1200147257332188, 'fraction_numerical': 0.002208859982819978, 'mean_word_length': 5.889264581572274, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4135373', 'n_tokens_mistral': 3141, 'n_tokens_neox': 3020, 'n_words': 675}