Explorar el Código

HPCC-14457 Split R plugin to its own package

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Signed-off-by: Michael Gardner <michael.gardner@lexisnexis.com>

Modifications necessary for rebasing to 6.0.0 and version control of
package dependencies
Richard Chapman hace 9 años
padre
commit
41fdcf477c

+ 61 - 28
CMakeLists.txt

@@ -1,4 +1,3 @@
-###############################################################################
 #    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License");
@@ -95,32 +94,51 @@ option(ENV_CONF_FILE "Set the environment conf file name.")
 option(LICENSE_FILE "Set the license file to use.")
 
 if(NOT LICENSE_FILE)
-    set(LICENSE_FILE "LICENSE.txt")
+    if(MAKE_R_ONLY)
+        set(LICENSE_FILE "R-LICENSE.txt")
+    else ()
+        set(LICENSE_FILE "LICENSE.txt")
+    endif()
 endif()
 
 include(${HPCC_SOURCE_DIR}/cmake_modules/optionDefaults.cmake)
+
+if ( MAKE_R_ONLY )
+  # various components that are not needed if only making the R plugin
+  SET(USE_LIBARCHIVE 0)
+  SET(USE_APR 0)
+endif()
+
 include(${HPCC_SOURCE_DIR}/cmake_modules/commonSetup.cmake)
 
-if(NOT MAKE_DOCS_ONLY)
-    HPCC_ADD_SUBDIRECTORY(initfiles)
-    HPCC_ADD_SUBDIRECTORY(tools)
-    HPCC_ADD_SUBDIRECTORY(common)
-    HPCC_ADD_SUBDIRECTORY(dali)
-    HPCC_ADD_SUBDIRECTORY(deploy)
-    HPCC_ADD_SUBDIRECTORY(deployment)
-    HPCC_ADD_SUBDIRECTORY(ecl)
-    HPCC_ADD_SUBDIRECTORY(ecllibrary)
-    HPCC_ADD_SUBDIRECTORY(esp)
-    HPCC_ADD_SUBDIRECTORY(plugins)
-    HPCC_ADD_SUBDIRECTORY(roxie)
-    HPCC_ADD_SUBDIRECTORY(rtl)
-    HPCC_ADD_SUBDIRECTORY(services "PLATFORM")
-    HPCC_ADD_SUBDIRECTORY(system)
-    HPCC_ADD_SUBDIRECTORY(thorlcr "PLATFORM")
-    HPCC_ADD_SUBDIRECTORY(testing)
-    if(NOT WIN32)
-        HPCC_ADD_SUBDIRECTORY(clienttools "CLIENTTOOLS_ONLY")
-    endif()
+if ( MAKE_R_ONLY )
+    HPCC_ADD_SUBDIRECTORY (roxie/roxiemem)
+    HPCC_ADD_SUBDIRECTORY (rtl/nbcd)
+    HPCC_ADD_SUBDIRECTORY (rtl/eclrtl)
+    HPCC_ADD_SUBDIRECTORY (system/lzma)
+    HPCC_ADD_SUBDIRECTORY (system/jlib)
+    HPCC_ADD_SUBDIRECTORY (plugins/Rembed)
+elseif ( NOT MAKE_DOCS_ONLY )
+    HPCC_ADD_SUBDIRECTORY (initfiles)
+    HPCC_ADD_SUBDIRECTORY (tools)
+    HPCC_ADD_SUBDIRECTORY (common)
+    HPCC_ADD_SUBDIRECTORY (dali)
+    HPCC_ADD_SUBDIRECTORY (deploy)
+    HPCC_ADD_SUBDIRECTORY (deployment)
+    HPCC_ADD_SUBDIRECTORY (ecl)
+    HPCC_ADD_SUBDIRECTORY (ecllibrary)
+    HPCC_ADD_SUBDIRECTORY (esp)
+    HPCC_ADD_SUBDIRECTORY (plugins)
+    HPCC_ADD_SUBDIRECTORY (roxie)
+    HPCC_ADD_SUBDIRECTORY (rtl)
+    HPCC_ADD_SUBDIRECTORY (services "PLATFORM")
+    HPCC_ADD_SUBDIRECTORY (system)
+    HPCC_ADD_SUBDIRECTORY (thorlcr "PLATFORM")
+    HPCC_ADD_SUBDIRECTORY (testing)
+   if ( NOT WIN32 )
+       HPCC_ADD_SUBDIRECTORY (clienttools "CLIENTTOOLS_ONLY")
+   endif()
+
 endif()
 
 HPCC_ADD_SUBDIRECTORY(docs "PLATFORM")
