diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-10-02 13:31:14 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | 1ffa0d60b0f253506a4e1e335f98c71bba3b866d (patch) | |
tree | d1a908d11900f43340bf3157972885545b7587b3 | |
parent | 0730f0379df326d8fd0ef71793ec90cf4a020119 (diff) |
Testing static linking on linux
-rw-r--r-- | CMakeLists.txt | 26 | ||||
-rw-r--r-- | backend/ninja/Ninja.cpp | 7 | ||||
-rw-r--r-- | src/Conf.cpp | 3 | ||||
-rw-r--r-- | static/linux/libarchive.a | bin | 0 -> 1621578 bytes | |||
-rw-r--r-- | static/linux/libbz2.a | bin | 0 -> 117762 bytes | |||
-rw-r--r-- | static/linux/libcrypto.a | bin | 0 -> 4374008 bytes | |||
-rw-r--r-- | static/linux/libcurl.a | bin | 0 -> 1378480 bytes | |||
-rw-r--r-- | static/linux/libgit2.a | bin | 0 -> 2481536 bytes | |||
-rw-r--r-- | static/linux/libhttp_parser.a | bin | 0 -> 46096 bytes | |||
-rw-r--r-- | static/linux/liblz4.a | bin | 0 -> 301294 bytes | |||
-rw-r--r-- | static/linux/liblzma.a | bin | 0 -> 409792 bytes | |||
-rw-r--r-- | static/linux/libssh2.a | bin | 0 -> 354480 bytes | |||
-rw-r--r-- | static/linux/libssl.a | bin | 0 -> 765298 bytes | |||
-rw-r--r-- | static/linux/libxml2.a | bin | 0 -> 2804996 bytes | |||
-rw-r--r-- | static/linux/libz.a | bin | 0 -> 154898 bytes | |||
-rw-r--r-- | static/windows/git2.lib (renamed from msvc/git2.lib) | bin | 180678 -> 180678 bytes |
16 files changed, 29 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1070620..6b4c3ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,8 @@ project(sibs) set(CMAKE_CXX_STANDARD 14) +option(BUILD_STATIC "Build sibs statically on linux" OFF) + set(SOURCE_FILES external/xxhash.c backend/ninja/Ninja.cpp @@ -35,9 +37,29 @@ add_executable(sibs ${SOURCE_FILES}) include_directories(${CURL_INCLUDE_DIR} ${LibArchive_INCLUDE_DIR} "depends/libninja/include") if(WIN32) - target_link_libraries(sibs ${CURL_LIBRARIES} ${LibArchive_LIBRARIES} "${CMAKE_CURRENT_SOURCE_DIR}/msvc/git2.lib") + target_link_libraries(sibs ${CURL_LIBRARIES} ${LibArchive_LIBRARIES} "${CMAKE_CURRENT_SOURCE_DIR}/static/windows/git2.lib") target_compile_options(sibs PRIVATE /Wall) else() - target_link_libraries(sibs ${CURL_LIBRARIES} ${LibArchive_LIBRARIES} -lgit2) + if(BUILD_STATIC AND UNIX AND NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8) + target_link_libraries(sibs + -static + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/libarchive.a" + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/libbz2.a" + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/libxml2.a" + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/liblzma.a" + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/liblz4.a" + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/libgit2.a" + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/libcurl.a" + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/libz.a" + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/libssh2.a" + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/libhttp_parser.a" + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/libssl.a" + "${CMAKE_CURRENT_SOURCE_DIR}/static/linux/libcrypto.a" + -pthread + -ldl + -lm) + else() + target_link_libraries(sibs ${CURL_LIBRARIES} ${LibArchive_LIBRARIES} -lgit2) + endif() target_compile_options(sibs PRIVATE -Wall -Wextra -Werror=return-type -fdiagnostics-show-option -fexceptions) endif() diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index 9ec12d3..8b92af1 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -397,7 +397,8 @@ namespace backend ninja::NinjaArg::createRaw("-g3"), ninja::NinjaArg::createRaw("-D_FORTIFY_SOURCE=2"), ninja::NinjaArg::createRaw("-D_GLIBCXX_ASSERTIONS"), - ninja::NinjaArg::createRaw("-fasynchronous-unwind-tables") + ninja::NinjaArg::createRaw("-fasynchronous-unwind-tables"), + ninja::NinjaArg::createRaw("-D_DEBUG") }; } case OPT_LEV_RELEASE: @@ -419,7 +420,9 @@ namespace backend { return { ninja::NinjaArg::createRaw("/Od"), - ninja::NinjaArg::createRaw("/MTd") + ninja::NinjaArg::createRaw("/Zi"), + ninja::NinjaArg::createRaw("/MTd"), + ninja::NinjaArg::createRaw("/D_DEBUG") }; } case OPT_LEV_RELEASE: diff --git a/src/Conf.cpp b/src/Conf.cpp index d981794..365cf38 100644 --- a/src/Conf.cpp +++ b/src/Conf.cpp @@ -487,9 +487,6 @@ namespace sibs else fprintf(stderr, "Warning: Project contains tests directory but we got an error while retrieving the full path to it\n"); } - - if(config.packaging && (!config.getDebugStaticLibs().empty() || !config.getReleaseStaticLibs().empty())) - return Result<bool>::Err("Project " + config.getPackageName() + " contains external static libraries, such projects are not supported when building a package"); } return parseResult; diff --git a/static/linux/libarchive.a b/static/linux/libarchive.a Binary files differnew file mode 100644 index 0000000..09f2986 --- /dev/null +++ b/static/linux/libarchive.a diff --git a/static/linux/libbz2.a b/static/linux/libbz2.a Binary files differnew file mode 100644 index 0000000..58652ca --- /dev/null +++ b/static/linux/libbz2.a diff --git a/static/linux/libcrypto.a b/static/linux/libcrypto.a Binary files differnew file mode 100644 index 0000000..518e29b --- /dev/null +++ b/static/linux/libcrypto.a diff --git a/static/linux/libcurl.a b/static/linux/libcurl.a Binary files differnew file mode 100644 index 0000000..8d208c1 --- /dev/null +++ b/static/linux/libcurl.a diff --git a/static/linux/libgit2.a b/static/linux/libgit2.a Binary files differnew file mode 100644 index 0000000..47f6c26 --- /dev/null +++ b/static/linux/libgit2.a diff --git a/static/linux/libhttp_parser.a b/static/linux/libhttp_parser.a Binary files differnew file mode 100644 index 0000000..f8db936 --- /dev/null +++ b/static/linux/libhttp_parser.a diff --git a/static/linux/liblz4.a b/static/linux/liblz4.a Binary files differnew file mode 100644 index 0000000..ab07dd9 --- /dev/null +++ b/static/linux/liblz4.a diff --git a/static/linux/liblzma.a b/static/linux/liblzma.a Binary files differnew file mode 100644 index 0000000..553ac4c --- /dev/null +++ b/static/linux/liblzma.a diff --git a/static/linux/libssh2.a b/static/linux/libssh2.a Binary files differnew file mode 100644 index 0000000..ed5e0c5 --- /dev/null +++ b/static/linux/libssh2.a diff --git a/static/linux/libssl.a b/static/linux/libssl.a Binary files differnew file mode 100644 index 0000000..6876ce9 --- /dev/null +++ b/static/linux/libssl.a diff --git a/static/linux/libxml2.a b/static/linux/libxml2.a Binary files differnew file mode 100644 index 0000000..c244b71 --- /dev/null +++ b/static/linux/libxml2.a diff --git a/static/linux/libz.a b/static/linux/libz.a Binary files differnew file mode 100644 index 0000000..fa2b2ab --- /dev/null +++ b/static/linux/libz.a diff --git a/msvc/git2.lib b/static/windows/git2.lib Binary files differindex 238331e..238331e 100644 --- a/msvc/git2.lib +++ b/static/windows/git2.lib |