Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: libraries/python/nacl.patch

Issue 18112024: Fix python to build with newlib. (Closed) Base URL: https://naclports.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « libraries/python/config.site ('k') | libraries/python/nacl-python.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 diff --git a/Makefile.pre.in b/Makefile.pre.in 1 diff --git a/Makefile.pre.in b/Makefile.pre.in
2 index 9d55550..09e7a69 100644 2 index 9d55550..09e7a69 100644
3 --- a/Makefile.pre.in 3 --- a/Makefile.pre.in
4 +++ b/Makefile.pre.in 4 +++ b/Makefile.pre.in
5 @@ -592,14 +592,18 @@ Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdi r)/Modules/posixmodule 5 @@ -592,14 +592,18 @@ Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdi r)/Modules/posixmodule
6 6
7 $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS) 7 $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
8 @$(MKDIR_P) Include 8 @$(MKDIR_P) Include
9 +ifndef CROSS_COMPILE 9 +ifndef CROSS_COMPILE
10 $(MAKE) $(PGEN) 10 $(MAKE) $(PGEN)
(...skipping 19 matching lines...) Expand all
30 $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ 30 $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
31 -d $(LIBDEST) -f \ 31 -d $(LIBDEST) -f \
32 @@ -1018,6 +1023,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(src dir)/Modules/xxmodule.c 32 @@ -1018,6 +1023,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(src dir)/Modules/xxmodule.c
33 $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ 33 $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
34 -d $(LIBDEST)/site-packages -f \ 34 -d $(LIBDEST)/site-packages -f \
35 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages 35 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
36 +endif 36 +endif
37 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 37 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
38 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST) /lib2to3/Grammar.txt 38 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST) /lib2to3/Grammar.txt
39 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ 39 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
40 diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
41 index 65ade9f..fad16aa 100644
42 --- a/Modules/posixmodule.c
43 +++ b/Modules/posixmodule.c
44 @@ -216,6 +216,31 @@ extern int lstat(const char *, struct stat *);
45
46 #endif /* !_MSC_VER */
47
48 +#if defined(__native_client__) && !defined(__GLIBC__)
49 +// NaCl's newlib headers don't declare these functions
50 +
51 +// TODO(sbc): add this to newlib's header:
52 +// https://code.google.com/p/nativeclient/issues/detail?id=3363
53 +extern int ftruncate(int fd, off_t length);
54 +
55 +// TODO(sbc): remove these once this change makes it into the NaCl SDK:
56 +// https://src.chromium.org/viewvc/native_client?view=rev&revision=11693
57 +extern int lstat(const char *, struct stat *);
58 +
59 +// These functions are missing from NaCl's newlib and nosys libraries.
60 +// TODO(sbc): remove these once this change makes it into the NaCl SDK:
61 +// https://codereview.chromium.org/18817002
62 +int fsync(int fd) {
63 + errno = ENOSYS;
64 + return -1;
65 +}
66 +
67 +int fdatasync(int fd) {
68 + errno = ENOSYS;
69 + return -1;
70 +}
71 +#endif
72 +
73 #ifdef HAVE_UTIME_H
74 #include <utime.h>
75 #endif /* HAVE_UTIME_H */
40 diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c 76 diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c
41 index c2907f6..9e64898 100644 77 index c2907f6..9e64898 100644
42 --- a/Modules/pwdmodule.c 78 --- a/Modules/pwdmodule.c
43 +++ b/Modules/pwdmodule.c 79 +++ b/Modules/pwdmodule.c
44 @@ -94,6 +94,22 @@ mkpwent(struct passwd *p) 80 @@ -94,6 +94,22 @@ mkpwent(struct passwd *p)
45 return v; 81 return v;
46 } 82 }
47 83
48 +#ifdef __native_client__ 84 +#ifdef __native_client__
49 +struct passwd *getpwuid(uid_t uid) 85 +struct passwd *getpwuid(uid_t uid)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 @@ -20,5 +24,9 @@ main(int argc, char **argv) 118 @@ -20,5 +24,9 @@ main(int argc, char **argv)
83 m = fpgetmask(); 119 m = fpgetmask();
84 fpsetmask(m & ~FP_X_OFL); 120 fpsetmask(m & ~FP_X_OFL);
85 #endif 121 #endif
86 +#ifdef __native_client__ 122 +#ifdef __native_client__
87 + setvbuf(stdout, NULL, _IOLBF, 0); 123 + setvbuf(stdout, NULL, _IOLBF, 0);
88 + setvbuf(stdin, NULL, _IOLBF, 0); 124 + setvbuf(stdin, NULL, _IOLBF, 0);
89 +#endif 125 +#endif
90 return Py_Main(argc, argv); 126 return Py_Main(argc, argv);
91 } 127 }
128 diff --git a/Python/thread.c b/Python/thread.c
129 index dd333e8..33fec81 100644
130 --- a/Python/thread.c
131 +++ b/Python/thread.c
132 @@ -14,9 +14,19 @@
133 library (e.g. gnu pth in pthread emulation) */
134 # ifdef HAVE_PTHREAD_H
135 # include <pthread.h> /* _POSIX_THREADS */
136 +# if defined __native_client__ && !defined __GLIBC__
137 + /* Under NaCl newlib neither pthread.h nor unistd.h defines _POSIX_THREADS .
138 + However this file expects it to be defined if pthreads are present so w e
139 + define it here after including pthread.h
140 + TODO(sbc): remove this hack once newlib is fixed:
141 + https://code.google.com/p/nativeclient/issues/detail?id=3551
142 + */
143 +# define _POSIX_THREADS
144 +# endif
145 # endif
146 #endif
147
148 +
149 #ifndef DONT_HAVE_STDIO_H
150 #include <stdio.h>
151 #endif
92 diff --git a/configure b/configure 152 diff --git a/configure b/configure
93 index dc0dfd0..d45f7b0 100755 153 index dc0dfd0..d45f7b0 100755
94 --- a/configure 154 --- a/configure
95 +++ b/configure 155 +++ b/configure
96 @@ -2853,19 +2853,26 @@ if test "$cross_compiling" = yes; then 156 @@ -2853,19 +2853,26 @@ if test "$cross_compiling" = yes; then
97 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter fo r cross build" >&5 157 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter fo r cross build" >&5
98 $as_echo_n "checking for python interpreter for cross build... " >&6; } 158 $as_echo_n "checking for python interpreter for cross build... " >&6; }
99 if test -z "$PYTHON_FOR_BUILD"; then 159 if test -z "$PYTHON_FOR_BUILD"; then
100 - for interp in python$PACKAGE_VERSION python2 python; do 160 - for interp in python$PACKAGE_VERSION python2 python; do
101 - which $interp >/dev/null 2>&1 || continue 161 - which $interp >/dev/null 2>&1 || continue
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 OpenUNIX*|UnixWare*) 325 OpenUNIX*|UnixWare*)
266 @@ -2128,7 +2147,7 @@ then 326 @@ -2128,7 +2147,7 @@ then
267 LINKFORSHARED="-Wl,-E -Wl,+s";; 327 LINKFORSHARED="-Wl,-E -Wl,+s";;
268 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; 328 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
269 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; 329 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
270 - Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; 330 - Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
271 + Linux*|GNU*|NaCl*) LINKFORSHARED="-Xlinker -export-dynamic";; 331 + Linux*|GNU*|NaCl*) LINKFORSHARED="-Xlinker -export-dynamic";;
272 # -u libsys_s pulls in all symbols in libsys 332 # -u libsys_s pulls in all symbols in libsys
273 Darwin/*) 333 Darwin/*)
274 # -u _PyMac_Error is needed to pull in the mac toolbox glue, 334 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
OLDNEW
« no previous file with comments | « libraries/python/config.site ('k') | libraries/python/nacl-python.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698