diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bmp2rb.c | 18 | ||||
-rw-r--r-- | tools/builds.pm | 11 | ||||
-rw-r--r-- | tools/checkwps/SOURCES | 1 | ||||
-rwxr-xr-x | tools/configure | 37 | ||||
-rw-r--r-- | tools/database/SOURCES | 1 | ||||
-rw-r--r-- | tools/database/database.c | 14 | ||||
-rw-r--r-- | tools/functions.make | 12 | ||||
-rwxr-xr-x | tools/genlang | 14 | ||||
-rw-r--r-- | tools/makesrc.inc | 2 | ||||
-rw-r--r-- | tools/rbspeex/rbspeex.c | 2 | ||||
-rwxr-xr-x | tools/rockboxdev.sh | 164 | ||||
-rw-r--r-- | tools/root.make | 6 | ||||
-rw-r--r-- | tools/toolchain-patches/crosstool-ng-1.13.2.diff | 13 | ||||
-rw-r--r-- | tools/toolchain-patches/glibc-220-make44.patch | 224 | ||||
-rw-r--r-- | tools/toolchain-patches/glibc-225-make44.patch | 228 | ||||
-rw-r--r-- | tools/voicefont.c | 29 |
16 files changed, 635 insertions, 141 deletions
diff --git a/tools/bmp2rb.c b/tools/bmp2rb.c index 387bcc05fe..1a10a17b49 100644 --- a/tools/bmp2rb.c +++ b/tools/bmp2rb.c @@ -512,6 +512,9 @@ void generate_c_source(char *id, char* header_dir, int width, int height, if (!id || !id[0]) id = "bitmap"; + bool initdata = create_bm && ((strcmp(id,"rockboxlogo") == 0) + || (strcmp(id,"remote_rockboxlogo") == 0)); + f = stdout; if (have_header) @@ -527,19 +530,24 @@ void generate_c_source(char *id, char* header_dir, int width, int height, fprintf(fh, "#define BMPHEIGHT_%s %d\n" "#define BMPWIDTH_%s %d\n", - id, height, id, width); + id, height, id, width); + if (t_depth <= 8) - fprintf(fh, "extern const unsigned char %s[];\n", id); + fprintf(fh, "extern const unsigned char %s[]%s;\n", id, + initdata ? " INITDATA_ATTR":""); else if (t_depth <= 16) - fprintf(fh, "extern const unsigned short %s[];\n", id); + fprintf(fh, "extern const unsigned short %s[]%s;\n", id, + initdata ? " INITDATA_ATTR":""); else - fprintf(fh, "extern const fb_data %s[];\n", id); + fprintf(fh, "extern const fb_data %s[]%s;\n", id, + initdata ? " INITDATA_ATTR":""); if (create_bm) { fprintf(f, "#include \"lcd.h\"\n"); - fprintf(fh, "extern const struct bitmap bm_%s;\n", id); + fprintf(fh, "extern const struct bitmap bm_%s%s;\n", id, + initdata ? " INITDATA_ATTR":""); } fclose(fh); } else { diff --git a/tools/builds.pm b/tools/builds.pm index a271d43327..e11b527a1f 100644 --- a/tools/builds.pm +++ b/tools/builds.pm @@ -674,6 +674,17 @@ sub allbuilds { }, 'enabled' => 1, }, + 'turkce' => { + 'lang' => 'turkce', + 'name' => 'Türkçe (Turkish)', + 'short' => 'tr', + 'defengine' => 'espeak', + 'engines' => { + 'espeak' => '-vtr', + 'gtts' => '-l tr', + }, + 'enabled' => 1, + }, ); sub bylang { diff --git a/tools/checkwps/SOURCES b/tools/checkwps/SOURCES index de3a74706a..c00268fa75 100644 --- a/tools/checkwps/SOURCES +++ b/tools/checkwps/SOURCES @@ -3,6 +3,7 @@ ../../apps/gui/skin_engine/skin_backdrops.c ../../apps/gui/viewport.c ../../apps/misc.c +../../firmware/common/strmemccpy.c ../../firmware/common/strlcpy.c ../../firmware/common/pathfuncs.c ../../firmware/asm/mempcpy.c diff --git a/tools/configure b/tools/configure index 3e66785af4..1f758a967d 100755 --- a/tools/configure +++ b/tools/configure @@ -8,7 +8,7 @@ # # global CC options for all platforms -CCOPTS="-W -Wall -Wextra -Wundef -Os -nostdlib -ffreestanding -Wstrict-prototypes -pipe -std=gnu99 -funit-at-a-time -fno-delete-null-pointer-checks" +CCOPTS="-W -Wall -Wextra -Wundef -Os -nostdlib -ffreestanding -Wstrict-prototypes -pipe -std=gnu99 -funit-at-a-time -fno-delete-null-pointer-checks -fno-strict-overflow" # LD options for the core LDOPTS="" @@ -270,6 +270,12 @@ simcc () { LDOPTS="$LDOPTS -fsanitize=address -lasan" fi + if [ "$ARG_UBSAN" = "1" ] ; then + echo "Using UBSan" + GCCOPTS="$GCCOPTS -fsanitize=undefined -fPIC" + LDOPTS="$LDOPTS -fsanitize=undefined" + fi + # Some linux setups like to warn about unused results. They are correct, # but cleaning this up is a lot of work. GCCOPTS="$GCCOPTS -Wno-unused-result" @@ -479,6 +485,9 @@ EOF if [ "$ARG_ADDR_SAN" = "1" ] ; then ARG_THREAD_SUPPORT=1 fi + if [ "$ARG_UBSAN" = "1" ] ; then + ARG_THREAD_SUPPORT=1 + fi thread_support= if [ -z "$ARG_THREAD_SUPPORT" ] || [ "$ARG_THREAD_SUPPORT" = "0" ]; then @@ -1429,6 +1438,7 @@ ARG_PREFIX="$PREFIX" ARG_THREAD_SUPPORT= ARG_32BIT= ARG_ADDR_SAN= +ARG_UBSAN= err= for arg in "$@"; do case "$arg" in @@ -1452,6 +1462,7 @@ for arg in "$@"; do --no-sdl-threads) ARG_THREAD_SUPPORT=0;; --with-address-sanitizer) ARG_ADDR_SAN=1;; + --with-ubsan) ARG_UBSAN=1;; --prefix=*) ARG_PREFIX=`echo "$arg" | cut -d = -f 2`;; --compiler-prefix=*) ARG_COMPILER_PREFIX=`echo "$arg" | cut -d = -f 2`;; --help) help;; @@ -4054,7 +4065,7 @@ fi appextra="recorder:gui" plugins="yes" tool="$rootdir/tools/scramble -add=fiiom3k " - boottool="" # not used + boottool="$rootdir/tools/mkspl-x1000 -type=nand -ppb=2 -bpp=2 " output="rockbox.m3k" bootoutput="bootloader.m3k" sysfontbl="16-Terminus" @@ -4078,7 +4089,7 @@ fi appextra="recorder:gui" plugins="yes" tool="$rootdir/tools/scramble -add=shq1 " - boottool="" # not used + boottool="$rootdir/tools/mkspl-x1000 -type=nand -ppb=2 -bpp=2 " output="rockbox.q1" bootoutput="bootloader.q1" sysfontbl="16-Terminus" @@ -4102,7 +4113,7 @@ fi appextra="recorder:gui" plugins="yes" tool="$rootdir/tools/scramble -add=erosqnative " - boottool="" # not used + boottool="$rootdir/tools/mkspl-x1000 -type=nand -ppb=2 -bpp=2 " output="rockbox.erosq" bootoutput="bootloader.erosq" sysfontbl="16-Terminus" @@ -4280,7 +4291,7 @@ fi toolset=''; t_cpu=''; GCCOPTS=''; - extradefines="$extradefines -DDEBUG" + extradefines="$extradefines -DDEBUG -DWARBLE" output='warble.'${modelname}; echo "Warble build selected" ;; @@ -4349,7 +4360,18 @@ gccver=`$CC -dumpversion`; if [ $uname = "Darwin" ]; then ldver=`$LD -v 2>&1 | sed -e 's/[^0-9.-]//g'` else - ldver=`$LD --version | head -n 1 | sed -e 's/\ /\n/g' | tail -n 1` + ldver=`$LD --version | sed -n '1p' | sed -e 's/.* \([0-9]*\)\.\([0-9]*\).*/\1\2/'` +fi + +# Convert LD version to a number major*100 + minor +ldnum1=`echo $ldver | cut -d . -f1` +ldnum2=`echo $ldver | cut -d . -f2` +ldnum=`(expr $ldnum1 "*" 100 + $ldnum2) 2>/dev/null` + +if test "$ldnum" -ge "227"; then + have_nocrossrefs_to="#define HAVE_NOCROSSREFS_TO" +else + have_nocrossrefs_to="#undef HAVE_NOCROSSREFS_TO" fi if [ -z "$gccver" ]; then @@ -4589,6 +4611,9 @@ ${app_lcd_height} #define ROCKBOX_BINARY_PATH "${bindir}" #define ROCKBOX_LIBRARY_PATH "${libdir}" +/* linker feature test macro for validating cross-section references */ +${have_nocrossrefs_to} + #endif /* __BUILD_AUTOCONF_H */ EOF diff --git a/tools/database/SOURCES b/tools/database/SOURCES index ca1775022c..02a871b0ca 100644 --- a/tools/database/SOURCES +++ b/tools/database/SOURCES @@ -4,6 +4,7 @@ database.c ../../apps/tagcache.c ../../firmware/common/crc32.c ../../firmware/common/pathfuncs.c +../../firmware/common/strmemccpy.c ../../firmware/common/strlcpy.c ../../firmware/common/strcasestr.c ../../firmware/common/structec.c diff --git a/tools/database/database.c b/tools/database/database.c index 30f1c39626..1e954d25b7 100644 --- a/tools/database/database.c +++ b/tools/database/database.c @@ -27,10 +27,11 @@ int main(int argc, char **argv) tagcache_init(); do_tagcache_build(paths); tagcache_reverse_scan(); - + return 0; } + /* needed for io.c */ const char *sim_root_dir = "."; @@ -39,25 +40,24 @@ const char *sim_root_dir = "."; void mutex_init(struct mutex *m) { (void)m; -} +} void mutex_lock(struct mutex *m) { (void)m; -} +} void mutex_unlock(struct mutex *m) { (void)m; -} +} void sim_thread_lock(void *me) { (void)me; -} +} void * sim_thread_unlock(void) { return (void*)1; -} - +} diff --git a/tools/functions.make b/tools/functions.make index 518b945320..c2237c9547 100644 --- a/tools/functions.make +++ b/tools/functions.make @@ -14,12 +14,18 @@ # # The sed line is to prepend the directory to all source files +# This is needed because GNU Make older than 4.3 treats this as the start +# of a comment even within a $(shell) call and requires a backslash escape. +# Newer Makes pass the whole "\#" through, making the backslash visible in +# the shell. To safely pass a literal "#", it has to go in a variable. +_hash_ = \# + preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c -include config.h $(1) | \ - grep -v '^\#' | grep -v "^ *$$" | \ + grep -v "^$(_hash_)" | grep -v "^ *$$" | \ sed -e 's:^..*:$(dir $(1))&:') -preprocess2file = $(SILENT)$(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(1) | \ - grep -v '^\#' | grep -v "^$$" > $(2) +preprocess2file = $(shell $(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(1) | \ + grep -v '^$(_hash_)' | grep -v "^$$" > $(2)) asmdefs2file = $(SILENT)$(CC) $(PPCFLAGS) $(3) -S -x c -o - -include config.h $(1) | \ perl -ne 'if(/^_?AD_(\w+):$$/){$$var=$$1}else{/^\W\.(?:word|long)\W(.*)$$/ && $$var && print "\#define $$var $$1\n";$$var=0}' > $(2) diff --git a/tools/genlang b/tools/genlang index 893badb57e..abff3e8e18 100755 --- a/tools/genlang +++ b/tools/genlang @@ -16,6 +16,7 @@ my $LANGUAGE_COOKIE = 0x1a; my $VOICE_COOKIE = 0x9a; my $LANGUAGE_VERSION = 0x06; my $LANGUAGE_FLAG_RTL = 0x01; +my $LANGUAGE_FLAG_UNITS_FIRST = 0x02; my $HEADER_SIZE = 4; my $SUBHEADER_SIZE = 6; @@ -369,6 +370,13 @@ while(<LANG>) { if($_ =~ /^( *\#|[ \t\n\r]*\z)/) { # comment or empty line - output it if it's part of the header + if ($_ =~ /LANGUAGE_IS_RTL/) { + $langoptions |= $LANGUAGE_FLAG_RTL; + } + if ($_ =~ /LANGUAGE_UNITS_FIRST/) { + $langoptions |= $LANGUAGE_FLAG_UNITS_FIRST; + } + if ($header and $sortfile) { print($_); } @@ -485,12 +493,6 @@ while(<LANG>) { } undef @phrase; } # end of </phrase> - elsif($part eq "/options") { - # closing the options - if ($options{'rtl'}) { - $langoptions |= $LANGUAGE_FLAG_RTL; - } - } # end of </options> # starts with a slash, this _ends_ this section $m = pop @m; # get back old value, the previous level's tag diff --git a/tools/makesrc.inc b/tools/makesrc.inc index 846df8cb9e..55c1bbe98d 100644 --- a/tools/makesrc.inc +++ b/tools/makesrc.inc @@ -11,4 +11,4 @@ SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \ $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - 2>/dev/null \ -| grep -v "^\#") +| grep -v "^#") diff --git a/tools/rbspeex/rbspeex.c b/tools/rbspeex/rbspeex.c index 88b18c7c85..66b8aeb19c 100644 --- a/tools/rbspeex/rbspeex.c +++ b/tools/rbspeex/rbspeex.c @@ -139,7 +139,9 @@ bool encode_file(FILE *fin, FILE *fout, float quality, int complexity, int i, tmp, target_sr, numchan, bps, sr, numsamples, frame_size, lookahead; int nbytes; bool ret = true; +#if defined(__BIG_ENDIAN__) int a; +#endif if (!get_wave_metadata(fin, &numchan, &bps, &sr, &numsamples)) { snprintf(errstr, errlen, "invalid WAV file"); diff --git a/tools/rockboxdev.sh b/tools/rockboxdev.sh index d0d623be1b..5c71589148 100755 --- a/tools/rockboxdev.sh +++ b/tools/rockboxdev.sh @@ -29,8 +29,12 @@ else make="make" fi +# record version +makever=`$make -v |sed -n '1p' | sed -e 's/.* \([0-9]*\)\.\([0-9]*\).*/\1\2/'` + # This is the absolute path to where the script resides. rockboxdevdir="$( readlink -f "$( dirname "${BASH_SOURCE[0]}" )" )" +patch_dir="$rockboxdevdir/toolchain-patches" if [ `uname -s` = "Darwin" ]; then parallel=`sysctl -n hw.physicalcpu` @@ -51,7 +55,7 @@ if [ -z $LINUX_MIRROR ] ; then fi # These are the tools this script requires and depends upon. -reqtools="gcc g++ bzip2 gzip make patch makeinfo automake libtool autoconf flex bison" +reqtools="gcc g++ xz bzip2 gzip $make patch makeinfo automake libtool autoconf flex bison" ############################################################################## # Functions: @@ -179,18 +183,23 @@ gettool() { srv_file="gcc-core-$version" fi url="$GNU_MIRROR/gcc/gcc-$version" + if ! version_lt "$version" "7.2"; then + ext="tar.xz" + fi ;; binutils) url="$GNU_MIRROR/binutils" + if ! version_lt "$version" "2.28.1"; then + ext="tar.xz" + fi ;; glibc) url="$GNU_MIRROR/glibc" - ;; - - crosstool-ng) - url="http://crosstool-ng.org/download/crosstool-ng" + if ! version_lt "$version" "2.11"; then + ext="tar.xz" + fi ;; alsa-lib) @@ -285,7 +294,7 @@ run_cmd() { echo "Running '$@'" >>$logfile if ! $@ >> "$logfile" 2>&1; then echo "ROCKBOXDEV: an error occured, please see $logfile" - exit + exit 1 fi } @@ -336,8 +345,7 @@ buildtool() { echo "ROCKBOXDEV: mkdir build-$toolname" mkdir "build-$toolname" - echo "ROCKBOXDEV: cd build-$toolname" - cd "build-$toolname" + cd build-$toolname # in-tree/out-of-tree build case "$tool" in @@ -387,9 +395,14 @@ buildtool() { echo "ROCKBOXDEV: $toolname/make (install)" run_cmd "$logfile" $make $install_opts - echo "ROCKBOXDEV: rm -rf build-$toolname $toolname" cd .. + + echo "ROCKBOXDEV: rm -rf build-$toolname $toolname" rm -rf build-$toolname + if [ "$stepname" != "gcc-stage1" ] ; then + echo "ROCKBOXDEV: rm -rf $toolname" + rm -rf $toolname + fi } build() { @@ -399,6 +412,14 @@ build() { patch="$4" configure_params="$5" needs_libs="$6" + logfile="$builddir/build-$toolname.log" + + stepname=${RESTART_STEP:-$toolname} + if ! check_restart "$stepname"; then + echo "ROCKBOXDEV: Skipping step '$stepname' as requested per RBDEV_RESTART" + return + fi + echo "ROCKBOXDEV: Starting step '$stepname'" # create build directory if test -d $builddir; then @@ -410,8 +431,6 @@ build() { mkdir -p $builddir fi - patch_dir="$rockboxdevdir/toolchain-patches" - # download source tarball gettool "$toolname" "$version" file="$toolname-$version" @@ -467,95 +486,32 @@ build() { cd $builddir fi + # GCC is special + if [ "$toolname" == "gcc" ] ; then + configure_params="--enable-languages=c --disable-libssp $configure_params" + fi + + echo "ROCKBOXDEV: logging to $logfile" + rm -f "$logfile" + echo "ROCKBOXDEV: mkdir build-$toolname" mkdir build-$toolname - echo "ROCKBOXDEV: cd build-$toolname" cd build-$toolname echo "ROCKBOXDEV: $toolname/configure" - case $toolname in - crosstool-ng) # ct-ng doesnt support out-of-tree build and the src folder is named differently - toolname="crosstool-ng" - cp -r ../$toolname-$version/* ../$toolname-$version/.version . - ./configure --prefix=$prefix $configure_params - ;; - *) - CFLAGS='-U_FORTIFY_SOURCE -fgnu89-inline -fcommon' CXXFLAGS='-std=gnu++03' ../$toolname-$version/configure --target=$target --prefix=$prefix --enable-languages=c --disable-libssp --disable-docs $configure_params - ;; - esac + CFLAGS='-U_FORTIFY_SOURCE -fgnu89-inline -fcommon -O2' CXXFLAGS='-std=gnu++03' run_cmd "$logfile" ../$toolname-$version/configure --target=$target --prefix=$prefix --disable-docs $configure_params echo "ROCKBOXDEV: $toolname/make" - $make $make_parallel + run_cmd "$logfile" $make $make_parallel echo "ROCKBOXDEV: $toolname/make install" - $make install + run_cmd "$logfile" $make install - echo "ROCKBOXDEV: rm -rf build-$toolname $toolname-$version" cd .. - rm -rf build-$toolname $toolname-$version -} - -make_ctng() { - if test -f "`which ct-ng 2>/dev/null`"; then - ctng="ct-ng" - else - ctng="" - fi - - if test ! -n "$ctng"; then - if test ! -f "$prefix/bin/ct-ng"; then # look if we build it already - build "crosstool-ng" "" "1.13.2" "crosstool-ng-1.13.2.diff" - fi - fi - ctng=`PATH=$prefix/bin:$PATH which ct-ng` -} -build_ctng() { - ctng_target="$1" - extra="$2" - tc_arch="$3" - tc_host="$4" - - make_ctng - - dlurl="http://www.rockbox.org/gcc/$ctng_target" - - # download - getfile "ct-ng-config" "$dlurl" - - test -n "$extra" && getfile "$extra" "$dlurl" - - # create build directory - if test -d $builddir; then - if test ! -w $builddir; then - echo "ROCKBOXDEV: No write permission for $builddir" - exit - fi - else - mkdir -p $builddir - fi - - # copy config and cd to $builddir - mkdir $builddir/build-$ctng_target - ctng_config="$builddir/build-$ctng_target/.config" - cat "$dlwhere/ct-ng-config" | sed -e "s,\(CT_PREFIX_DIR=\).*,\1$prefix," > $ctng_config - cd $builddir/build-$ctng_target - - $ctng "build" - - # install extras - if test -e "$dlwhere/$extra"; then - # verify the toolchain has sysroot support - if test -n `cat $ctng_config | grep CT_USE_SYSROOT\=y`; then - sysroot=`cat $ctng_config | grep CT_SYSROOT_NAME | sed -e 's,CT_SYSROOT_NAME\=\"\([a-zA-Z0-9]*\)\",\1,'` - tar xf "$dlwhere/$extra" -C "$prefix/$tc_arch-$ctng_target-$tc_host/$sysroot" - fi - fi - - # cleanup - cd $builddir - rm -rf $builddir/build-$ctng_target + echo "ROCKBOXDEV: rm -rf build-$toolname $toolname-$version" + rm -rf build-$toolname $toolname-$version } # build a cross compiler toolchain for linux @@ -576,6 +532,8 @@ build_linux_toolchain () { linux_ver="$6" glibc_ver="$7" glibc_opts="$8" + glibc_patches="$9" + # where to put the sysroot sysroot="$prefix/$target/sysroot" # extract arch from target @@ -599,6 +557,11 @@ build_linux_toolchain () { mkdir -p $builddir fi + if [ "$makever" -gt 43 ] ; then + glibc_make_opts="--jobserver-style=pipe --shuffle=none" +# MAKEFLAGS="--jobserver-style=pipe --shuffle=none" + fi + # download all tools gettool "binutils" "$binutils_ver" gettool "gcc" "$gcc_ver" @@ -612,6 +575,18 @@ build_linux_toolchain () { extract "linux-$linux_ver" extract "glibc-$glibc_ver" + # do we have a patch? + for p in $glibc_patches; do + echo "ROCKBOXDEV: applying patch $p" + (cd $builddir/glibc-$glibc_ver ; patch -p1 < "$patch_dir/$p") + + # check if the patch applied cleanly + if [ $? -gt 0 ]; then + echo "ROCKBOXDEV: failed to apply patch $p" + exit + fi + done + # we make it possible to restart a build on error by using the RBDEV_RESTART # variable, the format is RBDEV_RESTART="tool" where tool is the toolname at which # to restart (binutils, gcc) @@ -646,7 +621,7 @@ build_linux_toolchain () { prefix="/usr" \ buildtool "glibc" "$glibc_ver" "--target=$target --host=$target --build=$MACHTYPE \ --with-__thread --with-headers=$sysroot/usr/include $glibc_opts" \ - "" "install install_root=$sysroot" + "$glibc_make_opts" "install install_root=$sysroot" # build stage 2 compiler RESTART_STEP="gcc-stage2" \ buildtool "gcc" "$gcc_ver" "$gcc_opts --enable-languages=c,c++ --target=$target \ @@ -720,6 +695,11 @@ if [ -n "$missingtools" ]; then exit 1 fi +if ! $make -v | grep -q GNU ; then + echo "ROCKBOXDEV: Building the rockbox toolchains requires GNU Make." + exit 1 +fi + dlwhere=$(readlink -f "$dlwhere") prefix=$(readlink -f "$prefix") builddir=$(readlink -f "$builddir") @@ -762,7 +742,7 @@ fi if [ -z "$RBDEV_TARGET" ]; then echo "Select target arch:" echo "m - m68k (iriver h1x0/h3x0, iaudio m3/m5/x5 and mpio hd200)" - echo "a - arm (ipods, iriver H10, Sansa, D2, Gigabeat, etc)" + echo "a - arm (ipods, iriver H10, Sansa, D2, Gigabeat, older Sony NWZ, etc)" echo "i - mips (Jz47xx and ATJ-based players)" echo "x - arm-linux (Generic Linux ARM: Samsung ypr0, Linux-based Sony NWZ)" echo "y - mips-linux (Generic Linux MIPS: eg the many HiBy-OS targets)" @@ -835,7 +815,7 @@ do # avoid patches/bugs. glibcopts="--enable-kernel=2.6.23 --enable-oldest-abi=2.4" build_linux_toolchain "arm-rockbox-linux-gnueabi" "2.26.1" "" "4.9.4" \ - "$gccopts" "2.6.32.68" "2.19" "$glibcopts" + "$gccopts" "2.6.32.68" "2.19" "$glibcopts" "glibc-220-make44.patch" # build alsa-lib # we need to set the prefix to how it is on device (/usr) and then # tweak install dir at make install step @@ -871,7 +851,7 @@ do glibcopts="--enable-kernel=3.2 --enable-oldest-abi=2.16" # FIXME: maybe add -mhard-float build_linux_toolchain "mipsel-rockbox-linux-gnu" "2.26.1" "" "4.9.4" \ - "$gccopts" "3.2.85" "2.25" "$glibcopts" + "$gccopts" "3.2.85" "2.25" "$glibcopts" "glibc-225-make44.patch" # build alsa-lib # we need to set the prefix to how it is on device (/usr) and then # tweak install dir at make install step @@ -889,7 +869,7 @@ do (cd $prefix/$target/sysroot/usr/include ; ln -sf ../lib/libffi-$libffi_ver/include/ffi.h . ; ln -sf ../lib/libffi-$libffi_ver/include/ffitarget.h . ) # build zlib - zlib_ver="1.2.11" + zlib_ver="1.2.13" # Target uses 1.2.8! gettool "zlib" "$zlib_ver" extract "zlib-$zlib_ver" CHOST=$target prefix="/usr" buildtool "zlib" "$zlib_ver" \ diff --git a/tools/root.make b/tools/root.make index 2a83a32292..03c4d48986 100644 --- a/tools/root.make +++ b/tools/root.make @@ -75,6 +75,12 @@ ifeq (,$(findstring checkwps,$(APP_TYPE))) include $(ROOTDIR)/lib/unwarminder/unwarminder.make endif endif + ifeq (arch_mips,$(ARCH)) + # mips unwinder is only usable on native ports + ifeq (,$(APP_TYPE)) + include $(ROOTDIR)/lib/mipsunwinder/mipsunwinder.make + endif + endif ifeq (,$(findstring bootloader,$(APPSDIR))) include $(ROOTDIR)/lib/skin_parser/skin_parser.make include $(ROOTDIR)/lib/tlsf/libtlsf.make diff --git a/tools/toolchain-patches/crosstool-ng-1.13.2.diff b/tools/toolchain-patches/crosstool-ng-1.13.2.diff deleted file mode 100644 index f8b13a2794..0000000000 --- a/tools/toolchain-patches/crosstool-ng-1.13.2.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- a/Makefile.in 2014-07-30 14:16:57.989859205 +0200 -+++ b/Makefile.in 2014-07-30 14:16:52.133836316 +0200 -@@ -26,7 +26,11 @@ - # '-Rr' to MAKEFLAGS adds it literaly ( and does not add 'Rr' ) - ifeq ($(filter Rr,$(MAKEFLAGS)),) - ifeq ($(filter -Rr,$(MAKEFLAGS)),) -+ifeq ($(filter -rR,$(MAKEFLAGS)),) -+ifeq ($(filter rR,$(MAKEFLAGS)),) - CT_MAKEFLAGS += -Rr -+endif # No rR -+endif # No -rR - endif # No -Rr - endif # No Rr 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 @@ +diff -Naur glibc-2.20/libio/stdio.h glibc-2.20-patched/libio/stdio.h +--- glibc-2.20/libio/stdio.h 2014-09-07 04:09:09.000000000 -0400 ++++ glibc-2.20-patched/libio/stdio.h 2023-05-23 14:44:22.278872059 -0400 +@@ -151,18 +151,23 @@ + # define P_tmpdir "/tmp" + #endif + ++#define L_tmpnam 20 ++#define TMP_MAX 238328 + + /* Get the values: +- L_tmpnam How long an array of chars must be to be passed to `tmpnam'. +- TMP_MAX The minimum number of unique filenames generated by tmpnam +- (and tempnam when it uses tmpnam's name space), +- or tempnam (the two are separate). +- L_ctermid How long an array to pass to `ctermid'. +- L_cuserid How long an array to pass to `cuserid'. +- FOPEN_MAX Minimum number of files that can be open at once. + FILENAME_MAX Maximum length of a filename. */ + #include <bits/stdio_lim.h> + ++#ifdef __USE_POSIX ++# define L_ctermid 9 ++# if !defined __USE_XOPEN2K || defined __USE_GNU ++# define L_cuserid 9 ++# endif ++#endif ++ ++#undef FOPEN_MAX ++#define FOPEN_MAX 16 ++ + + /* Standard streams. */ + extern struct _IO_FILE *stdin; /* Standard input stream. */ +diff -Naur glibc-2.20/Makerules glibc-2.20-patched/Makerules +--- glibc-2.20/Makerules 2014-09-07 04:09:09.000000000 -0400 ++++ glibc-2.20-patched/Makerules 2023-05-23 14:42:21.745795149 -0400 +@@ -1277,54 +1277,6 @@ + + endif + +-# These will have been set by sysdeps/posix/Makefile. +-L_tmpnam ?= 1 +-TMP_MAX ?= 0 +-L_ctermid ?= 1 +-L_cuserid ?= 1 +- +-stdio_lim = $(common-objpfx)bits/stdio_lim.h +- +-$(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @: +-$(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \ +- $(common-objpfx)config.make +- $(make-target-directory) +- { echo '#include "$(..)posix/bits/posix1_lim.h"'; \ +- echo '#define _LIBC 1'; \ +- echo '#include "$(..)misc/sys/uio.h"'; } | \ +- $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)' \ +- $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT) +- sed $(sed-remove-objpfx) $(sed-remove-dotdot) \ +- $(@:st=dT) > $(@:st=dt) +- mv -f $(@:st=dt) $(@:st=d) +- fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \ +- filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \ +- iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`; \ +- fopen_max=$${fopen_max:-16}; \ +- filename_max=$${filename_max:-1024}; \ +- if [ -z "$$iov_max" ]; then \ +- define_iov_max="# undef IOV_MAX"; \ +- else \ +- define_iov_max="# define IOV_MAX $$iov_max"; \ +- fi; \ +- sed -e "s/@FOPEN_MAX@/$$fopen_max/" \ +- -e "s/@FILENAME_MAX@/$$filename_max/" \ +- -e "s/@L_tmpnam@/$(L_tmpnam)/" \ +- -e "s/@TMP_MAX@/$(TMP_MAX)/" \ +- -e "s/@L_ctermid@/$(L_ctermid)/" \ +- -e "s/@L_cuserid@/$(L_cuserid)/" \ +- -e "s/@define_IOV_MAX@/$$define_iov_max/" \ +- $< > $(@:st=h.new) +- $(move-if-change) $(@:st=h.new) $(@:st=h) +-# Remove these last so that they can be examined if something went wrong. +- rm -f $(@:st=hT) $(@:st=dT) $(@:st=dt) +- touch $@ +-# Get dependencies. +-ifndef no_deps +--include $(stdio_lim:h=d) +-endif +-common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st +- + FORCE: + + .PHONY: echo-headers +diff -Naur glibc-2.20/Rules glibc-2.20-patched/Rules +--- glibc-2.20/Rules 2014-09-07 04:09:09.000000000 -0400 ++++ glibc-2.20-patched/Rules 2023-05-23 14:44:22.279872060 -0400 +@@ -60,9 +60,6 @@ + common-generated := + endif + +-# See below. This must be set before Makerules processes it. +-before-compile += $(common-objpfx)bits/stdio_lim.h +- + include $(..)Makerules + + .PHONY: subdir_lib +diff -Naur glibc-2.20/stdio-common/stdio_lim.h.in glibc-2.20-patched/stdio-common/stdio_lim.h.in +--- glibc-2.20/stdio-common/stdio_lim.h.in 2014-09-07 04:09:09.000000000 -0400 ++++ glibc-2.20-patched/stdio-common/stdio_lim.h.in 1969-12-31 19:00:00.000000000 -0500 +@@ -1,42 +0,0 @@ +-/* Copyright (C) 1994-2014 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, see +- <http://www.gnu.org/licenses/>. */ +- +-#if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX +-# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." +-#endif +- +-#ifdef _STDIO_H +-# define L_tmpnam @L_tmpnam@ +-# define TMP_MAX @TMP_MAX@ +-# define FILENAME_MAX @FILENAME_MAX@ +- +-# ifdef __USE_POSIX +-# define L_ctermid @L_ctermid@ +-# if !defined __USE_XOPEN2K || defined __USE_GNU +-# define L_cuserid @L_cuserid@ +-# endif +-# endif +-#endif +- +-#if defined __need_FOPEN_MAX || defined _STDIO_H +-# undef FOPEN_MAX +-# define FOPEN_MAX @FOPEN_MAX@ +-#endif +- +-#if defined __need_IOV_MAX && !defined IOV_MAX +-@define_IOV_MAX@ +-#endif +diff -Naur glibc-2.20/sysdeps/mach/hurd/bits/stdio_lim.h glibc-2.20-patched/sysdeps/mach/hurd/bits/stdio_lim.h +--- glibc-2.20/sysdeps/mach/hurd/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500 ++++ glibc-2.20-patched/sysdeps/mach/hurd/bits/stdio_lim.h 2023-05-23 14:44:22.279872060 -0400 +@@ -0,0 +1,28 @@ ++/* System specific stdio.h definitions. Hurd version. ++ Copyright (C) 2023 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library 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 ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ <http://www.gnu.org/licenses/>. */ ++ ++#ifndef _BITS_STDIO_LIM_H ++#define _BITS_STDIO_LIM_H 1 ++ ++#ifndef _STDIO_H ++# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." ++#endif ++ ++#define FILENAME_MAX 1024 ++ ++#endif /* bits/stdio_lim.h */ +diff -Naur glibc-2.20/sysdeps/posix/Makefile glibc-2.20-patched/sysdeps/posix/Makefile +--- glibc-2.20/sysdeps/posix/Makefile 2014-09-07 04:09:09.000000000 -0400 ++++ glibc-2.20-patched/sysdeps/posix/Makefile 1969-12-31 19:00:00.000000000 -0500 +@@ -1,5 +0,0 @@ +-# These affect the generated bits/stdio_lim.h file. +-L_tmpnam = 20 +-TMP_MAX = 238328 +-L_ctermid = 9 +-L_cuserid = 9 +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 +--- glibc-2.20/sysdeps/unix/sysv/linux/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500 ++++ glibc-2.20-patched/sysdeps/unix/sysv/linux/bits/stdio_lim.h 2023-05-23 14:44:22.279872060 -0400 +@@ -0,0 +1,28 @@ ++/* System specific stdio.h definitions. Linux version. ++ Copyright (C) 2023 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library 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 ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ <https://www.gnu.org/licenses/>. */ ++ ++#ifndef _BITS_STDIO_LIM_H ++#define _BITS_STDIO_LIM_H 1 ++ ++//#ifndef _STDIO_H ++//# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." ++//#endif ++ ++#define FILENAME_MAX 4096 ++ ++#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 @@ +diff -Naur glibc-2.25/libio/stdio.h glibc-2.25-patched/libio/stdio.h +--- glibc-2.25/libio/stdio.h 2017-02-05 10:28:43.000000000 -0500 ++++ glibc-2.25-patched/libio/stdio.h 2023-05-23 15:22:27.482980335 -0400 +@@ -154,18 +154,23 @@ + # define P_tmpdir "/tmp" + #endif + ++#define L_tmpnam 20 ++#define TMP_MAX 238328 + + /* Get the values: +- L_tmpnam How long an array of chars must be to be passed to `tmpnam'. +- TMP_MAX The minimum number of unique filenames generated by tmpnam +- (and tempnam when it uses tmpnam's name space), +- or tempnam (the two are separate). +- L_ctermid How long an array to pass to `ctermid'. +- L_cuserid How long an array to pass to `cuserid'. +- FOPEN_MAX Minimum number of files that can be open at once. + FILENAME_MAX Maximum length of a filename. */ + #include <bits/stdio_lim.h> + ++#ifdef __USE_POSIX ++# define L_ctermid 9 ++# if !defined __USE_XOPEN2K || defined __USE_GNU ++# define L_cuserid 9 ++# endif ++#endif ++ ++#undef FOPEN_MAX ++#define FOPEN_MAX 16 ++ + + /* Standard streams. */ + extern struct _IO_FILE *stdin; /* Standard input stream. */ +diff -Naur glibc-2.25/Makerules glibc-2.25-patched/Makerules +--- glibc-2.25/Makerules 2017-02-05 10:28:43.000000000 -0500 ++++ glibc-2.25-patched/Makerules 2023-05-23 15:22:05.594967548 -0400 +@@ -1474,55 +1474,7 @@ + endif + + endif +- +-# These will have been set by sysdeps/posix/Makefile. +-L_tmpnam ?= 1 +-TMP_MAX ?= 0 +-L_ctermid ?= 1 +-L_cuserid ?= 1 + +-stdio_lim = $(common-objpfx)bits/stdio_lim.h +- +-$(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @: +-$(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \ +- $(common-objpfx)config.make +- $(make-target-directory) +- { echo '#include "$(..)posix/bits/posix1_lim.h"'; \ +- echo '#define _LIBC 1'; \ +- echo '#include "$(..)misc/sys/uio.h"'; } | \ +- $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)' \ +- $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT) +- sed $(sed-remove-objpfx) $(sed-remove-dotdot) \ +- $(@:st=dT) > $(@:st=dt) +- mv -f $(@:st=dt) $(@:st=d) +- fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \ +- filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \ +- iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`; \ +- fopen_max=$${fopen_max:-16}; \ +- filename_max=$${filename_max:-1024}; \ +- if [ -z "$$iov_max" ]; then \ +- define_iov_max="# undef IOV_MAX"; \ +- else \ +- define_iov_max="# define IOV_MAX $$iov_max"; \ +- fi; \ +- sed -e "s/@FOPEN_MAX@/$$fopen_max/" \ +- -e "s/@FILENAME_MAX@/$$filename_max/" \ +- -e "s/@L_tmpnam@/$(L_tmpnam)/" \ +- -e "s/@TMP_MAX@/$(TMP_MAX)/" \ +- -e "s/@L_ctermid@/$(L_ctermid)/" \ +- -e "s/@L_cuserid@/$(L_cuserid)/" \ +- -e "s/@define_IOV_MAX@/$$define_iov_max/" \ +- $< > $(@:st=h.new) +- $(move-if-change) $(@:st=h.new) $(@:st=h) +-# Remove these last so that they can be examined if something went wrong. +- rm -f $(@:st=hT) $(@:st=dT) $(@:st=dt) +- touch $@ +-# Get dependencies. +-ifndef no_deps +--include $(stdio_lim:h=d) +-endif +-common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st +- + FORCE: + + .PHONY: echo-headers +diff -Naur glibc-2.25/Rules glibc-2.25-patched/Rules +--- glibc-2.25/Rules 2017-02-05 10:28:43.000000000 -0500 ++++ glibc-2.25-patched/Rules 2023-05-23 15:22:27.482980335 -0400 +@@ -60,9 +60,6 @@ + common-generated := + endif + +-# See below. This must be set before Makerules processes it. +-before-compile += $(common-objpfx)bits/stdio_lim.h +- + include $(..)Makerules + + .PHONY: subdir_lib +diff -Naur glibc-2.25/stdio-common/stdio_lim.h.in glibc-2.25-patched/stdio-common/stdio_lim.h.in +--- glibc-2.25/stdio-common/stdio_lim.h.in 2017-02-05 10:28:43.000000000 -0500 ++++ glibc-2.25-patched/stdio-common/stdio_lim.h.in 1969-12-31 19:00:00.000000000 -0500 +@@ -1,42 +0,0 @@ +-/* Copyright (C) 1994-2017 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- +- The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library 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 +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, see +- <http://www.gnu.org/licenses/>. */ +- +-#if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX +-# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." +-#endif +- +-#ifdef _STDIO_H +-# define L_tmpnam @L_tmpnam@ +-# define TMP_MAX @TMP_MAX@ +-# define FILENAME_MAX @FILENAME_MAX@ +- +-# ifdef __USE_POSIX +-# define L_ctermid @L_ctermid@ +-# if !defined __USE_XOPEN2K || defined __USE_GNU +-# define L_cuserid @L_cuserid@ +-# endif +-# endif +-#endif +- +-#if defined __need_FOPEN_MAX || defined _STDIO_H +-# undef FOPEN_MAX +-# define FOPEN_MAX @FOPEN_MAX@ +-#endif +- +-#if defined __need_IOV_MAX && !defined IOV_MAX +-@define_IOV_MAX@ +-#endif +diff -Naur glibc-2.25/sysdeps/mach/hurd/bits/stdio_lim.h glibc-2.25-patched/sysdeps/mach/hurd/bits/stdio_lim.h +--- glibc-2.25/sysdeps/mach/hurd/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500 ++++ glibc-2.25-patched/sysdeps/mach/hurd/bits/stdio_lim.h 2023-05-23 15:22:27.483980336 -0400 +@@ -0,0 +1,28 @@ ++/* System specific stdio.h definitions. Hurd version. ++ Copyright (C) 2023 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library 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 ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ <http://www.gnu.org/licenses/>. */ ++ ++#ifndef _BITS_STDIO_LIM_H ++#define _BITS_STDIO_LIM_H 1 ++ ++#ifndef _STDIO_H ++# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." ++#endif ++ ++#define FILENAME_MAX 1024 ++ ++#endif /* bits/stdio_lim.h */ +diff -Naur glibc-2.25/sysdeps/posix/Makefile glibc-2.25-patched/sysdeps/posix/Makefile +--- glibc-2.25/sysdeps/posix/Makefile 2017-02-05 10:28:43.000000000 -0500 ++++ glibc-2.25-patched/sysdeps/posix/Makefile 2023-05-23 15:22:27.483980336 -0400 +@@ -1,8 +1,3 @@ +-# These affect the generated bits/stdio_lim.h file. +-L_tmpnam = 20 +-TMP_MAX = 238328 +-L_ctermid = 9 +-L_cuserid = 9 + + ifeq ($(subdir)|$(have-thread-library),rt|no) + # With NPTL, this lives in libpthread so it can be used for sem_open too. +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 +--- glibc-2.25/sysdeps/unix/sysv/linux/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500 ++++ glibc-2.25-patched/sysdeps/unix/sysv/linux/bits/stdio_lim.h 2023-05-23 15:22:27.483980336 -0400 +@@ -0,0 +1,28 @@ ++/* System specific stdio.h definitions. Linux version. ++ Copyright (C) 2023 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library 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 ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ <https://www.gnu.org/licenses/>. */ ++ ++#ifndef _BITS_STDIO_LIM_H ++#define _BITS_STDIO_LIM_H 1 ++ ++//#ifndef _STDIO_H ++//# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." ++//#endif ++ ++#define FILENAME_MAX 4096 ++ ++#endif /* bits/stdio_lim.h */ diff --git a/tools/voicefont.c b/tools/voicefont.c index b732f49c07..82ab537b73 100644 --- a/tools/voicefont.c +++ b/tools/voicefont.c @@ -29,8 +29,9 @@ #include <stdio.h> #include <string.h> -#define HEADER_SIZE 20 - +#define HEADER_SIZE (20) +#define MAX_NAME_LEN (80) +#define MAX_VOICE_ENTRIES (2048) /* endian conversion macros */ #if defined(__BIG_ENDIAN__) #define UINT_TO_BE(x) (x) @@ -47,11 +48,11 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi int i,j; /* two tables, one for normal strings, one for voice-only (>0x8000) */ - static char names[1000][80]; /* worst-case space */ - char name[80]; /* one string ID */ - static int pos[1000]; /* position of sample */ - static int size[1000]; /* length of clip */ - int voiceonly[1000]; /* flag if this is voice only */ + static char names[MAX_VOICE_ENTRIES][MAX_NAME_LEN]; /* worst-case space */ + char name[MAX_NAME_LEN]; /* one string ID */ + static int pos[MAX_VOICE_ENTRIES]; /* position of sample */ + static int size[MAX_VOICE_ENTRIES]; /* length of clip */ + int voiceonly[MAX_VOICE_ENTRIES]; /* flag if this is voice only */ int count = 0; int count_voiceonly = 0; unsigned int value; /* value to be written to file */ @@ -86,6 +87,11 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi } fclose(voicefontids); + if (count > MAX_VOICE_ENTRIES) + { + return -1; + } + fseek(output, HEADER_SIZE + count*8, SEEK_SET); /* space for header */ for (i=0; i<count; i++) @@ -161,6 +167,9 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi fwrite(&value, sizeof(value), 1,output); value = UINT_TO_BE(size[i]); /* size */ fwrite(&value, sizeof(value), 1, output); + printf(": [%d]%s : %s {%x, %x}\n", i, + (voiceonly[i] ==1 ? "[V]":""), names[i], + UINT_TO_BE(pos[i]), UINT_TO_BE(size[i])); /* debug */ } /* for i */ } /* for j */ @@ -199,7 +208,11 @@ int main (int argc, char** argv) return -2; } - voicefont(ids, atoi(argv[2]),argv[3],output, 400); + if (voicefont(ids, atoi(argv[2]),argv[3],output, 400) < 0) + { + printf("Error too many voicefont entries!\n"); + return -3; + } return 0; } #endif |