Package: mapserver / 6.4.1-5+deb8u3

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
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
--- a/mapscript/java/CMakeLists.txt
+++ b/mapscript/java/CMakeLists.txt
@@ -15,6 +15,23 @@ SET (CMAKE_SWIG_OUTDIR "${CMAKE_CURRENT_
 SET(CMAKE_SWIG_FLAGS -package edu.umn.gis.mapscript)
 SWIG_ADD_MODULE(javamapscript java ../mapscript.i)
 
+# 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
@@ -26,5 +43,5 @@ ADD_CUSTOM_COMMAND(TARGET javamapscript
                       )
 
 get_target_property(LOC_MAPSCRIPT_LIB ${SWIG_MODULE_javamapscript_REAL_NAME} LOCATION)
-install(FILES ${LOC_MAPSCRIPT_LIB} DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
+install(FILES ${LOC_MAPSCRIPT_LIB} DESTINATION lib/jni)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mapscript.jar DESTINATION share/java)