Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake] Update static dependencies to fix build issues #272

Merged
merged 35 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2b85429
Update mariadb-connector-c to 3.3.4
tobil4sk Feb 15, 2023
51a5aa1
Update apache, apr, and aprutil
tobil4sk Feb 15, 2023
65c3b27
Update remaining dependencies
tobil4sk Feb 15, 2023
2a6d75d
Remove unneeded cmake scripts
tobil4sk Feb 16, 2023
d6dd4f1
Use sha256 for zlib instead of md5
tobil4sk Feb 15, 2023
cfdcdf6
Reuse zlib build for mariadbconnector
tobil4sk Feb 15, 2023
69f3ca8
Fix pcre linking
tobil4sk Feb 16, 2023
d8a14ee
Fix make cflags for pcre2 build on mac
tobil4sk Feb 16, 2023
6f8e281
Fix and update cmake patches
tobil4sk Feb 17, 2023
e5f40ea
Fix openssl linking for mariadbconnector
tobil4sk Feb 19, 2023
2defbeb
Cleanup openssl config
tobil4sk Feb 19, 2023
a3fe191
Remove openssl config from aprutil build
tobil4sk Feb 19, 2023
d34d746
Update cmake version to 3.14
tobil4sk Feb 19, 2023
db05599
Fix new aprutil build on windows
tobil4sk Feb 19, 2023
b67e000
Fix apache static linking to pcre on windows
tobil4sk Feb 19, 2023
5694bef
Update changelog
tobil4sk Feb 15, 2023
0b86ee3
Fix azure pipeline step name
tobil4sk Feb 15, 2023
8ddeb03
Use add_compile_definitions
tobil4sk Feb 19, 2023
09f369f
Avoid error when only Apache is set in STATIC_DEPS
tobil4sk Feb 19, 2023
c4bb738
Fix GNUInstallDirs warning
tobil4sk Feb 19, 2023
101c498
Clean up minor issues
tobil4sk Feb 16, 2023
1cb3d46
Remove call to find openssl
tobil4sk Feb 19, 2023
5ab8792
Fix "WARNING: OpenSSL version is too old"
tobil4sk Feb 26, 2023
35eece3
Fix openssl static linking
tobil4sk Feb 26, 2023
1b620d0
Add version check for expat locating code
tobil4sk Feb 26, 2023
4d005fc
Clean up cmake version checks
tobil4sk Feb 26, 2023
02f7a49
Fix "no known rule" error for libssl.a
tobil4sk Mar 7, 2023
3ca8993
Merge branch 'master' into dependency-updates
Simn Mar 27, 2023
28a9fe5
Update CHANGES
Simn Mar 27, 2023
7b3ec08
Fix changelog
tobil4sk Mar 27, 2023
2a343b0
Merge branch 'master' into dependency-updates
tobil4sk Apr 9, 2023
50da3e5
Restore cmake 3.10.2 support
tobil4sk Apr 8, 2023
445ea5a
Add warning about CMake 3.12 on Windows
tobil4sk Apr 9, 2023
f118508
Remove redundant policy setting
tobil4sk Apr 9, 2023
f446dfe
Update mbedtls to 2.28.3
tobil4sk Apr 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
std : fixed put_env when null is passed in (#229 https://github.com/HaxeFoundation/haxe/issues/10395)
std : added sys_cpu_arch (#275)
std : fix sys_is64 returning false on 64 bit Windows (#276)
cmake : updated apr version for Mac
all : fixed various build issues on macOS Catalina
all : fixed various build issues on macOS Catalina and Big Sur
cmake : update all dependencies

2019-10-19 : 2.3.0
std : added socket_set_broadcast function (#190)
Expand Down
17 changes: 6 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
cmake_minimum_required(VERSION 3.10.2)

if (NOT ${CMAKE_VERSION} VERSION_LESS 3.24)
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.24)
cmake_policy(VERSION 3.24)
elseif (NOT ${CMAKE_VERSION} VERSION_LESS 3.19)
elseif (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.19)
cmake_policy(VERSION 3.19)
endif()
cmake_policy(SET CMP0068 NEW)

project(Neko C)

include(GNUInstallDirs)
include(CheckCCompilerFlag)
include(CheckIncludeFile)
include(TestBigEndian)
project(Neko C)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

Expand Down Expand Up @@ -57,7 +57,7 @@ option(WITH_REGEXP "Build with Perl-compatible regex support." ON)
option(WITH_UI "Build with GTK-3 UI support." ON)
option(WITH_SSL "Build with SSL support." ON)
option(WITH_MYSQL "Build with MySQL support." ON)
option(WITH_SQLITE "Build with Sqlite support." ON)
option(WITH_SQLITE "Build with SQLite support." ON)
option(WITH_APACHE "Build with Apache modules." ON)
option(WITH_NEKOML "Build NekoML." ON)

Expand Down Expand Up @@ -102,7 +102,7 @@ set(external_deps
OpenSSL
MariaDBConnector
pcre2
Sqlite3
SQLite3
APR
APRutil
Apache
Expand Down Expand Up @@ -130,9 +130,6 @@ if (STATIC_DEPS STREQUAL "all")
if (WIN32)
list(REMOVE_ITEM STATIC_DEPS_ALL BoehmGC)
endif()
if (APPLE)
list(REMOVE_ITEM STATIC_DEPS_ALL APRutil)
endif()
set(STATIC_DEPS ${STATIC_DEPS_ALL} CACHE STRING "${STATIC_DEPS_DOC}" FORCE)
elseif (STATIC_DEPS STREQUAL "none")
message(STATUS "set STATIC_DEPS to nothing")
Expand All @@ -144,8 +141,6 @@ else()
message(FATAL_ERROR "Invalid STATIC_DEPS. There is no ${dep} in the list of ${external_deps}")
elseif(WIN32 AND dep STREQUAL "BoehmGC")
message(FATAL_ERROR "Cannot link ${dep} statically on Windows")
elseif(APPLE AND dep STREQUAL "APRutil")
message(WARNING "${dep} is redundant as it was merged into APR in version 2.0, which is the version we build with on macOS.")
endif()
endforeach()
endif()
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ Settings that allow to exclude libraries and their dependencies from the build;

Default value: `all` for Windows, `none` otherwise

It defines the dependencies that should be linked statically. Can be `all`, `none`, or a list of library names (e.g. `BoehmGC;Zlib;OpenSSL;MariaDBConnector;pcre2;Sqlite3;APR;APRutil;Apache;MbedTLS`).
It defines the dependencies that should be linked statically. Can be `all`, `none`, or a list of library names (e.g. `BoehmGC;Zlib;OpenSSL;MariaDBConnector;pcre2;SQLite3;APR;APRutil;Apache;MbedTLS`).

CMake will automatically download and build the specified dependencies into the build folder. If a library is not present in this list, it should be installed manually, and it will be linked dynamically.

All third-party libraries, except GTK+3 (Linux) and BoehmGC on Windows, can be linked statically. We do not support statically linking GTK+3 due to the difficulty of building it and its own dependencies. Additionally, we do not support statically linking the BoehmGC library on Windows systems. Finally, on MacOS, APRutil cannot be linked statically as it has been merged with APR 2.0, which is used on MacOS builds.
All third-party libraries, except GTK+3 (Linux) and BoehmGC on Windows, can be linked statically. We do not support statically linking GTK+3 due to the difficulty of building it and its own dependencies. Additionally, we do not support statically linking the BoehmGC library on Windows systems.

#### `RELOCATABLE`

Expand Down
104 changes: 104 additions & 0 deletions cmake/FindSQLite3.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindSQLite3.cmake

#[==[
CMake - Cross Platform Makefile Generator
Copyright 2000-2023 Kitware, Inc. and Contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of Kitware, Inc. nor the names of Contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]==]

# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#[=======================================================================[.rst:
FindSQLite3
-----------

.. versionadded:: 3.14

Find the SQLite libraries, v3

IMPORTED targets
^^^^^^^^^^^^^^^^

This module defines the following :prop_tgt:`IMPORTED` target:

``SQLite::SQLite3``

Result variables
^^^^^^^^^^^^^^^^

This module will set the following variables if found:

``SQLite3_INCLUDE_DIRS``
where to find sqlite3.h, etc.
``SQLite3_LIBRARIES``
the libraries to link against to use SQLite3.
``SQLite3_VERSION``
version of the SQLite3 library found
``SQLite3_FOUND``
TRUE if found

#]=======================================================================]


# Look for the necessary header
find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h)
mark_as_advanced(SQLite3_INCLUDE_DIR)

# Look for the necessary library
find_library(SQLite3_LIBRARY NAMES sqlite3 sqlite)
mark_as_advanced(SQLite3_LIBRARY)

# Extract version information from the header file
if(SQLite3_INCLUDE_DIR)
file(STRINGS ${SQLite3_INCLUDE_DIR}/sqlite3.h _ver_line
REGEX "^#define SQLITE_VERSION *\"[0-9]+\\.[0-9]+\\.[0-9]+\""
LIMIT_COUNT 1)
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+"
SQLite3_VERSION "${_ver_line}")
unset(_ver_line)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SQLite3
REQUIRED_VARS SQLite3_INCLUDE_DIR SQLite3_LIBRARY
VERSION_VAR SQLite3_VERSION)

