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 22 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
6 changes: 3 additions & 3 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
2021-10-27 : 2.3.1
????-??-?? : 2.3.1
all : deprecated neko (see README)
std : fixed put_env when null is passed in (#229 https://github.com/HaxeFoundation/haxe/issues/10395)
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
18 changes: 7 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
cmake_minimum_required(VERSION 3.10.2)
cmake_minimum_required(VERSION 3.14)
Simn marked this conversation as resolved.
Show resolved Hide resolved

if (NOT ${CMAKE_VERSION} VERSION_LESS 3.24)
cmake_policy(VERSION 3.24)
elseif (NOT ${CMAKE_VERSION} VERSION_LESS 3.19)
cmake_policy(VERSION 3.19)
endif()

project(Neko C)

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

set(CMAKE_OSX_ARCHITECTURES x86_64)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
Expand Down Expand Up @@ -55,7 +56,7 @@ option(WITH_REGEXP "Build with Perl-compatible regex support." ON)
option(WITH_UI "Build with GTK-2 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 @@ -110,7 +111,7 @@ set(external_deps
OpenSSL
MariaDBConnector
pcre2
Sqlite3
SQLite3
APR
APRutil
Apache
Expand Down Expand Up @@ -138,9 +139,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 @@ -152,8 +150,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 Expand Up @@ -189,11 +185,11 @@ if (RELOCATABLE)
endif()

if(UNIX AND NOT APPLE)
add_definitions(-DABI_ELF)
add_compile_definitions(ABI_ELF)
endif()

if(UNIX)
add_definitions(-D_GNU_SOURCE)
add_compile_definitions(_GNU_SOURCE)
add_compile_options(-fno-omit-frame-pointer)

set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
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+2 (Linux) and BoehmGC on Windows, can be linked statically. We do not support statically linking GTK+2 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+2 (Linux) and BoehmGC on Windows, can be linked statically. We do not support statically linking GTK+2 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
64 changes: 0 additions & 64 deletions cmake/FindGTK2.cmake

This file was deleted.

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