diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/CMakeLists.txt | 94 |
1 files changed, 51 insertions, 43 deletions
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 1e823db..e7fde61 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -130,12 +130,12 @@ endfunction() unset (files) unset (corefiles) -if(${RELEASE_ID} MATCHES Ubuntu) +if(${RELEASE_ID} IN_LIST DebianBasedOS) execute_process(COMMAND dpkg-query -L vpp COMMAND grep -v memclnt COMMAND grep api.json OUTPUT_VARIABLE corefiles) STRING(REGEX REPLACE "\n" ";" corefiles "${corefiles}") -elseif(${RELEASE_ID} MATCHES CentOS) +elseif(${RELEASE_ID} IN_LIST RHBasedOS) # Exclude vpp plugin api files. VPP package should not contain vpp-plugins api files and vice-versa. Temporary fixing # by excluding them manually. execute_process(COMMAND rpm -ql vpp @@ -171,6 +171,8 @@ elseif(${RELEASE_ID} MATCHES CentOS) COMMAND grep -v vxlan_gpe_ioam_export COMMAND grep api.json OUTPUT_VARIABLE corefiles) STRING(REGEX REPLACE "\n" ";" corefiles "${corefiles}") +else() + message( FATAL_ERROR "Unsupported OS, CMake will now exit." ) endif() FILE(GLOB_RECURSE files RELATIVE @@ -193,11 +195,11 @@ unset (IOAM_TRACE_JSON_FILE) unset (IOAM_POT_JSON_FILE) unset (IOAM_EXPORT_JSON_FILE) -if(${RELEASE_ID} MATCHES Ubuntu) +if(${RELEASE_ID} IN_LIST DebianBasedOS) execute_process(COMMAND dpkg-query -L vpp-plugin-core COMMAND grep api.json OUTPUT_VARIABLE pluginfiles) STRING(REGEX REPLACE "\n" ";" pluginfiles "${pluginfiles}") -elseif(${RELEASE_ID} MATCHES CentOS) +elseif(${RELEASE_ID} IN_LIST RHBasedOS) execute_process(COMMAND rpm -ql vpp-plugins COMMAND grep api.json OUTPUT_VARIABLE pluginfiles) STRING(REGEX REPLACE "\n" ";" pluginfiles "${pluginfiles}") @@ -269,6 +271,7 @@ if(IOAM_EXPORT_JSON_FILE) endif() # Package Generator ####################################################### + unset(vpp_version) set(COLUMNS 200) execute_process( @@ -286,43 +289,48 @@ set(CPACK_PACKAGE_VENDOR "Cisco") set(CPACK_PACKAGE_CONTACT "hc2vpp@lists.fd.io") set(CPACK_OUTPUT_FILE_PREFIX build-root/packages) set(CPACK_PACKAGE_FILE_NAME "vpp-api-java_${JVPP_VERSION}") -if (${RELEASE_ID} MATCHES "Ubuntu") - set(CPACK_GENERATOR "DEB") - set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") - set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") - set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}") - set(CPACK_DEBIAN_PACKAGE_SECTION "${CPACK_PACKAGE_SECTION}") - set(CPACK_DEBIAN_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) - set(CPACK_DEBIAN_PACKAGE_PRIORITY extra) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "vpp (>= ${vpp_version}), vpp-plugin-core (>= ${vpp_version})") - - # Print Debian package summary - message("\nDebian package:") - message(" Name: ${CPACK_DEBIAN_PACKAGE_NAME}") - message(" Version: ${CPACK_DEBIAN_PACKAGE_VERSION}") - message(" Description: ${CPACK_DEBIAN_PACKAGE_DESCRIPTION}") - message(" File name: ${CPACK_DEBIAN_PACKAGE_FILE_NAME}") - message(" Depends on: ${CPACK_DEBIAN_PACKAGE_DEPENDS}\n") - include (CPack) -elseif(${RELEASE_ID} MATCHES "CentOS") - set(CPACK_GENERATOR "RPM") - # Excluding /usr/share/java top level directory due to conflict with javapackages-tools (openjdk dependency) - set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/java") - set(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") - set(CPACK_RPM_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") - set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}") - set(CPACK_RPM_PACKAGE_SECTION "${CPACK_PACKAGE_SECTION}") - set(CPACK_RPM_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) - set(CPACK_RPM_PACKAGE_PRIORITY extra) - set(CPACK_RPM_PACKAGE_DEPENDS "vpp (>= ${vpp_version}), vpp-plugins (>= ${vpp_version})") - - # Print CentOS package summary - message("\nRPM package:") - message(" Name: ${CPACK_RPM_PACKAGE_NAME}") - message(" Version: ${CPACK_RPM_PACKAGE_VERSION}") - message(" Description: ${CPACK_RPM_PACKAGE_DESCRIPTION}") - message(" File name: ${CPACK_RPM_PACKAGE_FILE_NAME}") - message(" Depends on: ${CPACK_RPM_PACKAGE_DEPENDS}\n") - include (CPack) +if (${RELEASE_ID} IN_LIST DebianBasedOS) + set(CPACK_GENERATOR DEB) + set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") + set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}") + set(CPACK_DEBIAN_PACKAGE_SECTION "${CPACK_PACKAGE_SECTION}") + set(CPACK_DEBIAN_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) + set(CPACK_DEBIAN_PACKAGE_PRIORITY extra) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "vpp (>= ${vpp_version}), vpp-plugin-core (>= ${vpp_version})") + + # Print Debian package summary + message("\nDebian package:") + message(" Name: ${CPACK_DEBIAN_PACKAGE_NAME}") + message(" Version: ${CPACK_DEBIAN_PACKAGE_VERSION}") + message(" Description: ${CPACK_DEBIAN_PACKAGE_DESCRIPTION}") + message(" File name: ${CPACK_DEBIAN_PACKAGE_FILE_NAME}") + message(" Depends on: ${CPACK_DEBIAN_PACKAGE_DEPENDS}\n") + +elseif (${RELEASE_ID} IN_LIST RHBasedOS) + set(CPACK_GENERATOR DEB) + # Excluding /usr/share/java top level directory due to conflict with javapackages-tools (openjdk dependency) + set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/java") + set(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") + set(CPACK_RPM_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") + set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}") + set(CPACK_RPM_PACKAGE_SECTION "${CPACK_PACKAGE_SECTION}") + set(CPACK_RPM_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) + set(CPACK_RPM_PACKAGE_PRIORITY extra) + set(CPACK_RPM_PACKAGE_DEPENDS "vpp (>= ${vpp_version}), vpp-plugins (>= ${vpp_version})") + + # Print CentOS package summary + message("\nRPM package:") + message(" Name: ${CPACK_RPM_PACKAGE_NAME}") + message(" Version: ${CPACK_RPM_PACKAGE_VERSION}") + message(" Description: ${CPACK_RPM_PACKAGE_DESCRIPTION}") + message(" File name: ${CPACK_RPM_PACKAGE_FILE_NAME}") + message(" Depends on: ${CPACK_RPM_PACKAGE_DEPENDS}\n") endif () - +if (PackZip) + list(APPEND CPACK_GENERATOR ZIP) +endif() +if (PackTgz) + list(APPEND CPACK_GENERATOR TGZ) +endif() +include(CPack) |