Package: cpio Version: 2.6-17 Severity: wishlist Tags: patch Hi
As discussed on IRC, I'd like to obtain win32 binaries of cpio that win32-loader can Build-Depend on (which will allow me to fix bug #442474). You'll find attached: - debian.diff: Arranges the package to produce a cpio-win32 binary. - mingw32.diff: Fixes in upstream code to allow compilation of win32 binaries via mingw32. This patch is merged in latest cpio alpha [1] release, with some modification. - srcdir_objdir.diff: Fixes a small issue when $(srcdir) != $(objdir). Just reported to bug-cpio. Please remember to re-run the autostuff (in this case, the following were needed: aclocal ; autoheader ; autoconf ; automake). Thanks! [1] ftp://download.gnu.org.ua/pub/alpha/cpio/cpio-2.9.90-20071205.tar.gz -- System Information: Debian Release: lenny/sid APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.18-5-amd64 Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8) Versions of packages cpio depends on: ii libc6 2.3.6.ds1-13etch2 GNU C Library: Shared libraries cpio recommends no packages. -- no debconf information
diff -x testsuite -x Makefile.in -x configure -x config.h.in -x aclocal.m4 -Nurp cpio-2.9.old/debian/control cpio-2.9/debian/control --- cpio-2.9.old/debian/control 2007-12-05 18:30:29.000000000 +0100 +++ cpio-2.9/debian/control 2007-12-05 18:43:16.000000000 +0100 @@ -2,7 +2,7 @@ Source: cpio Section: utils Priority: important Maintainer: Clint Adams <[EMAIL PROTECTED]> -Build-Depends: texinfo, gettext +Build-Depends: texinfo, gettext, mingw32 Standards-Version: 3.7.2 XS-VCS-Git: git://git.debian.org/git/private/schizo/cpio XS-VCS-Browser: http://git.debian.org/?p=private/schizo/cpio/.git @@ -16,3 +16,15 @@ Description: GNU cpio -- a program to ma GNU cpio is a tool for creating and extracting archives, or copying files from one place to another. It handles a number of cpio formats as well as reading and writing tar files. + +Package: cpio-win32 +Architecture: all +Priority: extra +Suggests: wine +Description: GNU cpio -- a program to manage archives of files (win32 build) + GNU cpio is a tool for creating and extracting archives, or copying + files from one place to another. It handles a number of cpio formats + as well as reading and writing tar files. + . + This is a win32 version of cpio. It's meant to be used by the win32-loader + component of Debian-Installer. diff -x testsuite -x Makefile.in -x configure -x config.h.in -x aclocal.m4 -Nurp cpio-2.9.old/debian/rules cpio-2.9/debian/rules --- cpio-2.9.old/debian/rules 2007-12-05 18:30:29.000000000 +0100 +++ cpio-2.9/debian/rules 2007-12-26 17:29:33.000000000 +0100 @@ -28,9 +28,10 @@ ifeq (,$(findstring nostrip,$(DEB_BUILD_ INSTALL_PROGRAM += -s endif -Makefile: +build/Makefile: $(checkdir) - CFLAGS='$(CFLAGS)' CPIO_MT_PROG=mt ./configure --prefix=/usr $(CROSS) \ + mkdir -p build + cd build && CFLAGS='$(CFLAGS)' CPIO_MT_PROG=mt ../configure --prefix=/usr $(CROSS) \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --bindir=/bin \ @@ -38,27 +39,61 @@ Makefile: touch tests/testsuite -build: Makefile +build-win32/Makefile: $(checkdir) - $(MAKE) + mkdir -p build-win32 + cd build-win32 && CFLAGS='$(CFLAGS)' ../configure --host i586-mingw32msvc + +build-stamp: build/Makefile + $(checkdir) + $(MAKE) -C build touch tests/testsuite.at tests/testsuite ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) - $(MAKE) check + $(MAKE) -C build check endif - touch build + touch $@ + +build-win32-stamp: build-win32/Makefile + $(checkdir) + $(MAKE) -C build-win32 + touch $@ + +build: build-stamp build-win32-stamp clean: $(checkdir) - $(RM) build + $(RM) build-stamp build-win32-stamp -$(MAKE) -i distclean $(RM) config.cache - $(RM) -r *~ debian/tmp debian/*~ debian/files* + $(RM) -r *~ debian/tmp debian/tmp-win32 debian/*~ debian/files* build build-win32 $(RM) -f debian/substvars -binary-indep: checkroot build +binary-indep: checkroot build-stamp build-win32-stamp $(checkdir) + $(RM) -r debian/tmp-win32 + $(INSTALL_DIR) debian/tmp-win32 debian/tmp-win32/DEBIAN + $(INSTALL_DIR) debian/tmp-win32/usr/share/doc/$(package)-win32 +# Install directories + $(INSTALL_DIR) \ + debian/tmp-win32/usr/share/win32 +# Install files + install -m 755 build-win32/src/cpio.exe debian/tmp-win32/usr/share/win32/ +# Install changelog & copyright + install -m 644 debian/changelog \ + debian/tmp-win32/usr/share/doc/$(package)-win32/changelog.Debian + gzip -9v debian/tmp-win32/usr/share/doc/$(package)-win32/* + install -m 644 debian/copyright debian/tmp/usr/share/doc/$(package)/. + +# Generate md5sums + cd debian/tmp && find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums + +# Generate deb file + dpkg-gencontrol -pcpio-win32 -Pdebian/tmp-win32 + chown -R root.root debian/tmp-win32 + chmod -R g-ws debian/tmp-win32 + dpkg-deb --build debian/tmp-win32 .. -binary-arch: checkroot build +binary-arch: checkroot build-stamp $(checkdir) $(RM) -r debian/tmp $(INSTALL_DIR) debian/tmp debian/tmp/DEBIAN @@ -72,7 +107,7 @@ binary-arch: checkroot build debian/tmp/usr/share/man/man1 \ debian/tmp/usr/share/info # Install files - $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp + $(MAKE) -C build install DESTDIR=$(CURDIR)/debian/tmp rm -rf debian/tmp/usr/libexec mv debian/tmp/bin/mt debian/tmp/bin/mt-gnu mv debian/tmp/usr/share/man/man1/mt.1 \ @@ -99,7 +134,7 @@ endif cd debian/tmp && find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums # Generate deb file - dpkg-gencontrol -isp + dpkg-gencontrol -pcpio -Pdebian/tmp chown -R root.root debian/tmp chmod -R g-ws debian/tmp dpkg-deb --build debian/tmp ..
diff -x testsuite -x Makefile.in -x configure -x config.h.in -x aclocal.m4 -Nurp cpio-2.9.old/configure.ac cpio-2.9/configure.ac --- cpio-2.9.old/configure.ac 2007-06-29 12:14:40.000000000 +0200 +++ cpio-2.9/configure.ac 2007-12-05 18:36:21.000000000 +0100 @@ -45,7 +45,7 @@ AC_CHECK_TYPE(gid_t, int) AC_HEADER_STDC AC_HEADER_DIRENT -AC_CHECK_FUNCS([fchmod fchown]) +AC_CHECK_FUNCS([fchmod fchown chown link symlink getuid geteuid setuid getgid setgid mknod pipe]) # gnulib modules gl_INIT @@ -61,7 +61,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 pwd.h grp.h sys/ioctl.h) AC_MSG_CHECKING(for sys_errlist and sys_nerr) AC_TRY_RUN( diff -x testsuite -x Makefile.in -x configure -x config.h.in -x aclocal.m4 -Nurp cpio-2.9.old/lib/Makefile.am cpio-2.9/lib/Makefile.am --- cpio-2.9.old/lib/Makefile.am 2007-06-27 16:00:13.000000000 +0200 +++ cpio-2.9/lib/Makefile.am 2007-12-05 18:36:21.000000000 +0100 @@ -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 -x testsuite -x Makefile.in -x configure -x config.h.in -x aclocal.m4 -Nurp cpio-2.9.old/lib/system.c cpio-2.9/lib/system.c --- cpio-2.9.old/lib/system.c 1970-01-01 01:00:00.000000000 +0100 +++ cpio-2.9/lib/system.c 2007-12-05 18:36:21.000000000 +0100 @@ -0,0 +1,156 @@ +/* System dependent functions for GNU cpio. + + Copyright (C) 2007 Free Software Foundation, Inc. + + This program 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. + + This program 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 this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#include <unistd.h> +#include <errno.h> + +#ifndef HAVE_PWUID +struct passwd * +getpwuid (uid_t uid __attribute__ ((unused))) +{ + errno = ENOSYS; + return NULL; +} +#endif + +#ifndef HAVE_GETPWNAM +struct passwd * +getpwnam (const char *name __attribute__ ((unused))) +{ + errno = ENOSYS; + return NULL; +} +#endif + +#ifndef HAVE_GETGRGID +struct group * +getgrgid (gid_t gid __attribute__ ((unused))) +{ + errno = ENOSYS; + return NULL; +} +#endif + +#ifndef HAVE_GETGRNAM +struct group * +getgrnam (const char *name __attribute__ ((unused))) +{ + errno = ENOSYS; + return NULL; +} +#endif + +#ifndef HAVE_PIPE +int +pipe (int filedes[2] __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + +#ifndef HAVE_FORK +int +fork (void) +{ + errno = ENOSYS; + return -1; +} +#endif + +#ifndef HAVE_GETUID +int +getuid (void) +{ + return 0; +} +#endif + +#ifndef HAVE_GETEUID +int +geteuid (void) +{ + return 0; +} +#endif + +#ifndef HAVE_GETGID +int +getgid (void) +{ + return 0; +} +#endif + +#ifndef HAVE_SETUID +int +setuid (int newuid __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + +#ifndef HAVE_SETGID +int +setgid (int newgid __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + +#ifndef HAVE_MKNOD +int +mknod (const char *filename __attribute__ ((unused)), int mode __attribute__ ((unused)), int dev __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + +#ifndef HAVE_SYMLINK +int +symlink (const char *oldname __attribute__ ((unused)), const char *newname __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + +#ifndef HAVE_LINK +int +link (const char *oldname __attribute__ ((unused)), const char *newname __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + +#ifndef HAVE_CHOWN +int +chown (const char *filename __attribute__ ((unused)), int owner __attribute__ ((unused)), int group __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif diff -x testsuite -x Makefile.in -x configure -x config.h.in -x aclocal.m4 -Nurp cpio-2.9.old/lib/system.h cpio-2.9/lib/system.h --- cpio-2.9.old/lib/system.h 2007-06-27 15:49:45.000000000 +0200 +++ cpio-2.9/lib/system.h 2007-12-05 18:36:21.000000000 +0100 @@ -453,16 +453,49 @@ char *getenv (); #define _(msgid) gettext (msgid) #define N_(msgid) msgid -#if MSDOS +/* msdos (and win32?) */ +#ifdef HAVE_PROCESS_H # include <process.h> +#endif + +/* Everyone else */ +#ifdef HAVE_PWD_H +# include <pwd.h> +#else +/* 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 +#ifdef HAVE_GRP_H +# include <grp.h> +#else +/* 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 + +#if MSDOS # define SET_BINARY_MODE(arc) setmode(arc, O_BINARY) # define ERRNO_IS_EACCES errno == EACCES # define mkdir(file, mode) (mkdir) (file) # define TTY_NAME "con" # define sys_reset_uid_gid() #else -# include <pwd.h> -# include <grp.h> # define SET_BINARY_MODE(arc) # define ERRNO_IS_EACCES 0 # define TTY_NAME "/dev/tty" @@ -473,3 +506,8 @@ char *getenv (); #if XENIX # include <sys/inode.h> #endif + +#include <signal.h> +#ifndef SIGPIPE +# define SIGPIPE -1 +#endif diff -x testsuite -x Makefile.in -x configure -x config.h.in -x aclocal.m4 -Nurp cpio-2.9.old/src/idcache.c cpio-2.9/src/idcache.c --- cpio-2.9.old/src/idcache.c 2007-06-28 12:45:35.000000000 +0200 +++ cpio-2.9/src/idcache.c 2007-12-05 18:36:21.000000000 +0100 @@ -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 -x testsuite -x Makefile.in -x configure -x config.h.in -x aclocal.m4 -Nurp cpio-2.9.old/src/userspec.c cpio-2.9/src/userspec.c --- cpio-2.9.old/src/userspec.c 2007-06-27 16:00:13.000000000 +0200 +++ cpio-2.9/src/userspec.c 2007-12-05 18:36:21.000000000 +0100 @@ -38,17 +38,22 @@ char *alloca (); #include <stdio.h> #include <ctype.h> #include <sys/types.h> -#include <pwd.h> -#include <grp.h> -#if !HAVE_DECL_GETPWNAM +#ifdef HAVE_PWD_H +# include <pwd.h> +# if !HAVE_DECL_GETPWNAM extern struct passwd *getpwnam (const char *name); +# endif #endif -#if !HAVE_DECL_GETGRNAM + +#ifdef HAVE_GRP_H +# include <grp.h> +# if !HAVE_DECL_GETGRNAM extern struct group *getgrnam (const char *name); -#endif -#if !HAVE_DECL_GETGRGID +# endif +# if !HAVE_DECL_GETGRGID extern struct group *getgrgid (gid_t gid); +# endif #endif #ifndef HAVE_ENDPWENT diff -x testsuite -x Makefile.in -x configure -x config.h.in -x aclocal.m4 -Nurp cpio-2.9.old/src/util.c cpio-2.9/src/util.c --- cpio-2.9.old/src/util.c 2007-06-28 15:04:51.000000000 +0200 +++ cpio-2.9/src/util.c 2007-12-05 18:36:21.000000000 +0100 @@ -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 } #ifndef HAVE_FCHOWN -# define fchown(fd, uid, gid) (-1) +# define HAVE_FCHOWN 0 +#endif +#ifndef HAVE_FCHMOD +# define HAVE_FCHMOD 0 #endif int
diff -x testsuite -x Makefile.in -x configure -x config.h.in -x aclocal.m4 -Nurp cpio-2.9.old/src/Makefile.am cpio-2.9/src/Makefile.am --- cpio-2.9.old/src/Makefile.am 2007-06-27 16:00:13.000000000 +0200 +++ cpio-2.9/src/Makefile.am 2007-12-26 10:23:07.000000000 +0100 @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA. -INCLUDES=-I. -I.. -I$(top_srcdir)/lib +INCLUDES=-I. -I.. -I$(top_srcdir)/lib -I../lib bin_PROGRAMS=cpio @CPIO_MT_PROG@ EXTRA_PROGRAMS=mt