# Create the imported target
if(SQLite3_FOUND)
set(SQLite3_INCLUDE_DIRS ${SQLite3_INCLUDE_DIR})
set(SQLite3_LIBRARIES ${SQLite3_LIBRARY})
if(NOT TARGET SQLite::SQLite3)
add_library(SQLite::SQLite3 UNKNOWN IMPORTED)
set_target_properties(SQLite::SQLite3 PROPERTIES
IMPORTED_LOCATION "${SQLite3_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}")
endif()
endif()
48 changes: 0 additions & 48 deletions cmake/FindSqlite3.cmake

This file was deleted.

33 changes: 0 additions & 33 deletions cmake/FindZlib.cmake

This file was deleted.

26 changes: 26 additions & 0 deletions cmake/patch_apache.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# https://github.com/apache/httpd/commit/dd4561dd17a669a8c1757ada0ca875dfa840d0e7
# https://github.com/apache/httpd/pull/343

set(cmakelists ${apache_source}/CMakeLists.txt)

file(READ ${cmakelists} content)

string(REPLACE
"pcre2-8d.lib"
"pcre2-8-staticd.lib"
content "${content}"
)

string(REPLACE
"pcre2-8.lib"
"pcre2-8-static.lib"
content "${content}"
)

string(REPLACE
"\"-DHAVE_PCRE2\""
"\"-DHAVE_PCRE2 -DPCRE2_STATIC\""
content "${content}"
)

