Kaynağa Gözat

HPCC-14931 Add ability to sign ecl libraries with SIGN_MODULES=ON

Signed-off-by: Michael Gardner <Michael.Gardner@lexisnexis.com>
Michael Gardner 9 yıl önce
ebeveyn
işleme
1a2e5ba079

+ 26 - 0
cmake_modules/commonSetup.cmake

@@ -53,6 +53,7 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   option(PLUGIN "Enable building of a plugin" OFF)
   option(USE_SHLIBDEPS "Enable the use of dpkg-shlibdeps on ubuntu packaging" OFF)
 
+  option(SIGN_MODULES "Enable signing of ecl standard library modules" OFF)
   option(USE_CPPUNIT "Enable unit tests (requires cppunit)" OFF)
   option(USE_OPENLDAP "Enable OpenLDAP support (requires OpenLDAP)" ON)
   option(USE_ICU "Enable unicode support (requires ICU)" ON)
@@ -912,4 +913,29 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
     message(STATUS "Updated ${cpackvar} to ${${cpackvar}}")
   endfunction()
 
+  MACRO(SIGN_MODULE module)
+    if(SIGN_MODULES)
+      add_custom_command(
+        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${module}
+        COMMAND gpg --output ${CMAKE_CURRENT_BINARY_DIR}/${module} --clearsign ${module}
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        COMMENT "Adding signed ${module} to project"
+        VERBATIM
+        )
+    else()
+      add_custom_command(
+        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${module}
+        COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/${module} ${CMAKE_CURRENT_BINARY_DIR}/${module}
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        COMMENT "Adding unsigned ${module} to project"
+        VERBATIM
+        )
+    endif()
+    # Use custom target to cause build to fail if dependency file isn't generated by gpg or cp commands
+    get_filename_component(module_without_extension ${module} NAME_WE)
+    add_custom_target(
+      ${module_without_extension}-ecl ALL
+      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${module}
+      )
+  ENDMACRO()
 endif ("${COMMONSETUP_DONE}" STREQUAL "")

+ 2 - 1
ecllibrary/CMakeLists.txt

@@ -14,6 +14,7 @@
 #    limitations under the License.
 ################################################################################
 
+add_subdirectory(std)
+
 Install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/StyleGuide.html DESTINATION share/ecllibrary COMPONENT Runtime )
-Install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/std DESTINATION share/ecllibrary COMPONENT Runtime USE_SOURCE_PERMISSIONS PATTERN ".svn" EXCLUDE )
 Install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/teststd DESTINATION share/ecllibrary COMPONENT Runtime USE_SOURCE_PERMISSIONS PATTERN ".svn" EXCLUDE )

+ 34 - 0
ecllibrary/std/CMakeLists.txt

@@ -0,0 +1,34 @@
+################################################################################
+#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+################################################################################
+
+add_subdirectory(system)
+
+set(
+    SRCS
+    Audit.ecl
+    BundleBase.ecl
+    Date.ecl
+    File.ecl
+    Metaphone3.ecl
+    Metaphone.ecl
+    Str.ecl
+    Uni.ecl
+    )
+
+foreach(module ${SRCS})
+    SIGN_MODULE(${module})
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${module} DESTINATION share/ecllibrary/std COMPONENT Runtime)
+endforeach()

+ 31 - 0
ecllibrary/std/system/CMakeLists.txt

@@ -0,0 +1,31 @@
+################################################################################
+#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+################################################################################
+
+set(
+    SRCS
+    Debug.ecl
+    Email.ecl
+    Job.ecl
+    Log.ecl
+    Thorlib.ecl
+    Util.ecl
+    Workunit.ecl
+    )
+
+foreach(module ${SRCS})
+    SIGN_MODULE(${module})
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${module} DESTINATION share/ecllibrary/std/system COMPONENT Runtime)
+endforeach()