<commit_before>project( oxygen-gtk )

cmake_minimum_required(VERSION 2.4)

###########################
# Define package generation
###########################

set( CPACK_PACKAGE_NAME "oxygen-gtk" )
set( CPACK_SOURCE_PACKAGE_NAME "oxygen-gtk" )
set( CPACK_SOURCE_GENERATOR TBZ2 )
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Oxygen Gtk theme" )
set( CPACK_PACKAGE_VENDOR "<EMAIL>" )
set( CPACK_PACKAGE_VERSION_MAJOR "1" )
set( CPACK_PACKAGE_VERSION_MINOR "1" )
set( CPACK_PACKAGE_VERSION_PATCH "50" )
set( CPACK_SOURCE_IGNORE_FILES "build" "^${PROJECT_SOURCE_DIR}.*/.git/" )

##################################
# Define oxygen-gtk version string
##################################
if( EXISTS "${CMAKE_SOURCE_DIR}/.git" )
	execute_process(COMMAND sh -c "cd ${CMAKE_SOURCE_DIR} && git describe 2>/dev/null"
		OUTPUT_VARIABLE OXYGEN_VERSION
		OUTPUT_STRIP_TRAILING_WHITESPACE)
endif( EXISTS "${CMAKE_SOURCE_DIR}/.git" )
STRING(COMPARE NOTEQUAL "${OXYGEN_VERSION}" "" OXYGEN_VERSION_DETECTED )
if( NOT OXYGEN_VERSION_DETECTED )
	set( OXYGEN_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH} )
endif( NOT OXYGEN_VERSION_DETECTED )
message( "Detected oxygen version string: ${OXYGEN_VERSION}" )

set( CPACK_SOURCE_PACKAGE_FILE_NAME "oxygen-gtk-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}" )
include( CPack )
########################
# Package specific flags
########################

# Set to 1 to enable debugging information
if( NOT DEFINED OXYGEN_DEBUG )
		set( OXYGEN_DEBUG 0 )
endif( NOT DEFINED OXYGEN_DEBUG )

# Set to 1 to enable debug logs regarding inner shadows
if( NOT DEFINED OXYGEN_DEBUG_INNERSHADOWS )
		set( OXYGEN_DEBUG_INNERSHADOWS 0 )
endif( NOT DEFINED OXYGEN_DEBUG_INNERSHADOWS )

# Set to 1 to replace gtk stock icons
# with oxygen-icons
if( NOT DEFINED OXYGEN_ICON_HACK )
		set( OXYGEN_ICON_HACK 1 )
endif( NOT DEFINED OXYGEN_ICON_HACK )

# Set to 1 to force KDE icons and fonts when running in non-KDE
if( NOT DEFINED OXYGEN_FORCE_KDE_ICONS_AND_FONTS )
		set( OXYGEN_FORCE_KDE_ICONS_AND_FONTS 1 )
endif( NOT DEFINED OXYGEN_FORCE_KDE_ICONS_AND_FONTS )

# Set to 1 to resize combobox list to compensate for combobox button glow width
# (may result in flicker on combo popup)
if( NOT DEFINED ENABLE_COMBOBOX_LIST_RESIZE )
		set( ENABLE_COMBOBOX_LIST_RESIZE 1 )
endif( NOT DEFINED ENABLE_COMBOBOX_LIST_RESIZE )

# Set to 0 to disable inner shadows hack
# Note this flag is automatically set to 0 if GTK version is too old (< 2.24.2)
if( NOT DEFINED ENABLE_INNER_SHADOWS_HACK )
		set( ENABLE_INNER_SHADOWS_HACK 1 )
endif( NOT DEFINED ENABLE_INNER_SHADOWS_HACK )

# set to 0 to disable groupbox hack
if( NOT DEFINED ENABLE_GROUPBOX_HACK )
		set( ENABLE_GROUPBOX_HACK 1 )
endif( NOT DEFINED ENABLE_GROUPBOX_HACK )

##############
# Requirements
##############

# install prefix
include( UsePkgConfig )
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

		exec_program(
				${PKGCONFIG_EXECUTABLE}
				ARGS --variable=prefix gtk+-2.0
				OUTPUT_VARIABLE GTK_PREFIX )

  	message( "Info: using PKGCONFIG_EXECUTABLE to set the installation prefix" )
		set(CMAKE_INSTALL_PREFIX
				${GTK_PREFIX} CACHE PATH "GTK install prefix" FORCE
				)
