From bae4bcbd357d368a33141f38891e2140a527b920 Mon Sep 17 00:00:00 2001 From: Luis Ibanez Date: Wed, 13 Jun 2012 18:25:20 -0400 Subject: [PATCH 1/8] ENH: Fixing the set of M files to copy/install. Reviewed with upstream team the list of .m files that must be copied to the build directory and to the install directory. --- CMakeLists.txt | 82 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 153094c..87112cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,8 +255,33 @@ install(TARGETS install(TARGETS gtmsecshr_real DESTINATION gtmsecshrdir) # .m -> .m -file(GLOB m_files RELATIVE ${GTM_SOURCE_DIR}/sr_port ${GTM_SOURCE_DIR}/sr_port/*.m) -foreach(m ${m_files}) +#file(GLOB m_files_port RELATIVE ${GTM_SOURCE_DIR}/sr_port ${GTM_SOURCE_DIR}/sr_port/*.m) +set(m_files_port + gdeadd.m + gdechang.m + gdedelet.m + gdeexit.m + gdehelp.m + gdeinit.m + gdelocks.m + gdelog.m + gde.m + gdemap.m + gdemsgin.m + gdeparse.m + gdequit.m + gderenam.m + gdescan.m + gdesetgd.m + gdeshow.m + gdespawn.m + gdetempl.m + gendash.m + genout.m + v5cbsu.m + ) + +foreach(m ${m_files_port}) string(TOUPPER "${m}" m_upper) string(REGEX REPLACE "M$" "m" m_out "${GTM_BINARY_DIR}/${m_upper}") add_custom_command( @@ -268,9 +293,23 @@ foreach(m ${m_files}) list(APPEND files_to_place "${m_out}") endforeach() +file(GLOB m_files_unix RELATIVE ${GTM_SOURCE_DIR}/sr_unix ${GTM_SOURCE_DIR}/sr_unix/*.m) +message(m_files_unix ${m_files_unix}) +foreach(m ${m_files_unix}) + string(TOUPPER "${m}" m_upper) + string(REGEX REPLACE "M$" "m" m_out "${GTM_BINARY_DIR}/${m_upper}") + add_custom_command( + OUTPUT "${m_out}" + DEPENDS ${GTM_SOURCE_DIR}/sr_unix/${m} + COMMAND ${CMAKE_COMMAND} -E copy ${GTM_SOURCE_DIR}/sr_unix/${m} "${m_out}" + ) + install(FILES "${m_out}" DESTINATION .) + list(APPEND files_to_place "${m_out}") +endforeach() + # .mpt -> _.m -file(GLOB mpt_files RELATIVE ${GTM_SOURCE_DIR}/sr_port ${GTM_SOURCE_DIR}/sr_port/*.mpt) -foreach(m ${mpt_files}) +file(GLOB mpt_files_port RELATIVE ${GTM_SOURCE_DIR}/sr_port ${GTM_SOURCE_DIR}/sr_port/*.mpt) +foreach(m ${mpt_files_port}) string(TOUPPER "_${m}" m_upper) string(REGEX REPLACE "MPT$" "m" m_out "${GTM_BINARY_DIR}/${m_upper}") add_custom_command( @@ -282,6 +321,19 @@ foreach(m ${mpt_files}) list(APPEND files_to_place "${m_out}") endforeach() +file(GLOB mpt_files_unix RELATIVE ${GTM_SOURCE_DIR}/sr_unix ${GTM_SOURCE_DIR}/sr_unix/*.mpt) +foreach(m ${mpt_files_unix}) + string(TOUPPER "_${m}" m_upper) + string(REGEX REPLACE "MPT$" "m" m_out "${GTM_BINARY_DIR}/${m_upper}") + add_custom_command( + OUTPUT "${m_out}" + DEPENDS ${GTM_SOURCE_DIR}/sr_unix/${m} + COMMAND ${CMAKE_COMMAND} -E copy ${GTM_SOURCE_DIR}/sr_unix/${m} "${m_out}" + ) + install(FILES "${m_out}" DESTINATION .) + list(APPEND files_to_place "${m_out}") +endforeach() + set(files) foreach(f gtm_stdio.h @@ -313,12 +365,34 @@ foreach(f list(APPEND files ${src}) endforeach() install(FILES ${files} DESTINATION .) +install(FILES ${files} DESTINATION ${GTM_SOURCE_DIR}) configure_file(sr_unix/gpgagent.tab.in plugin/gpgagent.tab @ONLY) install(FILES ${GTM_BINARY_DIR}/plugin/gpgagent.tab DESTINATION plugin) add_custom_target(place_files ALL DEPENDS ${files_to_place}) +set(list_of_extra_files_to_copy + add_db_key.sh + build.sh + encrypt_sign_db_key.sh + gen_keypair.sh + gen_sym_hash.sh + gen_sym_key.sh + gtmcrypt_dbk_ref.c + gtmcrypt_pk_ref.c + gtmcrypt_ref.c + gtminstall.sh + import_and_sign_key.sh + install.sh + maskpass.c + pinentry-gtm.sh + ) +foreach(f ${list_of_extra_files_to_copy}) + file(COPY ${GTM_SOURCE_DIR}/sr_unix/${f} DESTINATION ${GTM_BINARY_DIR}/${f}) + install(FILES ${GTM_SOURCE_DIR}/sr_unix/${f} DESTINATION .) +endforeach() + # Would install to: # /usr/lib/fis-gtm/V5.5-000_x86 # /usr/lib/fis-gtm/V5.5-000_x86_64 From 64389242530c34ae8bdea8c1217bb4e2e8be3d18 Mon Sep 17 00:00:00 2001 From: Luis Ibanez Date: Wed, 13 Jun 2012 19:17:45 -0400 Subject: [PATCH 2/8] BUG: destination directory for installed files --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87112cb..b47b51b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -365,7 +365,7 @@ foreach(f list(APPEND files ${src}) endforeach() install(FILES ${files} DESTINATION .) -install(FILES ${files} DESTINATION ${GTM_SOURCE_DIR}) +install(FILES ${files} DESTINATION ${GTM_BINARY_DIR}) configure_file(sr_unix/gpgagent.tab.in plugin/gpgagent.tab @ONLY) install(FILES ${GTM_BINARY_DIR}/plugin/gpgagent.tab DESTINATION plugin) From 814e285f602b0e739f9c29688fa3660cd2c522c7 Mon Sep 17 00:00:00 2001 From: Luis Ibanez Date: Wed, 13 Jun 2012 19:30:43 -0400 Subject: [PATCH 3/8] BUG: Remove installation of files in binary dir. Explore new set of compilation flags taken from GTM makefile. --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b47b51b..3cf4a6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(GTM C ASM) set(CMAKE_INCLUDE_FLAG_ASM "-Wa,-I") # gcc -I does not make it to "as" set(CMAKE_C_FLAGS # TODO: Use CMake 2.8.9 POSITION_INDEPENDENT_CODE abstraction for -fPIC in static libs - "${CMAKE_C_FLAGS} -ansi -fPIC -fsigned-char -Wmissing-prototypes -Wno-unused-result") + "${CMAKE_C_FLAGS} -O2 -fno-defer-pop -fno-strict-aliasing -ffloat-store -ansi -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600 -fsigned-char -fPIC -Wmissing-prototypes -D_LARGEFILE64_SOURCE") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-defer-pop -fno-strict-aliasing -ffloat-store") add_definitions( @@ -365,7 +365,6 @@ foreach(f list(APPEND files ${src}) endforeach() install(FILES ${files} DESTINATION .) -install(FILES ${files} DESTINATION ${GTM_BINARY_DIR}) configure_file(sr_unix/gpgagent.tab.in plugin/gpgagent.tab @ONLY) install(FILES ${GTM_BINARY_DIR}/plugin/gpgagent.tab DESTINATION plugin) From a8fa5d62518b57f3457b91f5d80a6c857fcb60af Mon Sep 17 00:00:00 2001 From: Luis Ibanez Date: Wed, 13 Jun 2012 19:48:12 -0400 Subject: [PATCH 4/8] ENH: installing geteuid. removing message --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cf4a6f..9bd0a47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -240,6 +240,7 @@ install(TARGETS mumps dse lke + geteuid gtcm_server gtcm_gnp_server gtcm_pkdisp @@ -294,7 +295,6 @@ foreach(m ${m_files_port}) endforeach() file(GLOB m_files_unix RELATIVE ${GTM_SOURCE_DIR}/sr_unix ${GTM_SOURCE_DIR}/sr_unix/*.m) -message(m_files_unix ${m_files_unix}) foreach(m ${m_files_unix}) string(TOUPPER "${m}" m_upper) string(REGEX REPLACE "M$" "m" m_out "${GTM_BINARY_DIR}/${m_upper}") From 5a518073a5db9bbe70c88d1ca5e7903bf281843d Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Jun 2012 08:52:23 -0400 Subject: [PATCH 5/8] WIP: Min req cmake 2.8.2 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bd0a47..b56f65c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.7) +cmake_minimum_required(VERSION 2.8.2) project(GTM C ASM) set(CMAKE_INCLUDE_FLAG_ASM "-Wa,-I") # gcc -I does not make it to "as" From 6e1ef8e7fdfc8b8a9f21f87c71b52b3837b8d566 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Jun 2012 08:52:54 -0400 Subject: [PATCH 6/8] WIP: Fix placement of gpgcrypt plugin files --- CMakeLists.txt | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b56f65c..ef82525 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,6 +236,33 @@ set_target_properties(maskpass PROPERTIES ) install(TARGETS maskpass DESTINATION plugin/gtmcrypt) +foreach(f + add_db_key.sh + build.sh + encrypt_sign_db_key.sh + gen_keypair.sh + gen_sym_hash.sh + gen_sym_key.sh + gtmcrypt_dbk_ref.c + gtmcrypt_pk_ref.c + gtmcrypt_ref.c + gtminstall.sh + import_and_sign_key.sh + install.sh + maskpass.c + pinentry-gtm.sh + ) + set(f_in "${GTM_SOURCE_DIR}/sr_unix/${f}") + set(f_out "${GTM_BINARY_DIR}/plugin/gtmcrypt/${f}") + add_custom_command( + OUTPUT "${f_out}" + DEPENDS "${f_in}" + COMMAND ${CMAKE_COMMAND} -E copy "${f_in}" "${f_out}" + ) + install(FILES "${f_out}" DESTINATION plugin/gtmcrypt) + list(APPEND files_to_place "${f_out}") +endforeach() + install(TARGETS mumps dse @@ -371,27 +398,6 @@ install(FILES ${GTM_BINARY_DIR}/plugin/gpgagent.tab DESTINATION plugin) add_custom_target(place_files ALL DEPENDS ${files_to_place}) -set(list_of_extra_files_to_copy - add_db_key.sh - build.sh - encrypt_sign_db_key.sh - gen_keypair.sh - gen_sym_hash.sh - gen_sym_key.sh - gtmcrypt_dbk_ref.c - gtmcrypt_pk_ref.c - gtmcrypt_ref.c - gtminstall.sh - import_and_sign_key.sh - install.sh - maskpass.c - pinentry-gtm.sh - ) -foreach(f ${list_of_extra_files_to_copy}) - file(COPY ${GTM_SOURCE_DIR}/sr_unix/${f} DESTINATION ${GTM_BINARY_DIR}/${f}) - install(FILES ${GTM_SOURCE_DIR}/sr_unix/${f} DESTINATION .) -endforeach() - # Would install to: # /usr/lib/fis-gtm/V5.5-000_x86 # /usr/lib/fis-gtm/V5.5-000_x86_64 From c4cdbce42c26819725a8de7ea214564333999762 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Jun 2012 08:53:26 -0400 Subject: [PATCH 7/8] WIP: Configure gpgagent.tab for build and install trees --- CMakeLists.txt | 5 ++++- sr_unix/gpgagent.tab.in | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef82525..8336dc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -393,8 +393,11 @@ foreach(f endforeach() install(FILES ${files} DESTINATION .) +set(GTM_TOP "${GTM_BINARY_DIR}") configure_file(sr_unix/gpgagent.tab.in plugin/gpgagent.tab @ONLY) -install(FILES ${GTM_BINARY_DIR}/plugin/gpgagent.tab DESTINATION plugin) +set(GTM_TOP "${CMAKE_INSTALL_PREFIX}") +configure_file(sr_unix/gpgagent.tab.in CMakeFiles/plugin/gpgagent.tab @ONLY) +install(FILES ${GTM_BINARY_DIR}/CMakeFiles/plugin/gpgagent.tab DESTINATION plugin) add_custom_target(place_files ALL DEPENDS ${files_to_place}) diff --git a/sr_unix/gpgagent.tab.in b/sr_unix/gpgagent.tab.in index 4dde386..558b7c9 100644 --- a/sr_unix/gpgagent.tab.in +++ b/sr_unix/gpgagent.tab.in @@ -1,2 +1,2 @@ -@CMAKE_INSTALL_PREFIX@/plugin/libgtmcrypt.so +@GTM_TOP@/plugin/libgtmcrypt.so unmaskpwd: xc_status_t gc_pk_mask_unmask_passwd_interlude(I:xc_string_t*,O:xc_string_t*[512],I:xc_int_t) From 0bc0ec44f12005179c8ba59ac871a1a4fe8009a2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Jun 2012 08:59:14 -0400 Subject: [PATCH 8/8] Factor C flags out to proper locations Most of the C flags taken from the GT.M makefile and hard-coded in CMAKE_C_FLAGS were already added in other places. Default to "Release" configuration so the flags are used when no configuration is selected. --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8336dc5..f10e4f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,14 @@ cmake_minimum_required(VERSION 2.8.2) project(GTM C ASM) +if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) +endif() + set(CMAKE_INCLUDE_FLAG_ASM "-Wa,-I") # gcc -I does not make it to "as" set(CMAKE_C_FLAGS # TODO: Use CMake 2.8.9 POSITION_INDEPENDENT_CODE abstraction for -fPIC in static libs - "${CMAKE_C_FLAGS} -O2 -fno-defer-pop -fno-strict-aliasing -ffloat-store -ansi -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600 -fsigned-char -fPIC -Wmissing-prototypes -D_LARGEFILE64_SOURCE") + "${CMAKE_C_FLAGS} -ansi -fsigned-char -fPIC -Wmissing-prototypes") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-defer-pop -fno-strict-aliasing -ffloat-store") add_definitions(