file(WRITE ${cmakelists} "${content}")
28 changes: 28 additions & 0 deletions cmake/patch_apr-util.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This is necessary so that the CMAKE_FIND_LIBRARY_SUFFIXES is preserved when
# locating expat, since it gets reset when PROJECT is called

set(cmakelists "${apr-util_source}/CMakeLists.txt")

file(READ ${cmakelists} content)

string(REPLACE
"PROJECT(APR-Util C)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

FIND_PACKAGE(OpenSSL)

FIND_PACKAGE(EXPAT)"

"CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

FIND_PACKAGE(OpenSSL)

FIND_PACKAGE(EXPAT)

PROJECT(APR-Util C)"

content "${content}"
)

file(WRITE ${cmakelists} "${content}")
19 changes: 3 additions & 16 deletions cmake/patch_mariadb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,10 @@ set(cmakelists ${mariadb_source}/CMakeLists.txt)
file(READ ${cmakelists} content)

# do not use replace /MD with /MT
string(REPLACE
string(REPLACE
"STRING(REPLACE \"/MD\" \"/MT\" COMPILER_FLAGS \${COMPILER_FLAGS})"
"# STRING(REPLACE \"/MD\" \"/MT\" COMPILER_FLAGS \${COMPILER_FLAGS})"
content ${content}
)

file(WRITE ${cmakelists} ${content})

set(cmakelists ${mariadb_source}/cmake/ConnectorName.cmake)

file(READ ${cmakelists} content)

# Fix broken syntax on newer CMake
string(REPLACE
" END()"
" ENDIF()"
content ${content}
content "${content}"
)

file(WRITE ${cmakelists} ${content})
file(WRITE ${cmakelists} "${content}")
Loading