endif()

# X11
find_package( X11 REQUIRED )

# PKG_CONFIG
find_package(PkgConfig REQUIRED )

# GTK
pkg_check_modules( GTK REQUIRED gtk+-2.0 )

# Cairo
pkg_check_modules( CAIRO REQUIRED cairo )

# DBus
set( HAVE_DBUS 0 )
pkg_check_modules( DBUS dbus-glib-1 )
if( DBUS_FOUND )
		set( HAVE_DBUS 1 )
endif()

##########################
# installation directories
##########################
exec_program(
	${PKGCONFIG_EXECUTABLE}
	ARGS --variable=gtk_binary_version gtk+-2.0
	OUTPUT_VARIABLE GTK_BIN_VERSION )

if( DEFINED LIB_SUFFIX OR NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )

 	message( "Info: using LIB_SUFFIX to set the theme engine installation path" )
	set( INSTALL_PATH_GTK_ENGINES "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/gtk-2.0/${GTK_BIN_VERSION}/engines" CACHE PATH "The directory in which to install the theme engine library( eg. /usr/lib/gtk-2.0/2.4.0/engines )" )

else()

	exec_program(
	  ${PKGCONFIG_EXECUTABLE}
	  ARGS --variable=libdir gtk+-2.0
	  OUTPUT_VARIABLE GTK_LIBDIR_PREFIX )

 	message( "Info: using PKGCONFIG_EXECUTABLE to set the theme engine installation path" )
	set( INSTALL_PATH_GTK_ENGINES "${GTK_LIBDIR_PREFIX}/gtk-2.0/${GTK_BIN_VERSION}/engines" CACHE PATH "The directory in which to install the theme engine library( eg. /usr/lib/gtk-2.0/2.4.0/engines )" )

endif()

set( INSTALL_PATH_GTK_THEMES "${CMAKE_INSTALL_PREFIX}/share/themes" CACHE PATH "The directory in which to install the theme data( eg. /usr/share/themes )" )
set( GTK_THEME_DIR ${INSTALL_PATH_GTK_THEMES}/oxygen-gtk )

# First emit all warnings in one place
# Warn user if dbus-glib not found
if( NOT DBUS_FOUND )
		message( "Warning: dbus-glib-1 <http://dbus.freedesktop.org/releases/dbus-glib/> could not be found on your system.\nD-Bus is a simple inter-process communication system. It is used for GTK applications to be updated on the fly when KDE configuration is changed." )
endif( NOT DBUS_FOUND )

# Adjust flags based on gtk version and warn user if needed
if( ENABLE_INNER_SHADOWS_HACK AND GTK_VERSION VERSION_LESS 2.24.2 )
		message( "Warning: disabling inner shadows hack because GTK version is too old (needed 2.24.2, found ${GTK_VERSION})" )
		set( ENABLE_INNER_SHADOWS_HACK 0 )
endif( ENABLE_INNER_SHADOWS_HACK AND GTK_VERSION VERSION_LESS 2.24.2 )

#########
# summary
#########
message( "Flags: " )
message( "  OXYGEN_DEBUG ${OXYGEN_DEBUG}" )
message( "  OXYGEN_DEBUG_INNERSHADOWS ${OXYGEN_DEBUG_INNERSHADOWS}" )
message( "  HAVE_DBUS ${HAVE_DBUS}" )
message( "  OXYGEN_ICON_HACK ${OXYGEN_ICON_HACK}" )
message( "  OXYGEN_FORCE_KDE_ICONS_AND_FONTS ${OXYGEN_FORCE_KDE_ICONS_AND_FONTS}" )
message( "  ENABLE_COMBOBOX_LIST_RESIZE ${ENABLE_COMBOBOX_LIST_RESIZE}" )
message( "  ENABLE_INNER_SHADOWS_HACK ${ENABLE_INNER_SHADOWS_HACK}" )
message( "  ENABLE_GROUPBOX_HACK ${ENABLE_GROUPBOX_HACK}" )
message( "" )
message( "Paths: " )
message( "  Installing the GTK theme engine library to: ${INSTALL_PATH_GTK_ENGINES}" )
message( "  Installing the GTK theme engine data to: ${GTK_THEME_DIR}" )
message( "" )<commit_msg>fixed indentations.<commit_after>project( oxygen-gtk )

cmake_minimum_required(VERSION 2.4)

###########################
# Define package generation
###########################

