diff options
-rwxr-xr-x | tools/rockboxdev.sh | 38 | ||||
-rw-r--r-- | tools/toolchain-patches/glibc-220-make44.patch | 224 | ||||
-rw-r--r-- | tools/toolchain-patches/glibc-225-make44.patch | 228 |
3 files changed, 484 insertions, 6 deletions
diff --git a/tools/rockboxdev.sh b/tools/rockboxdev.sh index 475977c46f..5c71589148 100755 --- a/tools/rockboxdev.sh +++ b/tools/rockboxdev.sh | |||
@@ -29,8 +29,12 @@ else | |||
29 | make="make" | 29 | make="make" |
30 | fi | 30 | fi |
31 | 31 | ||
32 | # record version | ||
33 | makever=`$make -v |sed -n '1p' | sed -e 's/.* \([0-9]*\)\.\([0-9]*\).*/\1\2/'` | ||
34 | |||
32 | # This is the absolute path to where the script resides. | 35 | # This is the absolute path to where the script resides. |
33 | rockboxdevdir="$( readlink -f "$( dirname "${BASH_SOURCE[0]}" )" )" | 36 | rockboxdevdir="$( readlink -f "$( dirname "${BASH_SOURCE[0]}" )" )" |
37 | patch_dir="$rockboxdevdir/toolchain-patches" | ||
34 | 38 | ||
35 | if [ `uname -s` = "Darwin" ]; then | 39 | if [ `uname -s` = "Darwin" ]; then |
36 | parallel=`sysctl -n hw.physicalcpu` | 40 | parallel=`sysctl -n hw.physicalcpu` |
@@ -51,7 +55,7 @@ if [ -z $LINUX_MIRROR ] ; then | |||
51 | fi | 55 | fi |
52 | 56 | ||
53 | # These are the tools this script requires and depends upon. | 57 | # These are the tools this script requires and depends upon. |
54 | reqtools="gcc g++ xz bzip2 gzip make patch makeinfo automake libtool autoconf flex bison" | 58 | reqtools="gcc g++ xz bzip2 gzip $make patch makeinfo automake libtool autoconf flex bison" |
55 | 59 | ||
56 | ############################################################################## | 60 | ############################################################################## |
57 | # Functions: | 61 | # Functions: |
@@ -427,8 +431,6 @@ build() { | |||
427 | mkdir -p $builddir | 431 | mkdir -p $builddir |
428 | fi | 432 | fi |
429 | 433 | ||
430 | patch_dir="$rockboxdevdir/toolchain-patches" | ||
431 | |||
432 | # download source tarball | 434 | # download source tarball |
433 | gettool "$toolname" "$version" | 435 | gettool "$toolname" "$version" |
434 | file="$toolname-$version" | 436 | file="$toolname-$version" |
@@ -530,6 +532,8 @@ build_linux_toolchain () { | |||
530 | linux_ver="$6" | 532 | linux_ver="$6" |
531 | glibc_ver="$7" | 533 | glibc_ver="$7" |
532 | glibc_opts="$8" | 534 | glibc_opts="$8" |
535 | glibc_patches="$9" | ||
536 | |||
533 | # where to put the sysroot | 537 | # where to put the sysroot |
534 | sysroot="$prefix/$target/sysroot" | 538 | sysroot="$prefix/$target/sysroot" |
535 | # extract arch from target | 539 | # extract arch from target |
@@ -553,6 +557,11 @@ build_linux_toolchain () { | |||
553 | mkdir -p $builddir | 557 | mkdir -p $builddir |
554 | fi | 558 | fi |
555 | 559 | ||
560 | if [ "$makever" -gt 43 ] ; then | ||
561 | glibc_make_opts="--jobserver-style=pipe --shuffle=none" | ||
562 | # MAKEFLAGS="--jobserver-style=pipe --shuffle=none" | ||
563 | fi | ||
564 | |||
556 | # download all tools | 565 | # download all tools |
557 | gettool "binutils" "$binutils_ver" | 566 | gettool "binutils" "$binutils_ver" |
558 | gettool "gcc" "$gcc_ver" | 567 | gettool "gcc" "$gcc_ver" |
@@ -566,6 +575,18 @@ build_linux_toolchain () { | |||
566 | extract "linux-$linux_ver" | 575 | extract "linux-$linux_ver" |
567 | extract "glibc-$glibc_ver" | 576 | extract "glibc-$glibc_ver" |
568 | 577 | ||
578 | # do we have a patch? | ||
579 | for p in $glibc_patches; do | ||
580 | echo "ROCKBOXDEV: applying patch $p" | ||
581 | (cd $builddir/glibc-$glibc_ver ; patch -p1 < "$patch_dir/$p") | ||
582 | |||
583 | # check if the patch applied cleanly | ||
584 | if [ $? -gt 0 ]; then | ||
585 | echo "ROCKBOXDEV: failed to apply patch $p" | ||
586 | exit | ||
587 | fi | ||
588 | done | ||
589 | |||
569 | # we make it possible to restart a build on error by using the RBDEV_RESTART | 590 | # we make it possible to restart a build on error by using the RBDEV_RESTART |
570 | # variable, the format is RBDEV_RESTART="tool" where tool is the toolname at which | 591 | # variable, the format is RBDEV_RESTART="tool" where tool is the toolname at which |
571 | # to restart (binutils, gcc) | 592 | # to restart (binutils, gcc) |
@@ -600,7 +621,7 @@ build_linux_toolchain () { | |||
600 | prefix="/usr" \ | 621 | prefix="/usr" \ |
601 | buildtool "glibc" "$glibc_ver" "--target=$target --host=$target --build=$MACHTYPE \ | 622 | buildtool "glibc" "$glibc_ver" "--target=$target --host=$target --build=$MACHTYPE \ |
602 | --with-__thread --with-headers=$sysroot/usr/include $glibc_opts" \ | 623 | --with-__thread --with-headers=$sysroot/usr/include $glibc_opts" \ |
603 | "" "install install_root=$sysroot" | 624 | "$glibc_make_opts" "install install_root=$sysroot" |
604 | # build stage 2 compiler | 625 | # build stage 2 compiler |
605 | RESTART_STEP="gcc-stage2" \ | 626 | RESTART_STEP="gcc-stage2" \ |
606 | buildtool "gcc" "$gcc_ver" "$gcc_opts --enable-languages=c,c++ --target=$target \ | 627 | buildtool "gcc" "$gcc_ver" "$gcc_opts --enable-languages=c,c++ --target=$target \ |
@@ -674,6 +695,11 @@ if [ -n "$missingtools" ]; then | |||
674 | exit 1 | 695 | exit 1 |
675 | fi | 696 | fi |
676 | 697 | ||
698 | if ! $make -v | grep -q GNU ; then | ||
699 | echo "ROCKBOXDEV: Building the rockbox toolchains requires GNU Make." | ||
700 | exit 1 | ||
701 | fi | ||
702 | |||
677 | dlwhere=$(readlink -f "$dlwhere") | 703 | dlwhere=$(readlink -f "$dlwhere") |
678 | prefix=$(readlink -f "$prefix") | 704 | prefix=$(readlink -f "$prefix") |
679 | builddir=$(readlink -f "$builddir") | 705 | builddir=$(readlink -f "$builddir") |
@@ -789,7 +815,7 @@ do | |||
789 | # avoid patches/bugs. | 815 | # avoid patches/bugs. |
790 | glibcopts="--enable-kernel=2.6.23 --enable-oldest-abi=2.4" | 816 | glibcopts="--enable-kernel=2.6.23 --enable-oldest-abi=2.4" |
791 | build_linux_toolchain "arm-rockbox-linux-gnueabi" "2.26.1" "" "4.9.4" \ | 817 | build_linux_toolchain "arm-rockbox-linux-gnueabi" "2.26.1" "" "4.9.4" \ |
792 | "$gccopts" "2.6.32.68" "2.19" "$glibcopts" | 818 | "$gccopts" "2.6.32.68" "2.19" "$glibcopts" "glibc-220-make44.patch" |
793 | # build alsa-lib | 819 | # build alsa-lib |
794 | # we need to set the prefix to how it is on device (/usr) and then | 820 | # we need to set the prefix to how it is on device (/usr) and then |
795 | # tweak install dir at make install step | 821 | # tweak install dir at make install step |
@@ -825,7 +851,7 @@ do | |||
825 | glibcopts="--enable-kernel=3.2 --enable-oldest-abi=2.16" | 851 | glibcopts="--enable-kernel=3.2 --enable-oldest-abi=2.16" |
826 | # FIXME: maybe add -mhard-float | 852 | # FIXME: maybe add -mhard-float |
827 | build_linux_toolchain "mipsel-rockbox-linux-gnu" "2.26.1" "" "4.9.4" \ | 853 | build_linux_toolchain "mipsel-rockbox-linux-gnu" "2.26.1" "" "4.9.4" \ |
828 | "$gccopts" "3.2.85" "2.25" "$glibcopts" | 854 | "$gccopts" "3.2.85" "2.25" "$glibcopts" "glibc-225-make44.patch" |
829 | # build alsa-lib | 855 | # build alsa-lib |
830 | # we need to set the prefix to how it is on device (/usr) and then | 856 | # we need to set the prefix to how it is on device (/usr) and then |
831 | # tweak install dir at make install step | 857 | # tweak install dir at make install step |
diff --git a/tools/toolchain-patches/glibc-220-make44.patch b/tools/toolchain-patches/glibc-220-make44.patch new file mode 100644 index 0000000000..6370acea80 --- /dev/null +++ b/tools/toolchain-patches/glibc-220-make44.patch | |||
@@ -0,0 +1,224 @@ | |||
1 | diff -Naur glibc-2.20/libio/stdio.h glibc-2.20-patched/libio/stdio.h | ||
2 | --- glibc-2.20/libio/stdio.h 2014-09-07 04:09:09.000000000 -0400 | ||
3 | +++ glibc-2.20-patched/libio/stdio.h 2023-05-23 14:44:22.278872059 -0400 | ||
4 | @@ -151,18 +151,23 @@ | ||
5 | # define P_tmpdir "/tmp" | ||
6 | #endif | ||
7 | |||
8 | +#define L_tmpnam 20 | ||
9 | +#define TMP_MAX 238328 | ||
10 | |||
11 | /* Get the values: | ||
12 | - L_tmpnam How long an array of chars must be to be passed to `tmpnam'. | ||
13 | - TMP_MAX The minimum number of unique filenames generated by tmpnam | ||
14 | - (and tempnam when it uses tmpnam's name space), | ||
15 | - or tempnam (the two are separate). | ||
16 | - L_ctermid How long an array to pass to `ctermid'. | ||
17 | - L_cuserid How long an array to pass to `cuserid'. | ||
18 | - FOPEN_MAX Minimum number of files that can be open at once. | ||
19 | FILENAME_MAX Maximum length of a filename. */ | ||
20 | #include <bits/stdio_lim.h> | ||
21 | |||
22 | +#ifdef __USE_POSIX | ||
23 | +# define L_ctermid 9 | ||
24 | +# if !defined __USE_XOPEN2K || defined __USE_GNU | ||
25 | +# define L_cuserid 9 | ||
26 | +# endif | ||
27 | +#endif | ||
28 | + | ||
29 | +#undef FOPEN_MAX | ||
30 | +#define FOPEN_MAX 16 | ||
31 | + | ||
32 | |||
33 | /* Standard streams. */ | ||
34 | extern struct _IO_FILE *stdin; /* Standard input stream. */ | ||
35 | diff -Naur glibc-2.20/Makerules glibc-2.20-patched/Makerules | ||
36 | --- glibc-2.20/Makerules 2014-09-07 04:09:09.000000000 -0400 | ||
37 | +++ glibc-2.20-patched/Makerules 2023-05-23 14:42:21.745795149 -0400 | ||
38 | @@ -1277,54 +1277,6 @@ | ||
39 | |||
40 | endif | ||
41 | |||
42 | -# These will have been set by sysdeps/posix/Makefile. | ||
43 | -L_tmpnam ?= 1 | ||
44 | -TMP_MAX ?= 0 | ||
45 | -L_ctermid ?= 1 | ||
46 | -L_cuserid ?= 1 | ||
47 | - | ||
48 | -stdio_lim = $(common-objpfx)bits/stdio_lim.h | ||
49 | - | ||
50 | -$(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @: | ||
51 | -$(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \ | ||
52 | - $(common-objpfx)config.make | ||
53 | - $(make-target-directory) | ||
54 | - { echo '#include "$(..)posix/bits/posix1_lim.h"'; \ | ||
55 | - echo '#define _LIBC 1'; \ | ||
56 | - echo '#include "$(..)misc/sys/uio.h"'; } | \ | ||
57 | - $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)' \ | ||
58 | - $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT) | ||
59 | - sed $(sed-remove-objpfx) $(sed-remove-dotdot) \ | ||
60 | - $(@:st=dT) > $(@:st=dt) | ||
61 | - mv -f $(@:st=dt) $(@:st=d) | ||
62 | - fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \ | ||
63 | - filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \ | ||
64 | - iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`; \ | ||
65 | - fopen_max=$${fopen_max:-16}; \ | ||
66 | - filename_max=$${filename_max:-1024}; \ | ||
67 | - if [ -z "$$iov_max" ]; then \ | ||
68 | - define_iov_max="# undef IOV_MAX"; \ | ||
69 | - else \ | ||
70 | - define_iov_max="# define IOV_MAX $$iov_max"; \ | ||
71 | - fi; \ | ||
72 | - sed -e "s/@FOPEN_MAX@/$$fopen_max/" \ | ||
73 | - -e "s/@FILENAME_MAX@/$$filename_max/" \ | ||
74 | - -e "s/@L_tmpnam@/$(L_tmpnam)/" \ | ||
75 | - -e "s/@TMP_MAX@/$(TMP_MAX)/" \ | ||
76 | - -e "s/@L_ctermid@/$(L_ctermid)/" \ | ||
77 | - -e "s/@L_cuserid@/$(L_cuserid)/" \ | ||
78 | - -e "s/@define_IOV_MAX@/$$define_iov_max/" \ | ||
79 | - $< > $(@:st=h.new) | ||
80 | - $(move-if-change) $(@:st=h.new) $(@:st=h) | ||
81 | -# Remove these last so that they can be examined if something went wrong. | ||
82 | - rm -f $(@:st=hT) $(@:st=dT) $(@:st=dt) | ||
83 | - touch $@ | ||
84 | -# Get dependencies. | ||
85 | -ifndef no_deps | ||
86 | --include $(stdio_lim:h=d) | ||
87 | -endif | ||
88 | -common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st | ||
89 | - | ||
90 | FORCE: | ||
91 | |||
92 | .PHONY: echo-headers | ||
93 | diff -Naur glibc-2.20/Rules glibc-2.20-patched/Rules | ||
94 | --- glibc-2.20/Rules 2014-09-07 04:09:09.000000000 -0400 | ||
95 | +++ glibc-2.20-patched/Rules 2023-05-23 14:44:22.279872060 -0400 | ||
96 | @@ -60,9 +60,6 @@ | ||
97 | common-generated := | ||
98 | endif | ||
99 | |||
100 | -# See below. This must be set before Makerules processes it. | ||
101 | -before-compile += $(common-objpfx)bits/stdio_lim.h | ||
102 | - | ||
103 | include $(..)Makerules | ||
104 | |||
105 | .PHONY: subdir_lib | ||
106 | diff -Naur glibc-2.20/stdio-common/stdio_lim.h.in glibc-2.20-patched/stdio-common/stdio_lim.h.in | ||
107 | --- glibc-2.20/stdio-common/stdio_lim.h.in 2014-09-07 04:09:09.000000000 -0400 | ||
108 | +++ glibc-2.20-patched/stdio-common/stdio_lim.h.in 1969-12-31 19:00:00.000000000 -0500 | ||
109 | @@ -1,42 +0,0 @@ | ||
110 | -/* Copyright (C) 1994-2014 Free Software Foundation, Inc. | ||
111 | - This file is part of the GNU C Library. | ||
112 | - | ||
113 | - The GNU C Library is free software; you can redistribute it and/or | ||
114 | - modify it under the terms of the GNU Lesser General Public | ||
115 | - License as published by the Free Software Foundation; either | ||
116 | - version 2.1 of the License, or (at your option) any later version. | ||
117 | - | ||
118 | - The GNU C Library is distributed in the hope that it will be useful, | ||
119 | - but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
120 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
121 | - Lesser General Public License for more details. | ||
122 | - | ||
123 | - You should have received a copy of the GNU Lesser General Public | ||
124 | - License along with the GNU C Library; if not, see | ||
125 | - <http://www.gnu.org/licenses/>. */ | ||
126 | - | ||
127 | -#if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX | ||
128 | -# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." | ||
129 | -#endif | ||
130 | - | ||
131 | -#ifdef _STDIO_H | ||
132 | -# define L_tmpnam @L_tmpnam@ | ||
133 | -# define TMP_MAX @TMP_MAX@ | ||
134 | -# define FILENAME_MAX @FILENAME_MAX@ | ||
135 | - | ||
136 | -# ifdef __USE_POSIX | ||
137 | -# define L_ctermid @L_ctermid@ | ||
138 | -# if !defined __USE_XOPEN2K || defined __USE_GNU | ||
139 | -# define L_cuserid @L_cuserid@ | ||
140 | -# endif | ||
141 | -# endif | ||
142 | -#endif | ||
143 | - | ||
144 | -#if defined __need_FOPEN_MAX || defined _STDIO_H | ||
145 | -# undef FOPEN_MAX | ||
146 | -# define FOPEN_MAX @FOPEN_MAX@ | ||
147 | -#endif | ||
148 | - | ||
149 | -#if defined __need_IOV_MAX && !defined IOV_MAX | ||
150 | -@define_IOV_MAX@ | ||
151 | -#endif | ||
152 | diff -Naur glibc-2.20/sysdeps/mach/hurd/bits/stdio_lim.h glibc-2.20-patched/sysdeps/mach/hurd/bits/stdio_lim.h | ||
153 | --- glibc-2.20/sysdeps/mach/hurd/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500 | ||
154 | +++ glibc-2.20-patched/sysdeps/mach/hurd/bits/stdio_lim.h 2023-05-23 14:44:22.279872060 -0400 | ||
155 | @@ -0,0 +1,28 @@ | ||
156 | +/* System specific stdio.h definitions. Hurd version. | ||
157 | + Copyright (C) 2023 Free Software Foundation, Inc. | ||
158 | + This file is part of the GNU C Library. | ||
159 | + | ||
160 | + The GNU C Library is free software; you can redistribute it and/or | ||
161 | + modify it under the terms of the GNU Lesser General Public | ||
162 | + License as published by the Free Software Foundation; either | ||
163 | + version 2.1 of the License, or (at your option) any later version. | ||
164 | + | ||
165 | + The GNU C Library is distributed in the hope that it will be useful, | ||
166 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
167 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
168 | + Lesser General Public License for more details. | ||
169 | + | ||
170 | + You should have received a copy of the GNU Lesser General Public | ||
171 | + License along with the GNU C Library; if not, see | ||
172 | + <http://www.gnu.org/licenses/>. */ | ||
173 | + | ||
174 | +#ifndef _BITS_STDIO_LIM_H | ||
175 | +#define _BITS_STDIO_LIM_H 1 | ||
176 | + | ||
177 | +#ifndef _STDIO_H | ||
178 | +# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." | ||
179 | +#endif | ||
180 | + | ||
181 | +#define FILENAME_MAX 1024 | ||
182 | + | ||
183 | +#endif /* bits/stdio_lim.h */ | ||
184 | diff -Naur glibc-2.20/sysdeps/posix/Makefile glibc-2.20-patched/sysdeps/posix/Makefile | ||
185 | --- glibc-2.20/sysdeps/posix/Makefile 2014-09-07 04:09:09.000000000 -0400 | ||
186 | +++ glibc-2.20-patched/sysdeps/posix/Makefile 1969-12-31 19:00:00.000000000 -0500 | ||
187 | @@ -1,5 +0,0 @@ | ||
188 | -# These affect the generated bits/stdio_lim.h file. | ||
189 | -L_tmpnam = 20 | ||
190 | -TMP_MAX = 238328 | ||
191 | -L_ctermid = 9 | ||
192 | -L_cuserid = 9 | ||
193 | diff -Naur glibc-2.20/sysdeps/unix/sysv/linux/bits/stdio_lim.h glibc-2.20-patched/sysdeps/unix/sysv/linux/bits/stdio_lim.h | ||
194 | --- glibc-2.20/sysdeps/unix/sysv/linux/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500 | ||
195 | +++ glibc-2.20-patched/sysdeps/unix/sysv/linux/bits/stdio_lim.h 2023-05-23 14:44:22.279872060 -0400 | ||
196 | @@ -0,0 +1,28 @@ | ||
197 | +/* System specific stdio.h definitions. Linux version. | ||
198 | + Copyright (C) 2023 Free Software Foundation, Inc. | ||
199 | + This file is part of the GNU C Library. | ||
200 | + | ||
201 | + The GNU C Library is free software; you can redistribute it and/or | ||
202 | + modify it under the terms of the GNU Lesser General Public | ||
203 | + License as published by the Free Software Foundation; either | ||
204 | + version 2.1 of the License, or (at your option) any later version. | ||
205 | + | ||
206 | + The GNU C Library is distributed in the hope that it will be useful, | ||
207 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
208 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
209 | + Lesser General Public License for more details. | ||
210 | + | ||
211 | + You should have received a copy of the GNU Lesser General Public | ||
212 | + License along with the GNU C Library; if not, see | ||
213 | + <https://www.gnu.org/licenses/>. */ | ||
214 | + | ||
215 | +#ifndef _BITS_STDIO_LIM_H | ||
216 | +#define _BITS_STDIO_LIM_H 1 | ||
217 | + | ||
218 | +//#ifndef _STDIO_H | ||
219 | +//# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." | ||
220 | +//#endif | ||
221 | + | ||
222 | +#define FILENAME_MAX 4096 | ||
223 | + | ||
224 | +#endif /* bits/stdio_lim.h */ | ||
diff --git a/tools/toolchain-patches/glibc-225-make44.patch b/tools/toolchain-patches/glibc-225-make44.patch new file mode 100644 index 0000000000..45d4e9c621 --- /dev/null +++ b/tools/toolchain-patches/glibc-225-make44.patch | |||
@@ -0,0 +1,228 @@ | |||
1 | diff -Naur glibc-2.25/libio/stdio.h glibc-2.25-patched/libio/stdio.h | ||
2 | --- glibc-2.25/libio/stdio.h 2017-02-05 10:28:43.000000000 -0500 | ||
3 | +++ glibc-2.25-patched/libio/stdio.h 2023-05-23 15:22:27.482980335 -0400 | ||
4 | @@ -154,18 +154,23 @@ | ||
5 | # define P_tmpdir "/tmp" | ||
6 | #endif | ||
7 | |||
8 | +#define L_tmpnam 20 | ||
9 | +#define TMP_MAX 238328 | ||
10 | |||
11 | /* Get the values: | ||
12 | - L_tmpnam How long an array of chars must be to be passed to `tmpnam'. | ||
13 | - TMP_MAX The minimum number of unique filenames generated by tmpnam | ||
14 | - (and tempnam when it uses tmpnam's name space), | ||
15 | - or tempnam (the two are separate). | ||
16 | - L_ctermid How long an array to pass to `ctermid'. | ||
17 | - L_cuserid How long an array to pass to `cuserid'. | ||
18 | - FOPEN_MAX Minimum number of files that can be open at once. | ||
19 | FILENAME_MAX Maximum length of a filename. */ | ||
20 | #include <bits/stdio_lim.h> | ||
21 | |||
22 | +#ifdef __USE_POSIX | ||
23 | +# define L_ctermid 9 | ||
24 | +# if !defined __USE_XOPEN2K || defined __USE_GNU | ||
25 | +# define L_cuserid 9 | ||
26 | +# endif | ||
27 | +#endif | ||
28 | + | ||
29 | +#undef FOPEN_MAX | ||
30 | +#define FOPEN_MAX 16 | ||
31 | + | ||
32 | |||
33 | /* Standard streams. */ | ||
34 | extern struct _IO_FILE *stdin; /* Standard input stream. */ | ||
35 | diff -Naur glibc-2.25/Makerules glibc-2.25-patched/Makerules | ||
36 | --- glibc-2.25/Makerules 2017-02-05 10:28:43.000000000 -0500 | ||
37 | +++ glibc-2.25-patched/Makerules 2023-05-23 15:22:05.594967548 -0400 | ||
38 | @@ -1474,55 +1474,7 @@ | ||
39 | endif | ||
40 | |||
41 | endif | ||
42 | - | ||
43 | -# These will have been set by sysdeps/posix/Makefile. | ||
44 | -L_tmpnam ?= 1 | ||
45 | -TMP_MAX ?= 0 | ||
46 | -L_ctermid ?= 1 | ||
47 | -L_cuserid ?= 1 | ||
48 | |||
49 | -stdio_lim = $(common-objpfx)bits/stdio_lim.h | ||
50 | - | ||
51 | -$(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @: | ||
52 | -$(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \ | ||
53 | - $(common-objpfx)config.make | ||
54 | - $(make-target-directory) | ||
55 | - { echo '#include "$(..)posix/bits/posix1_lim.h"'; \ | ||
56 | - echo '#define _LIBC 1'; \ | ||
57 | - echo '#include "$(..)misc/sys/uio.h"'; } | \ | ||
58 | - $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)' \ | ||
59 | - $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT) | ||
60 | - sed $(sed-remove-objpfx) $(sed-remove-dotdot) \ | ||
61 | - $(@:st=dT) > $(@:st=dt) | ||
62 | - mv -f $(@:st=dt) $(@:st=d) | ||
63 | - fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \ | ||
64 | - filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \ | ||
65 | - iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`; \ | ||
66 | - fopen_max=$${fopen_max:-16}; \ | ||
67 | - filename_max=$${filename_max:-1024}; \ | ||
68 | - if [ -z "$$iov_max" ]; then \ | ||
69 | - define_iov_max="# undef IOV_MAX"; \ | ||
70 | - else \ | ||
71 | - define_iov_max="# define IOV_MAX $$iov_max"; \ | ||
72 | - fi; \ | ||
73 | - sed -e "s/@FOPEN_MAX@/$$fopen_max/" \ | ||
74 | - -e "s/@FILENAME_MAX@/$$filename_max/" \ | ||
75 | - -e "s/@L_tmpnam@/$(L_tmpnam)/" \ | ||
76 | - -e "s/@TMP_MAX@/$(TMP_MAX)/" \ | ||
77 | - -e "s/@L_ctermid@/$(L_ctermid)/" \ | ||
78 | - -e "s/@L_cuserid@/$(L_cuserid)/" \ | ||
79 | - -e "s/@define_IOV_MAX@/$$define_iov_max/" \ | ||
80 | - $< > $(@:st=h.new) | ||
81 | - $(move-if-change) $(@:st=h.new) $(@:st=h) | ||
82 | -# Remove these last so that they can be examined if something went wrong. | ||
83 | - rm -f $(@:st=hT) $(@:st=dT) $(@:st=dt) | ||
84 | - touch $@ | ||
85 | -# Get dependencies. | ||
86 | -ifndef no_deps | ||
87 | --include $(stdio_lim:h=d) | ||
88 | -endif | ||
89 | -common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st | ||
90 | - | ||
91 | FORCE: | ||
92 | |||
93 | .PHONY: echo-headers | ||
94 | diff -Naur glibc-2.25/Rules glibc-2.25-patched/Rules | ||
95 | --- glibc-2.25/Rules 2017-02-05 10:28:43.000000000 -0500 | ||
96 | +++ glibc-2.25-patched/Rules 2023-05-23 15:22:27.482980335 -0400 | ||
97 | @@ -60,9 +60,6 @@ | ||
98 | common-generated := | ||
99 | endif | ||
100 | |||
101 | -# See below. This must be set before Makerules processes it. | ||
102 | -before-compile += $(common-objpfx)bits/stdio_lim.h | ||
103 | - | ||
104 | include $(..)Makerules | ||
105 | |||
106 | .PHONY: subdir_lib | ||
107 | diff -Naur glibc-2.25/stdio-common/stdio_lim.h.in glibc-2.25-patched/stdio-common/stdio_lim.h.in | ||
108 | --- glibc-2.25/stdio-common/stdio_lim.h.in 2017-02-05 10:28:43.000000000 -0500 | ||
109 | +++ glibc-2.25-patched/stdio-common/stdio_lim.h.in 1969-12-31 19:00:00.000000000 -0500 | ||
110 | @@ -1,42 +0,0 @@ | ||
111 | -/* Copyright (C) 1994-2017 Free Software Foundation, Inc. | ||
112 | - This file is part of the GNU C Library. | ||
113 | - | ||
114 | - The GNU C Library is free software; you can redistribute it and/or | ||
115 | - modify it under the terms of the GNU Lesser General Public | ||
116 | - License as published by the Free Software Foundation; either | ||
117 | - version 2.1 of the License, or (at your option) any later version. | ||
118 | - | ||
119 | - The GNU C Library is distributed in the hope that it will be useful, | ||
120 | - but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
121 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
122 | - Lesser General Public License for more details. | ||
123 | - | ||
124 | - You should have received a copy of the GNU Lesser General Public | ||
125 | - License along with the GNU C Library; if not, see | ||
126 | - <http://www.gnu.org/licenses/>. */ | ||
127 | - | ||
128 | -#if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX | ||
129 | -# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." | ||
130 | -#endif | ||
131 | - | ||
132 | -#ifdef _STDIO_H | ||
133 | -# define L_tmpnam @L_tmpnam@ | ||
134 | -# define TMP_MAX @TMP_MAX@ | ||
135 | -# define FILENAME_MAX @FILENAME_MAX@ | ||
136 | - | ||
137 | -# ifdef __USE_POSIX | ||
138 | -# define L_ctermid @L_ctermid@ | ||
139 | -# if !defined __USE_XOPEN2K || defined __USE_GNU | ||
140 | -# define L_cuserid @L_cuserid@ | ||
141 | -# endif | ||
142 | -# endif | ||
143 | -#endif | ||
144 | - | ||
145 | -#if defined __need_FOPEN_MAX || defined _STDIO_H | ||
146 | -# undef FOPEN_MAX | ||
147 | -# define FOPEN_MAX @FOPEN_MAX@ | ||
148 | -#endif | ||
149 | - | ||
150 | -#if defined __need_IOV_MAX && !defined IOV_MAX | ||
151 | -@define_IOV_MAX@ | ||
152 | -#endif | ||
153 | diff -Naur glibc-2.25/sysdeps/mach/hurd/bits/stdio_lim.h glibc-2.25-patched/sysdeps/mach/hurd/bits/stdio_lim.h | ||
154 | --- glibc-2.25/sysdeps/mach/hurd/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500 | ||
155 | +++ glibc-2.25-patched/sysdeps/mach/hurd/bits/stdio_lim.h 2023-05-23 15:22:27.483980336 -0400 | ||
156 | @@ -0,0 +1,28 @@ | ||
157 | +/* System specific stdio.h definitions. Hurd version. | ||
158 | + Copyright (C) 2023 Free Software Foundation, Inc. | ||
159 | + This file is part of the GNU C Library. | ||
160 | + | ||
161 | + The GNU C Library is free software; you can redistribute it and/or | ||
162 | + modify it under the terms of the GNU Lesser General Public | ||
163 | + License as published by the Free Software Foundation; either | ||
164 | + version 2.1 of the License, or (at your option) any later version. | ||
165 | + | ||
166 | + The GNU C Library is distributed in the hope that it will be useful, | ||
167 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
168 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
169 | + Lesser General Public License for more details. | ||
170 | + | ||
171 | + You should have received a copy of the GNU Lesser General Public | ||
172 | + License along with the GNU C Library; if not, see | ||
173 | + <http://www.gnu.org/licenses/>. */ | ||
174 | + | ||
175 | +#ifndef _BITS_STDIO_LIM_H | ||
176 | +#define _BITS_STDIO_LIM_H 1 | ||
177 | + | ||
178 | +#ifndef _STDIO_H | ||
179 | +# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." | ||
180 | +#endif | ||
181 | + | ||
182 | +#define FILENAME_MAX 1024 | ||
183 | + | ||
184 | +#endif /* bits/stdio_lim.h */ | ||
185 | diff -Naur glibc-2.25/sysdeps/posix/Makefile glibc-2.25-patched/sysdeps/posix/Makefile | ||
186 | --- glibc-2.25/sysdeps/posix/Makefile 2017-02-05 10:28:43.000000000 -0500 | ||
187 | +++ glibc-2.25-patched/sysdeps/posix/Makefile 2023-05-23 15:22:27.483980336 -0400 | ||
188 | @@ -1,8 +1,3 @@ | ||
189 | -# These affect the generated bits/stdio_lim.h file. | ||
190 | -L_tmpnam = 20 | ||
191 | -TMP_MAX = 238328 | ||
192 | -L_ctermid = 9 | ||
193 | -L_cuserid = 9 | ||
194 | |||
195 | ifeq ($(subdir)|$(have-thread-library),rt|no) | ||
196 | # With NPTL, this lives in libpthread so it can be used for sem_open too. | ||
197 | diff -Naur glibc-2.25/sysdeps/unix/sysv/linux/bits/stdio_lim.h glibc-2.25-patched/sysdeps/unix/sysv/linux/bits/stdio_lim.h | ||
198 | --- glibc-2.25/sysdeps/unix/sysv/linux/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500 | ||
199 | +++ glibc-2.25-patched/sysdeps/unix/sysv/linux/bits/stdio_lim.h 2023-05-23 15:22:27.483980336 -0400 | ||
200 | @@ -0,0 +1,28 @@ | ||
201 | +/* System specific stdio.h definitions. Linux version. | ||
202 | + Copyright (C) 2023 Free Software Foundation, Inc. | ||
203 | + This file is part of the GNU C Library. | ||
204 | + | ||
205 | + The GNU C Library is free software; you can redistribute it and/or | ||
206 | + modify it under the terms of the GNU Lesser General Public | ||
207 | + License as published by the Free Software Foundation; either | ||
208 | + version 2.1 of the License, or (at your option) any later version. | ||
209 | + | ||
210 | + The GNU C Library is distributed in the hope that it will be useful, | ||
211 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
212 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
213 | + Lesser General Public License for more details. | ||
214 | + | ||
215 | + You should have received a copy of the GNU Lesser General Public | ||
216 | + License along with the GNU C Library; if not, see | ||
217 | + <https://www.gnu.org/licenses/>. */ | ||
218 | + | ||
219 | +#ifndef _BITS_STDIO_LIM_H | ||
220 | +#define _BITS_STDIO_LIM_H 1 | ||
221 | + | ||
222 | +//#ifndef _STDIO_H | ||
223 | +//# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." | ||
224 | +//#endif | ||
225 | + | ||
226 | +#define FILENAME_MAX 4096 | ||
227 | + | ||
228 | +#endif /* bits/stdio_lim.h */ | ||