StephanTLavavej / mingw-distro

MinGW distro build scripts.
494 stars 55 forks source link

sed 4.3 is available, fixing mingw-w64 build issues #17

Closed StephanTLavavej closed 7 years ago

StephanTLavavej commented 8 years ago

My sed.patch fixes minor build issues with mingw-w64. It appears that they've all been fixed upstream in gnulib, so sed simply needs to update its copy and release a new version.

StephanTLavavej commented 7 years ago

"It has been over four years since the preceding release of sed. We expect to make upcoming releases with far greater frequency. Please give this test release a workout and let us know of any problem you find." - Jim Meyering, Dec 5, 2016

I should try this.

StephanTLavavej commented 7 years ago

Good news: sed updated its copy of gnulib.

Bad news: everything else is broken. I tried to build sed-4.2.2.177-a348 and encountered multiple problems.

  1. Hacked around this by adding -I/c/temp/gcc/build to CFLAGS:
gcc -O3  -s  ../src/sed/sed.c   -o sed/sed
In file included from ../src/sed/sed.c:19:0:
../src/sed/sed.h:18:20: fatal error: config.h: No such file or directory
 #include <config.h>
                    ^
  1. Hacked around this by adding -I/c/temp/gcc/src to CFLAGS:
gcc -O3 -I/c/temp/gcc/build  -s  ../src/sed/sed.c   -o sed/sed
In file included from ../src/sed/sed.c:19:0:
../src/sed/sed.h:19:23: fatal error: basicdefs.h: No such file or directory
 #include "basicdefs.h"
                       ^
  1. Hacked around this by adding -I/c/temp/gcc/src/lib to CFLAGS:
gcc -O3 -I/c/temp/gcc/build -I/c/temp/gcc/src  -s  ../src/sed/sed.c   -o sed/sed
In file included from ../src/sed/sed.c:19:0:
../src/sed/sed.h:20:17: fatal error: dfa.h: No such file or directory
 #include "dfa.h"
                 ^
  1. Hacked around this by adding #ifdef HAVE_ALLOCA_H to the file:
gcc -O3 -I/c/temp/gcc/build -I/c/temp/gcc/src  -s  ../src/sed/sed.c   -o sed/sed
In file included from ../src/sed/sed.h:19:0,
                 from ../src/sed/sed.c:19:
C:/temp/gcc/src/basicdefs.h:21:20: fatal error: alloca.h: No such file or directory
 #include <alloca.h>
                    ^
  1. Hacked around
gcc -O3 -I/c/temp/gcc/build -I/c/temp/gcc/src  -s  ../src/sed/sed.c   -o sed/sed
In file included from ../src/sed/sed.h:19:0,
                 from ../src/sed/sed.c:19:
C:/temp/gcc/src/basicdefs.h:29:21: fatal error: gettext.h: No such file or directory
 #include <gettext.h>
                     ^

by adding:

#ifdef HAVE_GETTEXT
#include <gettext.h>
#define N_(String) gettext_noop(String)
#define _(String) gettext(String)
#else
#define N_(String) (String)
#define _(String) (String)
#endif

which seems vaguely plausible but I am increasingly inventing nonsense.

  1. Got completely stuck with:
In file included from ../src/sed/sed.h:26:0,
                 from ../src/sed/sed.c:19:
../src/sed/utils.h: In function 'panic':
../src/sed/utils.h:30:45: error: expected declaration specifiers before '_GL_ATTRIBUTE_FORMAT_PRINTF'
 _Noreturn void panic (const char *str, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2);
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/sed/utils.h:42:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '_GL_ARG_NONNULL'
                    const char *mode) _GL_ARG_NONNULL ((1, 2, 3, 4));
                                      ^~~~~~~~~~~~~~~
../src/sed/utils.h:52:26: warning: '__pure__' attribute ignored [-Wattributes]
 char *get_buffer (struct buffer const *b) _GL_ATTRIBUTE_PURE;
                          ^~~~~~
../src/sed/utils.h:53:28: warning: '__pure__' attribute ignored [-Wattributes]
 size_t size_buffer (struct buffer const *b) _GL_ATTRIBUTE_PURE;
                            ^~~~~~
../src/sed/utils.h:58:20: error: storage class specified for parameter 'myname'
 extern const char *myname;
                    ^~~~~~
In file included from ../src/sed/sed.c:19:0:
../src/sed/sed.h:29:1: warning: empty declaration
 struct vector {
 ^~~~~~
../src/sed/sed.h:39:1: warning: empty declaration
 struct output {
 ^~~~~~

followed by many more diverse errors.

mmicko commented 7 years ago

Line 5779 of Makefile.in should be: doc/sed.1: sed/sed$(EXEEXT) .version $(srcdir)/doc/sed.x instead of doc/sed.1: sed/sed .version $(srcdir)/doc/sed.x

After that just use plain make to build, no additional parameter needed.

StephanTLavavej commented 7 years ago

Absolutely amazing, worked perfectly! Thank you!

StephanTLavavej commented 7 years ago

I've sent a patch in unified diff format to the sed-devel mailing list.

mmicko commented 7 years ago

Great. Thank you