diff options
101 files changed, 1672 insertions, 1482 deletions
@@ -28,7 +28,9 @@ Naram Qashat <cyberbotx@anope.org> <cyberbotx@5417fbe8-f217-4b02-8779-1006273d78 Naram Qashat <cyberbotx@anope.org> <cyberbotx@cyberbotx.com> Naram Qashat <cyberbotx@anope.org> <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> Pieter Bootsma <geniusdex@anope.org> <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> +Robby <robby@anope.org> Robby <robby@chat.be> +Robby <robby@chatbelgie.be> Robin Burchell <w00t@inspircd.org> <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> Robin Burchell <w00t@inspircd.org> <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> Sebastian V. <hal9000@denorastats.org> diff --git a/CMakeLists.txt b/CMakeLists.txt index 70ad660bd..974988b67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,13 @@ # This usage of CMake requires at least version 2.8 cmake_minimum_required(VERSION 2.8 FATAL_ERROR) -# If the Source dir and the Binary dir are the same, we are building in-source, which we will disallow due to Autotools being there (but only on non-Windows) -if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR} AND NOT WIN32) - message(FATAL_ERROR "You can not use CMake to build Anope from the root of it's source tree! Remove the CMakeCache.txt file from this directory, then create a separate directory (either below this directory or elsewhere), and then re-run CMake from there.") -endif(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR} AND NOT WIN32) +cmake_policy(SET CMP0003 NEW) +if(POLICY CMP0026) + cmake_policy(SET CMP0026 OLD) +endif(POLICY CMP0026) +if(POLICY CMP0007) + cmake_policy(SET CMP0007 OLD) +endif(POLICY CMP0007) # Set the project as C++ primarily, but have C enabled for the checks required later project(Anope CXX) @@ -58,9 +61,6 @@ endif(EXTRA_LIBS) # Find gettext find_package(Gettext) -# Add an optional variable for using run-cc.pl for building, Perl will be checked later regardless of this setting -option(USE_RUN_CC_PL "Use run-cc.pl for building" OFF) - # Use the following directories as includes # Note that it is important the binary include directory comes before the # source include directory so the precompiled headers work correctly. @@ -100,13 +100,15 @@ if(CMAKE_DL_LIBS) list(APPEND LINK_LIBS ${CMAKE_DL_LIBS}) endif(CMAKE_DL_LIBS) -# Under Windows, we set the executable name for Anope to be anope -if(WIN32) - set(PROGRAM_NAME anope) -# Under *nix, we set the executable name for Anope to be services -else(WIN32) - set(PROGRAM_NAME services) -endif(WIN32) +if(NOT PROGRAM_NAME) + # Under Windows, we set the executable name for Anope to be anope + if(WIN32) + set(PROGRAM_NAME anope) + # Under *nix, we set the executable name for Anope to be services + else(WIN32) + set(PROGRAM_NAME services) + endif(WIN32) +endif(NOT PROGRAM_NAME) # If we are not using Visual Studio, we'll run the following checks if(NOT MSVC) @@ -173,19 +175,11 @@ endif(LDFLAGS) # Search for the following programs find_program(CHGRP chgrp) find_program(CHMOD chmod) -find_program(PERL perl) - -# If perl is included on the system and the user wants to use run-cc.pl, change the commands for compiling and linking -if(PERL AND USE_RUN_CC_PL) - set(CMAKE_CXX_COMPILE_OBJECT "${PERL} ${Anope_SOURCE_DIR}/cmake/run-cc.pl -q ${CMAKE_CXX_COMPILE_OBJECT}") - set(CMAKE_CXX_LINK_EXECUTABLE "${PERL} ${Anope_SOURCE_DIR}/cmake/run-cc.pl -q ${CMAKE_CXX_LINK_EXECUTABLE}") - set(CMAKE_CXX_CREATE_SHARED_MODULE "${PERL} ${Anope_SOURCE_DIR}/cmake/run-cc.pl -q ${CMAKE_CXX_CREATE_SHARED_MODULE}") -endif(PERL AND USE_RUN_CC_PL) # If a INSTDIR was passed in to CMake, use it as the install prefix, otherwise set the default install prefix to the services directory under the user's home directory if(INSTDIR) set(CMAKE_INSTALL_PREFIX "${INSTDIR}") -else(INSTDIR) +elseif(NOT CMAKE_INSTALL_PREFIX) set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/services") endif(INSTDIR) @@ -217,16 +211,14 @@ endif(NOT LOGS_DIR) file(STRINGS ${Anope_SOURCE_DIR}/src/version.sh VERSIONS REGEX "^VERSION_") # Iterate through the strings found foreach(VERSION_STR ${VERSIONS}) - # Get the length of the string - string(LENGTH ${VERSION_STR} VERSION_LEN) - # Subtract 16 from the string's length (8 for VERSION_, 5 more for the type, 2 for the space and leading quote, 1 for the trailing quote) - math(EXPR VERSION_NUM_LEN "${VERSION_LEN} - 16") - # Extract the type from the string - string(SUBSTRING ${VERSION_STR} 8 5 VERSION_TYPE) - # Extract the actual value from the string - string(SUBSTRING ${VERSION_STR} 15 ${VERSION_NUM_LEN} VERSION) - # Set the version type to the value extract from above - set(VERSION_${VERSION_TYPE} ${VERSION}) + string(REGEX REPLACE "^VERSION_([A-Z]+)=\"?([^\"]*)\"?$" "\\1;\\2" VERSION_OUT ${VERSION_STR}) + # Depends on CMP0007 OLD + list(LENGTH VERSION_OUT VERSION_LEN) + list(GET VERSION_OUT 0 VERSION_TYPE) + if(${VERSION_LEN} GREATER 1) + list(GET VERSION_OUT 1 VERSION_DATA) + set(VERSION_${VERSION_TYPE} ${VERSION_DATA}) + endif(${VERSION_LEN} GREATER 1) endforeach(VERSION_STR ${VERSIONS}) # Default build version to 0 @@ -290,16 +282,16 @@ get_target_property(SERVICES_BINARY ${PROGRAM_NAME} LOCATION) get_filename_component(SERVICES_BINARY ${SERVICES_BINARY} NAME) # At install time, create the following additional directories -install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${DB_DIR}/backups\")") -install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${LOGS_DIR}\")") +install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${DB_DIR}/backups\")") +install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${LOGS_DIR}\")") if(WIN32) install(CODE "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${DB_DIR}/runtime\")") endif(WIN32) # On non-Windows platforms, if RUNGROUP is set, change the permissions of the below directories, as well as the group of the data directory if(NOT WIN32 AND RUNGROUP) - install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\${CMAKE_INSTALL_PREFIX}/\${DB_DIR}/backups\")") - install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\${CMAKE_INSTALL_PREFIX}/\${LOGS_DIR}\")") - install(CODE "execute_process(COMMAND ${CHGRP} -R ${RUNGROUP} \"\${CMAKE_INSTALL_PREFIX}\")") + install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/\${DB_DIR}/backups\")") + install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/\${LOGS_DIR}\")") + install(CODE "execute_process(COMMAND ${CHGRP} -R ${RUNGROUP} \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}\")") endif(NOT WIN32 AND RUNGROUP) # On Windows platforms, install extra files if(WIN32) @@ -312,7 +304,7 @@ if(WIN32) install(FILES ${EXTRA_DLLS} DESTINATION ${BIN_DIR}) endif(WIN32) -install(CODE "file(REMOVE_RECURSE \"${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/modules\")") +install(CODE "file(REMOVE_RECURSE \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/modules\")") # Only process the CPack section if we have CPack if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") @@ -61,12 +61,6 @@ Run_Build_System () { BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=RELEASE" fi - if [ "$USE_RUN_CC_PL" = "yes" ] ; then - RUN_CC_PL="-DUSE_RUN_CC_PL:BOOLEAN=ON" - else - RUN_CC_PL="-DUSE_RUN_CC_PL:BOOLEAN=OFF" - fi - if [ "$EXTRA_INCLUDE_DIRS" != "" ] ; then EXTRA_INCLUDE="-DEXTRA_INCLUDE:STRING=$EXTRA_INCLUDE_DIRS" fi @@ -118,7 +112,6 @@ INSTDIR=$HOME/services RUNGROUP= UMASK= DEBUG="no" -USE_RUN_CC_PL="no" EXTRA_INCLUDE_DIRS= EXTRA_LIB_DIRS= EXTRA_CONFIG_ARGS= @@ -307,30 +300,6 @@ echo "" #### -TEMP_YN="n" -if [ "$USE_RUN_CC_PL" = "yes" ] ; then - TEMP_YN="y" -fi -echo "You can optionally have the build run through run-cc.pl, which will" -echo "cause warnings and errors (if any) to be colored yellow and red," -echo "respectively. This relies on Perl being installed, so if you say yes" -echo "to this without Perl, the option will be ignored." -echo "NOTE: If you are using MinGW, it is NOT recommended to say yes to" -echo "this, it may fail." -echo "Would you like to utilize run-cc.pl?" -echo2 "[$TEMP_YN] " -read YN -if [ "$YN" ] ; then - if [ "$YN" = "y" ] ; then - USE_RUN_CC_PL="yes" - else - USE_RUN_CC_PL="no" - fi -fi -echo "" - -#### - echo "Are there any extra include directories you wish to use?" echo "You may only need to do this if CMake is unable to locate" echo "missing dependencies without hints." @@ -368,7 +337,7 @@ echo "" #### echo "Are there any extra arguments you wish to pass to CMake?" -echo "If you need no extra arugments to CMake, enter NONE in all caps." +echo "If you need no extra arguments to CMake, enter NONE in all caps." echo2 "[$EXTRA_CONFIG_ARGS] " if read INPUT ; then : ; else echo "" ; exit 1 ; fi if [ "$INPUT" ] ; then @@ -393,7 +362,6 @@ INSTDIR="$INSTDIR" RUNGROUP="$RUNGROUP" UMASK=$UMASK DEBUG="$DEBUG" -USE_RUN_CC_PL="$USE_RUN_CC_PL" EXTRA_INCLUDE_DIRS="$EXTRA_INCLUDE_DIRS" EXTRA_LIB_DIRS="$EXTRA_LIB_DIRS" EXTRA_CONFIG_ARGS="$EXTRA_CONFIG_ARGS" diff --git a/Config.exe b/Config.exe Binary files differdeleted file mode 100644 index 3be910bb0..000000000 --- a/Config.exe +++ /dev/null diff --git a/cmake/run-cc.pl b/cmake/run-cc.pl deleted file mode 100755 index fe28dee10..000000000 --- a/cmake/run-cc.pl +++ /dev/null @@ -1,226 +0,0 @@ -#!/usr/bin/env perl - -### THIS IS DESIGNED TO BE RUN BY MAKE! DO NOT RUN FROM THE SHELL (because it MIGHT sigterm the shell)! ### - -use strict; -use warnings FATAL => qw(all); - -use POSIX (); - -# Runs the compiler, passing it the given arguments. -# Filters select output from the compiler's standard error channel and -# can take different actions as a result. - -# NOTE: this is *NOT* a hash (sadly: a hash would stringize all the regexes and thus render them useless, plus you can't index a hash based on regexes anyway) -# even though we use the => in it. - -# The subs are passed the message, and anything the regex captured. - -my $flag = shift(@ARGV); -my $quiet = 0; -my $cc; -if ($flag eq "-q") { - $quiet = 1; - $cc = shift(@ARGV); -} -else { - $cc = $flag; -} - -my $showncmdline = 0; - -# GCC's "location of error stuff", which accumulates the "In file included from" include stack -my $location = ""; - -my @msgfilters = ( - [ qr/^(.*) warning: cannot pass objects of non-POD type `(.*)' through `\.\.\.'; call will abort at runtime/ => sub { - my ($msg, $where, $type) = @_; - my $errstr = $location . "$where error: cannot pass objects of non-POD type `$type' through `...'\n"; - $location = ""; - if ($type =~ m/::(basic_)?string/) { - $errstr .= "$where (Did you forget to call c_str()?)\n"; - } - die $errstr; - } ], - - # Start of an include stack. - [ qr/^In file included from .*[,:]$/ => sub { - my ($msg) = @_; - $location = "$msg\n"; - return undef; - } ], - - # Continuation of an include stack. - [ qr/^ from .*[,:]$/ => sub { - my ($msg) = @_; - $location .= "$msg\n"; - return undef; - } ], - - # A function, method, constructor, or destructor is the site of a problem - [ qr/In ((con|de)structor|(member )?function)/ => sub { - my ($msg) = @_; - # If a complete location string is waiting then probably we dropped an error, so drop the location for a new one. - if ($location =~ m/In ((con|de)structor|(member )?function)/) { - $location = "$msg\n"; - } else { - $location .= "$msg\n"; - } - return undef; |
