From eb42ac5565ac5322dc0784a7f5c01d0f89c77ad9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 19 Jun 2012 14:00:38 -0400 Subject: [PATCH 01/23] Generate and install (gtm|gde)help.dat --- CMakeLists.txt | 45 +++++++++++++++++++++++++++++++++++++++++++++ sr_unix/mumps.cmake | 5 +++++ 2 files changed, 50 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 764e27c..a2117fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -517,6 +517,51 @@ foreach(gtm_chset "" "UTF-8") endforeach() endforeach() +#----------------------------------------------------------------------------- +set(gtm_hlp mumps.hlp) +set(gde_hlp gde.hlp) +foreach(help gtm gde) + set(CMAKE_CONFIGURABLE_FILE_CONTENT + "Change -segment DEFAULT -block=2048 -file=${help}help.dat +Change -region DEFAULT -record=1020 -key=255 +exit") + configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in + ${GTM_BINARY_DIR}/${help}help.in1) + set(CMAKE_CONFIGURABLE_FILE_CONTENT + "Do ^GTMHLPLD +${GTM_SOURCE_DIR}/sr_port/${${help}_hlp} +Halt") + configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in + ${GTM_BINARY_DIR}/${help}help.in2) + set(env + -D gtm_dist=${GTM_BINARY_DIR} + -D gtmroutines=. + -D gtmgbldir=${GTM_BINARY_DIR}/${help}help + ) + add_custom_command( + OUTPUT ${help}help.dat ${help}help.gld + DEPENDS ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake mumps mupip + ${GTM_BINARY_DIR}/${help}help.in1 + ${GTM_BINARY_DIR}/${help}help.in2 + COMMAND ${CMAKE_COMMAND} -E remove ${help}help.dat ${help}help.gld + COMMAND ${CMAKE_COMMAND} ${env} + -D mumps=$ -D "args=-run;GDE" + -D input_file=${GTM_BINARY_DIR}/${help}help.in1 + -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake + COMMAND ${CMAKE_COMMAND} ${env} + -D mumps=$ -D "args=create" + -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake + COMMAND ${CMAKE_COMMAND} ${env} + -D mumps=$ -D "args=-direct" + -D input_file=${GTM_BINARY_DIR}/${help}help.in2 + -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake + VERBATIM + ) + list(APPEND files_to_place ${help}help.dat) + install(FILES ${GTM_BINARY_DIR}/${help}help.dat DESTINATION ${GTM_INSTALL_DIR}) +endforeach() +#----------------------------------------------------------------------------- + set(GTM_TOP "${GTM_BINARY_DIR}") configure_file(sr_unix/gpgagent.tab.in plugin/gpgagent.tab @ONLY) set(GTM_TOP "${CMAKE_INSTALL_PREFIX}/${GTM_INSTALL_DIR}") diff --git a/sr_unix/mumps.cmake b/sr_unix/mumps.cmake index 2f49e1b..e998330 100644 --- a/sr_unix/mumps.cmake +++ b/sr_unix/mumps.cmake @@ -13,15 +13,20 @@ foreach(v gtmroutines gtm_chset gtm_icu_version + gtmgbldir ) if(DEFINED ${v}) set("ENV{${v}}" "${${v}}") endif() endforeach() +if(input_file) + set(input_file INPUT_FILE ${input_file}) +endif() if(output_file) set(output_file OUTPUT_FILE ${output_file}) endif() execute_process( COMMAND ${mumps} ${args} + ${input_file} ${output_file} ) From 151c165eca3606f2dcfc8d5d693be20d772c279a Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 19 Jun 2012 14:39:39 -0400 Subject: [PATCH 02/23] Use literal '$gtm_dist/' in front of (gtm|gde)help.dat --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2117fe..dae116b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -522,7 +522,7 @@ set(gtm_hlp mumps.hlp) set(gde_hlp gde.hlp) foreach(help gtm gde) set(CMAKE_CONFIGURABLE_FILE_CONTENT - "Change -segment DEFAULT -block=2048 -file=${help}help.dat + "Change -segment DEFAULT -block=2048 -file=\$gtm_dist/${help}help.dat Change -region DEFAULT -record=1020 -key=255 exit") configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in From 81e6aa8856c3b4f7115687e33e1c2a7ce67c8e86 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 19 Jun 2012 15:12:52 -0400 Subject: [PATCH 03/23] configure: Use literal '$gtm_dist/' in front of (gtm|gde)help.dat --- sr_unix/configure.gtc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sr_unix/configure.gtc b/sr_unix/configure.gtc index 0c5b54e..7b3a604 100644 --- a/sr_unix/configure.gtc +++ b/sr_unix/configure.gtc @@ -754,7 +754,7 @@ export gtmgbldir cat < Date: Tue, 19 Jun 2012 17:12:14 -0400 Subject: [PATCH 04/23] gtminstall: Always generate configure.sh from scratch Previously it would append duplicate copies of configure on multiple runs. --- sr_unix/gtminstall.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sr_unix/gtminstall.sh b/sr_unix/gtminstall.sh index 8ded33f..f5bd1c1 100644 --- a/sr_unix/gtminstall.sh +++ b/sr_unix/gtminstall.sh @@ -419,8 +419,10 @@ fi tmp=`head -1 configure | cut -f 1` if [ "#!/bin/sh" != "$tmp" ] ; then echo "#!/bin/sh" >configure.sh + cat configure >>configure.sh +else + cp configure configure.sh fi -cat configure >>configure.sh chmod +x configure.sh # Stop here if this is a dry run From 8dde79ed64efebc53e4ac2dbd6c4ed0c394e5286 Mon Sep 17 00:00:00 2001 From: Luis Ibanez Date: Wed, 20 Jun 2012 14:40:19 -0400 Subject: [PATCH 05/23] configure: Isolate UTF-8 env in a subshell Do not leak LD_LIBRARY_PATH changes to rest of script. They break fakeroot and prevent subsequent commands like "chmod" from working during debian package genaration. --- sr_unix/configure.gtc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sr_unix/configure.gtc b/sr_unix/configure.gtc index 7b3a604..74b7d6d 100644 --- a/sr_unix/configure.gtc +++ b/sr_unix/configure.gtc @@ -673,6 +673,7 @@ export gtm_chset # Now work on UTF-8 mode if [ "$doutf8" -ne 0 ]; then + ( # Ensure we ARE in UTF-8 mode utflocale=`locale -a | grep -i en_us | grep -i utf | grep '8$'` if [ $arch = "zos" ]; then @@ -704,8 +705,7 @@ if [ "$doutf8" -ne 0 ]; then fi (gtm_dist=$gtmdist/utf8; export gtm_dist; cd $gtm_dist; ./mumps -noignore *.m; $echo $?>>$gtmdist/compstat; \ if [ $is64bit_gtm -eq 1 -o "linux" != $arch ] ; then $ldcmd $ldflags -o libgtmutil$ext *.o ; fi ) - gtm_chset="M" - export gtm_chset + ) fi # Change mode to executable for the normal binaries From 4657b4ff5a9294495fa1a791c6cc8b7b33d0a02a Mon Sep 17 00:00:00 2001 From: Amul Shah Date: Wed, 20 Jun 2012 16:28:33 -0400 Subject: [PATCH 06/23] Do not GTMHELP.o GTMHELP.o is called from sr_unix/op_zhelp_xfr.c. Deleting this file renders zhelp inoperable. --- sr_unix/configure.gtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sr_unix/configure.gtc b/sr_unix/configure.gtc index 0c5b54e..eafa6ef 100644 --- a/sr_unix/configure.gtc +++ b/sr_unix/configure.gtc @@ -769,7 +769,7 @@ Change -region DEFAULT -record=1020 -key=255 Exit GDE.in2 -other_object_files="CHK2LEV.o CHKOP.o GENDASH.o GENOUT.o GETNEAR.o GTMHELP.o GTMHLPLD.o LOAD.o LOADOP.o" +other_object_files="CHK2LEV.o CHKOP.o GENDASH.o GENOUT.o GETNEAR.o GTMHLPLD.o LOAD.o LOADOP.o" other_object_files="$other_object_files LOADVX.o MSG.o TTTGEN.o TTTSCAN.o UNLOAD.o GTMDefinedTypesInit.o" csh_script_files="" if [ $arch = "zos" ]; then From a20641dcc047ae3d1d79ebaf212f29b9195bc625 Mon Sep 17 00:00:00 2001 From: Amul Shah Date: Wed, 20 Jun 2012 16:29:27 -0400 Subject: [PATCH 07/23] FIX: NONUTF8LOCALE and ICU versions above 4.8 --- CMakeLists.txt | 12 ++++++++++++ sr_unix/mumps.cmake | 2 ++ 2 files changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 764e27c..15544c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -391,6 +391,10 @@ file(GLOB mpt_files_sr_unix RELATIVE ${GTM_SOURCE_DIR}/sr_unix ${GTM_SOURCE_DIR} set(gtm_chset_dir_ "") set(gtm_chset_dir_UTF-8 "/utf8") +set(gtm_chset_locale_ "C") +set(gtm_chset_locale_UTF-8 "en_US.utf8") +set(gtm_chset_all_locale_ "C") +set(gtm_chset_all_locale_UTF-8 "") foreach(d sr_port sr_unix) foreach(m ${m_files_${d}}) @@ -494,6 +498,12 @@ else() message(FATAL_ERROR "Unable to find 'icu-config'. Set ICUCONFIG in CMake cache.") endif() +if (gtm_icu_version GREATER 10) + message("libicu version ${gtm_icu_version} > 10") + string(REGEX REPLACE "([0-9])([0-9]).*" "\\1.\\2" gtm_icu_version "${gtm_icu_version}") + message("Fixing gtm_icu_version to ${gtm_icu_version}.\nThis had better be the default") +endif() + foreach(gtm_chset "" "UTF-8") foreach(in ${gtm_chset_routines_${gtm_chset}}) string(REPLACE ".m" ".o" out "${in}") @@ -506,6 +516,8 @@ foreach(gtm_chset "" "UTF-8") -D gtmroutines=. -D gtm_chset=${gtm_chset} -D gtm_icu_version=${gtm_icu_version} + -D LC_CTYPE=${gtm_chset_locale_${gtm_chset}} + -D LC_ALL=${gtm_chset_all_locale_${gtm_chset}} -D mumps=$ -D "args=${in}" -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake diff --git a/sr_unix/mumps.cmake b/sr_unix/mumps.cmake index 2f49e1b..fd98298 100644 --- a/sr_unix/mumps.cmake +++ b/sr_unix/mumps.cmake @@ -13,6 +13,8 @@ foreach(v gtmroutines gtm_chset gtm_icu_version + LC_CTYPE + LC_ALL ) if(DEFINED ${v}) set("ENV{${v}}" "${${v}}") From 57ef8ebf36078485aae827ba78fe3171f3c5503c Mon Sep 17 00:00:00 2001 From: Amul Shah Date: Wed, 20 Jun 2012 17:08:42 -0400 Subject: [PATCH 08/23] Add the GLD files to the install root The Global Directories for the help databases were missing from the install. zhelp would not work without these. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ec797a..1fff359 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -569,8 +569,9 @@ Halt") -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake VERBATIM ) - list(APPEND files_to_place ${help}help.dat) + list(APPEND files_to_place ${help}help.dat ${help}help.gld) install(FILES ${GTM_BINARY_DIR}/${help}help.dat DESTINATION ${GTM_INSTALL_DIR}) + install(FILES ${GTM_BINARY_DIR}/${help}help.gld DESTINATION ${GTM_INSTALL_DIR}) endforeach() #----------------------------------------------------------------------------- From bfc84d205b743e27fda57161b7c5579f1f560305 Mon Sep 17 00:00:00 2001 From: Amul Shah Date: Wed, 20 Jun 2012 17:22:41 -0400 Subject: [PATCH 09/23] LC_ALL should be set by the calling shell Read the blog post on http://www.mattfischer.com/blog/?p=105 M mode (aka ASCII) GT.M does not use LC_* while compiling UTF-8 mode GT.M requires the correct locale setting for the compiler to produce UTF-8 mode object files. --- CMakeLists.txt | 6 ------ sr_unix/mumps.cmake | 2 -- 2 files changed, 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fff359..cdd9ee2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -391,10 +391,6 @@ file(GLOB mpt_files_sr_unix RELATIVE ${GTM_SOURCE_DIR}/sr_unix ${GTM_SOURCE_DIR} set(gtm_chset_dir_ "") set(gtm_chset_dir_UTF-8 "/utf8") -set(gtm_chset_locale_ "C") -set(gtm_chset_locale_UTF-8 "en_US.utf8") -set(gtm_chset_all_locale_ "C") -set(gtm_chset_all_locale_UTF-8 "") foreach(d sr_port sr_unix) foreach(m ${m_files_${d}}) @@ -516,8 +512,6 @@ foreach(gtm_chset "" "UTF-8") -D gtmroutines=. -D gtm_chset=${gtm_chset} -D gtm_icu_version=${gtm_icu_version} - -D LC_CTYPE=${gtm_chset_locale_${gtm_chset}} - -D LC_ALL=${gtm_chset_all_locale_${gtm_chset}} -D mumps=$ -D "args=${in}" -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake diff --git a/sr_unix/mumps.cmake b/sr_unix/mumps.cmake index 0223b86..e998330 100644 --- a/sr_unix/mumps.cmake +++ b/sr_unix/mumps.cmake @@ -14,8 +14,6 @@ foreach(v gtm_chset gtm_icu_version gtmgbldir - LC_CTYPE - LC_ALL ) if(DEFINED ${v}) set("ENV{${v}}" "${${v}}") From 33f1fdacf98c92e01bb5fb116521a234010cc3fa Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 21 Jun 2012 09:33:15 -0400 Subject: [PATCH 10/23] Generate xfer_desc.i with CMake code --- CMakeLists.txt | 31 +++- sr_unix/gen_xfer_desc.cmake | 63 +++++++++ sr_x86_64/xfer_desc.i | 275 ------------------------------------ 3 files changed, 90 insertions(+), 279 deletions(-) create mode 100644 sr_unix/gen_xfer_desc.cmake delete mode 100644 sr_x86_64/xfer_desc.i diff --git a/CMakeLists.txt b/CMakeLists.txt index cdd9ee2..fa6c3b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,12 +63,14 @@ add_definitions( set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG) set(gt_src_list) +set(gen_xfer_desc 0) if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") list(APPEND gt_src_list sr_linux) if("${CMAKE_SIZEOF_VOID_P}" EQUAL 4) list(APPEND gt_src_list sr_i386 sr_x86_regs sr_unix_nsb) else() list(APPEND gt_src_list sr_x86_64 sr_x86_regs) + set(gen_xfer_desc 1) endif() endif() list(APPEND gt_src_list @@ -106,6 +108,7 @@ foreach(d ${gt_src_list}) ${d}/*.c ${d}/*.s ${d}/*.si) endforeach() +set(sources_used "") macro(set_source_list target) foreach(name ${ARGN}) set(src "") @@ -113,6 +116,7 @@ macro(set_source_list target) if(";${sources_${d}};" MATCHES ";(${name}\\.(c|s|si));") set(src ${d}/${CMAKE_MATCH_1}) set("source_used_${CMAKE_MATCH_1}" 1) + list(APPEND sources_used ${GTM_SOURCE_DIR}/${src}) break() endif() endforeach() @@ -164,19 +168,38 @@ set_source_list(semstat2 semstat2) #----------------------------------------------------------------------------- # libmumps gets leftover sources, so compute the remaining list. +set(source_used_dtgbldir.c 1) # exclude unused source set(libmumps_SOURCES "") foreach(d ${gt_src_list}) foreach(s ${sources_${d}}) if(NOT source_used_${s}) list(APPEND libmumps_SOURCES ${d}/${s}) set(source_used_${s} 1) + list(APPEND sources_used ${GTM_SOURCE_DIR}/${d}/${s}) endif() endforeach() endforeach() -# Remove unused sources. -list(REMOVE_ITEM libmumps_SOURCES - sr_unix/dtgbldir.c - ) + +if(gen_xfer_desc) + list(SORT sources_used) + set(CMAKE_CONFIGURABLE_FILE_CONTENT "") + foreach(src ${sources_used}) + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${src}\n") + endforeach() + configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in ${GTM_BINARY_DIR}/sources.list) + add_custom_command( + OUTPUT xfer_desc.i + WORKING_DIRECTORY ${GTM_BINARY_DIR} + DEPENDS ${GTM_SOURCE_DIR}/sr_unix/gen_xfer_desc.cmake + ${GTM_BINARY_DIR}/sources.list + COMMAND ${CMAKE_COMMAND} + -D CMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -D "includes=${includes}" + -P ${GTM_SOURCE_DIR}/sr_unix/gen_xfer_desc.cmake + VERBATIM + ) + list(APPEND libmumps_SOURCES xfer_desc.i) +endif() #----------------------------------------------------------------------------- diff --git a/sr_unix/gen_xfer_desc.cmake b/sr_unix/gen_xfer_desc.cmake new file mode 100644 index 0000000..a9e1d2d --- /dev/null +++ b/sr_unix/gen_xfer_desc.cmake @@ -0,0 +1,63 @@ +set(I "") +foreach(i ${includes}) + list(APPEND I "-I${i}") +endforeach() +file(WRITE tmp_xfer_1.c " +/* We have not yet created gtm_threadgbl_deftypes.h and don't need it, signal gtm_threadgbl.h to avoid including it */ +#define NO_THREADGBL_DEFTYPES +#include \"mdef.h\" +#define XFER(a,b) MY_XF,b +#include \"xfer.h\" +") + +execute_process( + COMMAND ${CMAKE_C_COMPILER} ${I} -E tmp_xfer_1.c -o tmp_xfer_2.c + RESULT_VARIABLE failed + ) +if(failed) + message(FATAL_ERROR "Preprocessing with ${CMAKE_C_COMPILER} failed") +endif() +file(STRINGS tmp_xfer_2.c lines REGEX "MY_XF") +string(REGEX REPLACE "(MY_XF|,)" "" names "${lines}") +file(REMOVE tmp_xfer_1.c tmp_xfer_2.c) + +file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/sources.list" sources) + +set(ftypes "") +#set(defines "") +foreach(name ${names}) + set(ftype "") + if(";${sources};" MATCHES ";([^;]*/${name}\\.s);") + set(ftype GTM_ASM_RTN) + elseif(";${sources};" MATCHES ";([^;]*/${name}\\.c);") + file(STRINGS "${CMAKE_MATCH_1}" sig REGEX "${name}.*\\.\\.\\.") + if(sig) + set(ftype "GTM_C_VAR_ARGS_RTN") + else() + set(ftype "GTM_C_RTN") + endif() + endif() + if(NOT ftype) + set(ftype GTM_C_VAR_ARGS_RTN) + foreach(src ${sources}) + if("${src}" MATCHES "\\.s$") + file(STRINGS "${src}" sig REGEX "^${name}") + if(sig) + set(ftype GTM_ASM_RTN) + break() + endif() + endif() + endforeach() + endif() + set(ftypes "${ftypes}${ftype}, /* ${name} */ \\\n") + #set(defines "${defines}#define ${name}_FUNCTYPE ${ftype}\n") # TODO for ia64 +endforeach() + +file(WRITE xfer_desc.i "/* Generated by gen_xfer_desc.cmake */ +#define GTM_C_RTN 1 +#define GTM_ASM_RTN 2 +#define GTM_C_VAR_ARGS_RTN 3 +#define DEFINE_XFER_TABLE_DESC char xfer_table_desc[] = \\ +{ \\ +${ftypes}0} + \n") diff --git a/sr_x86_64/xfer_desc.i b/sr_x86_64/xfer_desc.i deleted file mode 100644 index e07c3bc..0000000 --- a/sr_x86_64/xfer_desc.i +++ /dev/null @@ -1,275 +0,0 @@ -/* Generated by gen_xfer_desc.csh */ -#define GTM_C_RTN 1 -#define GTM_ASM_RTN 2 -#define GTM_C_VAR_ARGS_RTN 3 -#define DEFINE_XFER_TABLE_DESC char xfer_table_desc[] = \ -{ \ -GTM_ASM_RTN, /* op_sto */ \ -GTM_C_VAR_ARGS_RTN, /* op_cat */ \ -GTM_ASM_RTN, /* op_linefetch */ \ -GTM_ASM_RTN, /* op_linestart */ \ -GTM_ASM_RTN, /* mval2bool */ \ -GTM_C_VAR_ARGS_RTN, /* op_zbfetch */ \ -GTM_C_VAR_ARGS_RTN, /* op_zbstart */ \ -GTM_C_RTN, /* op_fnpiece */ \ -GTM_ASM_RTN, /* op_equ */ \ -GTM_C_RTN, /* op_write */ \ -GTM_C_RTN, /* op_kill */ \ -GTM_C_RTN, /* op_add */ \ -GTM_C_VAR_ARGS_RTN, /* op_getindx */ \ -GTM_C_VAR_ARGS_RTN, /* op_putindx */ \ -GTM_C_VAR_ARGS_RTN, /* op_gvnaked */ \ -GTM_ASM_RTN, /* opp_ret */ \ -GTM_ASM_RTN, /* op_numcmp */ \ -GTM_C_RTN, /* op_fnextract */ \ -GTM_C_VAR_ARGS_RTN, /* op_gvname */ \ -GTM_ASM_RTN, /* mval2mint */ \ -GTM_ASM_RTN, /* op_contain */ \ -GTM_C_RTN, /* op_wteol */ \ -GTM_C_RTN, /* op_gvget */ \ -GTM_C_VAR_ARGS_RTN, /* op_sub */ \ -GTM_C_RTN, /* op_fndata */ \ -GTM_C_VAR_ARGS_RTN, /* op_callw */ \ -GTM_ASM_RTN, /* op_extcall */ \ -GTM_ASM_RTN, /* op_forcenum */ \ -GTM_C_VAR_ARGS_RTN, /* op_srchindx */ \ -GTM_ASM_RTN, /* opp_newvar */ \ -GTM_ASM_RTN, /* op_extjmp */ \ -GTM_C_RTN, /* op_gvput */ \ -GTM_C_RTN, /* op_gvdata */ \ -GTM_C_RTN, /* op_fnlength */ \ -GTM_C_RTN, /* op_svget */ \ -GTM_ASM_RTN, /* opp_rterror */ \ -GTM_ASM_RTN, /* opp_commarg */ \ -GTM_C_RTN, /* op_gvnext */ \ -GTM_C_RTN, /* op_wttab */ \ -GTM_C_RTN, /* op_gvkill */ \ -GTM_C_RTN, /* op_read */ \ -GTM_ASM_RTN, /* op_neg */ \ -GTM_ASM_RTN, /* op_follow */ \ -GTM_C_RTN, /* op_wtone */ \ -GTM_C_VAR_ARGS_RTN, /* op_callb */ \ -GTM_ASM_RTN, /* mint2mval */ \ -GTM_ASM_RTN, /* op_forinit */ \ -GTM_ASM_RTN, /* op_forloop */ \ -GTM_C_RTN, /* flt_mod */ \ -GTM_C_RTN, /* op_fntext */ \ -GTM_C_RTN, /* op_fnnext */ \ -GTM_C_RTN, /* op_idiv */ \ -GTM_C_RTN, /* op_fnj2 */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnchar */ \ -GTM_C_RTN, /* op_fnfind */ \ -GTM_ASM_RTN, /* opp_indset */ \ -GTM_C_RTN, /* op_fnascii */ \ -GTM_C_RTN, /* op_halt */ \ -GTM_C_RTN, /* op_mul */ \ -GTM_ASM_RTN, /* opp_indtext */ \ -GTM_ASM_RTN, /* opp_indglvn */ \ -GTM_C_RTN, /* op_killall */ \ -GTM_C_RTN, /* op_use */ \ -GTM_C_RTN, /* op_div */ \ -GTM_C_RTN, /* op_fnj3 */ \ -GTM_C_VAR_ARGS_RTN, /* op_forlcldol */ \ -GTM_C_VAR_ARGS_RTN, /* op_forlcldow */ \ -GTM_C_RTN, /* op_unlock */ \ -GTM_C_RTN, /* op_wtff */ \ -GTM_ASM_RTN, /* opp_break */ \ -GTM_C_VAR_ARGS_RTN, /* op_calll */ \ -GTM_C_RTN, /* op_close */ \ -GTM_ASM_RTN, /* op_currtn */ \ -GTM_C_RTN, /* op_lock */ \ -GTM_C_VAR_ARGS_RTN, /* gtm_fetch */ \ -GTM_C_RTN, /* op_fnfnumber */ \ -GTM_ASM_RTN, /* op_fnget */ \ -GTM_C_RTN, /* op_fngetdvi */ \ -GTM_C_RTN, /* op_fngetjpi */ \ -GTM_C_RTN, /* op_fngetsyi */ \ -GTM_C_RTN, /* op_fngvget */ \ -GTM_C_RTN, /* op_fnorder */ \ -GTM_C_RTN, /* op_fnrandom */ \ -GTM_C_RTN, /* op_fnzfile */ \ -GTM_C_RTN, /* op_fnzm */ \ -GTM_C_RTN, /* op_fnzparse */ \ -GTM_C_RTN, /* op_fnzpid */ \ -GTM_C_RTN, /* op_fnzpriv */ \ -GTM_C_RTN, /* op_fnzsearch */ \ -GTM_C_RTN, /* op_fnzsetprv */ \ -GTM_ASM_RTN, /* op_gettruth */ \ -GTM_C_RTN, /* op_zallocate */ \ -GTM_C_RTN, /* op_gvorder */ \ -GTM_C_RTN, /* op_hang */ \ -GTM_ASM_RTN, /* opp_hardret */ \ -GTM_ASM_RTN, /* opp_indfun */ \ -GTM_ASM_RTN, /* opp_indlvadr */ \ -GTM_C_VAR_ARGS_RTN, /* op_indname */ \ -GTM_ASM_RTN, /* opp_indpat */ \ -GTM_ASM_RTN, /* op_iretmvad */ \ -GTM_ASM_RTN, /* opp_iretmval */ \ -GTM_C_VAR_ARGS_RTN, /* op_job */ \ -GTM_C_RTN, /* op_labaddr */ \ -GTM_C_RTN, /* op_incrlock */ \ -GTM_C_RTN, /* op_decrlock */ \ -GTM_C_VAR_ARGS_RTN, /* op_lvpatwrite */ \ -GTM_C_VAR_ARGS_RTN, /* op_lvzwrite */ \ -GTM_C_RTN, /* op_open */ \ -GTM_C_RTN, /* op_fnpopulation */ \ -GTM_C_RTN, /* op_rdone */ \ -GTM_C_RTN, /* op_readfl */ \ -GTM_C_RTN, /* op_rhdaddr */ \ -GTM_C_RTN, /* op_setpiece */ \ -GTM_C_RTN, /* op_setzbrk */ \ -GTM_C_RTN, /* op_svput */ \ -GTM_C_VAR_ARGS_RTN, /* op_view */ \ -GTM_ASM_RTN, /* opp_xnew */ \ -GTM_ASM_RTN, /* opp_zcont */ \ -GTM_ASM_RTN, /* opp_zgoto */ \ -GTM_C_RTN, /* op_zlink */ \ -GTM_C_VAR_ARGS_RTN, /* op_zmess */ \ -GTM_C_RTN, /* op_zprint */ \ -GTM_C_RTN, /* op_zshow */ \ -GTM_C_RTN, /* op_zsystem */ \ -GTM_C_RTN, /* op_gvsavtarg */ \ -GTM_C_RTN, /* op_gvrectarg */ \ -GTM_C_RTN, /* op_igetsrc */ \ -GTM_C_RTN, /* op_fnzdate */ \ -GTM_C_RTN, /* op_fntranslate */ \ -GTM_C_VAR_ARGS_RTN, /* op_xkill */ \ -GTM_C_RTN, /* op_lkinit */ \ -GTM_C_RTN, /* op_zattach */ \ -GTM_C_RTN, /* op_zedit */ \ -GTM_ASM_RTN, /* op_restartpc */ \ -GTM_C_VAR_ARGS_RTN, /* op_gvextnam */ \ -GTM_C_RTN, /* op_fnzcall */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnview */ \ -GTM_C_RTN, /* op_zdeallocate */ \ -GTM_ASM_RTN, /* opp_indlvarg */ \ -GTM_ASM_RTN, /* op_forchk1 */ \ -GTM_C_RTN, /* op_cvtparm */ \ -GTM_C_RTN, /* op_zprevious */ \ -GTM_C_RTN, /* op_fnzprevious */ \ -GTM_C_RTN, /* op_gvquery */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnquery */ \ -GTM_C_VAR_ARGS_RTN, /* op_bindparm */ \ -GTM_ASM_RTN, /* op_retarg */ \ -GTM_ASM_RTN, /* op_exfun */ \ -GTM_ASM_RTN, /* op_extexfun */ \ -GTM_ASM_RTN, /* op_zhelp */ \ -GTM_C_RTN, /* op_fnp1 */ \ -GTM_ASM_RTN, /* opp_zg1 */ \ -GTM_ASM_RTN, /* opp_newintrinsic */ \ -GTM_C_RTN, /* op_gvzwithdraw */ \ -GTM_C_RTN, /* op_lvzwithdraw */ \ -GTM_ASM_RTN, /* op_pattern */ \ -GTM_C_RTN, /* op_nullexp */ \ -GTM_C_RTN, /* op_exfunret */ \ -GTM_C_RTN, /* op_fnlvname */ \ -GTM_C_VAR_ARGS_RTN, /* op_forlcldob */ \ -GTM_ASM_RTN, /* opp_indrzshow */ \ -GTM_C_VAR_ARGS_RTN, /* op_gvzwrite */ \ -GTM_C_RTN, /* op_zstep */ \ -GTM_ASM_RTN, /* mval2num */ \ -GTM_C_VAR_ARGS_RTN, /* op_lkname */ \ -GTM_C_RTN, /* op_fnztrnlnm */ \ -GTM_C_RTN, /* op_ztcommit */ \ -GTM_C_RTN, /* op_ztstart */ \ -GTM_ASM_RTN, /* op_equnul */ \ -GTM_C_RTN, /* op_fngetlki */ \ -GTM_C_RTN, /* op_fnzlkid */ \ -GTM_ASM_RTN, /* opp_indlvnamadr */ \ -GTM_C_VAR_ARGS_RTN, /* op_callspb */ \ -GTM_C_VAR_ARGS_RTN, /* op_callspw */ \ -GTM_C_VAR_ARGS_RTN, /* op_callspl */ \ -GTM_C_VAR_ARGS_RTN, /* op_iocontrol */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnfgncal */ \ -GTM_C_RTN, /* op_zcompile */ \ -GTM_ASM_RTN, /* opp_tcommit */ \ -GTM_ASM_RTN, /* opp_trollback */ \ -GTM_ASM_RTN, /* opp_trestart */ \ -GTM_ASM_RTN, /* opp_tstart */ \ -GTM_C_RTN, /* op_exp */ \ -GTM_C_RTN, /* op_fnget2 */ \ -GTM_ASM_RTN, /* opp_indget */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnname */ \ -GTM_ASM_RTN, /* opp_indfnname */ \ -GTM_C_RTN, /* op_fnlvprvname */ \ -GTM_C_RTN, /* op_gvo2 */ \ -GTM_C_RTN, /* op_fnlvnameo2 */ \ -GTM_C_RTN, /* op_fno2 */ \ -GTM_ASM_RTN, /* opp_indo2 */ \ -GTM_C_RTN, /* op_get_msf */ \ -GTM_C_RTN, /* op_dt_get */ \ -GTM_C_RTN, /* op_dt_store */ \ -GTM_C_RTN, /* op_dt_false */ \ -GTM_C_RTN, /* op_dt_true */ \ -GTM_C_RTN, /* op_fnzbitstr */ \ -GTM_C_RTN, /* op_fnzbitlen */ \ -GTM_C_RTN, /* op_fnzbitget */ \ -GTM_C_RTN, /* op_fnzbitset */ \ -GTM_C_RTN, /* op_fnzbitcoun */ \ -GTM_C_RTN, /* op_fnzbitfind */ \ -GTM_C_RTN, /* op_fnzbitnot */ \ -GTM_C_RTN, /* op_fnzbitand */ \ -GTM_C_RTN, /* op_fnzbitor */ \ -GTM_C_RTN, /* op_fnzbitxor */ \ -GTM_C_RTN, /* op_fgnlookup */ \ -GTM_ASM_RTN, /* op_sorts_after */ \ -GTM_C_RTN, /* op_fnzqgblmod */ \ -GTM_C_RTN, /* op_fngvget1 */ \ -GTM_C_RTN, /* op_fngvget2 */ \ -GTM_C_RTN, /* op_setp1 */ \ -GTM_C_RTN, /* op_setextract */ \ -GTM_ASM_RTN, /* opp_inddevparms */ \ -GTM_C_RTN, /* op_merge */ \ -GTM_C_RTN, /* op_merge_arg */ \ -GTM_ASM_RTN, /* opp_indmerge */ \ -GTM_C_VAR_ARGS_RTN, /* op_m_srchindx */ \ -GTM_C_RTN, /* op_fnstack1 */ \ -GTM_C_RTN, /* op_fnstack2 */ \ -GTM_C_RTN, /* op_fnqlength */ \ -GTM_C_RTN, /* op_fnqsubscript */ \ -GTM_C_RTN, /* op_fnreverse */ \ -GTM_ASM_RTN, /* opp_svput */ \ -GTM_C_RTN, /* op_fnzjobexam */ \ -GTM_C_RTN, /* op_fnzsigproc */ \ -GTM_C_RTN, /* op_fnincr */ \ -GTM_C_RTN, /* op_gvincr */ \ -GTM_ASM_RTN, /* opp_indincr */ \ -GTM_C_RTN, /* op_setzextract */ \ -GTM_C_RTN, /* op_setzp1 */ \ -GTM_C_RTN, /* op_setzpiece */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnzascii */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnzchar */ \ -GTM_ASM_RTN, /* op_fnzextract */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnzfind */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnzj2 */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnzlength */ \ -GTM_C_RTN, /* op_fnzpopulation */ \ -GTM_C_RTN, /* op_fnzpiece */ \ -GTM_C_RTN, /* op_fnzp1 */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnztranslate */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnzconvert2 */ \ -GTM_C_VAR_ARGS_RTN, /* op_fnzconvert3 */ \ -GTM_C_RTN, /* op_fnzwidth */ \ -GTM_C_RTN, /* op_fnzsubstr */ \ -GTM_C_RTN, /* op_setals2als */ \ -GTM_C_RTN, /* op_setalsin2alsct */ \ -GTM_C_RTN, /* op_setalsctin2als */ \ -GTM_C_RTN, /* op_setalsct2alsct */ \ -GTM_C_RTN, /* op_killalias */ \ -GTM_C_RTN, /* op_killaliasall */ \ -GTM_C_RTN, /* op_fnzdata */ \ -GTM_C_RTN, /* op_clralsvars */ \ -GTM_C_RTN, /* op_fnzahandle */ \ -GTM_C_RTN, /* op_fnztrigger */ \ -GTM_C_RTN, /* op_exfunretals */ \ -GTM_C_RTN, /* op_setfnretin2als */ \ -GTM_C_RTN, /* op_setfnretin2alsct */ \ -GTM_C_RTN, /* op_zwritesvn */ \ -GTM_C_RTN, /* op_ztrigger */ \ -GTM_C_VAR_ARGS_RTN, /* op_rfrshindx */ \ -GTM_C_VAR_ARGS_RTN, /* op_savputindx */ \ -GTM_C_RTN, /* op_forfreeindx */ \ -GTM_C_RTN, /* op_fornestlvl */ \ -GTM_C_RTN, /* op_zhalt */ \ -0} - From 0cd020d056ff70b1426dff9d0255898dd47c351b Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 21 Jun 2012 10:59:37 -0400 Subject: [PATCH 11/23] gtm_threadgbl_deftypes depends on xfer_desc --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa6c3b9..497b6fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,9 +201,12 @@ if(gen_xfer_desc) list(APPEND libmumps_SOURCES xfer_desc.i) endif() +add_custom_target(gen_xfer_desc DEPENDS xfer_desc.i) + #----------------------------------------------------------------------------- add_executable(gtm_threadgbl_deftypes ${gtm_threadgbl_deftypes_SOURCES}) +add_dependencies(gtm_threadgbl_deftypes gen_xfer_desc) add_custom_command( OUTPUT gtm_threadgbl_deftypes.h From 949806c6a6fb21bec4159334dac6a8920ae25db5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 21 Jun 2012 11:02:44 -0400 Subject: [PATCH 12/23] gen_xfer_desc does not run in 32-bit build --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 497b6fe..9ec852a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,15 +198,15 @@ if(gen_xfer_desc) -P ${GTM_SOURCE_DIR}/sr_unix/gen_xfer_desc.cmake VERBATIM ) - list(APPEND libmumps_SOURCES xfer_desc.i) + add_custom_target(gen_xfer_desc DEPENDS xfer_desc.i) endif() -add_custom_target(gen_xfer_desc DEPENDS xfer_desc.i) - #----------------------------------------------------------------------------- add_executable(gtm_threadgbl_deftypes ${gtm_threadgbl_deftypes_SOURCES}) -add_dependencies(gtm_threadgbl_deftypes gen_xfer_desc) +if(gen_xfer_desc) + add_dependencies(gtm_threadgbl_deftypes gen_xfer_desc) +endif() add_custom_command( OUTPUT gtm_threadgbl_deftypes.h From 89f3cc3b49b3bebdfa09a6f76d3cd91ce6a30849 Mon Sep 17 00:00:00 2001 From: Amul Shah Date: Thu, 21 Jun 2012 11:58:03 -0400 Subject: [PATCH 13/23] detect ICU on Debian wheezy The ICU libraries are now located under /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu They were previously located under /usr/lib64 /usr/lib32 The configure script runs a detection sequence that works for all supported platforms. Remove GTMHELP.o when deleting all built files --- sr_unix/configure.gtc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sr_unix/configure.gtc b/sr_unix/configure.gtc index 1bf8e82..dc8c506 100644 --- a/sr_unix/configure.gtc +++ b/sr_unix/configure.gtc @@ -239,9 +239,9 @@ if [ -d "utf8" ]; then is64bit_gtm=`file mumps | grep "64-bit" | wc -l` fi if [ $is64bit_gtm -eq 1 ] ; then - library_path="/usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib /lib64 /lib /usr/local/ssl/lib" + library_path="/usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib /usr/lib/x86_64-linux-gnu /lib64 /lib /usr/local/ssl/lib" else - library_path="/usr/local/lib32 /usr/local/lib /usr/lib32 /usr/lib /lib32 /lib" + library_path="/usr/local/lib32 /usr/local/lib /usr/lib32 /usr/lib /usr/lib/i386-linux-gnu /lib32 /lib" fi $echo "Should UTF-8 support be installed? (y or n) \c" read resp @@ -901,7 +901,7 @@ if [ "$resp" = "Y" -o "$resp" = "y" ] ; then \rm -rf $binaries $pathmods $rscripts $nscripts $dirs configure \ *.gtc gtm* gde* GDE*.o _*.m _*.o mumps.dat mumps.gld geteuid $other_object_files $csh_script_files lowerc_cp\ esnecil *.hlp core *.h libgtmrpc.a *.m gdehelp.* COPYING README.txt - \rm -rf GETPASS.o plugin PINENTRY.o + \rm -rf GETPASS.o plugin PINENTRY.o GTMHELP.o if [ -d utf8 ]; then \rm -rf utf8 fi From 4077ab87abb86c5ed06870ddf3e46ab3b5765745 Mon Sep 17 00:00:00 2001 From: Amul Shah Date: Thu, 21 Jun 2012 12:20:37 -0400 Subject: [PATCH 14/23] revert addition of GLD files to install directory The configure script will generate this in the ultimate install directory. --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ec852a..e477148 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -589,9 +589,8 @@ Halt") -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake VERBATIM ) - list(APPEND files_to_place ${help}help.dat ${help}help.gld) + list(APPEND files_to_place ${help}help.dat) install(FILES ${GTM_BINARY_DIR}/${help}help.dat DESTINATION ${GTM_INSTALL_DIR}) - install(FILES ${GTM_BINARY_DIR}/${help}help.gld DESTINATION ${GTM_INSTALL_DIR}) endforeach() #----------------------------------------------------------------------------- From 8ec5ab7218d74729c52e9d3a46275b244da0c4f0 Mon Sep 17 00:00:00 2001 From: Amul Shah Date: Fri, 29 Jun 2012 16:34:26 -0400 Subject: [PATCH 15/23] BUG: change memcpy to memmove --- sr_port/dse_rmrec.c | 10 +++++----- sr_port/gtm_malloc_src.h | 15 ++++++++++----- sr_port/gtm_string.h | 17 +++++++++++++---- sr_port/gtm_threadgbl_init.c | 4 +++- sr_port/op_tstart.c | 2 +- sr_port/symbinit.c | 9 +++++---- sr_port_cm/gvcmz_doop.c | 14 +++++++------- sr_unix/gtm.c | 7 +++++-- sr_unix/gtmsecshr_wrapper.c | 6 ++++-- sr_unix_cm/gtcm_pkdisp.c | 6 ++++-- 10 files changed, 57 insertions(+), 33 deletions(-) diff --git a/sr_port/dse_rmrec.c b/sr_port/dse_rmrec.c index ba6f0f2..ea34d9f 100644 --- a/sr_port/dse_rmrec.c +++ b/sr_port/dse_rmrec.c @@ -52,6 +52,10 @@ GBLREF unsigned char patch_comp_count; GBLREF cw_set_element cw_set[]; GBLREF unsigned char *non_tp_jfb_buff_ptr; +error_def(ERR_DBRDONLY); +error_def(ERR_DSEBLKRDFAIL); +error_def(ERR_DSEFAIL); + void dse_rmrec(void) { block_id blk; @@ -64,10 +68,6 @@ void dse_rmrec(void) short int size, i, rsize; srch_blk_status blkhist; - error_def(ERR_DBRDONLY); - error_def(ERR_DSEBLKRDFAIL); - error_def(ERR_DSEFAIL); - if (gv_cur_region->read_only) rts_error(VARLSTCNT(4) ERR_DBRDONLY, 2, DB_LEN_STR(gv_cur_region)); CHECK_AND_RESET_UPDATE_ARRAY; /* reset update_array_ptr to update_array */ @@ -182,7 +182,7 @@ void dse_rmrec(void) rsize = r_top - key_top + SIZEOF(rec_hdr) + patch_comp_count - i; PUT_SHORT(&((rec_hdr_ptr_t)rp_base)->rsiz, rsize); memcpy(rp_base + SIZEOF(rec_hdr), &patch_comp_key[i], patch_comp_count - i); - memcpy(rp_base + SIZEOF(rec_hdr) + patch_comp_count - i, key_top, b_top - key_top); + memmove(rp_base + SIZEOF(rec_hdr) + patch_comp_count - i, key_top, b_top - key_top); ((blk_hdr_ptr_t)lbp)->bsiz = (unsigned int)(rp_base + rsize - lbp + b_top - r_top); BLK_INIT(bs_ptr, bs1); BLK_SEG(bs_ptr, (uchar_ptr_t)lbp + SIZEOF(blk_hdr), ((blk_hdr_ptr_t)lbp)->bsiz - SIZEOF(blk_hdr)); diff --git a/sr_port/gtm_malloc_src.h b/sr_port/gtm_malloc_src.h index dace11b..78ed04b 100644 --- a/sr_port/gtm_malloc_src.h +++ b/sr_port/gtm_malloc_src.h @@ -33,7 +33,12 @@ */ #include "mdef.h" - +/* If this is a pro build (meaning PRO_BUILD is defined), avoid the memcpy() override. That code is only + * appropriate for a pure debug build. + */ +#ifdef PRO_BUILD +# define BYPASS_MEMCPY_OVERRIDE /* Instruct gtm_string.h not to override memcpy() */ +#endif /* We are the redefined versions so use real versions in this module */ #undef malloc #undef free @@ -45,11 +50,11 @@ #include #include #if !defined(VMS) && !defined(__MVS__) -#include +# include #endif #include "gtm_stdio.h" -#include "gtm_string.h" #include "gtm_stdlib.h" +#include "gtm_string.h" #include "eintr_wrappers.h" #include "gtmdbglvl.h" @@ -67,8 +72,8 @@ #include "gtm_malloc.h" #include "have_crit.h" #ifdef UNIX -#include "gtmio.h" -#include "deferred_signal_handler.h" +# include "gtmio.h" +# include "deferred_signal_handler.h" #endif /* This routine is compiled twice, once as debug and once as pro and put into the same pro build. The alternative diff --git a/sr_port/gtm_string.h b/sr_port/gtm_string.h index 5c1d153..d1eea3e 100644 --- a/sr_port/gtm_string.h +++ b/sr_port/gtm_string.h @@ -1,6 +1,6 @@ /**************************************************************** * * - * Copyright 2001, 2011 Fidelity Information Services, Inc * + * Copyright 2001, 2012 Fidelity Information Services, Inc * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * @@ -15,9 +15,7 @@ #ifndef GTM_STRINGH #define GTM_STRINGH -#ifndef __vax -# include -#endif +#include #define STRERROR strerror @@ -31,4 +29,15 @@ #define STRNCMP_LIT_FULL(SOURCE, LITERAL) strncmp(SOURCE, LITERAL, SIZEOF(LITERAL)) /* BYPASSOK */ #define STRNCMP_STR(SOURCE, STRING, LEN) strncmp(SOURCE, STRING, LEN) +/* We need to catch any memcpy() that is used when the source and target strings overlap in any fashion so we can change + * them to a memmove. So in debug builds, assert fail if this is the case. + */ +#if defined(DEBUG) && !defined(BYPASS_MEMCPY_OVERRIDE) +# include "gtm_memcpy_validate_and_execute.h" +# ifdef memcpy +# undef memcpy /* Some platforms like AIX create memcpy as a #define which needs removing before re-define */ +# endif +# define memcpy(TARGET, SRC, LEN) gtm_memcpy_validate_and_execute((void *)(TARGET), (const void *)(SRC), (LEN)) +#endif + #endif diff --git a/sr_port/gtm_threadgbl_init.c b/sr_port/gtm_threadgbl_init.c index 10dd750..780a15b 100644 --- a/sr_port/gtm_threadgbl_init.c +++ b/sr_port/gtm_threadgbl_init.c @@ -9,8 +9,10 @@ * * ****************************************************************/ - #include "mdef.h" +#define BYPASS_MEMCPY_OVERRIDE /* Signals gtm_string.h to not override memcpy(). When this routine is linked into gtcm_pkdisp, + * the assert in the routine called by memcpy macro causes the world to be pulled in. Avoid. + */ /* Note that since this routine is called prior to reading environment vars or pretty much any * other initialization, we cannot use gtm_malloc() yet so care is taken to use the real system * malloc. diff --git a/sr_port/op_tstart.c b/sr_port/op_tstart.c index f29c99d..2dc9170 100644 --- a/sr_port/op_tstart.c +++ b/sr_port/op_tstart.c @@ -315,7 +315,7 @@ void op_tstart(int implicit_flag, ...) /* value of $T when TSTART */ } else rts_error(VARLSTCNT(1) ERR_STACKCRIT); } - memcpy(msp, old_sp, top - (unsigned char *)old_sp); + memmove(msp, old_sp, top - (unsigned char *)old_sp); /* Shift stack w/possible overlapping ranges */ mv_st_ent = (mv_stent *)(top - shift_size); mv_st_ent->mv_st_type = MVST_TPHOLD; ADJUST_FRAME_POINTER(frame_pointer, shift_size); diff --git a/sr_port/symbinit.c b/sr_port/symbinit.c index f32f232..0eaa87c 100644 --- a/sr_port/symbinit.c +++ b/sr_port/symbinit.c @@ -1,6 +1,6 @@ /**************************************************************** * * - * Copyright 2001, 2011 Fidelity Information Services, Inc * + * Copyright 2001, 2012 Fidelity Information Services, Inc * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * @@ -26,6 +26,9 @@ GBLREF mv_stent *mv_chain; GBLREF unsigned char *stackbase, *stacktop, *msp, *stackwarn; GBLREF stack_frame *frame_pointer; +error_def(ERR_STACKOFLOW); +error_def(ERR_STACKCRIT); + int4 symbinit(void) { unsigned char *msp_save; @@ -35,8 +38,6 @@ int4 symbinit(void) int4 shift_size, ls_size, temp_size; int size; unsigned char *old_sp, *top, *l_syms; - error_def(ERR_STACKOFLOW); - error_def(ERR_STACKCRIT); if (frame_pointer->type & SFT_COUNT) { @@ -91,7 +92,7 @@ int4 symbinit(void) } else rts_error(VARLSTCNT(1) ERR_STACKCRIT); } - memcpy(msp, old_sp, top - (unsigned char *)old_sp); + memmove(msp, old_sp, top - (unsigned char *)old_sp); /* Shift stack w/possible overlapping range */ if (shift_size > MVST_STAB_SIZE) fp_prev->l_symtab = (ht_ent_mname **)(top - shift_size); l_syms = (unsigned char *)fp_prev->l_symtab; diff --git a/sr_port_cm/gvcmz_doop.c b/sr_port_cm/gvcmz_doop.c index ba48235..ccd4235 100644 --- a/sr_port_cm/gvcmz_doop.c +++ b/sr_port_cm/gvcmz_doop.c @@ -1,6 +1,6 @@ /**************************************************************** * * - * Copyright 2001, 2009 Fidelity Information Services, Inc * + * Copyright 2001, 2012 Fidelity Information Services, Inc * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * @@ -32,6 +32,11 @@ GBLREF gv_key *gv_altkey; GBLREF spdesc stringpool; GBLREF bool undef_inhibit; +error_def(ERR_BADSRVRNETMSG); +error_def(ERR_UNIMPLOP); +error_def(ERR_TEXT); +error_def(ERR_GVIS); + void gvcmz_doop(unsigned char query_code, unsigned char reply_code, mval *v) { unsigned char *ptr; @@ -41,11 +46,6 @@ void gvcmz_doop(unsigned char query_code, unsigned char reply_code, mval *v) unsigned char buff[MAX_ZWR_KEY_SZ], *end; unsigned short srv_buff_size; - error_def(ERR_BADSRVRNETMSG); - error_def(ERR_UNIMPLOP); - error_def(ERR_TEXT); - error_def(ERR_GVIS); - lnk = gv_cur_region->dyn.addr->cm_blk; if (!((link_info *)lnk->usr)->server_supports_long_names && (PRE_V5_MAX_MIDENT_LEN < strlen((char *)gv_currkey->base))) { @@ -218,7 +218,7 @@ void gvcmz_doop(unsigned char query_code, unsigned char reply_code, mval *v) v->mvtype = MV_STR; v->str.len = len; v->str.addr = (char *)stringpool.free; /* we don't need the reply msg anymore, can overwrite reply */ - memcpy(v->str.addr, ptr, len); /* so that we don't leave a gaping hole in the stringpool */ + memmove(v->str.addr, ptr, len); /* so that we don't leave a gaping hole in the stringpool */ stringpool.free += len; return; } diff --git a/sr_unix/gtm.c b/sr_unix/gtm.c index 0a4d696..d7b164c 100644 --- a/sr_unix/gtm.c +++ b/sr_unix/gtm.c @@ -1,6 +1,6 @@ /**************************************************************** * * - * Copyright 2001, 2010 Fidelity Information Services, Inc * + * Copyright 2001, 2012 Fidelity Information Services, Inc * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * @@ -10,6 +10,10 @@ ****************************************************************/ #include "mdef.h" + +#define BYPASS_MEMCPY_OVERRIDE /* Signals gtm_string.h to not override memcpy(). This causes linking problems when libmumps.a + * is not available. + */ #include "main_pragma.h" #undef UNIX /* Causes non-GTM-runtime routines (libgtmshr) to be used since libgtmshr is not yet available */ @@ -20,7 +24,6 @@ #include "gtm_stdlib.h" #include "gtm_limits.h" #include - #ifdef __osf__ /* On OSF/1 (Digital Unix), pointers are 64 bits wide; the only exception to this is C programs for which one may * specify compiler and link editor options in order to use (and allocate) 32-bit pointers. However, since C is diff --git a/sr_unix/gtmsecshr_wrapper.c b/sr_unix/gtmsecshr_wrapper.c index 418287b..7e1cfc0 100644 --- a/sr_unix/gtmsecshr_wrapper.c +++ b/sr_unix/gtmsecshr_wrapper.c @@ -10,7 +10,10 @@ ****************************************************************/ #include "mdef.h" -/* We want system malloc, not gtm_malloc (which comes from mdef.h --> mdefsp.h). Since gtmsecshr_wrapper runs as root, +#define BYPASS_MEMCPY_OVERRIDE /* Signals gtm_string.h to not override memcpy(). This causes linking problems when libmumps.a + * is not available. + */ +#/* We want system malloc, not gtm_malloc (which comes from mdef.h --> mdefsp.h). Since gtmsecshr_wrapper runs as root, * using the system malloc will increase security over using gtm_malloc. Additionally, by not using gtm_malloc, we * are reducing code bloat. */ @@ -26,7 +29,6 @@ #include #endif #include - #define ROOTUID 0 #define ROOTGID 0 diff --git a/sr_unix_cm/gtcm_pkdisp.c b/sr_unix_cm/gtcm_pkdisp.c index 9273feb..84d3828 100644 --- a/sr_unix_cm/gtcm_pkdisp.c +++ b/sr_unix_cm/gtcm_pkdisp.c @@ -1,6 +1,6 @@ /**************************************************************** * * - * Copyright 2001, 2011 Fidelity Information Services, Inc * + * Copyright 2001, 2012 Fidelity Information Services, Inc * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * @@ -10,7 +10,9 @@ ****************************************************************/ #include "mdef.h" - +#define BYPASS_MEMCPY_OVERRIDE /* Signals gtm_string.h to not override memcpy(). The assert in the called routine ends + * up pulling in the world in various executables so bypass for this routine. + */ #include "gtm_string.h" #undef UNIX /* Cause non-GTM-runtime routines to be used since this is a standalone module */ #include "gtm_stdio.h" From 0246551a5656e070139ceea450ab6a6d48444b85 Mon Sep 17 00:00:00 2001 From: Amul Shah Date: Sun, 1 Jul 2012 22:36:30 -0400 Subject: [PATCH 16/23] ENH: sources are not identical to the original V5.5-000 release --- sr_linux/release_name.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sr_linux/release_name.h b/sr_linux/release_name.h index d15474f..d810239 100644 --- a/sr_linux/release_name.h +++ b/sr_linux/release_name.h @@ -10,15 +10,15 @@ ****************************************************************/ #ifdef __CYGWIN__ -#define GTM_RELEASE_NAME "GT.M V5.5-000 CYGWIN x86" +#define GTM_RELEASE_NAME "GT.M V5.5-000A CYGWIN x86" #elif defined(__ia64) -#define GTM_RELEASE_NAME "GT.M V5.5-000 Linux IA64" +#define GTM_RELEASE_NAME "GT.M V5.5-000A Linux IA64" #elif defined(__x86_64__) -#define GTM_RELEASE_NAME "GT.M V5.5-000 Linux x86_64" +#define GTM_RELEASE_NAME "GT.M V5.5-000A Linux x86_64" #elif defined(__s390__) -#define GTM_RELEASE_NAME "GT.M V5.5-000 Linux S390X" +#define GTM_RELEASE_NAME "GT.M V5.5-000A Linux S390X" #else -#define GTM_RELEASE_NAME "GT.M V5.5-000 Linux x86" +#define GTM_RELEASE_NAME "GT.M V5.5-000A Linux x86" #endif #define GTM_PRODUCT "GT.M" #define GTM_VERSION "V5.5" From ab79a1f44b5fc40ce58b8d6a3809ea67a0bf6631 Mon Sep 17 00:00:00 2001 From: Amul Shah Date: Mon, 2 Jul 2012 09:47:25 -0400 Subject: [PATCH 17/23] ENH: missed two files --- sr_port/gtm_memcpy_validate_and_execute.c | 35 +++++++++++++++++++++++ sr_port/gtm_memcpy_validate_and_execute.h | 17 +++++++++++ 2 files changed, 52 insertions(+) create mode 100644 sr_port/gtm_memcpy_validate_and_execute.c create mode 100644 sr_port/gtm_memcpy_validate_and_execute.h diff --git a/sr_port/gtm_memcpy_validate_and_execute.c b/sr_port/gtm_memcpy_validate_and_execute.c new file mode 100644 index 0000000..670634a --- /dev/null +++ b/sr_port/gtm_memcpy_validate_and_execute.c @@ -0,0 +1,35 @@ +/**************************************************************** + * * + * Copyright 2012 Fidelity Information Services, Inc * + * * + * This source code contains the intellectual property * + * of its copyright holder(s), and is made available * + * under a license. If you do not know the terms of * + * the license, please stop and do not read further. * + * * + ****************************************************************/ + +#include "mdef.h" +#define BYPASS_MEMCPY_OVERRIDE /* Want to run original system memcpy() here */ +#include "gtm_string.h" + +#include "gtm_memcpy_validate_and_execute.h" + +#ifdef DEBUG /* Is only a debugging routine - nothing to see here for a production build - move along */ + +/* Identify memcpy() invocations that should be memmove() instead. If this routine assert fails, the arguments + * overlap so should be converted to memmove(). One exception to that rule which is currently bypassed is when + * source and target are equal. There are no known implementation of memcpy() that would break in such a + * condition so since at least two of these currently exist in GT.M (one in gtmcrypt.h on UNIX and one in + * mu_cre_file on VMS), this routine does not cause an assert fail in that case. + */ +void *gtm_memcpy_validate_and_execute(void *target, const void *src, size_t len) +{ + if (target == src) /* Allow special case to go through but avoid actual memcpy() call */ + return target; + assert(((char *)(target) > (char *)(src)) + ? ((char *)(target) >= ((char *)(src) + (len))) + : ((char *)(src) >= ((char *)(target) + (len)))); + return memcpy(target, src, len); +} +#endif diff --git a/sr_port/gtm_memcpy_validate_and_execute.h b/sr_port/gtm_memcpy_validate_and_execute.h new file mode 100644 index 0000000..0de2e70 --- /dev/null +++ b/sr_port/gtm_memcpy_validate_and_execute.h @@ -0,0 +1,17 @@ +/**************************************************************** + * * + * Copyright 2012 Fidelity Information Services, Inc * + * * + * This source code contains the intellectual property * + * of its copyright holder(s), and is made available * + * under a license. If you do not know the terms of * + * the license, please stop and do not read further. * + * * + ****************************************************************/ + +#ifndef GTM_MVAE_INCLUDED +#define GTM_MVAE_INCLUDED + +void *gtm_memcpy_validate_and_execute(void *target, const void *src, size_t len); + +#endif From fcf79ab740bd13c2e100c77353e31303ad41df85 Mon Sep 17 00:00:00 2001 From: Amul Shah Date: Tue, 3 Jul 2012 13:16:35 -0400 Subject: [PATCH 18/23] ENH: add shebang to the beginning of scripts --- sr_unix/gtmstart.gtc | 2 +- sr_unix/gtmstop.gtc | 1 + sr_unix_cm/gtcm_run.gtc | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sr_unix/gtmstart.gtc b/sr_unix/gtmstart.gtc index ed1cc35..c188096 100644 --- a/sr_unix/gtmstart.gtc +++ b/sr_unix/gtmstart.gtc @@ -1,4 +1,4 @@ -: +#!/bin/sh ################################################################# # # # Copyright 2001, 2005 Fidelity Information Services, Inc # diff --git a/sr_unix/gtmstop.gtc b/sr_unix/gtmstop.gtc index a5a132f..75e522b 100644 --- a/sr_unix/gtmstop.gtc +++ b/sr_unix/gtmstop.gtc @@ -1,3 +1,4 @@ +#!/bin/sh ################################################################# # # # Copyright 2001, 2005 Fidelity Information Services, Inc # diff --git a/sr_unix_cm/gtcm_run.gtc b/sr_unix_cm/gtcm_run.gtc index c89a390..0a6f553 100644 --- a/sr_unix_cm/gtcm_run.gtc +++ b/sr_unix_cm/gtcm_run.gtc @@ -1,3 +1,4 @@ +#!/bin/sh ################################################################# # # # Copyright 2001, 2005 Fidelity Information Services, Inc # From 57f2d896697fb9200f5973f2a395372dc8810568 Mon Sep 17 00:00:00 2001 From: Amul Shah Date: Tue, 3 Jul 2012 16:48:55 -0400 Subject: [PATCH 19/23] BUG: GT.CM servers are built with_export --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e477148..3392654 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,11 +280,14 @@ target_link_libraries(lke liblke libmumps libgnpclient libmumps libgnpclient lib add_executable(gtcm_server ${gtcm_server_SOURCES}) target_link_libraries(gtcm_server libgtcm libmumps libstub) +list(APPEND with_export gtcm_server) add_executable(gtcm_gnp_server ${gtcm_gnp_server_SOURCES}) target_link_libraries(gtcm_gnp_server libgnpserver liblke libmumps libcmisockettcp libstub) +list(APPEND with_export gtcm_gnp_server) add_executable(gtcm_play ${gtcm_play_SOURCES}) target_link_libraries(gtcm_play libgtcm libmumps libstub) +list(APPEND with_export gtcm_play) add_executable(gtcm_pkdisp ${gtcm_pkdisp_SOURCES}) target_link_libraries(gtcm_pkdisp libgtcm libmumps libstub) From 71aca86507d2f936291cdbfde1e6c6c72f5f94fb Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 4 Oct 2012 07:13:38 -0400 Subject: [PATCH 20/23] Move generation of files needing gtm 'mumps' up --- CMakeLists.txt | 124 +++++++++++++++++++++++++------------------------ 1 file changed, 63 insertions(+), 61 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3392654..5b74ed3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,6 +180,69 @@ foreach(d ${gt_src_list}) endforeach() endforeach() +#----------------------------------------------------------------------------- +# Generate files depending on gtm + +# Copy generation routines to a working directory. +foreach(m chk2lev.m chkop.m gendash.m genout.m loadop.m loadvx.m msg.m tttgen.m tttscan.m) + add_custom_command( + OUTPUT gen/${m} + DEPENDS ${GTM_SOURCE_DIR}/sr_port/${m} + COMMAND ${CMAKE_COMMAND} -E copy ${GTM_SOURCE_DIR}/sr_port/${m} ${GTM_BINARY_DIR}/gen/${m} + ) +endforeach() + +set(mumps_ttt_args -run tttgen + ${GTM_SOURCE_DIR}/sr_unix/ttt.txt + ${GTM_SOURCE_DIR}/sr_port/opcode_def.h + ${GTM_SOURCE_DIR}/sr_port/vxi.h + ) +add_custom_command( + OUTPUT gen/ttt.c + DEPENDS ${GTM_SOURCE_DIR}/sr_unix/ttt.txt + gen/chk2lev.m gen/chkop.m gen/gendash.m gen/genout.m gen/loadop.m + gen/loadvx.m gen/tttgen.m gen/tttscan.m + ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake mumps + WORKING_DIRECTORY ${GTM_BINARY_DIR}/gen + COMMAND ${CMAKE_COMMAND} + -D gtm_dist=${GTM_BINARY_DIR} + -D gtmroutines=. + -D mumps=$ + -D "args=${mumps_ttt_args}" + -D output_file=ttt.log + -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake + VERBATIM + ) +list(APPEND gen_bootstrap_files gen/ttt.c) + +foreach(msg + sr_port/cmerrors.msg + sr_port/gdeerrors.msg + sr_port/merrors.msg + sr_unix_gnp/cmierrors.msg + ) + get_filename_component(name ${msg} NAME_WE) + set(mumps_msg_args -run msg ${GTM_SOURCE_DIR}/${msg} unix) + add_custom_command( + OUTPUT gen/${name}_ctl.c + DEPENDS gen/msg.m ${GTM_SOURCE_DIR}/${msg} + ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake mumps + WORKING_DIRECTORY ${GTM_BINARY_DIR}/gen + COMMAND ${CMAKE_COMMAND} + -D gtm_dist=${GTM_BINARY_DIR} + -D gtmroutines=. + -D mumps=$ + -D "args=${mumps_msg_args}" + -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake + VERBATIM + ) + list(APPEND gen_bootstrap_files gen/${name}_ctl.c) +endforeach() + +add_custom_target(gen_bootstrap ALL DEPENDS ${gen_bootstrap_files}) + +#----------------------------------------------------------------------------- + if(gen_xfer_desc) list(SORT sources_used) set(CMAKE_CONFIGURABLE_FILE_CONTENT "") @@ -621,64 +684,3 @@ install(FILES COPYING DESTINATION ${GTM_INSTALL_DIR}) install(FILES sr_port/README.txt DESTINATION ${GTM_INSTALL_DIR}) add_custom_target(place_files ALL DEPENDS ${files_to_place}) - -#----------------------------------------------------------------------------- -# Generate files depending on gtm - -# Copy generation routines to a working directory. -foreach(m chk2lev.m chkop.m gendash.m genout.m loadop.m loadvx.m msg.m tttgen.m tttscan.m) - add_custom_command( - OUTPUT gen/${m} - DEPENDS ${GTM_SOURCE_DIR}/sr_port/${m} - COMMAND ${CMAKE_COMMAND} -E copy ${GTM_SOURCE_DIR}/sr_port/${m} ${GTM_BINARY_DIR}/gen/${m} - ) -endforeach() - -set(mumps_ttt_args -run tttgen - ${GTM_SOURCE_DIR}/sr_unix/ttt.txt - ${GTM_SOURCE_DIR}/sr_port/opcode_def.h - ${GTM_SOURCE_DIR}/sr_port/vxi.h - ) -add_custom_command( - OUTPUT gen/ttt.c - DEPENDS ${GTM_SOURCE_DIR}/sr_unix/ttt.txt - gen/chk2lev.m gen/chkop.m gen/gendash.m gen/genout.m gen/loadop.m - gen/loadvx.m gen/tttgen.m gen/tttscan.m - ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake mumps - WORKING_DIRECTORY ${GTM_BINARY_DIR}/gen - COMMAND ${CMAKE_COMMAND} - -D gtm_dist=${GTM_BINARY_DIR} - -D gtmroutines=. - -D mumps=$ - -D "args=${mumps_ttt_args}" - -D output_file=ttt.log - -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake - VERBATIM - ) -list(APPEND gen_bootstrap_files gen/ttt.c) - -foreach(msg - sr_port/cmerrors.msg - sr_port/gdeerrors.msg - sr_port/merrors.msg - sr_unix_gnp/cmierrors.msg - ) - get_filename_component(name ${msg} NAME_WE) - set(mumps_msg_args -run msg ${GTM_SOURCE_DIR}/${msg} unix) - add_custom_command( - OUTPUT gen/${name}_ctl.c - DEPENDS gen/msg.m ${GTM_SOURCE_DIR}/${msg} - ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake mumps - WORKING_DIRECTORY ${GTM_BINARY_DIR}/gen - COMMAND ${CMAKE_COMMAND} - -D gtm_dist=${GTM_BINARY_DIR} - -D gtmroutines=. - -D mumps=$ - -D "args=${mumps_msg_args}" - -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake - VERBATIM - ) - list(APPEND gen_bootstrap_files gen/${name}_ctl.c) -endforeach() - -add_custom_target(gen_bootstrap ALL DEPENDS ${gen_bootstrap_files}) From 1978075e2941ebb7f1e8b2edd83119700a96d376 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 4 Oct 2012 07:35:24 -0400 Subject: [PATCH 21/23] Generation of merrors_ctl.c also produces merrors_ansi.h --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b74ed3..4bb6df5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,6 +215,7 @@ add_custom_command( ) list(APPEND gen_bootstrap_files gen/ttt.c) +set(gen_merrors_extra gen/merrors_ansi.h) foreach(msg sr_port/cmerrors.msg sr_port/gdeerrors.msg @@ -223,8 +224,9 @@ foreach(msg ) get_filename_component(name ${msg} NAME_WE) set(mumps_msg_args -run msg ${GTM_SOURCE_DIR}/${msg} unix) + set(outputs gen/${name}_ctl.c ${gen_${name}_extra}) add_custom_command( - OUTPUT gen/${name}_ctl.c + OUTPUT ${outputs} DEPENDS gen/msg.m ${GTM_SOURCE_DIR}/${msg} ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake mumps WORKING_DIRECTORY ${GTM_BINARY_DIR}/gen @@ -236,7 +238,7 @@ foreach(msg -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake VERBATIM ) - list(APPEND gen_bootstrap_files gen/${name}_ctl.c) + list(APPEND gen_bootstrap_files ${outputs}) endforeach() add_custom_target(gen_bootstrap ALL DEPENDS ${gen_bootstrap_files}) From c84d7bef82f16f7f080ab9026f355f544fa68b87 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 4 Oct 2012 08:19:45 -0400 Subject: [PATCH 22/23] Pre-compute gt_src_list entry directories and their contents This will allow the list to contain locations other than the source tree. --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bb6df5..dd3550b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,10 +80,15 @@ list(APPEND gt_src_list sr_port_cm sr_port ) +foreach(d ${gt_src_list}) + set(source_dir_${d} ${GTM_SOURCE_DIR}/${d}) + file(GLOB sources_${d} RELATIVE ${source_dir_${d}} + ${d}/*.c ${d}/*.s ${d}/*.si) +endforeach() set(includes) foreach(d ${gt_src_list}) - list(APPEND includes ${GTM_SOURCE_DIR}/${d}) + list(APPEND includes ${source_dir_${d}}) endforeach() include_directories(${includes}) include_directories(${GTM_BINARY_DIR}) @@ -91,7 +96,7 @@ include_directories(${GTM_BINARY_DIR}) function(select_file src_var name) set(found "") foreach(d ${gt_src_list}) - set(src "${GTM_SOURCE_DIR}/${d}/${name}") + set(src "${source_dir_${d}}/${name}") if(EXISTS "${src}") set(found "${src}") break() @@ -103,11 +108,6 @@ function(select_file src_var name) set("${src_var}" "${found}" PARENT_SCOPE) endfunction() -foreach(d ${gt_src_list}) - file(GLOB sources_${d} RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${d} - ${d}/*.c ${d}/*.s ${d}/*.si) -endforeach() - set(sources_used "") macro(set_source_list target) foreach(name ${ARGN}) @@ -116,7 +116,7 @@ macro(set_source_list target) if(";${sources_${d}};" MATCHES ";(${name}\\.(c|s|si));") set(src ${d}/${CMAKE_MATCH_1}) set("source_used_${CMAKE_MATCH_1}" 1) - list(APPEND sources_used ${GTM_SOURCE_DIR}/${src}) + list(APPEND sources_used ${source_dir_${d}}/${CMAKE_MATCH_1}) break() endif() endforeach() @@ -175,7 +175,7 @@ foreach(d ${gt_src_list}) if(NOT source_used_${s}) list(APPEND libmumps_SOURCES ${d}/${s}) set(source_used_${s} 1) - list(APPEND sources_used ${GTM_SOURCE_DIR}/${d}/${s}) + list(APPEND sources_used ${source_dir_${d}}/${s}) endif() endforeach() endforeach() From 487c514ebbc1ad68c16756e23dbbb33c6786caad Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 4 Oct 2012 08:29:00 -0400 Subject: [PATCH 23/23] Optionally generate bootstrap sources with existing mumps --- CMakeLists.txt | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd3550b..a29f8e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,24 @@ else() set(arch "x86_64") endif() +# Choose where to get bootstrap sources. +set(GTM_DIST "" CACHE PATH "Existing GT.M Distribution") +if(GTM_DIST) + # Bootstrap using already-installed mumps. + message(STATUS "Using existing gtm_dist=${GTM_DIST} to generate sources.") + set(gen_bootstrap 1) + set(gen_bootstrap_dist "${GTM_DIST}") + set(gen_bootstrap_mumps "${GTM_DIST}/mumps") + set(gen_bootstrap_depend "${gen_bootstrap_mumps}") +else() + # Bootstrap using pre-generated bootstrap sources. + # We generate them again only for comparison. + set(gen_bootstrap 0) + set(gen_bootstrap_dist "${GTM_BINARY_DIR}") + set(gen_bootstrap_mumps "$") + set(gen_bootstrap_depend mumps) +endif() + set(GTM_INSTALL_DIR lib/fis-gtm/${version}_${arch} CACHE STRING "Install directory (under CMAKE_PREFIX_PATH if relative)") if(NOT GTM_INSTALL_DIR) set(GTM_INSTALL_DIR .) @@ -85,6 +103,13 @@ foreach(d ${gt_src_list}) file(GLOB sources_${d} RELATIVE ${source_dir_${d}} ${d}/*.c ${d}/*.s ${d}/*.si) endforeach() +if(gen_bootstrap) + # Prefer generated sources over all other locations. + set(gt_src_list gen ${gt_src_list}) + set(source_dir_gen ${GTM_BINARY_DIR}/gen) + # Hard-code list since we cannot glob files that do not exist. + set(sources_gen cmerrors_ctl.c cmierrors_ctl.c gdeerrors_ctl.c merrors_ctl.c ttt.c) +endif() set(includes) foreach(d ${gt_src_list}) @@ -202,12 +227,12 @@ add_custom_command( DEPENDS ${GTM_SOURCE_DIR}/sr_unix/ttt.txt gen/chk2lev.m gen/chkop.m gen/gendash.m gen/genout.m gen/loadop.m gen/loadvx.m gen/tttgen.m gen/tttscan.m - ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake mumps + ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake ${gen_bootstrap_depend} WORKING_DIRECTORY ${GTM_BINARY_DIR}/gen COMMAND ${CMAKE_COMMAND} - -D gtm_dist=${GTM_BINARY_DIR} + -D gtm_dist=${gen_bootstrap_dist} -D gtmroutines=. - -D mumps=$ + -D mumps=${gen_bootstrap_mumps} -D "args=${mumps_ttt_args}" -D output_file=ttt.log -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake @@ -228,12 +253,12 @@ foreach(msg add_custom_command( OUTPUT ${outputs} DEPENDS gen/msg.m ${GTM_SOURCE_DIR}/${msg} - ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake mumps + ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake ${gen_bootstrap_depend} WORKING_DIRECTORY ${GTM_BINARY_DIR}/gen COMMAND ${CMAKE_COMMAND} - -D gtm_dist=${GTM_BINARY_DIR} + -D gtm_dist=${gen_bootstrap_dist} -D gtmroutines=. - -D mumps=$ + -D mumps=${gen_bootstrap_mumps} -D "args=${mumps_msg_args}" -P ${GTM_SOURCE_DIR}/sr_unix/mumps.cmake VERBATIM @@ -264,6 +289,9 @@ if(gen_xfer_desc) VERBATIM ) add_custom_target(gen_xfer_desc DEPENDS xfer_desc.i) + if(gen_bootstrap) + add_dependencies(gen_xfer_desc gen_bootstrap) + endif() endif() #----------------------------------------------------------------------------- @@ -271,6 +299,8 @@ endif() add_executable(gtm_threadgbl_deftypes ${gtm_threadgbl_deftypes_SOURCES}) if(gen_xfer_desc) add_dependencies(gtm_threadgbl_deftypes gen_xfer_desc) +elseif(gen_bootstrap) + add_dependencies(gtm_threadgbl_deftypes gen_bootstrap) endif() add_custom_command(