@@ -139,7 +157,10 @@ if("${stagever}" MATCHES "^rc[0-9]+$")
 endif()
 
 if(TOP_LEVEL_PROJECT)
-    if(PLATFORM)
+    if(MAKE_R_ONLY)
+        set(CPACK_PACKAGE_NAME "hpccsystems-r-plugin")
+        set(PACKAGE_FILE_NAME_PREFIX "hpccsystems-r-plugin")
+    elseif(PLATFORM)
         set(CPACK_PACKAGE_NAME "hpccsystems-platform")
         set(PACKAGE_FILE_NAME_PREFIX "hpccsystems-platform-${projname}")
     else()
@@ -195,7 +216,9 @@ if(TOP_LEVEL_PROJECT)
 %define __getdeps() while read file; do /usr/lib/rpm/rpmdeps -%{1} ${file}; done | /bin/sort -u
 %define __find_provides /bin/sh -c '%{__getdeps P}'
 %define __find_requires /bin/sh -c '%{__grep} -v libRembed.so | %{__getdeps R}'")
-            set(PACKAGE_FILE_NAME_PREFIX "${PACKAGE_FILE_NAME_PREFIX}-with-plugins")
+            if(NOT MAKE_R_ONLY)
+                set(PACKAGE_FILE_NAME_PREFIX "${PACKAGE_FILE_NAME_PREFIX}-with-plugins")
+            endif()
         endif()
 
         if("${packageManagement}" STREQUAL "DEB")
@@ -310,11 +333,21 @@ if(TOP_LEVEL_PROJECT)
         endif ()
     endif(UNIX)
 
-    if(EXISTS ${HPCC_SOURCE_DIR}/cmake_modules/dependencies/${packageRevision}.cmake)
-        include(${HPCC_SOURCE_DIR}/cmake_modules/dependencies/${packageRevision}.cmake)
+    if(MAKE_R_ONLY)
+        if("${packageManagement}" STREQUAL "RPM")
+            SET_DEPENDENCIES(CPACK_RPM_PACKAGE_REQUIRES "hpccsystems-platform = ${CPACK_RPM_PACKAGE_VERSION}")
+        elseif("${packageManagement}" STREQUAL "DEB")
+            SET_DEPENDENCIES(CPACK_DEBIAN_PACKAGE_DEPENDS "hpccsystems-platform = ${CPACK_RPM_PACKAGE_VERSION}")
+        else()
+            message(WARNING "Dependencies not set")
+        endif()
     else()
-        message("-- WARNING: DEPENDENCY FILE FOR ${packageRevision} NOT FOUND, Using deps template.")
-        include(${HPCC_SOURCE_DIR}/cmake_modules/dependencies/template.cmake)
+        if(EXISTS ${HPCC_SOURCE_DIR}/cmake_modules/dependencies/${packageRevision}.cmake)
+            include(${HPCC_SOURCE_DIR}/cmake_modules/dependencies/${packageRevision}.cmake)
+        else()
+            message("-- WARNING: DEPENDENCY FILE FOR ${packageRevision} NOT FOUND, Using deps template.")
+            include(${HPCC_SOURCE_DIR}/cmake_modules/dependencies/template.cmake)
+        endif()
     endif()
 
     if(UNIX)

+ 12 - 0
R-LICENSE.txt

@@ -0,0 +1,12 @@
+HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
+
+   The plugin for embedded R code into HPCC is Licensed under the GPL,
+   Version 2.0 or later(the "License");
+
+   You may not use this file except in compliance with the License.
+
+   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.

+ 2 - 0
cmake_modules/commonSetup.cmake

@@ -82,6 +82,8 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   option(USE_SIGNED_CHAR "Build system with default char type is signed" OFF)
   option(USE_UNSIGNED_CHAR "Build system with default char type is unsigned" OFF)
 
