Ticket #10476: singular-3-1-3-3.p7.diff

File singular-3-1-3-3.p7.diff, 8.4 KB (added by jdemeyer, 10 years ago)

Diff for the singular spkg. For reference / review only.

  • SPKG.txt

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1340053245 -7200
    # Node ID 8b9a7066b2afb196ef52ccda54e5a1b7b3100557
    # Parent  1275ac543b538d5c59d6a2dddc94cb2d1475b493
    Trac #10476: Add patch cntrlc.patch to disable the CTRL-C prompt
    
    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    3838   autoconf-2.68 instead of autoconf-2.13.  This fixes a build failure
    3939   on OS X 10.4 (Trac #12304).
    4040 * factory.GNUmakefile.in.patch to fix a hardcoded 'g++'.
     41 * cntrlc.patch: Implement a --cntrlc option to disable the CTRL-C prompt.
    4142
    4243Other notes
    4344 * The option '--without-dynamic-kernel' is used on *all*
     
    5455
    5556== ChangeLog ==
    5657
     58=== singular-3-1-3-3.p7 (Jeroen Demeyer, 18 June 2012) ===
     59 * #10476: Add patch cntrlc.patch to disable the CTRL-C prompt.
     60 * In spkg-install, remove distclean() step; merge clean_headers() and
     61   part of the old distclean() into remove_old_version().
     62 * Replace TABs by spaces in spkg-install.
     63
    5764=== singular-3-1-3-3.p6 (Leif Leonhardy, March 17th 2012) ===
    5865 * #12680: Fix hardcoded 'g++' (and two typos) in factory/GNUmakefile.in.
    5966
  • new file patches/cntrlc.patch

    diff --git a/patches/cntrlc.patch b/patches/cntrlc.patch
    new file mode 100644
    - +  
     1diff -ru src.orig/Singular/cntrlc.cc src/Singular/cntrlc.cc
     2--- src.orig/Singular/cntrlc.cc 2011-04-08 12:19:57.000000000 +0200
     3+++ src/Singular/cntrlc.cc      2012-06-18 17:17:43.000000000 +0200
     4@@ -73,6 +73,7 @@
     5 
     6 si_link pipeLastLink=NULL;
     7 BOOLEAN singular_in_batchmode=FALSE;
     8+int cntrlc_prompt_answer = 0;
     9 
     10 void sig_pipe_hdl(int sig)
     11 {
     12@@ -378,7 +379,7 @@
     13   #endif /* SIGIOT */
     14   #ifdef SIGXCPU
     15   si_set_signal(SIGXCPU, (void (*)(int))SIG_IGN);
     16-  #endif /* SIGIOT */
     17+  #endif /* SIGXCPU */
     18   si_set_signal(SIGINT ,sigint_handler);
     19   #if defined(HPUX_9) || defined(HPUX_10)
     20   si_set_signal(SIGCHLD, (void (*)(int))SIG_IGN);
     21@@ -401,10 +402,15 @@
     22   {
     23     int cnt=0;
     24     int c;
     25-    if(singular_in_batchmode)
     26+
     27+    if (singular_in_batchmode)
     28     {
     29       c = 'q';
     30     }
     31+    else if (cntrlc_prompt_answer)
     32+    {
     33+      c = cntrlc_prompt_answer;
     34+    }
     35     else
     36     {
     37       fprintf(stderr,"// ** Interrupt at cmd:`%s` in line:'%s'\n",
     38@@ -422,7 +428,7 @@
     39 
     40     switch(c)
     41     {
     42-      case 'q':
     43+      case 'q': case EOF:
     44                 m2_end(2);
     45       case 'r':
     46                 longjmp(si_start_jmpbuf,1);
     47@@ -432,7 +438,11 @@
     48       case 'a':
     49                 siCntrlc++;
     50       case 'c':
     51-                if (feGetOptValue(FE_OPT_EMACS) == NULL) fgetc(stdin);
     52+                if (feGetOptValue(FE_OPT_EMACS) == NULL && !cntrlc_prompt_answer)
     53+                {
     54+                  /* Read until a newline or EOF */
     55+                  while (c != EOF && c != '\n') c = fgetc(stdin);
     56+                }
     57                 si_set_signal(SIGINT ,(si_hdl_typ)sigint_handler);
     58                 return;
     59                 //siCntrlc ++;
     60diff -ru src.orig/Singular/cntrlc.h src/Singular/cntrlc.h
     61--- src.orig/Singular/cntrlc.h  2011-03-07 16:30:09.000000000 +0100
     62+++ src/Singular/cntrlc.h       2012-06-18 14:15:45.000000000 +0200
     63@@ -16,7 +16,12 @@
     64 extern BOOLEAN siCntrlc;
     65 void init_signals();
     66 
     67-extern BOOLEAN singular_in_batchmode;
     68 /* TRUE for child of a fork or started with --batch*/
     69+extern BOOLEAN singular_in_batchmode;
     70+
     71+/* If non-zero, do not prompt on SIGINT. Instead, use
     72+ * cntlr_prompt_answer as answer (this could be set to 'a' to skip the
     73+ * prompt and always assume the "abort" answer) . */
     74+extern int cntrlc_prompt_answer;
     75 
     76 #endif
     77diff -ru src.orig/Singular/feOpt.cc src/Singular/feOpt.cc
     78--- src.orig/Singular/feOpt.cc  2011-02-18 17:10:43.000000000 +0100
     79+++ src/Singular/feOpt.cc       2012-06-18 15:23:25.000000000 +0200
     80@@ -3,7 +3,7 @@
     81 ****************************************/
     82 /* $Id: feOpt.cc 13875 2011-02-18 16:10:43Z hannes $ */
     83 /*
     84-* ABSTRACT: Implementation of option buisness
     85+* ABSTRACT: Implementation of option business
     86 */
     87 
     88 #include <string.h>
     89@@ -118,6 +118,9 @@
     90   {"browser",           required_argument,  LONG_OPTION_RETURN,
     91    "BROWSER",  "Display help in BROWSER (see help.cnf)",       feOptString, 0,   0},
     92 
     93+  {"cntrlc",           optional_argument,   LONG_OPTION_RETURN,
     94+   "CHAR",     "Automatic answer for CTRL-C prompt",                   feOptString, 0,   0},
     95+
     96 #ifndef ESINGULAR
     97   {"emacs",             no_argument,        LONG_OPTION_RETURN,
     98    0,          "Set defaults for running within emacs",                feOptBool,    0,      0},
     99@@ -358,6 +361,13 @@
     100           fe_fgets_stdin=fe_fgets_dummy;
     101         return NULL;
     102 
     103+      case FE_OPT_CNTRLC:
     104+        if (feOptSpec[FE_OPT_CNTRLC].value)
     105+          cntrlc_prompt_answer = ((char*)(feOptSpec[FE_OPT_CNTRLC].value))[0];
     106+        else
     107+          cntrlc_prompt_answer = 0;
     108+        return NULL;
     109+
     110       case FE_OPT_HELP:
     111         feOptHelp(feArgv0);
     112         return NULL;
     113@@ -397,7 +407,7 @@
     114 
     115       case FE_OPT_RANDOM:
     116         siRandomStart = (unsigned int) ((unsigned long)
     117-                                         (feOptSpec[FE_OPT_RANDOM].value));
     118+                        (feOptSpec[FE_OPT_RANDOM].value));
     119         siSeed=siRandomStart;
     120 #ifdef HAVE_FACTORY
     121         factoryseed(siRandomStart);
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    9797fi
    9898   
    9999
    100 clean_headers()
    101 {
    102     rm -rf $SAGE_LOCAL/include/singular
    103 }
    104 
    105100apply_patches()
    106101{
    107     pushd $SRC
     102    cd "$SRC"
    108103
    109     patches="assert.h.diff sing_win.cc.diff Minor.h.patch os_x_ppc.patch \
    110         Singular.configure.patch make_parallel.patch Singular.Makefile.in.shared.patch \
    111         factory.GNUmakefile.in.patch"
     104    patches="assert.h.diff sing_win.cc.diff Minor.h.patch cntrlc.patch \
     105        os_x_ppc.patch Singular.configure.patch make_parallel.patch \
     106        Singular.Makefile.in.shared.patch factory.GNUmakefile.in.patch"
    112107
    113108    if [ "$UNAME" = "CYGWIN" ]; then
    114109        patches="$patches IntegerProgramming-Makefile.in.diff"
     
    125120        fi
    126121    done
    127122
    128         # Finally, copy the new src/factory/configure
    129         # We don't use patch for this, since the file is completely changed.
    130         # The .patch file would be larger than the complete patched file.
    131         cp -p ../patches/factory_configure factory/configure
    132 
    133     popd
     123    # Finally, copy the new src/factory/configure
     124    # We don't use patch for this, since the file is completely changed.
     125    # The .patch file would be larger than the complete patched file.
     126    cp -p ../patches/factory_configure factory/configure
    134127}
    135128
    136 distclean()
     129remove_old_version()
    137130{
    138     cd $SRC
    139     $MAKE distclean
    140     rm $SAGE_LOCAL/bin/Singular*
    141     find . -name *.dl_o -exec rm \{\} \;
    142     find . -name *.o -exec rm \{\} \;
    143     find . -name *.og -exec rm \{\} \;
    144     find . -name *.so -exec rm \{\} \;
    145     find . -name *.a -exec rm \{\} \;
    146     rm -f $SAGE_LOCAL/include/factory.h
    147     rm -f $SAGE_LOCAL/include/factoryconf.h
     131    rm -f "$SAGE_LOCAL"/bin/Singular*
     132    rm -f "$SAGE_LOCAL/include/factory.h"
     133    rm -f "$SAGE_LOCAL/include/factoryconf.h"
     134    rm -rf "$SAGE_LOCAL/include/singular"
    148135}
    149136
    150137config()
    151138{
    152     cd $SRC
     139    cd "$SRC"
    153140    ./configure --prefix="$SAGE_LOCAL" \
    154141                --exec-prefix="$SAGE_LOCAL" \
    155142                --bindir="$SAGE_LOCAL"/bin \
     
    181168
    182169build_singular()
    183170{
    184     cd $SRC
     171    cd "$SRC"
    185172
    186173    # Build Singular + rest
    187174    $MAKE
     
    201188        fi
    202189    fi
    203190
    204     cd $SRC
     191    cd "$SRC"
    205192    if [ $? -ne 0 ]; then
    206193        echo "Unable to change to directory $SRC"
    207194        exit 1
     
    248235
    249236build_libsingular()
    250237{
    251     cd $SRC
     238    cd "$SRC"
    252239    if [ $? -ne 0 ]; then
    253240        echo "Unable to change to directory $SRC"
    254241        exit 1
     
    276263
    277264build_factory()
    278265{
    279     cd $SRC/factory
     266    cd "$SRC/factory"
    280267
    281268    $MAKE distclean
    282269
     
    318305
    319306build_libfac()
    320307{
    321     cd $SRC/libfac
     308    cd "$SRC/libfac"
    322309    if [ $? -ne 0 ]; then
    323310        echo "Error changing to directory $SRC/libfac"
    324311        exit 1
     
    372359
    373360build()
    374361{
    375     for i in clean_headers apply_patches distclean config build_singular build_libsingular build_factory build_libfac create_singular_script install_docs ; do
     362    for i in apply_patches remove_old_version config \
     363        build_singular build_libsingular build_factory build_libfac \
     364        create_singular_script install_docs ; do
    376365    $i
    377366    if [ $? -ne 0 ]; then
    378367        echo "Error building Singular at stage '$i'."