1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Sun, 29 Oct 2017 00:11:28 +1100
Subject: [PATCH 1/2] add option to disable shared libs
Taken from:
https://www.libssh.org/archive/libssh/2017-10/0000012.html
diff --git a/DefineOptions.cmake b/DefineOptions.cmake
index 1111111..2222222 100644
--- a/DefineOptions.cmake
+++ b/DefineOptions.cmake
@@ -3,6 +3,7 @@ option(WITH_ZLIB "Build with ZLIB support" ON)
option(WITH_SSH1 "Build with SSH1 support" OFF)
option(WITH_SFTP "Build with SFTP support" ON)
option(WITH_SERVER "Build with SSH server support" ON)
+option(WITH_SHARED_LIB "Build with a shared library" ON)
option(WITH_STATIC_LIB "Build with a static library" OFF)
option(WITH_DEBUG_CRYPTO "Build with cryto debug output" OFF)
option(WITH_DEBUG_CALLTRACE "Build with calltrace debug output" ON)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1111111..2222222 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -225,6 +225,7 @@ include_directories(
${LIBSSH_PRIVATE_INCLUDE_DIRS}
)
+if (WITH_SHARED_LIB)
add_library(${LIBSSH_SHARED_LIBRARY} SHARED ${libssh_SRCS})
target_link_libraries(${LIBSSH_SHARED_LIBRARY} ${LIBSSH_LINK_LIBRARIES})
@@ -259,6 +260,7 @@ install(
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
COMPONENT libraries
)
+endif (WITH_SHARED_LIB)
if (WITH_STATIC_LIB)
add_library(${LIBSSH_STATIC_LIBRARY} STATIC ${libssh_SRCS})
diff --git a/src/threads/CMakeLists.txt b/src/threads/CMakeLists.txt
index 1111111..2222222 100644
--- a/src/threads/CMakeLists.txt
+++ b/src/threads/CMakeLists.txt
@@ -59,6 +59,7 @@ include_directories(
if (libssh_threads_SRCS)
set(LIBSSH_THREADS ON CACHE "libssh threads lib" INTERNAL)
+ if (WITH_SHARED_LIB)
add_library(${LIBSSH_THREADS_SHARED_LIBRARY} SHARED ${libssh_threads_SRCS})
target_link_libraries(${LIBSSH_THREADS_SHARED_LIBRARY} ${LIBSSH_THREADS_LINK_LIBRARIES})
@@ -88,6 +89,7 @@ if (libssh_threads_SRCS)
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
COMPONENT libraries
)
+ endif (WITH_SHARED_LIB)
if (WITH_STATIC_LIB)
add_library(${LIBSSH_THREADS_STATIC_LIBRARY} STATIC ${libssh_threads_SRCS})
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Sun, 29 Oct 2017 00:45:55 +1100
Subject: [PATCH 2/2] add indentation for shared lib hunks
Taken from:
https://www.libssh.org/archive/libssh/2017-10/0000012.html
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1111111..2222222 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -226,40 +226,40 @@ include_directories(
)
if (WITH_SHARED_LIB)
-add_library(${LIBSSH_SHARED_LIBRARY} SHARED ${libssh_SRCS})
-
-target_link_libraries(${LIBSSH_SHARED_LIBRARY} ${LIBSSH_LINK_LIBRARIES})
-
-set_target_properties(
- ${LIBSSH_SHARED_LIBRARY}
- PROPERTIES
- VERSION
- ${LIBRARY_VERSION}
- SOVERSION
- ${LIBRARY_SOVERSION}
- OUTPUT_NAME
- ssh
- DEFINE_SYMBOL
- LIBSSH_EXPORTS
-)
+ add_library(${LIBSSH_SHARED_LIBRARY} SHARED ${libssh_SRCS})
+
+ target_link_libraries(${LIBSSH_SHARED_LIBRARY} ${LIBSSH_LINK_LIBRARIES})
+
+ set_target_properties(
+ ${LIBSSH_SHARED_LIBRARY}
+ PROPERTIES
+ VERSION
+ ${LIBRARY_VERSION}
+ SOVERSION
+ ${LIBRARY_SOVERSION}
+ OUTPUT_NAME
+ ssh
+ DEFINE_SYMBOL
+ LIBSSH_EXPORTS
+ )
-if (WITH_VISIBILITY_HIDDEN)
- set_target_properties(${LIBSSH_SHARED_LIBRARY} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
-endif (WITH_VISIBILITY_HIDDEN)
+ if (WITH_VISIBILITY_HIDDEN)
+ set_target_properties(${LIBSSH_SHARED_LIBRARY} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
+ endif (WITH_VISIBILITY_HIDDEN)
-if (MINGW)
- set_target_properties(${LIBSSH_SHARED_LIBRARY} PROPERTIES LINK_FLAGS "-Wl,--enable-stdcall-fixup")
-endif ()
+ if (MINGW)
+ set_target_properties(${LIBSSH_SHARED_LIBRARY} PROPERTIES LINK_FLAGS "-Wl,--enable-stdcall-fixup")
+ endif ()
-install(
- TARGETS
- ${LIBSSH_SHARED_LIBRARY}
- RUNTIME DESTINATION ${BIN_INSTALL_DIR}
- LIBRARY DESTINATION ${LIB_INSTALL_DIR}
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
- COMPONENT libraries
-)
+ install(
+ TARGETS
+ ${LIBSSH_SHARED_LIBRARY}
+ RUNTIME DESTINATION ${BIN_INSTALL_DIR}
+ LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+ COMPONENT libraries
+ )
endif (WITH_SHARED_LIB)
if (WITH_STATIC_LIB)
diff --git a/src/threads/CMakeLists.txt b/src/threads/CMakeLists.txt
index 1111111..2222222 100644
--- a/src/threads/CMakeLists.txt
+++ b/src/threads/CMakeLists.txt
@@ -60,35 +60,35 @@ if (libssh_threads_SRCS)
set(LIBSSH_THREADS ON CACHE "libssh threads lib" INTERNAL)
if (WITH_SHARED_LIB)
- add_library(${LIBSSH_THREADS_SHARED_LIBRARY} SHARED ${libssh_threads_SRCS})
-
- target_link_libraries(${LIBSSH_THREADS_SHARED_LIBRARY} ${LIBSSH_THREADS_LINK_LIBRARIES})
-
- set_target_properties(
- ${LIBSSH_THREADS_SHARED_LIBRARY}
- PROPERTIES
- VERSION
- ${LIBRARY_VERSION}
- SOVERSION
- ${LIBRARY_SOVERSION}
- OUTPUT_NAME
- ssh_threads
- DEFINE_SYMBOL
- LIBSSH_EXPORTS
- )
+ add_library(${LIBSSH_THREADS_SHARED_LIBRARY} SHARED ${libssh_threads_SRCS})
- if (WITH_VISIBILITY_HIDDEN)
- set_target_properties(${LIBSSH_THREADS_SHARED_LIBRARY} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
- endif (WITH_VISIBILITY_HIDDEN)
+ target_link_libraries(${LIBSSH_THREADS_SHARED_LIBRARY} ${LIBSSH_THREADS_LINK_LIBRARIES})
- install(
- TARGETS
+ set_target_properties(
${LIBSSH_THREADS_SHARED_LIBRARY}
- RUNTIME DESTINATION ${BIN_INSTALL_DIR}
- LIBRARY DESTINATION ${LIB_INSTALL_DIR}
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
- COMPONENT libraries
- )
+ PROPERTIES
+ VERSION
+ ${LIBRARY_VERSION}
+ SOVERSION
+ ${LIBRARY_SOVERSION}
+ OUTPUT_NAME
+ ssh_threads
+ DEFINE_SYMBOL
+ LIBSSH_EXPORTS
+ )
+
+ if (WITH_VISIBILITY_HIDDEN)
+ set_target_properties(${LIBSSH_THREADS_SHARED_LIBRARY} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
+ endif (WITH_VISIBILITY_HIDDEN)
+
+ install(
+ TARGETS
+ ${LIBSSH_THREADS_SHARED_LIBRARY}
+ RUNTIME DESTINATION ${BIN_INSTALL_DIR}
+ LIBRARY DESTINATION ${LIB_INSTALL_DIR}
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+ COMPONENT libraries
+ )
endif (WITH_SHARED_LIB)
if (WITH_STATIC_LIB)
|