aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--NEWS8
-rw-r--r--THANKS1
-rwxr-xr-xbootstrap8
-rw-r--r--configure.ac9
-rw-r--r--lib/Makefile.am3
-rw-r--r--mingw.m486
-rw-r--r--src/idcache.c4
-rw-r--r--src/userspec.c26
-rw-r--r--src/util.c9
-rw-r--r--sysdep.m485
11 files changed, 220 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index eac6ff8..83f1573 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2007-12-05 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ Fix mingw build. Thanks to Robert Millan.
+
+ * NEWS, THANKS: Update.
+ * bootstrap: Create lib/system.c, m4/sysdep.m4, update lib/system.h.
+ * mingw.m4, sysdep.m4: New files.
+ * configure.ac: Raise version number to 2.9.90.
+ Call CPIO_SYSDEP. Remove the call to gl_USE_SYSTEM_EXTENSIONS.
+ (AC_CHECK_HEADERS): Add process.h sys/ioctl.h
+ * lib/Makefile.am (libcpio_a_SOURCES): Add system.c
+ * src/idcache.c: Include system.h
+ * src/userspec.c: Remove alloca stuff (already handled by
+ gnulib). Include alloca.h.
+ Remove useless declarations of get.* functions.
+ * src/util.c: Include sys/ioctl.h conditionally.
+
2007-09-28 Sergey Poznyakoff <gray@gnu.org.ua>
* src/copyin.c (read_in_binary): Fix passing improper argument
diff --git a/NEWS b/NEWS
index a9e542e..355c006 100644
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,15 @@
-GNU cpio NEWS -- history of user-visible changes. 2007-06-29
+GNU cpio NEWS -- history of user-visible changes. 2007-12-05
Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
See the end of file for copying conditions.
Please send cpio bug reports to <bug-cpio@gnu.org>.
+Version 2.9.90
+
+* Support MinGW builds (thanks to Robert Millan)
+
+
+
Version 2.9 - Sergey Poznyakoff, 2007-06-28
* Licensed under the GPLv3.
diff --git a/THANKS b/THANKS
index 393de05..3807e10 100644
--- a/THANKS
+++ b/THANKS
@@ -18,3 +18,4 @@ Matthew Braithwaite <mab@cnet.com>
Mike Frysinger <vapier@gentoo.org>
Mitsuru Chinen <mchinen@yamato.ibm.com>
Peter Vrabec <pvrabec@redhat.com>
+Robert Millan <rmh@aybabtu.com> \ No newline at end of file
diff --git a/bootstrap b/bootstrap
index 6d9ac67..fb938f1 100755
--- a/bootstrap
+++ b/bootstrap
@@ -595,6 +595,13 @@ rm -fr $bt $bt2 || exit
# Reconfigure, getting other files.
+echo "$0: Creating lib/system.c"
+m4 -DMODE=C sysdep.m4 mingw.m4 > lib/system.c
+echo "$0: Updating lib/system.h"
+m4 -DMODE=H sysdep.m4 mingw.m4 >> lib/system.h
+echo "$0: Creating m4/sysdep.m4"
+m4 -DMODE=AC sysdep.m4 mingw.m4 > m4/sysdep.m4
+
for command in \
'aclocal --force -I m4' \
'autoconf --force' \
@@ -648,4 +655,5 @@ if test -d runtime-po; then
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
fi
cleanup_ifl
+
echo "$0: done. Now you can run './configure'."
diff --git a/configure.ac b/configure.ac
index 9ca5131..33f0f51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software Foundation,
dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-AC_INIT([GNU cpio], [2.9], [bug-cpio@gnu.org])
+AC_INIT([GNU cpio], [2.9.90], [bug-cpio@gnu.org])
AC_CONFIG_SRCDIR(src/cpio.h)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
@@ -25,7 +25,6 @@ AC_CONFIG_HEADERS([config.h])
AC_PREREQ([2.59])
dnl Check for programs
-gl_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
@@ -45,12 +44,14 @@ AC_CHECK_TYPE(gid_t, int)
AC_HEADER_STDC
AC_HEADER_DIRENT
-AC_CHECK_FUNCS([fchmod fchown])
+AC_CHECK_FUNCS([fchmod fchown setmode])
# gnulib modules
gl_INIT
# paxutils modules
cpio_PAXUTILS
+# Additional system dependencies (for mingw)
+CPIO_SYSDEP
AC_SUBST(CPIO_MT_PROG)
@@ -61,7 +62,7 @@ AC_ARG_ENABLE(mt,
no) ;;
esac])
-AC_CHECK_HEADERS(unistd.h stdlib.h string.h fcntl.h sys/io/trioctl.h utmp.h getopt.h locale.h libintl.h sys/wait.h utime.h locale.h)
+AC_CHECK_HEADERS(unistd.h stdlib.h string.h fcntl.h sys/io/trioctl.h utmp.h getopt.h locale.h libintl.h sys/wait.h utime.h locale.h process.h sys/ioctl.h)
AC_MSG_CHECKING(for sys_errlist and sys_nerr)
AC_TRY_RUN(
diff --git a/lib/Makefile.am b/lib/Makefile.am
index a4545f1..450f86d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -32,7 +32,8 @@ libcpio_a_SOURCES += \
paxexit.c\
paxlib.h\
paxnames.c\
- rtapelib.c
+ rtapelib.c\
+ system.c
DISTCLEANFILES += rmt-command.h
rmt-command.h: Makefile
diff --git a/mingw.m4 b/mingw.m4
new file mode 100644
index 0000000..51ad025
--- /dev/null
+++ b/mingw.m4
@@ -0,0 +1,86 @@
+/* System dependent functions for GNU cpio.
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+
+ GNU cpio 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 3, or (at your option)
+ any later version.
+
+ GNU cpio 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 GNU cpiio. If not, see <http://www.gnu.org/licenses/>. */
+
+ifelse(MODE,`C',`
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <unistd.h>
+#include <errno.h>
+',MODE,`H',`
+#ifdef HAVE_PROCESS_H
+# include <process.h>
+#endif
+
+#ifndef HAVE_PWD_H
+/* Borrowed from GNU libc */
+/* The passwd structure. */
+struct passwd
+{
+ char *pw_name; /* Username. */
+ char *pw_passwd; /* Password. */
+ int pw_uid; /* User ID. */
+ int pw_gid; /* Group ID. */
+ char *pw_gecos; /* Real name. */
+ char *pw_dir; /* Home directory. */
+ char *pw_shell; /* Shell program. */
+};
+#endif
+#ifndef HAVE_GRP_H
+/* Borrowed from GNU libc */
+/* The group structure. */
+struct group
+ {
+ char *gr_name; /* Group name. */
+ char *gr_passwd; /* Password. */
+ int gr_gid; /* Group ID. */
+ char **gr_mem; /* Member list. */
+ };
+#endif
+
+#include <signal.h>
+#ifndef SIGPIPE
+# define SIGPIPE -1
+#endif
+
+')
+
+BEGIN
+MAKESTUB(struct passwd *, getpwuid, uid_t uid)
+MAKESTUB(struct passwd *, getpwnam, const char *name)
+MAKESTUB(struct group *, getgrgid, gid_t gid)
+MAKESTUB(struct group *, getgrnam, const char *name)
+MAKESTUB(int, pipe, int filedes[2])
+MAKESTUB(int, fork)
+
+define([INTRETVAL],0)
+MAKESTUB(int, getuid)
+
+define([INTRETVAL],0)
+MAKESTUB(int, geteuid)
+
+define([INTRETVAL],0)
+MAKESTUB(int, getgid)
+
+MAKESTUB(int, setuid, int newuid)
+MAKESTUB(int, setgid, int newgid)
+MAKESTUB(int, mknod, const char *filename, int mode, int dev)
+MAKESTUB(int, symlink, const char *oldname, const char *newname)
+MAKESTUB(int, link, const char *oldname, const char *newname)
+MAKESTUB(int, chown, const char *filename, int owner, int group)
+END
diff --git a/src/idcache.c b/src/idcache.c
index 1e57dd3..069aa71 100644
--- a/src/idcache.c
+++ b/src/idcache.c
@@ -23,10 +23,10 @@
#include <stdio.h>
#include <sys/types.h>
-#include <pwd.h>
-#include <grp.h>
#include <xalloc.h>
+#include <system.h>
+
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
#include <string.h>
#else
diff --git a/src/userspec.c b/src/userspec.c
index ccd2eb5..045448b 100644
--- a/src/userspec.c
+++ b/src/userspec.c
@@ -20,36 +20,10 @@
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
#include <system.h>
-
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#ifdef HAVE_ALLOCA_H
#include <alloca.h>
-#else
-#ifdef _AIX
- #pragma alloca
-#else
-char *alloca ();
-#endif
-#endif
-#endif
-
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
-#include <pwd.h>
-#include <grp.h>
-
-#if !HAVE_DECL_GETPWNAM
-extern struct passwd *getpwnam (const char *name);
-#endif
-#if !HAVE_DECL_GETGRNAM
-extern struct group *getgrnam (const char *name);
-#endif
-#if !HAVE_DECL_GETGRGID
-extern struct group *getgrgid (gid_t gid);
-#endif
#ifndef HAVE_ENDPWENT
# define endpwent()
diff --git a/src/util.c b/src/util.c
index e93b9bd..2732f37 100644
--- a/src/util.c
+++ b/src/util.c
@@ -33,7 +33,9 @@
#include <hash.h>
#include <utimens.h>
-#include <sys/ioctl.h>
+#ifdef HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
#ifdef HAVE_SYS_MTIO_H
# ifdef HAVE_SYS_IO_TRIOCTL_H
@@ -1266,7 +1268,10 @@ stat_to_cpio (struct cpio_file_stat *hdr, struct stat *st)
}
#ifndef HAVE_FCHOWN
-# define fchown(fd, uid, gid) (-1)
+# define HAVE_FCHOWN 0
+#endif
+#ifndef HAVE_FCHMOD
+# define HAVE_FCHMOD 0
#endif
int
diff --git a/sysdep.m4 b/sysdep.m4
new file mode 100644
index 0000000..44a6bc6
--- /dev/null
+++ b/sysdep.m4
@@ -0,0 +1,85 @@
+divert(-1)
+# System dependent functions for GNU cpio.
+#
+# Copyright (C) 2007 Free Software Foundation, Inc.
+# GNU cpio 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 3, or (at your option)
+# any later version.
+#
+# GNU cpio 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 GNU cpiio. If not, see <http://www.gnu.org/licenses/>.
+
+undef(`include')
+
+ifelse(MODE,`AC',`
+
+define(`FUNCLIST')
+
+define(`BEGIN')
+define(`END',`divert(0)dnl
+# -*- buffer-read-only: t -*- vi: set ro:
+# THIS FILE IS GENERATED AUTOMATICALLY. PLEASE DO NOT EDIT.
+AC_DEFUN([CPIO_SYSDEP],[AC_CHECK_FUNCS([FUNCLIST])])')
+
+dnl MAKESTUB(type, name, args...)
+define(`MAKESTUB',`define(`FUNCLIST',FUNCLIST` $2')')
+
+',MODE,`H',`
+changecom(/*,*/)
+define(`ROHEADER',`/* -*- buffer-read-only: t -*- vi: set ro:
+ THIS FILE IS GENERATED AUTOMATICALLY. PLEASE DO NOT EDIT.
+*/')
+
+define(`BEGIN')
+define(`END')
+
+dnl MAKESTUB(type, name, args...)
+define(`MAKESTUB',`
+`#ifndef HAVE_'translit($2, `a-z-', `A-Z_')
+$1 $2 (ifelse($#,2,`void',`shift(shift($@))'));
+#endif
+')
+
+divert(0)dnl
+ROHEADER
+',MODE,`C',`
+changecom(/*,*/)
+define(`ROHEADER',`/* -*- buffer-read-only: t -*- vi: set ro:
+ THIS FILE IS GENERATED AUTOMATICALLY. PLEASE DO NOT EDIT.
+*/')
+
+define(`BEGIN')
+define(`END')
+
+define(`__make_unused_args',`dnl
+ $1 __attribute__ ((unused))dnl
+ ifelse($#,1,,`, __make_unused_args(shift($@))')')
+
+define(`__makeargs',`ifelse($1,`',`void',`__make_unused_args($@)')')
+
+define(`INTRETVAL',-1)
+
+dnl MAKESTUB(type, name, args...)
+define(`MAKESTUB',`
+`#ifndef HAVE_'translit($2, `a-z-', `A-Z_')
+# warning "Providing stub placeholder for $2 function"
+$1
+$2 (__makeargs(shift(shift($@))))
+{
+ errno = ENOSYS;
+ return ifelse($1,`int',INTRETVAL,NULL);
+}
+#endif`'dnl
+define(`INTRETVAL',-1)dnl
+')
+
+divert(0)dnl
+ROHEADER
+')
+

Return to:

Send suggestions and report system problems to the System administrator.