Package: mapserver / 7.2.2-1

java-hardening.patch Patch series | download
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
Description: fixes hardened java
 Java doesn't compile with hardened options. Adapted from ruby mapscript
Author: Ezequiel Lara Gómez <ezequiel.lara@qualitasremos.com>
Bug-Debian: https://bugs.debian.org/740351
Forwarded: not-needed

--- a/mapscript/java/CMakeLists.txt
+++ b/mapscript/java/CMakeLists.txt
@@ -20,6 +20,23 @@ else ()
     swig_add_module(javamapscript java ../mapscript.i)
 endif ()
 
+# Java mapscript fails to build with -Werror=format-security
+
+if(${CMAKE_C_FLAGS} MATCHES "-Werror=format-security")
+  string(REPLACE "-Werror=format-security" "" TMP "${CMAKE_C_FLAGS}")
+  set(CMAKE_C_FLAGS "${TMP}")
+endif(${CMAKE_C_FLAGS} MATCHES "-Werror=format-security")
+
+if(${CMAKE_CXX_FLAGS} MATCHES "-Werror=format-security")
+  string(REPLACE "-Werror=format-security" "" TMP "${CMAKE_CXX_FLAGS}")
+  set(CMAKE_CXX_FLAGS "${TMP}")
+endif(${CMAKE_CXX_FLAGS} MATCHES "-Werror=format-security")
+
+if(${CMAKE_CPP_FLAGS} MATCHES "-Werror=format-security")
+  string(REPLACE "-Werror=format-security" "" TMP "${CMAKE_CPP_FLAGS}")
+  set(CMAKE_CPP_FLAGS "${TMP}")
+endif(${CMAKE_CPP_FLAGS} MATCHES "-Werror=format-security")
+
 swig_link_libraries(javamapscript ${MAPSERVER_LIBMAPSERVER})
 
 add_custom_command(TARGET javamapscript
@@ -31,4 +48,5 @@ add_custom_command(TARGET javamapscript
                       )
 
 set(mapscript_files $<TARGET_FILE:${SWIG_MODULE_javamapscript_REAL_NAME}>)
-install(FILES ${mapscript_files} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(FILES ${mapscript_files} DESTINATION lib/jni)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mapscript.jar DESTINATION share/java)