aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-10-02 13:31:14 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:33 +0200
commit1ffa0d60b0f253506a4e1e335f98c71bba3b866d (patch)
treed1a908d11900f43340bf3157972885545b7587b3
parent0730f0379df326d8fd0ef71793ec90cf4a020119 (diff)
Testing static linking on linux
-rw-r--r--CMakeLists.txt26
-rw-r--r--backend/ninja/Ninja.cpp7
-rw-r--r--src/Conf.cpp3
-rw-r--r--static/linux/libarchive.abin0 -> 1621578 bytes
-rw-r--r--static/linux/libbz2.abin0 -> 117762 bytes
-rw-r--r--static/linux/libcrypto.abin0 -> 4374008 bytes
-rw-r--r--static/linux/libcurl.abin0 -> 1378480 bytes
-rw-r--r--static/linux/libgit2.abin0 -> 2481536 bytes
-rw-r--r--static/linux/libhttp_parser.abin0 -> 46096 bytes
-rw-r--r--static/linux/liblz4.abin0 -> 301294 bytes
-rw-r--r--static/linux/liblzma.abin0 -> 409792 bytes
-rw-r--r--static/linux/libssh2.abin0 -> 354480 bytes
-rw-r--r--static/linux/libssl.abin0 -> 765298 bytes
-rw-r--r--static/linux/libxml2.abin0 -> 2804996 bytes
-rw-r--r--static/linux/libz.abin0 -> 154898 bytes
-rw-r--r--static/windows/git2.lib (renamed from msvc/git2.lib)bin180678 -> 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
new file mode 100644
index 0000000..09f2986
--- /dev/null
+++ b/static/linux/libarchive.a
Binary files differ
diff --git a/static/linux/libbz2.a b/static/linux/libbz2.a
new file mode 100644
index 0000000..58652ca
--- /dev/null
+++ b/static/linux/libbz2.a
Binary files differ
diff --git a/static/linux/libcrypto.a b/static/linux/libcrypto.a
new file mode 100644
index 0000000..518e29b
--- /dev/null
+++ b/static/linux/libcrypto.a
Binary files differ
diff --git a/static/linux/libcurl.a b/static/linux/libcurl.a
new file mode 100644
index 0000000..8d208c1
--- /dev/null
+++ b/static/linux/libcurl.a
Binary files differ
diff --git a/static/linux/libgit2.a b/static/linux/libgit2.a
new file mode 100644
index 0000000..47f6c26
--- /dev/null
+++ b/static/linux/libgit2.a
Binary files differ
diff --git a/static/linux/libhttp_parser.a b/static/linux/libhttp_parser.a
new file mode 100644
index 0000000..f8db936
--- /dev/null
+++ b/static/linux/libhttp_parser.a
Binary files differ
diff --git a/static/linux/liblz4.a b/static/linux/liblz4.a
new file mode 100644
index 0000000..ab07dd9
--- /dev/null
+++ b/static/linux/liblz4.a
Binary files differ
diff --git a/static/linux/liblzma.a b/static/linux/liblzma.a
new file mode 100644
index 0000000..553ac4c
--- /dev/null
+++ b/static/linux/liblzma.a
Binary files differ
diff --git a/static/linux/libssh2.a b/static/linux/libssh2.a
new file mode 100644
index 0000000..ed5e0c5
--- /dev/null
+++ b/static/linux/libssh2.a
Binary files differ
diff --git a/static/linux/libssl.a b/static/linux/libssl.a
new file mode 100644
index 0000000..6876ce9
--- /dev/null
+++ b/static/linux/libssl.a
Binary files differ
diff --git a/static/linux/libxml2.a b/static/linux/libxml2.a
new file mode 100644
index 0000000..c244b71
--- /dev/null
+++ b/static/linux/libxml2.a
Binary files differ
diff --git a/static/linux/libz.a b/static/linux/libz.a
new file mode 100644
index 0000000..fa2b2ab
--- /dev/null
+++ b/static/linux/libz.a
Binary files differ
diff --git a/msvc/git2.lib b/static/windows/git2.lib
index 238331e..238331e 100644
--- a/msvc/git2.lib
+++ b/static/windows/git2.lib
Binary files differ