+  option(MAKE_R_ONLY "Create a package with ONLY the R plugin" OFF)
+
   option(WITH_PLUGINS "Enable the building of plugins" ON)
   # WITH_PLUGINS = OFF will disable all of the following, else they can be set off on a case by case basis
   option(USE_MYSQL "Enable MySQL support" ON)

+ 7 - 13
plugins/Rembed/CMakeLists.txt

@@ -1,11 +1,8 @@
 ################################################################################
-#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
+#    HPCC SYSTEMS software Copyright (C) 2015 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
+#    Licensed under the GPL, Version 2.0 or later (the "License");
+#    You may not use this file except in compliance with the License.
 #
 #    Unless required by applicable law or agreed to in writing, software
 #    distributed under the License is distributed on an "AS IS" BASIS,
@@ -21,11 +18,14 @@
 # Description:
 # ------------
 #    Cmake Input File for Rembed
+#    Note that as RInside and RCpp are GPL licensed,
+#    Rembed must not be packaged with any Apache licenced
+#    software such as the HPCC platform or client tools
 #####################################################
 
 project( Rembed )
 
-if (USE_RINSIDE)
+if (USE_RINSIDE AND MAKE_R_ONLY)
   ADD_PLUGIN(Rembed PACKAGES R OPTION MAKE_REMBED)
   if ( MAKE_REMBED )
     set (    SRCS
@@ -48,12 +48,6 @@ if (USE_RINSIDE)
     endif()
 
     HPCC_ADD_LIBRARY( Rembed SHARED ${SRCS} )
-    if (${CMAKE_VERSION} VERSION_LESS "2.8.9")
-      message("WARNING: Cannot set NO_SONAME. shlibdeps will give warnings when package is installed")
-    elseif(NOT APPLE)
-      set_target_properties( Rembed PROPERTIES NO_SONAME 1 )
-    endif()
-
     install ( TARGETS Rembed DESTINATION plugins )
 
     target_link_libraries ( Rembed

+ 2 - 5
plugins/Rembed/Rembed.cpp

@@ -1,12 +1,9 @@
 /*##############################################################################
 
- HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
+ HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems®.
 
- Licensed under the Apache License, Version 2.0 (the "License");
+ Licensed under the GPL, Version 2.0 or later
  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,

+ 3 - 1
roxie/roxiemem/CMakeLists.txt

@@ -43,7 +43,9 @@ include_directories (
 ADD_DEFINITIONS( -D_USRDLL -DROXIEMEM_EXPORTS)
 
 HPCC_ADD_LIBRARY( roxiemem SHARED ${SRCS} ${INCLUDES})
-install ( TARGETS roxiemem RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} )
+if (NOT MAKE_R_ONLY)
+  install ( TARGETS roxiemem RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} )
+endif()
 target_link_libraries ( roxiemem
          jlib
          ${CPPUNIT_LIBRARIES}

+ 7 - 6
rtl/eclrtl/CMakeLists.txt

@@ -78,7 +78,6 @@ else ()
 endif ()
 
 HPCC_ADD_LIBRARY( eclrtl SHARED ${SRCS} )
-install ( TARGETS eclrtl RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} ARCHIVE DESTINATION componentfiles/cl/lib )
 target_link_libraries ( eclrtl 
       ${BOOST_REGEX_LIBRARIES}
       ${ICU_LIBRARIES}
@@ -87,7 +86,9 @@ target_link_libraries ( eclrtl
       roxiemem
     )
 
-FOREACH( iFILES
+if (NOT MAKE_R_ONLY)
+  install ( TARGETS eclrtl RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} ARCHIVE DESTINATION componentfiles/cl/lib )
+  FOREACH( iFILES
     ${CMAKE_CURRENT_SOURCE_DIR}/eclinclude4.hpp
     ${CMAKE_CURRENT_SOURCE_DIR}/eclrtl.hpp
     ${CMAKE_CURRENT_SOURCE_DIR}/eclrtl_imp.hpp
@@ -96,7 +97,7 @@ FOREACH( iFILES
     ${CMAKE_CURRENT_SOURCE_DIR}/rtlds_imp.hpp
     ${CMAKE_CURRENT_SOURCE_DIR}/rtlfield_imp.hpp
     ${CMAKE_CURRENT_SOURCE_DIR}/rtlkey.hpp
-)
-    Install ( FILES ${iFILES} DESTINATION componentfiles/cl/include COMPONENT Runtime )
-ENDFOREACH ( iFILES )
-
+  )
+    install ( FILES ${iFILES} DESTINATION componentfiles/cl/include COMPONENT Runtime )
+  ENDFOREACH ( iFILES )
+endif()

+ 3 - 1
rtl/nbcd/CMakeLists.txt

@@ -41,7 +41,9 @@ include_directories (
 ADD_DEFINITIONS( -D_USRDLL -DNBCD_EXPORTS )
 
 HPCC_ADD_LIBRARY( nbcd SHARED ${SRCS} )
-install ( TARGETS nbcd RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} ARCHIVE DESTINATION componentfiles/cl/lib )
+if (NOT MAKE_R_ONLY)
+  install ( TARGETS nbcd RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} ARCHIVE DESTINATION componentfiles/cl/lib )
+endif()
 target_link_libraries ( nbcd 
       jlib
       ${CPPUNIT_LIBRARIES}

+ 12 - 11
system/jlib/CMakeLists.txt

@@ -169,7 +169,6 @@ include_directories (
 ADD_DEFINITIONS( -DLOGMSGCOMPONENT=1 -D_USRDLL -DJLIB_EXPORTS )
 HPCC_ADD_LIBRARY( jlib SHARED ${SRCS} ${INCLUDES} )
 
-install ( TARGETS jlib RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} )
 target_link_libraries ( jlib
         lzma
        )
@@ -193,10 +192,11 @@ else ()
  target_link_libraries ( jlib rt)
 endif ()
 
-if (WIN32)
-    FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" WINDOWS_CMAKE_CURRENT_BINARY_DIR)
-    FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}\\jelog.mc" WINDOWS_CMAKE_CURRENT_SOURCE_DIR)
-    add_custom_command ( DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/jelog.mc
+if (NOT MAKE_R_ONLY)
+    if (WIN32)
+        FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" WINDOWS_CMAKE_CURRENT_BINARY_DIR)
+        FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}\\jelog.mc" WINDOWS_CMAKE_CURRENT_SOURCE_DIR)
+        add_custom_command ( DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/jelog.mc
                          OUTPUT ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/jelog.dll ${CMAKE_CURRENT_BINARY_DIR}/jelog.h
                          COMMAND echo mc -r ${WINDOWS_CMAKE_CURRENT_BINARY_DIR} -h ${WINDOWS_CMAKE_CURRENT_BINARY_DIR} ${WINDOWS_CMAKE_CURRENT_SOURCE_DIR}
                          COMMAND echo rc -r -fo ${CMAKE_CURRENT_BINARY_DIR}/jelog.res ${CMAKE_CURRENT_BINARY_DIR}/jelog.rc 
@@ -205,9 +205,10 @@ if (WIN32)
                          COMMAND rc -r -fo ${CMAKE_CURRENT_BINARY_DIR}/jelog.res ${CMAKE_CURRENT_BINARY_DIR}/jelog.rc 
                          COMMAND link -dll -noentry -machine:IX86 -out:${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/jelog.dll ${CMAKE_CURRENT_BINARY_DIR}/jelog.res
                         )
-    add_custom_target ( jelog ALL DEPENDS ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/jelog.dll )
-    add_dependencies( jlib jelog )
-    install ( PROGRAMS ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/jelog.dll DESTINATION ${EXEC_DIR} )
-endif ()
-
-Install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/jscm.hpp DESTINATION componentfiles/cl/include COMPONENT Runtime )
+        add_custom_target ( jelog ALL DEPENDS ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/jelog.dll )
+        add_dependencies( jlib jelog )
+        install ( PROGRAMS ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/jelog.dll DESTINATION ${EXEC_DIR} )
+    endif ()
+    install ( TARGETS jlib RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} )
+    install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/jscm.hpp DESTINATION componentfiles/cl/include COMPONENT Runtime )
+endif()