<commit_before>cmake_minimum_required(VERSION 2.8)

include(FindOpenSSL)

find_package(PythonLibs REQUIRED)
find_package(PythonInterp REQUIRED)
if(NOT PYTHONLIBS_FOUND OR NOT PYTHON_EXECUTABLE)
    message(FATAL "You need Python to build Python binding")
endif()

if(NOT OPENSSL_FOUND)
    message(FATAL "OpenSSL not found!")
endif()

include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

add_definitions(
    -Wall
    -pedantic
    -Werror
    -Wno-long-long
    -Wno-unknown-pragmas
    -std=gnu99
    -fno-strict-aliasing  # when Python authors write a line of code, kitten dies
    )

option(DEBUG_ECDSA "Display debug messages on stderr" FALSE)

if (DEBUG_ECDSA)
    add_definitions(-DDEBUG_ECDSA)
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
    set (RESOLVLIB resolv)
endif()

file(GLOB SOURCES "src/*.[ch]")
python_add_module(ecdsa ${SOURCES})
target_link_libraries(ecdsa ${RESOLVLIB} ${PYTHON_LIBRARIES} ${OPENSSL_LIBRARIES})

option(INSTALL_DIR "Relative to prefix directory where to install" "")
if (NOT INSTALL_DIR)
    execute_process(
        COMMAND ${PYTHON_EXECUTABLE} -c "import site, sys; sys.stdout.write(site.PREFIXES[-1])"
        OUTPUT_VARIABLE PYTHON_PREFIX
        )
    file(TO_CMAKE_PATH "${PYTHON_PREFIX}" PYTHON_PREFIX)
    execute_process(
        COMMAND ${PYTHON_EXECUTABLE} -c "import site, sys; sys.stdout.write(site.getsitepackages()[-1])"
        OUTPUT_VARIABLE PYTHON_SITE_DIR
        )
    file(TO_CMAKE_PATH "${PYTHON_SITE_DIR}" PYTHON_SITE_DIR)<commit_msg>Another build fix for lucid<commit_after>cmake_minimum_required(VERSION 2.8)

include(FindOpenSSL)

find_package(PythonLibs REQUIRED)
find_package(PythonInterp REQUIRED)
if(NOT PYTHONLIBS_FOUND OR NOT PYTHON_EXECUTABLE)
    message(FATAL "You need Python to build Python binding")
endif()

if(NOT OPENSSL_FOUND)
    message(FATAL "OpenSSL not found!")
endif()

include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

add_definitions(
    -Wall
    -pedantic
    -Werror
    -Wno-long-long
    -Wno-unknown-pragmas
    -std=gnu99
    -fno-strict-aliasing  # when Python authors write a line of code, kitten dies
    )

option(DEBUG_ECDSA "Display debug messages on stderr" FALSE)

if (DEBUG_ECDSA)
    add_definitions(-DDEBUG_ECDSA)
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
    set (RESOLVLIB resolv)
endif()

file(GLOB SOURCES "src/*.[ch]")
python_add_module(ecdsa ${SOURCES})
set_target_properties(ecdsa PROPERTIES PREFIX "")  # older CMake versions don't remove prefix on their own
target_link_libraries(ecdsa ${RESOLVLIB} ${PYTHON_LIBRARIES} ${OPENSSL_LIBRARIES})

option(INSTALL_DIR "Relative to prefix directory where to install" "")
if (NOT INSTALL_DIR)
    execute_process(
        COMMAND ${PYTHON_EXECUTABLE} -c "import site, sys; sys.stdout.write(site.PREFIXES[-1])"
        OUTPUT_VARIABLE PYTHON_PREFIX
        )
    file(TO_CMAKE_PATH "${PYTHON_PREFIX}" PYTHON_PREFIX)
    execute_process(
        COMMAND ${PYTHON_EXECUTABLE} -c "import site, sys; sys.stdout.write(site.getsitepackages()[-1])"
        OUTPUT_VARIABLE PYTHON_SITE_DIR
        )
    file(TO_CMAKE_PATH "${PYTHON_SITE_DIR}" PYTHON_SITE_DIR)
{'fraction_non_alphanumeric': 0.10354223433242507, 'fraction_numerical': 0.0036330608537693005, 'mean_word_length': 4.921146953405018, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1300216', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1205, 'n_words': 243}