set( CPACK_PACKAGE_NAME "oxygen-gtk" )
set( CPACK_SOURCE_PACKAGE_NAME "oxygen-gtk" )
set( CPACK_SOURCE_GENERATOR TBZ2 )
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Oxygen Gtk theme" )
set( CPACK_PACKAGE_VENDOR "<EMAIL>" )
set( CPACK_PACKAGE_VERSION_MAJOR "1" )
set( CPACK_PACKAGE_VERSION_MINOR "1" )
set( CPACK_PACKAGE_VERSION_PATCH "50" )
set( CPACK_SOURCE_IGNORE_FILES "build" "^${PROJECT_SOURCE_DIR}.*/.git/" )

##################################
# Define oxygen-gtk version string
##################################
if( EXISTS "${CMAKE_SOURCE_DIR}/.git" )
  execute_process(COMMAND sh -c "cd ${CMAKE_SOURCE_DIR} && git describe 2>/dev/null"
    OUTPUT_VARIABLE OXYGEN_VERSION
    OUTPUT_STRIP_TRAILING_WHITESPACE)
endif( EXISTS "${CMAKE_SOURCE_DIR}/.git" )
STRING(COMPARE NOTEQUAL "${OXYGEN_VERSION}" "" OXYGEN_VERSION_DETECTED )
if( NOT OXYGEN_VERSION_DETECTED )
  set( OXYGEN_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH} )
endif( NOT OXYGEN_VERSION_DETECTED )
message( "Detected oxygen version string: ${OXYGEN_VERSION}" )

set( CPACK_SOURCE_PACKAGE_FILE_NAME "oxygen-gtk-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}" )
include( CPack )
########################
# Package specific flags
########################

# Set to 1 to enable debugging information
if( NOT DEFINED OXYGEN_DEBUG )
    set( OXYGEN_DEBUG 0 )
endif( NOT DEFINED OXYGEN_DEBUG )

# Set to 1 to enable debug logs regarding inner shadows
if( NOT DEFINED OXYGEN_DEBUG_INNERSHADOWS )
    set( OXYGEN_DEBUG_INNERSHADOWS 0 )
endif( NOT DEFINED OXYGEN_DEBUG_INNERSHADOWS )

# Set to 1 to replace gtk stock icons
# with oxygen-icons
if( NOT DEFINED OXYGEN_ICON_HACK )
    set( OXYGEN_ICON_HACK 1 )
endif( NOT DEFINED OXYGEN_ICON_HACK )

# Set to 1 to force KDE icons and fonts when running in non-KDE
if( NOT DEFINED OXYGEN_FORCE_KDE_ICONS_AND_FONTS )
    set( OXYGEN_FORCE_KDE_ICONS_AND_FONTS 1 )
endif( NOT DEFINED OXYGEN_FORCE_KDE_ICONS_AND_FONTS )

# Set to 1 to resize combobox list to compensate for combobox button glow width
# (may result in flicker on combo popup)
if( NOT DEFINED ENABLE_COMBOBOX_LIST_RESIZE )
    set( ENABLE_COMBOBOX_LIST_RESIZE 1 )
endif( NOT DEFINED ENABLE_COMBOBOX_LIST_RESIZE )

# Set to 0 to disable inner shadows hack
# Note this flag is automatically set to 0 if GTK version is too old (< 2.24.2)
if( NOT DEFINED ENABLE_INNER_SHADOWS_HACK )
    set( ENABLE_INNER_SHADOWS_HACK 1 )
endif( NOT DEFINED ENABLE_INNER_SHADOWS_HACK )

# set to 0 to disable groupbox hack
if( NOT DEFINED ENABLE_GROUPBOX_HACK )
    set( ENABLE_GROUPBOX_HACK 1 )
endif( NOT DEFINED ENABLE_GROUPBOX_HACK )

##############
# Requirements
##############

# install prefix
include( UsePkgConfig )
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

    exec_program(
        ${PKGCONFIG_EXECUTABLE}
        ARGS --variable=prefix gtk+-2.0
        OUTPUT_VARIABLE GTK_PREFIX )

  	message( "Info: using PKGCONFIG_EXECUTABLE to set the installation prefix" )
    set(CMAKE_INSTALL_PREFIX
        ${GTK_PREFIX} CACHE PATH "GTK install prefix" FORCE
        )
endif()

# X11
find_package( X11 REQUIRED )

