[gpsim] Two small fixes

Lubomir Rintel lkundrak at fedoraproject.org
Tue Nov 11 13:09:05 UTC 2014


commit 3da834daf3128a64c092fcec6e619369b1f28101
Author: Lubomir Rintel <lkundrak at v3.sk>
Date:   Tue Oct 28 17:49:54 2014 +0100

    Two small fixes
    
    - Fix CTRL+C crash
    - Fix command line option parsing

 gpsim-0.27.0-break.patch   |   27 ++
 gpsim-0.27.0-cmdline.patch |  617 ++++++++++++++++++++++++++++++++++++++++++++
 gpsim.spec                 |   14 +-
 3 files changed, 657 insertions(+), 1 deletions(-)
---
diff --git a/gpsim-0.27.0-break.patch b/gpsim-0.27.0-break.patch
new file mode 100644
index 0000000..ce4860f
--- /dev/null
+++ b/gpsim-0.27.0-break.patch
@@ -0,0 +1,27 @@
+From 6ec1e6af69ec7d71da81d133bb2a9c2977e16647 Mon Sep 17 00:00:00 2001
+From: Lubomir Rintel <lkundrak at v3.sk>
+Date: Tue, 28 Oct 2014 11:49:25 +0100
+Subject: [PATCH] Don't crash on CTRL+C in console if the simulation is not
+ running
+
+---
+ src/sim_context.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/sim_context.cc b/src/sim_context.cc
+index c4b8373..9276bd4 100644
+--- a/src/sim_context.cc
++++ b/src/sim_context.cc
+@@ -315,7 +315,8 @@ void CSimulationContext::NotifyUserCanceled() {
+     m_pbUserCanceled = NULL;
+     return;
+   }
+-  if(CSimulationContext::GetContext()->GetActiveCPU()->simulation_mode
++  if(CSimulationContext::GetContext()->GetActiveCPU() &&
++     CSimulationContext::GetContext()->GetActiveCPU()->simulation_mode
+     == eSM_RUNNING) {
+     // If we get a CTRL->C while processing a command file
+     // we should probably stop the command file processing.
+-- 
+2.1.0
+
diff --git a/gpsim-0.27.0-cmdline.patch b/gpsim-0.27.0-cmdline.patch
new file mode 100644
index 0000000..74a4bfb
--- /dev/null
+++ b/gpsim-0.27.0-cmdline.patch
@@ -0,0 +1,617 @@
+Fix command line parsing
+
+"gpsim -p p12f675 file.hex" did ignore the arguments.
+
+Three patches cherry-picked from development trunk fix it. The second patch 
+fixes the actual issue, while the first and the last fix up the compilation.
+
+borutr (3):
+      * gpsim/main.h.in: added to source control
+      * gpsim/main.cc, gpsim/Makefile.am, set_cl_revision.sh:       fixed mess with --help and --version commnd line options,       show svn revision number in --version
+      - reintroduced gpsim_version()
+
+
+From dd2bd633fd3fe936ebeed3ce804fbe7aa1fa5294 Mon Sep 17 00:00:00 2001
+From: borutr <borutr at c0b0687f-f210-0410-a348-de8ada4243c3>
+Date: Sat, 26 Oct 2013 06:48:14 +0000
+Subject: [PATCH 1/3] * gpsim/main.h.in: added to source control
+
+git-svn-id: svn://svn.code.sf.net/p/gpsim/code/trunk@2251 c0b0687f-f210-0410-a348-de8ada4243c3
+
+Conflicts:
+	ChangeLog
+---
+ ChangeLog        |  3 +++
+ gpsim/gpsim.h.in | 27 +++++++++++++++++++++++++++
+ 2 files changed, 30 insertions(+)
+ create mode 100644 gpsim/gpsim.h.in
+
+diff --git a/ChangeLog b/ChangeLog
+index 580a770..192f51d 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,6 @@
++2013-10-26 Borut Razem <borutr at users.sourceforge.net>
++	* gpsim/main.h.in: added to source control
++
+ 2013-09-02 Roy Rankin <rrankin at ihug.com.au>
+ 	* configure.ac: Version 0.27.0
+ 	* ANNOUNCE: 0.27.0 release highlights
+diff --git a/gpsim/gpsim.h.in b/gpsim/gpsim.h.in
+new file mode 100644
+index 0000000..ac10eb9
+--- /dev/null
++++ b/gpsim/gpsim.h.in
+@@ -0,0 +1,27 @@
++/* Common definitions for gpsim
++   Copyright (C) 2013
++   Borut Razem
++
++This file is part of gpsim.
++
++gpsim is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++gpsim is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with gpsim; see the file COPYING.  If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA.  */
++
++#ifndef __GPSIM_H__
++#define __GPSIM_H__
++
++#define GPSIM_VERSION_STRING ("gpsim-" VERSION " #" @REVISION@ " (" __DATE__ ")")
++
++#endif
+-- 
+2.1.0
+
+From d3f144e559f93c5f01f320bbed58222382eede35 Mon Sep 17 00:00:00 2001
+From: borutr <borutr at c0b0687f-f210-0410-a348-de8ada4243c3>
+Date: Tue, 22 Oct 2013 12:43:56 +0000
+Subject: [PATCH 2/3] * gpsim/main.cc, gpsim/Makefile.am, set_cl_revision.sh:  
+ fixed mess with --help and --version commnd line options,   show svn revision
+ number in --version
+
+git-svn-id: svn://svn.code.sf.net/p/gpsim/code/trunk@2249 c0b0687f-f210-0410-a348-de8ada4243c3
+
+Conflicts:
+	ChangeLog
+---
+ ChangeLog          |   5 ++
+ get_cl_revision.sh |  43 ++++++++++++++
+ gpsim/Makefile.am  |  11 +++-
+ gpsim/main.cc      | 164 +++++++++++++++++++++--------------------------------
+ 4 files changed, 122 insertions(+), 101 deletions(-)
+ create mode 100755 get_cl_revision.sh
+
+diff --git a/ChangeLog b/ChangeLog
+index 192f51d..f88a139 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++2013-10-22 Borut Razem <borutr at users.sourceforge.net>
++	* gpsim/main.cc, gpsim/Makefile.am, set_cl_revision.sh:
++	  fixed mess with --help and --version commnd line options,
++	  show svn revision number in --version
++
+ 2013-10-26 Borut Razem <borutr at users.sourceforge.net>
+ 	* gpsim/main.h.in: added to source control
+ 
+diff --git a/get_cl_revision.sh b/get_cl_revision.sh
+new file mode 100755
+index 0000000..07d088b
+--- /dev/null
++++ b/get_cl_revision.sh
+@@ -0,0 +1,43 @@
++# get_cl_revision.sh
++#
++# Extraxts the source control revision number from the ChangeLog file.
++# the $Revision$ keyword should be in the last line of the file
++
++VERSION=1.0
++AS_STRING=0
++
++usage ()
++{
++  echo "usage: $0 [options] <ChangeLog_file_name>"
++  echo "options:"
++  echo "  -s, --string          return the revision number as double quoted string"
++  echo "  -V, --version         output version information and exit"
++  echo "  -h, --help            display this help and exit"
++  echo "arguments:"
++  echo "  <ChangeLog_file_name> ChangeLog file name"
++}
++
++while true
++do
++  case "$1" in
++    -s|--string) AS_STRING=1; shift;;
++    -h|--help) usage; exit 0;;
++    -V|--version) echo $(basename $0) $VERSION; exit 0;;
++    --) shift; break;;
++    -*|--*) echo "unknown option $1"; usage; exit 1;;
++    ''|*) break;;
++  esac
++done
++
++if [ "$#" != 1 ]
++then
++  echo "too many arguments"; usage; exit 1;
++else
++  REV=$(expr "$(tail -1 $1)" : '\$Revision: *\([0-9]*\) *\$') || REV=0
++  if [ "$AS_STRING" != 0 ]
++  then
++    echo "\"$REV\""
++  else
++    echo $REV
++  fi
++fi
+diff --git a/gpsim/Makefile.am b/gpsim/Makefile.am
+index 5e56e7a..4c1c978 100644
+--- a/gpsim/Makefile.am
++++ b/gpsim/Makefile.am
+@@ -6,11 +6,20 @@ AM_CPPFLAGS = @X_CFLAGS@ @Y_CFLAGS@
+ 
+ bin_PROGRAMS = gpsim
+ 
+-gpsim_SOURCES = main.cc
++gpsim_SOURCES = main.cc \
++	gpsim.h.in
+ 
+ #gpsim_LDFLAGS =  $(shell gtk-config --cflags)
+ gpsim_LDADD = ../src/libgpsim.la ../cli/libgpsimcli.la ../gui/libgpsimgui.la \
+   ../eXdbm/libgpsim_eXdbm.la @GTK@ @GDK@ @GLIB@ -lstdc++ -lpopt @LIBDL@ \
+   @X_LDFLAGS@ @Y_LDFLAGS@ @LIBREADLINE@
+ 
++# Make sure we have parse.h when compiling other sources
++BUILT_SOURCES = gpsim.h
++
++CLEANFILES = gpsim.h
++
+ EXTRA_DIST = makefile.mingw
++
++gpsim.h: gpsim.h.in
++	sed -e "s/@REVISION@/$$(${top_srcdir}\/get_cl_revision.sh -s ${top_srcdir}\/ChangeLog)/g" "$<" > "$@"
+diff --git a/gpsim/main.cc b/gpsim/main.cc
+index ba89961..e2ff068 100644
+--- a/gpsim/main.cc
++++ b/gpsim/main.cc
+@@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA.  */
+ using namespace std;
+ 
+ #include "../config.h"
++#include "gpsim.h"
+ #include "../cli/input.h"
+ #include "../src/interface.h"
+ #include "../src/gpsim_interface.h"
+@@ -71,11 +72,6 @@ extern int abort_gpsim;
+   char szBuild[] = "Release";
+ #endif
+ 
+-void gpsim_version(void)
+-{
+-  printf("%s %s\n", szBuild, VERSION);
+-}
+-
+ // from ui_gpsim.cc
+ void initialize_ConsoleUI();
+ 
+@@ -85,24 +81,28 @@ void initialize_ConsoleUI();
+ // Here are the variables that popt (the command line invocation parsing
+ // library) will assign values to:
+ 
+-static const char *startup_name = "";
+-static const char *include_startup_name = "";
+-static const char *processor_name = "";
+-static const char *cod_name     = "";
+-static const char *hex_name     = "";
+-static const char *search_path  = "";
+-static const char *icd_port     = "";
+-static const char *defineSymbol = "";
+-static const char *sExitOn      = "";
+-static const char *sourceEnabled = "";
++static const char *startup_name = NULL;
++static const char *include_startup_name = NULL;
++static const char *processor_name = NULL;
++static const char *cod_name     = NULL;
++static const char *hex_name     = NULL;
++static const char *search_path  = NULL;
++static const char *icd_port     = NULL;
++static const char *defineSymbol = NULL;
++static const char *sExitOn      = NULL;
++static const char *sourceEnabled = NULL;
+ 
+ 
+-#define POPT_MYEXAMPLES { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \
++
++struct poptOption myHelpOptions[] = {
++    POPT_TABLEEND
++} ;
++
++#define POPT_MYEXAMPLES { NULL, '\0', POPT_ARG_INCLUDE_TABLE, myHelpOptions, \
+                         0, "Examples:\n\
+-  gpsim  myprog.cod          <-- loads a symbol file\n\
+-  gpsim -p p16f877 myprog.hex  <-- select processor and load hex\n\
+-  gpsim  myscript.stc        <-- loads a script\n\
+-\nHelp options:", NULL },
++  gpsim  myprog.cod                    <-- loads a symbol file\n\
++  gpsim -p p16f877 myprog.hex          <-- select processor and load hex\n\
++  gpsim  myscript.stc                  <-- loads a script\n", NULL },
+ 
+ //------------------------------------------------------------------------
+ // see popt documentation about how the poptOption structure is defined.
+@@ -117,76 +117,42 @@ static const char *sourceEnabled = "";
+ // gpsim to interpret and further parse the option.
+ 
+ struct poptOption optionsTable[] = {
+-  //  { "help", 'h', 0, 0, 'h',
+-  //    "this help list" },
++  { "cli", 'i', POPT_ARG_NONE, 0, 'i',
++    "command line mode only", NULL },
++  { "command", 'c', POPT_ARG_STRING, &startup_name, 0,
++    "startup command file (-c optional)", NULL },
++  { "define", 'D', POPT_ARG_STRING, &defineSymbol, 'D',
++    "define symbol with value that is added to the gpsim symbol table. "
++    "Define any number of symbols.", NULL },
++  { "echo", 'E', POPT_ARG_NONE, 0, 'E',
++    "Echo lines from a command file to the console.", NULL },
++  { "help", 'h', 0, 0, 'h',
++    "display this help and exit" },
++  { "icd", 'd', POPT_ARG_STRING, &icd_port, 0,
++    "use ICD (e.g. -d /dev/ttyS0).", NULL },
++  { "include", 'I', POPT_ARG_STRING, &include_startup_name, 0,
++    "startup command file - does not change directories", NULL },
+   { "processor", 'p', POPT_ARG_STRING, &processor_name, 0,
+     "processor (e.g. -pp16c84 for the 'c84)","<processor name>" },
+-  { "command",   'c', POPT_ARG_STRING, &startup_name, 0,
+-    "startup command file (-c optional)",0 },
+-  { "symbol",    's', POPT_ARG_STRING, &cod_name, 0,
+-    ".cod symbol file (-s optional)",0 } ,
+-  { "sourcepath", 'L',POPT_ARG_STRING, &search_path, 'L',
+-    "colon separated list of directories to search.", 0},
+-  { "include", 'I',POPT_ARG_STRING, &include_startup_name, 0,
+-    "startup command file - does not change directories", 0},
+-  { "version",'v',0,0,'v',
+-    "gpsim version",0},
+-  { "echo",'E',POPT_ARG_NONE,0,'E',
+-    "Echo lines from a command file to the console.",0},
+-  { "cli",'i',POPT_ARG_NONE,0,'i',
+-    "command line mode only",0},
+-  { "source",'S',POPT_ARG_STRING,&sourceEnabled,'S',
++  { "source", 'S', POPT_ARG_STRING, &sourceEnabled, 'S',
+     "'enable' or 'disable' the loading of source code. Default is 'enable'. "
+-    "Useful for running faster regression tests.",0},
+-  { "icd", 'd',POPT_ARG_STRING, &icd_port, 0,
+-    "use ICD (e.g. -d /dev/ttyS0).",0 },
+-  { "define",'D',POPT_ARG_STRING, &defineSymbol,'D',
+-    "define symbol with value that is added to the gpsim symbol table. "
+-    "Define any number of symbols.",0},
+-  { "exit", 'e',POPT_ARG_STRING, &sExitOn, 'e',
+-    "Causes gpsim to auto exit on a condition. Specifying onbreak will cause "
+-    "gpsim to exit when the simulation halts, but not until after the current "
+-    "command script completes.",0 },
++    "Useful for running faster regression tests.", NULL },
++  { "sourcepath", 'L', POPT_ARG_STRING, &search_path, 'L',
++    "colon separated list of directories to search.", NULL },
++  { "symbol", 's', POPT_ARG_STRING, &cod_name, 0,
++    ".cod symbol file (-s optional)", 0 } ,
++  { "version", 'v', 0, 0, 'v',
++    "gpsim version", NULL },
++  POPT_AUTOHELP
+   POPT_MYEXAMPLES
+   POPT_TABLEEND
+ };
+ 
+-// copied the format of this from the popt.h include file:
+-
+-
+-void
+-helpme (char *iam)
+-{
+-  printf ("\n\nuseage:\n%s [-h] [[-p <device> [<hex_file>]] | [[-s] <cod_file>]] [[-c] <stc_file>]\n", iam);
+-  printf ("\t-h             : this help list\n");
+-  printf ("\t-p <device>    : processor (e.g. -pp16c84 for the 'c84)\n");
+-  printf ("\t<hex_file>     : input file in \"intelhex16\" format\n");
+-  printf ("\t-c <stc_file>  : startup command file (-c optional)\n");
+-  printf ("\t-s <cod_file>  : .cod symbol file (-s optional)\n");
+-  printf ("\t-L <path list> : colon separated list of directories to search.\n");
+-  printf ("\t-d <port>      : Use ICD with serial port <port>\n");
+-  printf ("\t-D <symbol>=<value> : Define a symbol that will exist in the gpsim\n"
+-          "\t                      symbol table\n You may define any number.\n");
+-  printf ("\n\t-v             : gpsim version\n");
+-  printf ("\n Long options:\n\n");
+-  printf ("\t--cli          : command line mode only\n");
+-  printf ("\n\texamples:\n\n");
+-  printf ("%s myprog.cod          <-- loads a symbol file\n",iam);
+-  printf ("%s -p p16f877 myprog.hex  <-- select processor and load hex\n",iam);
+-  printf ("%s myscript.stc        <-- loads a script\n",iam);
+-
+-}
+-
+-
+-
+-
+ void welcome(void)
+ {
+   printf("\ngpsim - the GNUPIC simulator\nversion: %s %s\n",
+     szBuild, VERSION);
+   printf("\n\ntype help for help\n");
+-
+-  return;
+ }
+ 
+ void exit_gpsim(int ret)
+@@ -200,7 +166,7 @@ main (int argc, char *argv[])
+ {
+   bool bEcho = false;
+   bool bSourceEnabled = true;
+-  int c,usage=0;
++  int c, usage = 0;
+   bool bUseGUI = true;    // assume that we want to use the gui
+   char command_str[256];
+   poptContext optCon;     // context for parsing command-line options
+@@ -208,8 +174,6 @@ main (int argc, char *argv[])
+   // Perform basic initialization before parsing invocation arguments
+ 
+ 
+-  welcome();
+-
+   InitSourceSearchAsSymbol();
+   initialize_ConsoleUI();
+   initialize_gpsim_core();
+@@ -217,12 +181,11 @@ main (int argc, char *argv[])
+   initialize_commands();
+ 
+   optCon = poptGetContext(0, argc, (const char **)argv, optionsTable, 0);
+-  if(argc>=2) {
++  if (argc >= 2) {
+     while ((c = poptGetNextOpt(optCon)) >= 0  && !usage) {
+-
+-        const char * optArg = poptGetOptArg(optCon);
++      const char * optArg = poptGetOptArg(optCon);
+ #ifndef _WIN32
+-        free((char *)optArg);
++      free((char *)optArg);
+ #endif
+       switch (c) {
+ 
+@@ -245,7 +208,8 @@ main (int argc, char *argv[])
+         break;
+ 
+       case 'v':
+-        gpsim_version();
++        fprintf(stderr, "%s\n", GPSIM_VERSION_STRING);
++        return 0;
+         break;
+ 
+       case 'i':
+@@ -261,7 +225,6 @@ main (int argc, char *argv[])
+ #ifndef _WIN32
+         free((char *)defineSymbol);
+ #endif
+-        defineSymbol = "";
+         break;
+ 
+       case 'S':
+@@ -299,15 +262,15 @@ main (int argc, char *argv[])
+ 
+       if (usage)
+         break;
+-
+     }
+-    poptFreeContext(optCon);
+   }
+ 
+   if (usage) {
+-    helpme(argv[0]);
++    poptPrintHelp(optCon, stdout, 0);
+     exit (1);
+-  }
++ }
++
++  welcome();
+ 
+   if(bEcho) {
+     for(int index = 0; index < argc; index++) {
+@@ -316,8 +279,9 @@ main (int argc, char *argv[])
+     printf("\n");
+   }
+   if(poptPeekArg(optCon))
+-    hex_name=strdup(poptPeekArg(optCon));
++    hex_name=strdup(poptGetArg(optCon));
+ 
++  poptFreeContext(optCon);
+ 
+   initialize_readline();
+ 
+@@ -356,12 +320,12 @@ main (int argc, char *argv[])
+   try {
+ 
+   // Convert the remaining command line options into gpsim commands
+-  if(*cod_name) {
++  if(cod_name) {
+ 
+-    if(*processor_name)
++    if(processor_name)
+       cout << "WARNING: command line processor named \"" << processor_name <<
+         "\" is being ignored\nsince the .cod file specifies the processor\n";
+-    if(*hex_name)
++    if(hex_name)
+       cout << "WARNING: Ignoring the hex file \"" << hex_name <<
+         "\"\nsince the .cod file specifies the hex code\n";
+ 
+@@ -369,28 +333,28 @@ main (int argc, char *argv[])
+              "load s \"%s\"\n",cod_name);
+     parse_string(command_str);
+ 
+-  } else  if(*processor_name) {
++  } else  if(processor_name) {
+ 
+-    if(*hex_name){
++    if(hex_name){
+       snprintf(command_str, sizeof(command_str),
+         "load %s \"%s\"\n",processor_name, hex_name);
+       parse_string(command_str);
+ 
+     }
+   }
+-  if(*icd_port) {
++  if(icd_port) {
+       snprintf(command_str, sizeof(command_str),
+                "icd open \"%s\"\n",icd_port);
+       parse_string(command_str);
+   }
+ 
+-  if(*startup_name) {
++  if(startup_name) {
+       snprintf(command_str, sizeof(command_str),
+                "load c \"%s\"\n",startup_name);
+       parse_string(command_str);
+   }
+ 
+-  if(*include_startup_name) {
++  if(include_startup_name) {
+       snprintf(command_str, sizeof(command_str),
+                "load i \"%s\"\n",include_startup_name);
+       parse_string(command_str);
+-- 
+2.1.0
+
+From ee5456159bd207b426a8ecade74daa9304e55f28 Mon Sep 17 00:00:00 2001
+From: borutr <borutr at c0b0687f-f210-0410-a348-de8ada4243c3>
+Date: Tue, 22 Oct 2013 18:37:33 +0000
+Subject: [PATCH 3/3] - reintroduced gpsim_version()
+
+git-svn-id: svn://svn.code.sf.net/p/gpsim/code/trunk@2250 c0b0687f-f210-0410-a348-de8ada4243c3
+---
+ gpsim/main.cc | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/gpsim/main.cc b/gpsim/main.cc
+index e2ff068..c2f3fdd 100644
+--- a/gpsim/main.cc
++++ b/gpsim/main.cc
+@@ -72,6 +72,11 @@ extern int abort_gpsim;
+   char szBuild[] = "Release";
+ #endif
+ 
++void gpsim_version(void)
++{
++  printf("%s %s\n", szBuild, VERSION);
++}
++
+ // from ui_gpsim.cc
+ void initialize_ConsoleUI();
+ 
+-- 
+2.1.0
+
+From 26d9a996843c942d901cb1f3c394ab8ff1954324 Mon Sep 17 00:00:00 2001
+From: Lubomir Rintel <lkundrak at v3.sk>
+Date: Tue, 28 Oct 2014 17:15:30 +0100
+Subject: [PATCH] automake
+
+So that gpsim.h gets created
+---
+ gpsim/Makefile.in | 26 ++++++++++++++++++++------
+ 1 file changed, 20 insertions(+), 6 deletions(-)
+
+diff --git a/gpsim/Makefile.in b/gpsim/Makefile.in
+index dfa43b8..f7d916b 100644
+--- a/gpsim/Makefile.in
++++ b/gpsim/Makefile.in
+@@ -1,4 +1,4 @@
+-# Makefile.in generated by automake 1.13.4 from Makefile.am.
++# Makefile.in generated by automake 1.14.1 from Makefile.am.
+ # @configure_input@
+ 
+ # Copyright (C) 1994-2013 Free Software Foundation, Inc.
+@@ -306,15 +306,22 @@ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ AM_CPPFLAGS = @X_CFLAGS@ @Y_CFLAGS@
+-gpsim_SOURCES = main.cc
++gpsim_SOURCES = main.cc \
++	gpsim.h.in
++
+ 
+ #gpsim_LDFLAGS =  $(shell gtk-config --cflags)
+ gpsim_LDADD = ../src/libgpsim.la ../cli/libgpsimcli.la ../gui/libgpsimgui.la \
+   ../eXdbm/libgpsim_eXdbm.la @GTK@ @GDK@ @GLIB@ -lstdc++ -lpopt @LIBDL@ \
+   @X_LDFLAGS@ @Y_LDFLAGS@ @LIBREADLINE@
+ 
++
++# Make sure we have parse.h when compiling other sources
++BUILT_SOURCES = gpsim.h
++CLEANFILES = gpsim.h
+ EXTRA_DIST = makefile.mingw
+-all: all-am
++all: $(BUILT_SOURCES)
++	$(MAKE) $(AM_MAKEFLAGS) all-am
+ 
+ .SUFFIXES:
+ .SUFFIXES: .cc .lo .o .obj
+@@ -520,13 +527,15 @@ distdir: $(DISTFILES)
+ 	  fi; \
+ 	done
+ check-am: all-am
+-check: check-am
++check: $(BUILT_SOURCES)
++	$(MAKE) $(AM_MAKEFLAGS) check-am
+ all-am: Makefile $(PROGRAMS)
+ installdirs:
+ 	for dir in "$(DESTDIR)$(bindir)"; do \
+ 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ 	done
+-install: install-am
++install: $(BUILT_SOURCES)
++	$(MAKE) $(AM_MAKEFLAGS) install-am
+ install-exec: install-exec-am
+ install-data: install-data-am
+ uninstall: uninstall-am
+@@ -548,6 +557,7 @@ install-strip:
+ mostlyclean-generic:
+ 
+ clean-generic:
++	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+ 
+ distclean-generic:
+ 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+@@ -556,6 +566,7 @@ distclean-generic:
+ maintainer-clean-generic:
+ 	@echo "This command is intended for maintainers to use"
+ 	@echo "it deletes files that may require special tools to rebuild."
++	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ clean: clean-am
+ 
+ clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+@@ -626,7 +637,7 @@ ps-am:
+ 
+ uninstall-am: uninstall-binPROGRAMS
+ 
+-.MAKE: install-am install-strip
++.MAKE: all check install install-am install-strip
+ 
+ .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+ 	clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
+@@ -643,6 +654,9 @@ uninstall-am: uninstall-binPROGRAMS
+ 	tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
+ 
+ 
++gpsim.h: gpsim.h.in
++	sed -e "s/@REVISION@/$$(${top_srcdir}\/get_cl_revision.sh -s ${top_srcdir}\/ChangeLog)/g" "$<" > "$@"
++
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
+-- 
+2.1.0
+
diff --git a/gpsim.spec b/gpsim.spec
index bd0e655..593bdd1 100644
--- a/gpsim.spec
+++ b/gpsim.spec
@@ -1,6 +1,6 @@
 Name:		gpsim
 Version:	0.27.0
-Release:	3%{?dist}
+Release:	4%{?dist}
 Summary:	A simulator for Microchip (TM) PIC (TM) microcontrollers
 Summary(fr):	Un simulateur pour les microcontrôleurs PIC (TM) Microchip (TM)
 
@@ -9,6 +9,12 @@ Group:		Development/Debuggers
 License:	GPLv2+ and LGPLv2+
 URL:		http://gpsim.sourceforge.net/gpsim.html
 Source:		http://downloads.sourceforge.net/gpsim/gpsim-%{version}.tar.gz
+
+# https://sourceforge.net/p/gpsim/patches/39/
+Patch0:		gpsim-0.27.0-break.patch
+# From upstream SVN trunk
+Patch1:		gpsim-0.27.0-cmdline.patch
+
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:	gtk+extra-devel, flex, readline-devel, popt-devel
@@ -46,6 +52,8 @@ qui utilisent la bibliothèque gpsim.
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
 mv AUTHORS AUTHORS.raw
 mv ChangeLog ChangeLog.raw
 iconv -f ISO88592 -t UTF8  AUTHORS.raw -o  AUTHORS
@@ -90,6 +98,10 @@ autoconf
 %{_includedir}/*
 
 %changelog
+* Tue Oct 28 2014 Lubomir Rintel <lkundrak at v3.sk> - 0.27.0-4
+- Fix CTRL+C crash
+- Fix command line option parsing
+
 * Sat Aug 16 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.27.0-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
 


More information about the scm-commits mailing list