Chromium Code Reviews| Index: ports/coreutils/nacl.patch |
| diff --git a/ports/coreutils/nacl.patch b/ports/coreutils/nacl.patch |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e830ec367881ed38854e573a65e4fc995f5a0e57 |
| --- /dev/null |
| +++ b/ports/coreutils/nacl.patch |
| @@ -0,0 +1,133 @@ |
| +diff --git a/Makefile.in b/Makefile.in |
| +index dab25d0..e2ddb16 100644 |
| +--- a/Makefile.in |
| ++++ b/Makefile.in |
| +@@ -612,7 +612,7 @@ nodist_src_libver_a_OBJECTS = src/version.$(OBJEXT) |
| + src_libver_a_OBJECTS = $(nodist_src_libver_a_OBJECTS) |
| + am__EXEEXT_1 = src/arch$(EXEEXT) src/hostname$(EXEEXT) |
| + am__EXEEXT_2 = src/chroot$(EXEEXT) src/df$(EXEEXT) src/hostid$(EXEEXT) \ |
| +- src/libstdbuf.so$(EXEEXT) src/nice$(EXEEXT) src/pinky$(EXEEXT) \ |
|
Sam Clegg
2014/01/15 16:48:39
Is this an upstream bug?
hamaji
2014/01/16 05:43:46
Yes, I think. What are we doing for upstreamable c
|
| ++ src/libstdbuf.so src/nice$(EXEEXT) src/pinky$(EXEEXT) \ |
| + src/stdbuf$(EXEEXT) src/stty$(EXEEXT) src/uptime$(EXEEXT) \ |
| + src/users$(EXEEXT) src/who$(EXEEXT) |
| + am__EXEEXT_3 = src/[$(EXEEXT) src/base64$(EXEEXT) \ |
| +@@ -1493,7 +1493,7 @@ CPP = @CPP@ |
| + CPPFLAGS = @CPPFLAGS@ |
| + CYGPATH_W = @CYGPATH_W@ |
| + DEFAULT_POSIX2_VERSION = @DEFAULT_POSIX2_VERSION@ |
| +-DEFS = @DEFS@ |
| ++DEFS = @DEFS@ -Dmain=nacl_main |
| + DEPDIR = @DEPDIR@ |
| + ECHO_C = @ECHO_C@ |
| + ECHO_N = @ECHO_N@ |
| +@@ -2306,7 +2306,7 @@ LIBMULTITHREAD = @LIBMULTITHREAD@ |
| + LIBOBJS = @LIBOBJS@ |
| + LIBPTH = @LIBPTH@ |
| + LIBPTH_PREFIX = @LIBPTH_PREFIX@ |
| +-LIBS = @LIBS@ |
| ++LIBS = @LIBS@ $(EXTRA_LIBS) |
| + LIBSOCKET = @LIBSOCKET@ |
| + LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ |
| + LIBTHREAD = @LIBTHREAD@ |
| +@@ -2749,7 +2749,9 @@ libexecdir = @libexecdir@ |
| + lispdir = @lispdir@ |
| + localedir = @localedir@ |
| + localstatedir = @localstatedir@ |
| +-man1_MANS = @man1_MANS@ |
| ++# The build rule for man pages are broken for NaCl, and we do not need |
| ++# man pages anyway. |
| ++#man1_MANS = @man1_MANS@ |
| + mandir = @mandir@ |
| + mkdir_p = @mkdir_p@ |
| + oldincludedir = @oldincludedir@ |
| +@@ -5579,8 +5581,8 @@ src/kill$(EXEEXT): $(src_kill_OBJECTS) $(src_kill_DEPENDENCIES) $(EXTRA_src_kill |
| + src/src_libstdbuf_so-libstdbuf.$(OBJEXT): src/$(am__dirstamp) \ |
| + src/$(DEPDIR)/$(am__dirstamp) |
| + |
| +-src/libstdbuf.so$(EXEEXT): $(src_libstdbuf_so_OBJECTS) $(src_libstdbuf_so_DEPENDENCIES) $(EXTRA_src_libstdbuf_so_DEPENDENCIES) src/$(am__dirstamp) |
| +- @rm -f src/libstdbuf.so$(EXEEXT) |
| ++src/libstdbuf.so: $(src_libstdbuf_so_OBJECTS) $(src_libstdbuf_so_DEPENDENCIES) $(EXTRA_src_libstdbuf_so_DEPENDENCIES) src/$(am__dirstamp) |
| ++ @rm -f src/libstdbuf.so |
| + $(AM_V_CCLD)$(src_libstdbuf_so_LINK) $(src_libstdbuf_so_OBJECTS) $(src_libstdbuf_so_LDADD) $(LIBS) |
| + src/link.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) |
| + |
| +diff --git a/lib/openat.c b/lib/openat.c |
| +index fd1ff91..0155f9d 100644 |
| +--- a/lib/openat.c |
| ++++ b/lib/openat.c |
| +@@ -27,6 +27,11 @@ |
| + #include <sys/types.h> |
| + #undef __need_system_fcntl_h |
| + |
| ++#if defined(__native_client__) |
| ++/* We do not have openat. */ |
| ++#undef HAVE_OPENAT |
| ++#endif |
| ++ |
| + #if HAVE_OPENAT |
| + static int |
| + orig_openat (int fd, char const *filename, int flags, mode_t mode) |
| +diff --git a/lib/sigaction.c b/lib/sigaction.c |
| +index 97eb76d..86c9008 100644 |
| +--- a/lib/sigaction.c |
| ++++ b/lib/sigaction.c |
| +@@ -15,6 +15,8 @@ |
| + You should have received a copy of the GNU General Public License |
| + along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| + |
| ++#if !defined(__native_client__) |
| ++ |
| + #include <config.h> |
| + |
| + /* Specification. */ |
| +@@ -202,3 +204,5 @@ sigaction (int sig, const struct sigaction *restrict act, |
| + errno = saved_errno; |
| + return -1; |
| + } |
| ++ |
| ++#endif |
| +diff --git a/lib/signal.in.h b/lib/signal.in.h |
| +index a531487..4f5d605 100644 |
| +--- a/lib/signal.in.h |
| ++++ b/lib/signal.in.h |
| +@@ -402,6 +402,10 @@ typedef struct siginfo_t siginfo_t; |
| + /* We assume that platforms which lack the sigaction() function also lack |
| + the 'struct sigaction' type, and vice versa. */ |
| + |
| ++# if defined(__native_client__) |
| ++# define GNULIB_defined_struct_sigaction 1 |
| ++# endif |
| ++ |
| + # if !GNULIB_defined_struct_sigaction |
| + |
| + struct sigaction |
| +diff --git a/src/fs.h b/src/fs.h |
| +index 8826c4f..c8d2a23 100644 |
| +--- a/src/fs.h |
| ++++ b/src/fs.h |
| +@@ -2,7 +2,7 @@ |
| + Please send additions to bug-coreutils@gnu.org and meskes@debian.org. |
| + This file is generated automatically from ./src/stat.c. */ |
| + |
| +-#if defined __linux__ |
| ++#if defined __linux__ || defined __native_client__ |
| + # define S_MAGIC_ADFS 0xADF5 |
| + # define S_MAGIC_AFFS 0xADFF |
| + # define S_MAGIC_AFS 0x5346414F |
| +diff --git a/src/ls.c b/src/ls.c |
| +index e7d1d93..518c39f 100644 |
| +--- a/src/ls.c |
| ++++ b/src/ls.c |
| +@@ -3641,7 +3641,12 @@ align_nstrftime (char *buf, size_t size, char const *fmt, struct tm const *tm, |
| + char *pfmt = rpl_fmt; |
| + nfmt = rpl_fmt; |
| + |
| ++#if defined(__native_client__) |
|
Sam Clegg
2014/01/15 16:48:39
What is this fix? Can you add a comment maybe?
hamaji
2014/01/16 05:43:46
Sorry, I forgot to write comments for this patch.
|
| ++ memcpy (pfmt, fmt, pb - fmt); |
| ++ pfmt = pfmt + (pb - fmt); |
| ++#else |
| + pfmt = mempcpy (pfmt, fmt, pb - fmt); |
| ++#endif |
| + pfmt = stpcpy (pfmt, abmon[tm->tm_mon]); |
| + strcpy (pfmt, pb + 2); |
| + } |