# PKG_CONFIG
find_package(PkgConfig REQUIRED )

# GTK
pkg_check_modules( GTK REQUIRED gtk+-2.0 )

# Cairo
pkg_check_modules( CAIRO REQUIRED cairo )

# DBus
set( HAVE_DBUS 0 )
pkg_check_modules( DBUS dbus-glib-1 )
if( DBUS_FOUND )
    set( HAVE_DBUS 1 )
endif()

##########################
# installation directories
##########################
exec_program(
  ${PKGCONFIG_EXECUTABLE}
  ARGS --variable=gtk_binary_version gtk+-2.0
  OUTPUT_VARIABLE GTK_BIN_VERSION )

if( DEFINED LIB_SUFFIX OR NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )

 	message( "Info: using LIB_SUFFIX to set the theme engine installation path" )
  set( INSTALL_PATH_GTK_ENGINES "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/gtk-2.0/${GTK_BIN_VERSION}/engines" CACHE PATH "The directory in which to install the theme engine library( eg. /usr/lib/gtk-2.0/2.4.0/engines )" )

else()

  exec_program(
    ${PKGCONFIG_EXECUTABLE}
    ARGS --variable=libdir gtk+-2.0
    OUTPUT_VARIABLE GTK_LIBDIR_PREFIX )

 	message( "Info: using PKGCONFIG_EXECUTABLE to set the theme engine installation path" )
  set( INSTALL_PATH_GTK_ENGINES "${GTK_LIBDIR_PREFIX}/gtk-2.0/${GTK_BIN_VERSION}/engines" CACHE PATH "The directory in which to install the theme engine library( eg. /usr/lib/gtk-2.0/2.4.0/engines )" )

endif()

set( INSTALL_PATH_GTK_THEMES "${CMAKE_INSTALL_PREFIX}/share/themes" CACHE PATH "The directory in which to install the theme data( eg. /usr/share/themes )" )
set( GTK_THEME_DIR ${INSTALL_PATH_GTK_THEMES}/oxygen-gtk )

# First emit all warnings in one place
# Warn user if dbus-glib not found
if( NOT DBUS_FOUND )
    message( "Warning: dbus-glib-1 <http://dbus.freedesktop.org/releases/dbus-glib/> could not be found on your system.\nD-Bus is a simple inter-process communication system. It is used for GTK applications to be updated on the fly when KDE configuration is changed." )
endif( NOT DBUS_FOUND )

# Adjust flags based on gtk version and warn user if needed
if( ENABLE_INNER_SHADOWS_HACK AND GTK_VERSION VERSION_LESS 2.24.2 )
    message( "Warning: disabling inner shadows hack because GTK version is too old (needed 2.24.2, found ${GTK_VERSION})" )
    set( ENABLE_INNER_SHADOWS_HACK 0 )
endif( ENABLE_INNER_SHADOWS_HACK AND GTK_VERSION VERSION_LESS 2.24.2 )

#########
# summary
#########
message( "Flags: " )
message( "  OXYGEN_DEBUG ${OXYGEN_DEBUG}" )
message( "  OXYGEN_DEBUG_INNERSHADOWS ${OXYGEN_DEBUG_INNERSHADOWS}" )
message( "  HAVE_DBUS ${HAVE_DBUS}" )
message( "  OXYGEN_ICON_HACK ${OXYGEN_ICON_HACK}" )
message( "  OXYGEN_FORCE_KDE_ICONS_AND_FONTS ${OXYGEN_FORCE_KDE_ICONS_AND_FONTS}" )
message( "  ENABLE_COMBOBOX_LIST_RESIZE ${ENABLE_COMBOBOX_LIST_RESIZE}" )
message( "  ENABLE_INNER_SHADOWS_HACK ${ENABLE_INNER_SHADOWS_HACK}" )
message( "  ENABLE_GROUPBOX_HACK ${ENABLE_GROUPBOX_HACK}" )
message( "" )
message( "Paths: " )
message( "  Installing the GTK theme engine library to: ${INSTALL_PATH_GTK_ENGINES}" )
message( "  Installing the GTK theme engine data to: ${GTK_THEME_DIR}" )
message( "" )
{'fraction_non_alphanumeric': 0.12762417808761783, 'fraction_numerical': 0.011090865879743325, 'mean_word_length': 5.665258711721225, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '7435526', 'n_tokens_mistral': 4896, 'n_tokens_neox': 4618, 'n_words': 1115}