diff options
author | Eli Zaretskii <eliz@gnu.org> | 2013-05-14 16:26:29 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2013-05-14 16:26:29 +0300 |
commit | 242f84cd211a13c4056d228aaa9bc1f57aa21763 (patch) | |
tree | 8be4635902df1dde1c21e6ca9cb457a2860c73ff /pc | |
parent | c96323b5e32f54295556809833d2d6a44daa75d0 (diff) | |
download | egawk-242f84cd211a13c4056d228aaa9bc1f57aa21763.tar.gz egawk-242f84cd211a13c4056d228aaa9bc1f57aa21763.tar.bz2 egawk-242f84cd211a13c4056d228aaa9bc1f57aa21763.zip |
Fix building, installing, and testing extensions on MS-Windows.
test/Makefile.in (mpfr-tests, shlib-tests): Add a blank character
between ' and /FOO/ in Gawk command lines, for the benefit of
testing under MSYS Bash.
test/filefuncs.awk (BEGIN): Call 'stat' on gawkapi.o, not on gawk,
which does not exist on systems that produce gawk.exe.
README_D/README.pc: Update the pc build and test instructions.
pc/Makefile.tst (AWK): Set AWKLIBPATH so extensions could be found.
(LS): New variable.
(check): Add back shlib-tests and shlib-msg-end.
(readdir): Add a warning regarding inode reporting by ls.exe.
(fts, fork, fork2): Add message about expected failure on MinGW.
pc/Makefile (install): Install the extensions.
(install-strip): Likewise.
pc/Makefile.ext: New file.
io.c (devopen) [__EMX__ || __MINGW32__]: Produce EISDIR on MinGW
when an attempt to open() a directory fails.
(two_way_open) [__EMX__ || __MINGW32__]: When trying to open() a
directory fails with EISDIR, assign FAKE_FD_VALUE to the file
descriptor and attributes of a directory to its mode bits. This
is needed to support the readdir extension.
gawkapi.h (FAKE_FD_VALUE): New macro, used in io.h and in
extension/gawkdirfd.h.
extension/rwarray.c [__MINGW32__]: Include winsock2.h instead of
arpa/inet.h.
extension/readdir.c [__MINGW32__]: Include windows.h.
Include gawkapi.h before gawkdirfd.h, since the former defines
FAKE_FD_VALUE needed by the latter.
(ftype): Accept an additional argument, the directory that is
being read. Callers changed.
[!DT_BLK]: Produce the file's type by calling 'stat' on it, if the
dirent structure doesn't provide that.
(get_inode): New function, to produce inode values on MS-Windows.
(dir_get_record): Use it.
extension/inplace.c (chown, link) [__MINGW32__]: Redirect to existing
library functions.
(mkstemp) [__MINGW32__]: New function, for MinGW, which doesn't
have it in its library.
(do_inplace_end) [__MINGW32__]: Remove the old file before
renaming the new, since 'rename' on Windows cannot overwrite
existing files.
extension/gawkdirfd.h (ENOTSUP): Define to ENOSYS if not already defined.
(DIR_TO_FD): If not defined yet, define to FAKE_FD_VALUE.
extension/filefuncs.c (get_inode) [_WIN32]: New function, produces the
file index used on Windows as its inode.
(fill_stat_array) [_WIN32]: Use it.
Diffstat (limited to 'pc')
-rw-r--r-- | pc/ChangeLog | 13 | ||||
-rw-r--r-- | pc/Makefile | 2 | ||||
-rw-r--r-- | pc/Makefile.ext | 75 | ||||
-rw-r--r-- | pc/Makefile.tst | 31 |
4 files changed, 107 insertions, 14 deletions
diff --git a/pc/ChangeLog b/pc/ChangeLog index eeae9767..2c246fc2 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,16 @@ +2013-05-14 Eli Zaretskii <eliz@gnu.org> + + * Makefile.tst (AWK): Set AWKLIBPATH so extensions could be found. + (LS): New variable. + (check): Add back shlib-tests and shlib-msg-end. + (readdir): Add a warning regarding inode reporting by ls.exe. + (fts, fork, fork2): Add message about expected failure on MinGW. + + * Makefile (install): Install the extensions. + (install-strip): Likewise. + + * Makefile.ext: New file. + 2013-05-09 Arnold D. Robbins <arnold@skeeve.com> * 4.1.0: Release tar ball made. diff --git a/pc/Makefile b/pc/Makefile index b2344460..4152ed24 100644 --- a/pc/Makefile +++ b/pc/Makefile @@ -263,6 +263,7 @@ alloca$O: alloca.c install: install$(install) + -$(MAKE) -C extension install-extensions install1: echo extproc sh $(prefix)/bin/igawk.cmd > igawk.cmd @@ -286,6 +287,7 @@ install2: install-strip: install$(install) strip "$(prefix)/bin"/*.exe + -$(MAKE) -C extension $@ clean: -rm -rf gawk *.exe gawk.map *.o *.obj core a.out $(RSPFILE) $(PRSPFILE) $(DRSPFILE) $(DYN_EXP) diff --git a/pc/Makefile.ext b/pc/Makefile.ext new file mode 100644 index 00000000..8971014b --- /dev/null +++ b/pc/Makefile.ext @@ -0,0 +1,75 @@ +# extension/Makefile for the MinGW build +# +# Copyright (C) 2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +prefix = c:/gnu +pkgdatadir = $(prefix)/lib/awk +pkgextensiondir = $(prefix)/lib/gawk +includedir = $(prefix)/include +libdir = $(prefix)/lib +datadir = $(prefix)/share +pkgdatadir = $(datadir)/gawk-extensions +pkgincludedir = $(includedir)/gawk-extensions +pkglibdir = $(libdir)/gawk-extensions +pkglibexecdir = $(libexecdir)/gawk-extensions + +SOEXT = dll +SIMPLE_EXTENSIONS = inplace.$(SOEXT) ordchr.$(SOEXT) readfile.$(SOEXT)\ + revoutput.$(SOEXT) revtwoway.$(SOEXT) testext.$(SOEXT) +ALL_EXTENSIONS = filefuncs.$(SOEXT) fnmatch.$(SOEXT) inplace.$(SOEXT)\ + ordchr.$(SOEXT) readdir.$(SOEXT) readfile.$(SOEXT) revoutput.$(SOEXT)\ + revtwoway.$(SOEXT) rwarray.$(SOEXT) testext.$(SOEXT) time.$(SOEXT) + +extensions: $(ALL_EXTENSIONS) + +fnmatch.$(SOEXT): fnmatch.c + gcc -I.. -I../missing_d -DHAVE_FNMATCH_H -shared -gdwarf-2 -g3 -o $@ fnmatch.c + +readdir.$(SOEXT): readdir.c gawkdirfd.h + gcc -I.. -DHAVE_DIRENT_H -shared -gdwarf-2 -g3 -o $@ readdir.c + +rwarray.$(SOEXT): rwarray.c + gcc -I.. -shared -gdwarf-2 -g3 -o $@ rwarray.c -lws2_32 + +filefuncs.$(SOEXT): filefuncs.c stack.c stack.h gawkfts.h + gcc -I.. -shared -gdwarf-2 -g3 -o $@ filefuncs.c stack.c + +time.$(SOEXT): time.c + gcc -DHAVE_GETSYSTEMTIMEASFILETIME -I.. -shared -gdwarf-2 -g3 -o $@ time.c + +$(SIMPLE_EXTENSIONS): + gcc -I.. -shared -gdwarf-2 -g3 -o $@ $(@:.$(SOEXT)=.c) + +$(ALL_EXTENSIONS): ../gawkapi.h ../gettext.h + +inplace.$(SOEXT): inplace.c +ordchr.$(SOEXT): ordchr.c +readfile.$(SOEXT): readfile.c +revoutput.$(SOEXT): revoutput.c +rwarray.$(SOEXT): rwarray.c +testext.$(SOEXT): testext.c +time.$(SOEXT): time.c + +# This must not be called 'install' because there's a file INSTALL, +# and case-insensitive filesystems will gladly accept it. +install-extensions: + -mkdir "$(pkgextensiondir)" + cp *.$(SOEXT) "$(pkgextensiondir)" + -mkdir "$(prefix)/share/man/man3" + cp *.3am "$(prefix)/share/man/man3" + +install-strip: install-extensions + strip --strip-unneeded "$(pkgextensiondir)"/*.$(SOEXT) + +clean: + -rm -f *.$(SOEXT) + diff --git a/pc/Makefile.tst b/pc/Makefile.tst index dff0cacb..cc188fda 100644 --- a/pc/Makefile.tst +++ b/pc/Makefile.tst @@ -60,11 +60,16 @@ SHELL = /bin/sh # Point to gawk -AWK = ../gawk.exe +AWK = AWKLIBPATH=../extension ../gawk.exe # Also point to gawk but for DOS commands needing backslashes. We need # the forward slash version too or 'arrayparam' fails. AWK2 = '..\gawk.exe' AWKPROG = ../gawk.exe +# Point $(LS) to a version of ls.exe that reports true Windows file +# index numbers, because this is what the readdir test expects. +# Otherwise, the readdir test will fail. (The MSYS ls.exe doesn't +# report full index values.) +LS = ls.exe # Define PGAWK PGAWK = ../gawk.exe -p @@ -100,12 +105,13 @@ CP = cp #CP = : && command -c copy #CP = command.com /c copy -MV = cmd.exe /c ren +#MV = cmd.exe /c ren +MV = mv -#MKDIR = mkdir +MKDIR = mkdir #MKDIR = gmkdir #MKDIR = : && command -c mkdir -MKDIR = command.com /c mkdir +#MKDIR = command.com /c mkdir # Set your unix-style date function here #DATE = date @@ -237,13 +243,10 @@ check: msg \ extend-msg-start gawk-extensions extend-msg-end \ machine-msg-start machine-tests machine-msg-end \ charset-msg-start charset-tests charset-msg-end \ - shlib-msg-start \ + shlib-msg-start shlib-tests shlib-msg-end \ mpfr-msg-start mpfr-tests mpfr-msg-end \ pass-fail -# Removed from 'check': shlib-tests shlib-msg-end -# FIXME: add back when the extensions are built by default. - basic: $(BASIC_TESTS) unix-tests: $(UNIX_TESTS) @@ -1007,17 +1010,15 @@ readdir: echo If it does, try rerunning on an ext'[234]' filesystem. ; \ fi @echo $@ + @echo This test may fail if $(LS) does not report full Windows file index as the inode @$(AWK) -f $(srcdir)/readdir.awk $(top_srcdir) > _$@ - @ls -afli $(top_srcdir) | sed 1d | $(AWK) -f $(srcdir)/readdir0.awk -v extout=_$@ > $@.ok + @$(LS) -afli $(top_srcdir) | sed 1d | $(AWK) -f $(srcdir)/readdir0.awk -v extout=_$@ > $@.ok @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ fts: - @if [ "`uname`" = IRIX ]; then \ - echo This test may fail on IRIX systems when run on an NFS filesystem.; \ - echo If it does, try rerunning on an xfs filesystem. ; \ - fi @echo $@ - @$(AWK) -f $(srcdir)/fts.awk + @echo Expect $@ to fail with MinGW because function 'fts' is not defined. + @-$(AWK) -f $(srcdir)/fts.awk @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ charasbytes: @@ -2362,11 +2363,13 @@ filefuncs: fork: @echo $@ + @echo Expect $@ to fail with MinGW because fork.dll is not available @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fork2: @echo $@ + @echo Expect $@ to fail with MinGW because fork.dll is not available @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ |