diff --git a/app-text/docbook_xsl_stylesheets/docbook_xsl_stylesheets-1.78.1.recipe b/app-text/docbook_xsl_stylesheets/docbook_xsl_stylesheets-1.78.1.recipe new file mode 100644 index 000000000..d76ef5487 --- /dev/null +++ b/app-text/docbook_xsl_stylesheets/docbook_xsl_stylesheets-1.78.1.recipe @@ -0,0 +1,46 @@ +SUMMARY="XSL stylesheets for DocBook XML document instances." +DESCRIPTION=" +DocBook is an XML vocabulary that lets you create documents in a presentation-neutral form that captures the logical structure of your content. Using free tools along with the DocBook XSL stylesheets, you can publish your content as HTML pages and PDF files, and in many other formats. +" + +HOMEPAGE="http://docbook.sourceforge.net" +SRC_URI="http://sourceforge.net/projects/docbook/files/docbook-xsl/1.78.1/docbook-xsl-1.78.1.tar.bz2" +CHECKSUM_SHA256="c98f7296ab5c8ccd2e0bc07634976a37f50847df2d8a59bdb1e157664700b467" + +REVISION="1" +ARCHITECTURES="any" + +LICENSE="BSD (3-clause)" +COPYRIGHT=" + 1999-2007 Norman Walsh + 2003 Jiří Kosek + 2004-2007 Steve Ball + 2005-2008 The DocBook Project + 2011-2012 O'Reilly Media +" + +PROVIDES=" + docbook_xsl_stylesheets = $portVersion + " + +BUILD_PREREQUIRES=" + cmd:find + " + +SOURCE_DIR="docbook-xsl-$portVersion" +BUILD() +{ + true +} + +INSTALL() +{ + mkdir -p $dataDir/xml/docbook/xsl-stylesheets-1.78.1 + + cp -v -R VERSION common eclipse epub extensions fo highlighting html \ + htmlhelp images javahelp lib manpages params profiling \ + roundtrip slides template tests tools webhelp website \ + xhtml xhtml-1_1 $dataDir/xml/docbook/xsl-stylesheets-1.78.1 + + ln -s VERSION $dataDir/xml/docbook/xsl-stylesheets-1.78.1/VERSION.xsl +} diff --git a/app-text/help2man/help2man-1.44.1.recipe b/app-text/help2man/help2man-1.44.1.recipe index f5b00a3cf..2e0ffc432 100644 --- a/app-text/help2man/help2man-1.44.1.recipe +++ b/app-text/help2man/help2man-1.44.1.recipe @@ -19,8 +19,8 @@ REVISION="1" LICENSE="GNU GPL v3" COPYRIGHT="1997-2013 Free Software Foundation" -ARCHITECTURES="?x86_gcc2 x86 x86_64" -SECONDARY_ARCHITECTURES="?x86_gcc2 x86" +ARCHITECTURES="x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="x86_gcc2 x86" PROVIDES=" help2man = $portVersion diff --git a/dev-libs/chmlib/chmlib-0.40.recipe b/dev-libs/chmlib/chmlib-0.40.recipe index 7b968a6df..877e0b6c4 100644 --- a/dev-libs/chmlib/chmlib-0.40.recipe +++ b/dev-libs/chmlib/chmlib-0.40.recipe @@ -1,32 +1,76 @@ +SUMMARY="A library for dealing with Microsoft ITSS/CHM format files." DESCRIPTION=" -CHMLIB is a library for dealing with Microsoft ITSS/CHM format files. -" -HOMEPAGE="http://www.jedrea.com/chmlib/" -SRC_URI="http://www.jedrea.com/chmlib/chmlib-0.40.zip" -CHECKSUM_MD5="a20d86103b8ab369e5b93506d5ffa802" +chmlib is a small library designed for accessing MS ITSS files. The ITSS file \ +format is used for Microsoft Html Help files (.chm), which have been the \ +predominant medium for software documentation from Microsoft during the past \ +several years, having superceded the previously used .hlp file format. +Note that this is NOT the same as the OLE structured storage file format used \ +by MS Excel, Word, and so on. Instead, it is a different file format which \ +fulfills a similar purpose. Both file formats may be accessed via instances \ +of the IStorage COM interface, which is essentially an \"acts like a \ +filesystem\" interface. +" +HOMEPAGE="http://www.jedrea.com/chmlib/" +COPYRIGHT=" + 2003 Jed Wing + " +LICENSE="GNU LGPL v2.1" +SRC_URI="http://www.jedrea.com/chmlib/chmlib-0.40.tar.gz" +CHECKSUM_SHA256="512148ed1ca86dea051ebcf62e6debbb00edfdd9720cde28f6ed98071d3a9617" REVISION="1" -STATUS_HAIKU="stable" -DEPEND="" +ARCHITECTURES="x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="x86_gcc2 x86" + +PROVIDES=" + chmlib$secondaryArchSuffix = $portVersion compat >= 0 + lib:libchm$secondaryArchSuffix = 0.0.0 compat >= 0 + " +REQUIRES=" + haiku$secondaryArchSuffix >= $haikuVersion + " +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel >= $haikuVersion + " +BUILD_PREREQUIRES=" + cmd:aclocal + cmd:autoconf + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:libtoolize + cmd:make + cmd:sed + cmd:grep + cmd:gawk + " + BUILD() { - cd chmlib-0.40 - rm aclocal.m4 - rm acinclude.m4 - libtoolize --force --copy --install + libtoolize -fci aclocal sed -i 's/lpthread//g' configure.in Makefile.in src/Makefile.in autoconf automake - chmod 777 configure - ./configure --prefix=`finddir B_COMMON_DIRECTORY` - make + runConfigure ./configure + make $jobArgs } INSTALL() { - cd chmlib-0.40 make install + + prepareInstalledDevelLibs libchm + + # devel package + packageEntries devel \ + $developDir } -LICENSE="GNU LGPL v2.1" -COPYRIGHT="2003 Jed Wing" +# ----- devel package ------------------------------------------------------- + +PROVIDES_devel=" + chmlib${secondaryArchSuffix}_devel = $portVersion + devel:libchm${secondaryArchSuffix} = 0.0.0 compat >= 0 + " +REQUIRES_devel=" + chmlib${secondaryArchSuffix} == $portVersion base + " diff --git a/dev-libs/libgcrypt/libgcrypt-1.5.3.recipe b/dev-libs/libgcrypt/libgcrypt-1.5.3.recipe index e618a82a1..f7d6e9146 100644 --- a/dev-libs/libgcrypt/libgcrypt-1.5.3.recipe +++ b/dev-libs/libgcrypt/libgcrypt-1.5.3.recipe @@ -1,18 +1,19 @@ -DESCRIPTION="libgcrypt" -SUMMARY=" -Libgcrypt is GNU's basic cryptographic library. +SUMMARY="GNU's basic cryptographic library." +DESCRIPTION=" +Libgcrypt is a general purpose crypto library based on the code \ +used in GnuPG. " LICENSE="GNU LGPL v3" COPYRIGHT="2000-2013 Free Software Foundation, Inc." HOMEPAGE="http://directory.fsf.org/project/libgcrypt/" SRC_URI="ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.5.3.tar.bz2" CHECKSUM_SHA256="bcf5334e7da352c45de6aec5d2084ce9a1d30029ff4a4a5da13f1848874759d1" -REVISION="1" +REVISION="2" ARCHITECTURES="x86" PROVIDES=" libgcrypt = $portVersion compat >= 1.5 - lib:libgcrypt = $portVersion compat >= 1.5 + lib:libgcrypt = 11.8.2 compat >= 11 " REQUIRES=" @@ -31,20 +32,6 @@ BUILD_PREREQUIRES=" cmd:gcc " -PROVIDES_devel=" - libgcrypt_devel = $portVersion compat >= 1.5 - devel:libgcrypt = $portVersion compat >= 1.5 - cmd:dumpsexp = $portVersion compat >= 1.5 - cmd:libgcrypt_config = $portVersion compat >= 1.5 - cmd:hmac256 = $portVersion compat >= 1.5 - " - -REQUIRES_devel=" - libgcrypt == $portVersion - haiku >= $haikuVersion - libgpg_error_devel - " - PATCHES="libgcrypt-1.5.3.patch" BUILD() @@ -63,3 +50,16 @@ INSTALL() packageEntries devel \ $developDir $binDir } + +PROVIDES_devel=" + libgcrypt_devel = $portVersion compat >= 1.5 + devel:libgcrypt = 11.8.2 compat >= 11 + cmd:dumpsexp = $portVersion compat >= 1.5 + cmd:libgcrypt_config = $portVersion compat >= 1.5 + cmd:hmac256 = $portVersion compat >= 1.5 + " + +REQUIRES_devel=" + libgcrypt == $portVersion base + libgpg_error_devel + " diff --git a/dev-libs/libgpg_error/libgpg_error-1.12.recipe b/dev-libs/libgpg_error/libgpg_error-1.12.recipe index 4a1311c1b..234427854 100644 --- a/dev-libs/libgpg_error/libgpg_error-1.12.recipe +++ b/dev-libs/libgpg_error/libgpg_error-1.12.recipe @@ -9,13 +9,13 @@ COPYRIGHT="2003-2013 g10 Code GmbH" HOMEPAGE="http://www.gnupg.org/related_software/libraries.en.html#lib-libgpg-error" SRC_URI="ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.12.tar.bz2" CHECKSUM_SHA256="cafc9ed6a87c53a35175d5a1220a96ca386696eef2fa059cc0306211f246e55f" -REVISION="1" +REVISION="2" ARCHITECTURES="x86" PROVIDES=" - libgpg_error = $portVersion compat >= 1.12 - lib:libgpg_error = $portVersion compat >= 1.12 - cmd:gpg_error = $portVersion compat >= 1.12 + libgpg_error = $portVersion compat >= 1 + lib:libgpg_error = 0.10.0 compat >= 0 + cmd:gpg_error = $portVersion compat >= 1 " REQUIRES=" @@ -27,23 +27,14 @@ BUILD_REQUIRES=" " BUILD_PREREQUIRES=" + cmd:awk cmd:make cmd:gcc " -PROVIDES_devel=" - libgpg_error_devel = $portVersion compat >= 1.12 - cmd:gpg_error_config = $portVersion compat >= 1.12 - devel:libgpg_error = $portVersion compat >= 1.12 - " +SOURCE_DIR="libgpg-error-$portVersion" -REQUIRES_devel=" - libgpg_error == $portVersion - " - -SOURCE_DIR="libgpg-error-1.12" - -PATCHES="libgpg_error-1.12.patch" +PATCHES="libgpg_error-$portVersion.patch" BUILD() { @@ -60,3 +51,13 @@ INSTALL() packageEntries devel \ $developDir $binDir/gpg-error-config } + +PROVIDES_devel=" + libgpg_error_devel = $portVersion compat >= 1 + cmd:gpg_error_config = $portVersion compat >= 1 + devel:libgpg_error = 0.10.0 compat >= 0 + " + +REQUIRES_devel=" + libgpg_error == $portVersion + " diff --git a/dev-libs/libusb/libusb-1.0.17.recipe b/dev-libs/libusb/libusb-1.0.17.recipe index 5e07192fd..3e383bc34 100644 --- a/dev-libs/libusb/libusb-1.0.17.recipe +++ b/dev-libs/libusb/libusb-1.0.17.recipe @@ -28,7 +28,7 @@ COPYRIGHT=" " HOMEPAGE="http://libusbx.org/" SRC_URI="git+git://github.com/pulkomandy/libusbx#c6f866b9914f266ab198a3313eba45e55c094024" -REVISION="1" +REVISION="2" ARCHITECTURES="x86 x86_64" if [ $effectiveTargetArchitecture != x86_gcc2 ]; then # x86_gcc2 is fine as primary target architecture as long as we're building @@ -37,6 +37,8 @@ if [ $effectiveTargetArchitecture != x86_gcc2 ]; then fi SECONDARY_ARCHITECTURES="x86" +PATCHES="$portVersionedName.patchset" + PROVIDES=" libusb$secondaryArchSuffix = $portVersion lib:libusb_1.0$secondaryArchSuffix = $portVersion diff --git a/dev-libs/libusb/patches/libusb-1.0.17.patchset b/dev-libs/libusb/patches/libusb-1.0.17.patchset new file mode 100644 index 000000000..581ddea6f --- /dev/null +++ b/dev-libs/libusb/patches/libusb-1.0.17.patchset @@ -0,0 +1,31 @@ +From 91edd51cfa1be577227e396f3460f7564964b46c Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Wed, 21 May 2014 21:18:27 +0000 +Subject: build fix + + +diff --git a/libusb/os/haiku_usbkit.cpp b/libusb/os/haiku_usbkit.cpp +index f4955c0..eec2007 100644 +--- a/libusb/os/haiku_usbkit.cpp ++++ b/libusb/os/haiku_usbkit.cpp +@@ -69,7 +69,7 @@ private: + usb_configuration_descriptor** fConfigurationDescriptors; + uint32 fActiveConfiguration; + char* fPath; +- volatile int32 fOpenCount; ++ int32 fOpenCount; + }; + + +@@ -609,7 +609,7 @@ UsbRoster::DeviceRemoved(BUSBDevice* device) + + + UsbRoster gUsbRoster; +-volatile int32 gInitCount = 0; ++int32 gInitCount = 0; + + static int + haiku_init(struct libusb_context* ctx) +-- +1.8.3.4 + diff --git a/dev-util/cmake/cmake-3.0.0_rc5.recipe b/dev-util/cmake/cmake-3.0.0_rc5.recipe new file mode 100644 index 000000000..eeb2d72e7 --- /dev/null +++ b/dev-util/cmake/cmake-3.0.0_rc5.recipe @@ -0,0 +1,73 @@ +SUMMARY="Cross platform Make" +DESCRIPTION=" +CMake is a cross-platform, open-source build system. It is a family of tools \ +designed to build, test and package software. CMake is used to control the \ +software compilation process using simple platform and compiler independent \ +configuration files. CMake generates native makefiles and workspaces that can \ +be used in the compiler environment of your choice. +" +HOMEPAGE="http://www.cmake.org" +LICENSE="CMake" +COPYRIGHT="2002-2013 Kitware, Inc., Insight Consortium, All rights reserved." +SRC_URI="http://www.cmake.org/files/v3.0/cmake-3.0.0-rc5.tar.gz" +CHECKSUM_SHA256="fa8e76e5ed44199f4ceef24abd65a4d7df2d857edf44094d4ae7a2401af78389" +REVISION="1" +ARCHITECTURES="x86 x86_64" +if [ $effectiveTargetArchitecture != x86_gcc2 ]; then + # x86_gcc2 is fine as primary target architecture as long as we're building + # for a different secondary architecture. + ARCHITECTURES="$ARCHITECTURES x86_gcc2" +fi +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + cmake = $portVersion compat >= 3.0 + cmd:cmake = $portVersion compat >= 3.0 + cmd:ccmake = $portVersion compat >= 3.0 + cmd:cpack = $portVersion compat >= 3.0 + cmd:ctest = $portVersion compat >= 3.0 + " +REQUIRES=" + haiku$secondaryArchSuffix >= $haikuVersion + lib:libstdc++$secondaryArchSuffix + lib:libncurses$secondaryArchSuffix + " +BUILD_REQUIRES=" + devel:libncurses$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + haiku${secondaryArchSuffix}_devel >= $haikuVersion + haiku_devel >= $haikuVersion + cmd:gcc$secondaryArchSuffix + cmd:grep + cmd:ld$secondaryArchSuffix + cmd:libtool + cmd:make + cmd:sed + " +PATCHES="cmake-3.0.0_rc1.patchset" +SOURCE_DIR="cmake-3.0.0-rc5" +BUILD() +{ + ./configure --prefix=$prefix \ + --datadir=/$relativeDataDir/cmake \ + --docdir=/$relativeDocDir \ + --mandir=/$relativeManDir + make $jobArgs +} + +INSTALL() +{ + make install + + # No way to tell this to configure... + mv $prefix/share/aclocal $dataDir + rmdir $prefix/share +} + +TEST() +{ + cp bin/ctest Bootstrap.cmk/ + make test VERBOSE=1 +} + diff --git a/haiku-libs/ale/ale-0.9.1.recipe b/haiku-libs/ale/ale-0.9.1.recipe index e35c82949..e24665865 100644 --- a/haiku-libs/ale/ale-0.9.1.recipe +++ b/haiku-libs/ale/ale-0.9.1.recipe @@ -21,10 +21,11 @@ SOURCE_DIR="ALEditor-$srcGitRef" SRC_URI="https://github.com/czeidler/ALEditor/archive/$srcGitRef.tar.gz" COPYRIGHT="Copyright (C) 2009-2014 by UniAuckland Team" LICENSE="MIT" -REVISION="1" -ARCHITECTURES="x86 x86_gcc2" +REVISION="2" +ARCHITECTURES="x86 x86_gcc2 x86_64" PROVIDES=" + ale = $portVersion lib:libale = $portVersion app:ALEditor = $portVersion " @@ -32,10 +33,9 @@ REQUIRES=" haiku >= $haikuVersion " BUILD_REQUIRES=" - haiku >= $haikuVersion + haiku_devel >= $haikuVersion " BUILD_PREREQUIRES=" - haiku_devel >= $haikuVersion cmd:gcc cmd:ld cmd:cmake diff --git a/media-libs/flac/flac-1.3.0.recipe b/media-libs/flac/flac-1.3.0.recipe index 5318d0c9f..1fa598f90 100644 --- a/media-libs/flac/flac-1.3.0.recipe +++ b/media-libs/flac/flac-1.3.0.recipe @@ -54,6 +54,7 @@ BUILD_PREREQUIRES=" cmd:make cmd:gawk cmd:perl + cmd:find " BUILD() diff --git a/media-libs/libaubio/libaubio-0.4.1.recipe b/media-libs/libaubio/libaubio-0.4.1.recipe new file mode 100644 index 000000000..ad9801676 --- /dev/null +++ b/media-libs/libaubio/libaubio-0.4.1.recipe @@ -0,0 +1,89 @@ +SUMMARY="A library to label music and sounds" +DESCRIPTION=" +aubio is a library to label music and sounds. It listens to audio signals and \ +attempts to detect events. For instance, when a drum is hit, at which frequency \ +is a note, or at what tempo is a rhythmic melody. + +Its features include segmenting a sound file before each of its attacks, \ +performing pitch detection, tapping the beat and producing midi streams from \ +live audio. +" +HOMEPAGE="http://aubio.org" +COPYRIGHT=" + 2003-2013 Paul Brossier + " +LICENSE="GNU GPL v3" +SRC_URI="http://aubio.org/pub/aubio-$portVersion.tar.bz2" +CHECKSUM_SHA256="25d7df0a9cd6366fda764a803424caddf5fb819fc75b42a7a03e1e6f8eb3c695" +REVISION="1" +ARCHITECTURES="?x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="?x86_gcc2 x86" + +SOURCE_DIR="aubio-$portVersion" + +PATCHES="libaubio-$portVersion.patchset" + +PROVIDES=" + libaubio$secondaryArchSuffix = $portVersion compat >= 0 + lib:libaubio$secondaryArchSuffix = 4.1.1 compat >= 4 + " +if [ -z "$secondaryArchSuffix" ]; then +PROVIDES="$PROVIDES + cmd:aubiomfcc = $portVersion compat >= 0 + cmd:aubionotes = $portVersion compat >= 0 + cmd:aubioonset = $portVersion compat >= 0 + cmd:aubiopitch = $portVersion compat >= 0 + cmd:aubioquiet = $portVersion compat >= 0 + cmd:aubiotrack = $portVersion compat >= 0 + " +fi + +REQUIRES=" + haiku$secondaryArchSuffix >= $haikuVersion +# lib:libsamplerate$secondaryArchSuffix + " +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel >= $haikuVersion +# devel:libsamplerate$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:python + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:pkg_config$secondaryArchSuffix + " + +BUILD() +{ + echo $includeDir + runConfigure --omit-buildspec ./waf configure \ + --with-target-platform=$effectiveTargetMachineTriple + ./waf build +} + +INSTALL() +{ + ./waf install + + prepareInstalledDevelLibs libaubio + fixPkgconfig + + # devel package + packageEntries devel \ + $developDir + + #remove bin commands when building for secondary arch + if [ -n "$secondaryArchSuffix" ];then + rm -rf $prefix/bin + fi +} + +# ----- devel package ------------------------------------------------------- + +PROVIDES_devel=" + libaubio${secondaryArchSuffix}_devel = $portVersion compat >= 0 + devel:libaubio$secondaryArchSuffix = 4.1.1 compat >= 4 + " +REQUIRES_devel=" + libaubio$secondaryArchSuffix == $portVersion base + " diff --git a/media-libs/libaubio/patches/libaubio-0.4.1.patchset b/media-libs/libaubio/patches/libaubio-0.4.1.patchset new file mode 100644 index 000000000..586bec539 --- /dev/null +++ b/media-libs/libaubio/patches/libaubio-0.4.1.patchset @@ -0,0 +1,79 @@ +From 0dc450424ce8c66628b22790656fc4f3577f80e7 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Mon, 19 May 2014 19:39:09 +0000 +Subject: Haiku has no libm + + +diff --git a/examples/wscript_build b/examples/wscript_build +index db5fed6..3f573cc 100644 +--- a/examples/wscript_build ++++ b/examples/wscript_build +@@ -17,7 +17,7 @@ bld(features = 'c', + for source_file in programs_source: + bld(features = 'c cprogram', + includes = '../src', +- lib = 'm', ++ lib = '', + use = ['aubio', 'utilsio'], + source = source_file, + target = str(source_file).split('.')[0] +diff --git a/src/wscript_build b/src/wscript_build +index 94b2062..2b9b60d 100644 +--- a/src/wscript_build ++++ b/src/wscript_build +@@ -15,7 +15,7 @@ ctx(features = 'c', + source = source, + includes = ['.'], + uselib = uselib, +- lib = 'm', ++ lib = '', + target = 'lib_objects') + + # build libaubio.so (cshlib) and/or libaubio.a (cstlib) +@@ -29,7 +29,7 @@ else: #linux, darwin, android, mingw, ... + for target in build_features: + ctx(features = 'c ' + target, + use = ['lib_objects'], +- lib = 'm', ++ lib = '', + target = 'aubio', + install_path = '${PREFIX}/lib', + vnum = ctx.env['LIB_VERSION']) +diff --git a/tests/wscript_build b/tests/wscript_build +index 04bbf9a..8a8c625 100644 +--- a/tests/wscript_build ++++ b/tests/wscript_build +@@ -6,7 +6,7 @@ for target_name in ctx.path.ant_glob('src/**/*.c'): + extra_source = [] + + bld(features = 'c cprogram test', +- lib = 'm', ++ lib = '', + uselib = uselib, + source = [target_name] + extra_source, + target = str(target_name).split('.')[0], +-- +1.8.3.4 + + +From 3d07ca19c7c3ec7044417c062553d3ea02375d17 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Mon, 19 May 2014 23:15:04 +0000 +Subject: fix headers installation + + +diff --git a/src/wscript_build b/src/wscript_build +index 2b9b60d..194345d 100644 +--- a/src/wscript_build ++++ b/src/wscript_build +@@ -35,6 +35,6 @@ for target in build_features: + vnum = ctx.env['LIB_VERSION']) + + # install headers, except _priv.h ones +-ctx.install_files('${PREFIX}/include/aubio/', ++ctx.install_files('${INCLUDEDIR}/aubio/', + ctx.path.ant_glob('**/*.h', excl = ['**_priv.h', 'config.h']), + relative_trick=True) +-- +1.8.3.4 + diff --git a/media-libs/liblo/liblo-0.28.recipe b/media-libs/liblo/liblo-0.28.recipe new file mode 100644 index 000000000..20c26f40a --- /dev/null +++ b/media-libs/liblo/liblo-0.28.recipe @@ -0,0 +1,74 @@ +SUMMARY="Lightweight OSC (Open Sound Control) Implementation" +DESCRIPTION=" +liblo is a lightweight library that provides an easy to use implementation of \ +the OSC protocol. +" +HOMEPAGE="http://plugin.org.uk/liblo" +COPYRIGHT=" + 2008-2012 Stephen Sinclair + 2008 Kentaro Fukuchi + 2005-2008 Nicholas Humfrey + 2005 Martin Habets + 2005-2006 Steve Harris" +LICENSE="GNU LGPL v2.1" +SRC_URI="http://prdownloads.sourceforge.net/liblo/$portVersionedName.tar.gz" +CHECKSUM_SHA256="da94a9b67b93625354dd89ff7fe31e5297fc9400b6eaf7378c82ee1caf7db909" +REVISION="1" +ARCHITECTURES="x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="x86_gcc2 x86" + +PATCHES="$portVersionedName.patchset" + +PROVIDES=" + liblo$secondaryArchSuffix = $portVersion compat >= 0 + cmd:oscdump + cmd:oscsend + lib:liblo$secondaryArchSuffix = 7.2.0 compat >= 7 + " +REQUIRES=" + haiku$secondaryArchSuffix >= $haikuVersion + " +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel >= $haikuVersion + " +BUILD_PREREQUIRES=" + cmd:aclocal + cmd:autoconf + cmd:automake + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:libtoolize + cmd:make + cmd:find + " + +BUILD() +{ + libtoolize --force --copy --install + aclocal + autoconf + runConfigure ./configure + make $jobArgs +} + +INSTALL() +{ + make install + + prepareInstalledDevelLibs liblo + fixPkgconfig + + # devel package + packageEntries devel \ + $developDir +} + +# ----- devel package ------------------------------------------------------- + +PROVIDES_devel=" + liblo${secondaryArchSuffix}_devel = $portVersion compat >= 0 + devel:liblo$secondaryArchSuffix = 7.2.0 compat >= 7 + " +REQUIRES_devel=" + liblo$secondaryArchSuffix == $portVersion base + " diff --git a/media-libs/liblo/patches/liblo-0.28.patchset b/media-libs/liblo/patches/liblo-0.28.patchset new file mode 100644 index 000000000..d38db784b --- /dev/null +++ b/media-libs/liblo/patches/liblo-0.28.patchset @@ -0,0 +1,209 @@ +From 5e7d6dc8d32f0189a3385cb824030cb6c500e869 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 20 May 2014 16:30:21 +0000 +Subject: haiku patch + + +diff --git a/configure.ac b/configure.ac +index c487d18..80bf8da 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -139,7 +139,7 @@ else + fi + + # Checks for libraries. +-AC_SEARCH_LIBS([recvfrom], [socket]) ++AC_SEARCH_LIBS([recvfrom], [socket network]) + AC_CHECK_FUNC([log], [], [AC_CHECK_LIB([m],[log])]) + AC_CHECK_FUNCS([getifaddrs]) + +-- +1.8.3.4 + + +From dcc0e8c2cbd9453252c3dbed013683f3573ad384 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 20 May 2014 16:51:04 +0000 +Subject: check getifaddrs + + +diff --git a/lo/lo_cpp.h b/lo/lo_cpp.h +index 79db0b6..7675380 100644 +--- a/lo/lo_cpp.h ++++ b/lo/lo_cpp.h +@@ -184,12 +184,19 @@ namespace lo { + + std::string url() const + { return std::string(lo_address_get_url(address)?:""); } +- ++#ifdef HAVE_GETIFADDRS + std::string iface() const + { return std::string(lo_address_get_iface(address)?:""); } + + void set_iface(const string_type &iface, const string_type &ip) + { lo_address_set_iface(address, iface._s?:0, ip._s?:0); } ++#else ++ std::string iface() const ++ { return std::string(""); } ++ ++ void set_iface(const string_type &iface, const string_type &ip) ++ { } ++#endif + + int set_tcp_nodelay(int enable) + { return lo_address_set_tcp_nodelay(address, enable); } +-- +1.8.3.4 + + +From 4e66b251cb3f6c37418e413476082efddfd0710b Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 20 May 2014 22:09:52 +0000 +Subject: gcc2 build fix + + +diff --git a/examples/example_tcp_echo_server.c b/examples/example_tcp_echo_server.c +index 93af99b..b675e92 100644 +--- a/examples/example_tcp_echo_server.c ++++ b/examples/example_tcp_echo_server.c +@@ -46,6 +46,9 @@ void ctrlc(int sig) + + int main(int argc, char *argv[]) + { ++ lo_server_thread st; ++ lo_server s; ++ lo_address a = 0; + const char *port = "7770"; + int do_send = 0; + +@@ -55,13 +58,13 @@ int main(int argc, char *argv[]) + } + + /* start a new server on port 7770 */ +- lo_server_thread st = lo_server_thread_new_with_proto(port, LO_TCP, error); ++ st = lo_server_thread_new_with_proto(port, LO_TCP, error); + if (!st) { + printf("Could not create server thread.\n"); + exit(1); + } + +- lo_server s = lo_server_thread_get_server(st); ++ s = lo_server_thread_get_server(st); + + /* add method that will match the path /quit with no args */ + lo_server_thread_add_method(st, "/quit", "", quit_handler, NULL); +@@ -75,14 +78,14 @@ int main(int argc, char *argv[]) + + printf("Listening on TCP port %s\n", port); + +- lo_address a = 0; + if (do_send) { ++ int r; + a = lo_address_new_with_proto(LO_TCP, "localhost", "7770"); + if (!a) { + printf("Error creating destination address.\n"); + exit(1); + } +- int r = lo_send_from(a, s, LO_TT_IMMEDIATE, "/test", "ifs", ++ r = lo_send_from(a, s, LO_TT_IMMEDIATE, "/test", "ifs", + 1, 2.0f, "3"); + if (r < 0) + printf("Error sending initial message.\n"); +@@ -115,6 +118,7 @@ int echo_handler(const char *path, const char *types, lo_arg ** argv, + int argc, void *data, void *user_data) + { + int i; ++ int r; + lo_message m = (lo_message)data; + lo_address a = lo_message_get_source(m); + lo_server s = (lo_server)user_data; +@@ -142,7 +146,7 @@ int echo_handler(const char *path, const char *types, lo_arg ** argv, + return 0; + } + +- int r = lo_send_message_from(a, s, path, m); ++ r = lo_send_message_from(a, s, path, m); + if (r < 0) + printf("Error sending back message, socket may have closed.\n"); + else +diff --git a/src/message.c b/src/message.c +index 7980ccf..28a2bd5 100644 +--- a/src/message.c ++++ b/src/message.c +@@ -259,6 +259,7 @@ int lo_message_add_varargs_internal(lo_message msg, const char *types, + } + } + #ifndef USE_ANSI_C ++{ + void *i = va_arg(ap, void *); + if (((unsigned long)i & 0xFFFFFFFFUL) + != ((unsigned long)LO_MARKER_A & 0xFFFFFFFFUL)) +@@ -281,6 +282,7 @@ int lo_message_add_varargs_internal(lo_message msg, const char *types, + "mismatching types and data at\n%s:%d, exiting.\n", file, + line); + } ++} + #endif + va_end(ap); + +diff --git a/src/server.c b/src/server.c +index 3d01e88..0521bfc 100644 +--- a/src/server.c ++++ b/src/server.c +@@ -1275,6 +1275,7 @@ int lo_server_wait(lo_server s, int timeout) + { + if (s->protocol == LO_TCP) + { ++ double diff; + int sock = accept(s->sockets[0].fd, + (struct sockaddr *) &addr, &addr_len); + +@@ -1286,7 +1287,7 @@ int lo_server_wait(lo_server s, int timeout) + + lo_timetag_now(&now); + +- double diff = lo_timetag_diff(now, then); ++ diff = lo_timetag_diff(now, then); + + sched_timeout = lo_server_next_event_delay(s) * 1000; + timeout -= (int)(diff*1000); +diff --git a/src/test_bidirectional_tcp.c b/src/test_bidirectional_tcp.c +index 0408df3..226595e 100644 +--- a/src/test_bidirectional_tcp.c ++++ b/src/test_bidirectional_tcp.c +@@ -28,6 +28,7 @@ int generic_handler(const char *path, const char *types, lo_arg ** argv, + + void *sendthread(void *arg) + { ++ lo_address a; + lo_server s = lo_server_new_with_proto("7772", LO_TCP, 0); + if (!s) { printf("no server2\n"); exit(1); } + +@@ -35,7 +36,7 @@ void *sendthread(void *arg) + + lo_server_add_method(s, 0, 0, generic_handler, s); + +- lo_address a = lo_address_new_with_proto(LO_TCP, "localhost", "7771"); ++ a = lo_address_new_with_proto(LO_TCP, "localhost", "7771"); + + lo_send_from(a, s, LO_TT_IMMEDIATE, "/test", 0); + +@@ -55,6 +56,7 @@ void *sendthread(void *arg) + + int main() + { ++ pthread_t thr; + /* start a new server on port 7770 */ + lo_server s = lo_server_new_with_proto("7771", LO_TCP, 0); + if (!s) { printf("no server\n"); exit(1); } +@@ -64,7 +66,6 @@ int main() + + printf("%p.server fd: %d\n", s, lo_server_get_socket_fd(s)); + +- pthread_t thr; + pthread_create(&thr, 0, sendthread, s); + + printf("%p.receiving1..\n", s); +-- +1.8.3.4 + diff --git a/media-libs/libmtp/libmtp-1.1.6.recipe b/media-libs/libmtp/libmtp-1.1.6.recipe new file mode 100644 index 000000000..17b0be066 --- /dev/null +++ b/media-libs/libmtp/libmtp-1.1.6.recipe @@ -0,0 +1,82 @@ +SUMMARY="MTP initiator library" +DESCRIPTION=" +libmtp implements an MTP initiator, which means it initiate \ +MTP sessions with devices. The devices responding are known \ +as MTP responders. libmtp runs on something with a USB host \ +controller interface, using libusb to access the host \ +controller. +" +HOMEPAGE="http://libmtp.sourceforge.net" +COPYRIGHT=" + Richard Low + Linus Walleij + Mariusz Woloszyn + Marcus Meissner + " +LICENSE="GNU LGPL v2.1" +SRC_URI="http://prdownloads.sourceforge.net/libmtp/$portVersionedName.tar.gz" +CHECKSUM_SHA256="3a1c1c83af91de4052eb54feb795c141b4c04a252e0031954ebbf6175970cb0a" +REVISION="1" +ARCHITECTURES="x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="x86_gcc2 x86" + +PATCHES="$portVersionedName.patchset" + +PROVIDES=" + libmtp$secondaryArchSuffix = $portVersion compat >= 1.0 + lib:libmtp$secondaryArchSuffix = 9.1.0 compat >= 9 + " +# add cmd provides +REQUIRES=" + haiku$secondaryArchSuffix >= $haikuVersion + lib:libgcrypt$secondaryArchSuffix + lib:libiconv$secondaryArchSuffix + lib:libusb_1.0$secondaryArchSuffix + " +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel >= $haikuVersion + devel:libgcrypt$secondaryArchSuffix + devel:libiconv$secondaryArchSuffix + devel:libusb_1.0$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:aclocal + cmd:autoconf + cmd:automake + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:libtoolize + cmd:make + cmd:gettext + cmd:pkg_config + cmd:doxygen + cmd:find + " + +BUILD() +{ + runConfigure ./configure # --enable-doxygen + make $jobArgs +} + +INSTALL() +{ + make install + + prepareInstalledDevelLibs libmtp + fixPkgconfig + + # devel package + packageEntries devel \ + $developDir # $docDir +} + +# ----- devel package ------------------------------------------------------- + +PROVIDES_devel=" + libmtp${secondaryArchSuffix}_devel = $portVersion compat >= 1.0 + devel:libmtp$secondaryArchSuffix = 9.1.0 compat >= 9 + " +REQUIRES_devel=" + libmtp$secondaryArchSuffix == $portVersion base + " diff --git a/media-libs/libmtp/patches/libmtp-1.1.6.patchset b/media-libs/libmtp/patches/libmtp-1.1.6.patchset new file mode 100644 index 000000000..e7c611bae --- /dev/null +++ b/media-libs/libmtp/patches/libmtp-1.1.6.patchset @@ -0,0 +1,22 @@ +From 42d85dd2edd255726d4a48226d7dafa2dfe964f8 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Wed, 21 May 2014 21:24:57 +0000 +Subject: fix configure.ac + + +diff --git a/configure.ac b/configure.ac +index 87d7fcc..2063735 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -4,7 +4,7 @@ AC_INIT([libmtp], [1.1.6], [libmtp-discuss@lists.sourceforge.net]) + AC_CONFIG_MACRO_DIR([m4]) + AM_INIT_AUTOMAKE([foreign]) + AC_CONFIG_SRCDIR([src/libmtp.c]) +-AM_CONFIG_HEADER(config.h) ++AC_CONFIG_HEADERS(config.h) + + # Checks for programs. + AC_PROG_CC +-- +1.8.3.4 + diff --git a/media-libs/libsndfile/libsndfile-1.0.25.recipe b/media-libs/libsndfile/libsndfile-1.0.25.recipe new file mode 100644 index 000000000..c361b6648 --- /dev/null +++ b/media-libs/libsndfile/libsndfile-1.0.25.recipe @@ -0,0 +1,87 @@ +SUMMARY="C library for reading and writing files containing sampled sound" +DESCRIPTION=" +libsndfile is a library of C routines for reading and writing \ +files containing sampled audio data. +" +HOMEPAGE="http://www.mega-nerd.com/libsndfile" +COPYRIGHT=" + 1999-2011 Erik de Castro Lopo +" +LICENSE="GNU LGPL v2.1" +SRC_URI="http://www.mega-nerd.com/libsndfile/files/$portVersionedName.tar.gz" +CHECKSUM_SHA256="59016dbd326abe7e2366ded5c344c853829bebfd1702ef26a07ef662d6aa4882" +REVISION="1" +ARCHITECTURES="!x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="!x86_gcc2 x86" + +PATCHES="$portVersionedName.patchset" + +PROVIDES=" + libsndfile$secondaryArchSuffix = $portVersion compat >= 1 + cmd:sndfile_cmp + cmd:sndfile_concat + cmd:sndfile_convert + cmd:sndfile_deinterleave + cmd:sndfile_info + cmd:sndfile_interleave + cmd:sndfile_metadata_get + cmd:sndfile_metadata_set + cmd:sndfile_play + cmd:sndfile_regtest + cmd:sndfile_salvage + lib:libsndfile$secondaryArchSuffix = $portVersion compat >= 1 + " +REQUIRES=" + haiku$secondaryArchSuffix >= $haikuVersion + lib:libflac$secondaryArchSuffix + lib:libogg$secondaryArchSuffix + lib:libvorbis$secondaryArchSuffix + " +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel >= $haikuVersion + devel:libflac$secondaryArchSuffix + devel:libogg$secondaryArchSuffix + devel:libvorbis$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:aclocal + cmd:autoconf + cmd:automake + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:libtoolize + cmd:make + cmd:pkg_config + " + +BUILD() +{ + libtoolize --force --copy --install + aclocal -I M4 + autoconf + automake + runConfigure ./configure + make $jobArgs +} + +INSTALL() +{ + make install + + prepareInstalledDevelLibs libsndfile + fixPkgconfig + + # devel package + packageEntries devel \ + $developDir +} + +# ----- devel package ------------------------------------------------------- + +PROVIDES_devel=" + libsndfile${secondaryArchSuffix}_devel = $portVersion compat >= 1 + devel:libsndfile$secondaryArchSuffix = $portVersion compat >= 1 + " +REQUIRES_devel=" + libsndfile$secondaryArchSuffix == $portVersion base + " diff --git a/media-libs/libsndfile/patches/libsndfile-1.0.25.patchset b/media-libs/libsndfile/patches/libsndfile-1.0.25.patchset new file mode 100644 index 000000000..d1203e9d4 --- /dev/null +++ b/media-libs/libsndfile/patches/libsndfile-1.0.25.patchset @@ -0,0 +1,21 @@ +From c94a905e75ff6769bd4289d56f687d6c2a8f6ba4 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 20 May 2014 16:43:24 +0000 +Subject: haiku patch + + +diff --git a/src/sndfile.h.in b/src/sndfile.h.in +index 8926fc6..ef9636b 100644 +--- a/src/sndfile.h.in ++++ b/src/sndfile.h.in +@@ -29,6 +29,7 @@ + /* This is the version 1.0.X header file. */ + #define SNDFILE_1 + ++#include + #include + #include + +-- +1.8.3.4 + diff --git a/net-ftp/lftp/patches/lftp-4.4.16.patchset b/net-ftp/lftp/patches/lftp-4.4.16.patchset new file mode 100644 index 000000000..a2c5d76fb --- /dev/null +++ b/net-ftp/lftp/patches/lftp-4.4.16.patchset @@ -0,0 +1,22 @@ +From 5ade774564ec60f247d60adbd39c2f94c6164fff Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 17 May 2014 13:38:15 +0000 +Subject: gcc2 fix + + +diff --git a/lib/gl_openssl.h b/lib/gl_openssl.h +index 2414421..014769d 100644 +--- a/lib/gl_openssl.h ++++ b/lib/gl_openssl.h +@@ -95,7 +95,7 @@ GL_CRYPTO_FN (_finish_ctx) (struct _gl_ctx *ctx, void *res) + + GL_OPENSSL_INLINE void * + GL_CRYPTO_FN (_buffer) (const char *buf, size_t len, void *res) +-{ return OPENSSL_FN () ((const unsigned char *) buf, len, (unsigned char *) res); } ++{ return OPENSSL_FN ( ) ((const unsigned char *) buf, len, (unsigned char *) res); } + + GL_OPENSSL_INLINE void * + GL_CRYPTO_FN (_read_ctx) (const struct _gl_ctx *ctx, void *res) +-- +1.8.3.4 + diff --git a/net-misc/curl/curl-7.37.0.recipe b/net-misc/curl/curl-7.37.0.recipe new file mode 100644 index 000000000..b5aac30f6 --- /dev/null +++ b/net-misc/curl/curl-7.37.0.recipe @@ -0,0 +1,116 @@ +SUMMARY="A commandline-tool and library for downloading data from URLs" +HOMEPAGE="http://curl.haxx.se" +COPYRIGHT="1996-2014, Daniel Stenberg, . All rights reserved." +LICENSE="Curl" +SRC_URI="http://curl.haxx.se/download/$portVersionedName.tar.bz2" +CHECKSUM_SHA256="24502492de3168b0556d8e1a06f14f7589e57b204917d602a572e14239b3e09e" +REVISION="1" +ARCHITECTURES="x86_gcc2 x86 x86_64 arm" +SECONDARY_ARCHITECTURES="x86_gcc2 x86" + +PATCHES="" + +PROVIDES=" + curl$secondaryArchSuffix = $portVersion + lib:libcurl$secondaryArchSuffix = 4.2.0 compat >= 4 + " +if [ -z "$secondaryArchSuffix" ]; then + PROVIDES="$PROVIDES + cmd:curl = $portVersion compat >= 7.16 + " +fi + +REQUIRES=" + haiku$secondaryArchSuffix >= $haikuVersion + ca_root_certificates + lib:libssl$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " +BUILD_REQUIRES=" + devel:libssl$secondaryArchSuffix + devel:libz$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + haiku${secondaryArchSuffix}_devel >= $haikuVersion + cmd:autoconf + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:libtoolize + cmd:make + cmd:nroff + " + +BUILD() +{ + certsInstallDir="$portPackageLinksDir/ca_root_certificates" + certsDir="$certsInstallDir/$relativeDataRootDir/ssl" + + libtoolize --force --copy --install + autoconf + runConfigure ./configure \ + --enable-ipv6 --enable-manual \ + --with-ca-bundle="$certsDir/CARootCertificates.pem" + make $jobArgs +} + +INSTALL() +{ + make install + + # prepare develop/lib + prepareInstalledDevelLibs libcurl + fixPkgconfig + + # fix curl-config + fixDevelopLibDirReferences $binDir/curl-config + sed -i -e "s,--libexecdir=$developLibDir,--libexecdir=$libExecDir,g" \ + -e "s,--libdir=$developLibDir,--libdir=$libDir,g" $binDir/curl-config + + # install html documentation for curl + mkdir -p "$docDir" + install -c -m 644 "docs/curl.html" "$docDir" + + # install html development documentation for libcurl + mkdir -p "$developDocDir" + for h in docs/libcurl/*.html; do + install -c -m 644 "$h" "$developDocDir" + done + + # devel package + packageEntries devel \ + $binDir/curl-config \ + $developDir \ + $manDir/man3 + + # Remove stuff we don't need in the secondary architecture base package. + if [ -n "$secondaryArchSuffix" ]; then + rm -rf $binDir + rm -rf $documentationDir + fi +} + +TEST() +{ + make check +} + +DESCRIPTION=" +Curl is a command line tool for transferring data with URL syntax, supporting \ +DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, \ +POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. curl supports SSL \ +certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, \ +proxies, cookies, user+password authentication (Basic, Digest, NTLM, \ +Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload \ +of other useful tricks. +" + +# ----- devel package ------------------------------------------------------- + +PROVIDES_devel=" + curl${secondaryArchSuffix}_devel = $portVersion + cmd:curl_config$secondaryArchSuffix = $portVersion compat >= 7.16 + devel:libcurl$secondaryArchSuffix = 4.2.0 compat >= 4 + " +REQUIRES_devel=" + curl$secondaryArchSuffix == $portVersion base + " diff --git a/net-misc/wget/patches/wget-1.15.patchset b/net-misc/wget/patches/wget-1.15.patchset new file mode 100644 index 000000000..7df49d780 --- /dev/null +++ b/net-misc/wget/patches/wget-1.15.patchset @@ -0,0 +1,678 @@ +From d44e24178a9dd9864e7ac068249444a1d95b9af1 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Mon, 19 May 2014 15:38:37 +0000 +Subject: apply wget-1.14.patch + + +diff --git a/configure.ac b/configure.ac +index b24588f..b396ec2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -161,6 +161,7 @@ AC_HEADER_STDBOOL + AC_CHECK_HEADERS(unistd.h sys/time.h) + AC_CHECK_HEADERS(termios.h sys/ioctl.h sys/select.h utime.h sys/utime.h) + AC_CHECK_HEADERS(stdint.h inttypes.h pwd.h wchar.h) ++AC_CHECK_HEADERS(arpa/inet.h) + + AC_CHECK_DECLS(h_errno,,,[#include ]) + +diff --git a/m4/wget.m4 b/m4/wget.m4 +index 777e973..5a8b75d 100644 +--- a/m4/wget.m4 ++++ b/m4/wget.m4 +@@ -88,6 +88,7 @@ AC_DEFUN([WGET_POSIX_CLOCK], [ + + dnl Check whether we need to link with -lnsl and -lsocket, as is the + dnl case on e.g. Solaris. ++dnl Haiku needs libnetwork + + AC_DEFUN([WGET_NSL_SOCKET], [ + dnl On Solaris, -lnsl is needed to use gethostbyname. But checking +@@ -107,6 +108,8 @@ AC_DEFUN([WGET_NSL_SOCKET], [ + AC_CHECK_LIB(nsl, $wget_check_in_nsl) + fi + AC_CHECK_LIB(socket, socket) ++ AC_CHECK_LIB(network, gethostbyname) ++ AC_CHECK_LIB(network, socket) + ]) + + +diff --git a/src/config.h.in b/src/config.h.in +index 4b03033..a4543c4 100644 +--- a/src/config.h.in ++++ b/src/config.h.in +@@ -672,6 +672,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_LANGINFO_H + ++/* Define to 1 if you have the `bind' library (-lbind). */ ++#undef HAVE_LIBBIND ++ + /* Define to 1 if you have the `dl' library (-ldl). */ + #undef HAVE_LIBDL + +@@ -684,6 +687,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_LIBINTL_H + ++/* Define to 1 if you have the `network' library (-lnetwork). */ ++#undef HAVE_LIBNETWORK ++ + /* Define to 1 if you have the `nsl' library (-lnsl). */ + #undef HAVE_LIBNSL + +diff --git a/src/connect.c b/src/connect.c +index bfb079b..916a90e 100644 +--- a/src/connect.c ++++ b/src/connect.c +@@ -46,7 +46,7 @@ as that of the covered work. */ + # include + # endif /* def __VMS [else] */ + # include +-# ifndef __BEOS__ ++# ifdef HAVE_ARPA_INET_H + # include + # endif + #endif /* not WINDOWS */ +diff --git a/src/host.h b/src/host.h +index 3f27ea0..3cd3ed9 100644 +--- a/src/host.h ++++ b/src/host.h +@@ -42,9 +42,9 @@ as that of the covered work. */ + # endif /* def __VMS [else] */ + # include + # include +-#ifndef __BEOS__ +-# include +-#endif ++# ifdef HAVE_ARPA_INET_H ++# include ++# endif + #endif + + struct url; +-- +1.8.3.4 + + +From d91114a406b6b16542a77b55ebe140314ce803c1 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Mon, 19 May 2014 15:47:24 +0000 +Subject: apply and augment wget-1.14-build-fixes.patch + + +diff --git a/src/ftp-basic.c b/src/ftp-basic.c +index 7a512c6..7237cd1 100644 +--- a/src/ftp-basic.c ++++ b/src/ftp-basic.c +@@ -969,8 +969,6 @@ ftp_list (int csock, const char *file, bool avoid_list_a, bool avoid_list, + bool ok = false; + size_t i = 0; + +- *list_a_used = false; +- + /* 2013-10-12 Andrea Urbani (matfanjol) + For more information about LIST and "LIST -a" please look at ftp.c, + function getftp, text "__LIST_A_EXPLANATION__". +@@ -979,7 +977,9 @@ ftp_list (int csock, const char *file, bool avoid_list_a, bool avoid_list, + later "i" variable. */ + const char *list_commands[] = { "LIST -a", + "LIST" }; ++ *list_a_used = false; + ++ + if (avoid_list_a) + { + i = countof (list_commands)- 1; +diff --git a/src/html-url.c b/src/html-url.c +index 1bb44b4..5285983 100644 +--- a/src/html-url.c ++++ b/src/html-url.c +@@ -789,6 +789,7 @@ get_urls_file (const char *file) + char *url_text; + struct urlpos *entry; + struct url *url; ++ char *new_url; + + const char *line_beg = text; + const char *line_end = memchr (text, '\n', text_end - text); +@@ -821,7 +822,7 @@ get_urls_file (const char *file) + url_text = merged; + } + +- char *new_url = rewrite_shorthand_url (url_text); ++ new_url = rewrite_shorthand_url (url_text); + if (new_url) + { + xfree (url_text); +diff --git a/src/http.c b/src/http.c +index 5715df6..38ee4b1 100644 +--- a/src/http.c ++++ b/src/http.c +@@ -29,6 +29,7 @@ Corresponding Source for a non-source form of such a combination + shall include the source code for the parts of OpenSSL used as well + as that of the covered work. */ + ++#define __USE_GNU + #include "wget.h" + + #include +@@ -1067,6 +1068,7 @@ extract_param (const char **source, param_token *name, param_token *value, + char separator) + { + const char *p = *source; ++ int param_type; + + while (c_isspace (*p)) ++p; + if (!*p) +@@ -1122,7 +1124,7 @@ extract_param (const char **source, param_token *name, param_token *value, + } + *source = p; + +- int param_type = modify_param_name(name); ++ param_type = modify_param_name(name); + if (NOT_RFC2231 != param_type) + { + modify_param_value(value, param_type); +@@ -1512,6 +1514,7 @@ read_response_body (struct http_stat *hs, int sock, FILE *fp, wgint contlen, + int warc_payload_offset = 0; + FILE *warc_tmp = NULL; + int warcerr = 0; ++ int flags; + + if (opt.warc_filename != NULL) + { +@@ -1548,7 +1551,7 @@ read_response_body (struct http_stat *hs, int sock, FILE *fp, wgint contlen, + } + + /* Read the response body. */ +- int flags = 0; ++ flags = 0; + if (contlen != -1) + /* If content-length is present, read that much; otherwise, read + until EOF. The HTTP spec doesn't require the server to +@@ -1653,6 +1656,7 @@ static uerr_t + gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy, + struct iri *iri, int count) + { ++ int warc_tmp_written; + struct request *req; + + char *type; +@@ -2125,10 +2129,11 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy, + if (write_error >= 0 && warc_tmp != NULL) + { + /* Remember end of headers / start of payload. */ ++ int warc_tmp_written; + warc_payload_offset = ftello (warc_tmp); + + /* Write a copy of the data to the WARC record. */ +- int warc_tmp_written = fwrite (opt.body_data, 1, body_data_size, warc_tmp); ++ warc_tmp_written = fwrite (opt.body_data, 1, body_data_size, warc_tmp); + if (warc_tmp_written != body_data_size) + write_error = -2; + } +@@ -2309,6 +2314,7 @@ read_header: + + if (statcode == HTTP_STATUS_UNAUTHORIZED) + { ++ uerr_t auth_err; + /* Authorization is required. */ + + /* Normally we are not interested in the response body. +@@ -2347,7 +2353,7 @@ read_header: + } + + pconn.authorized = false; +- uerr_t auth_err = RETROK; ++ auth_err = RETROK; + if (!auth_finished && (user && passwd)) + { + /* IIS sends multiple copies of WWW-Authenticate, one with +diff --git a/src/main.c b/src/main.c +index 19d7253..ea6986e 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -987,13 +987,20 @@ main (int argc, char **argv) + int i, ret, longindex; + int nurl; + bool append_to_log = false; ++ struct ptimer *timer; ++ double start_time; ++ int arglen; ++ int argstring_length; ++ int retconf; ++ bool use_userconfig = false; ++ char *p; + + total_downloaded_bytes = 0; + + program_name = argv[0]; + +- struct ptimer *timer = ptimer_new (); +- double start_time = ptimer_measure (timer); ++ timer = ptimer_new (); ++ start_time = ptimer_measure (timer); + + i18n_initialize (); + +@@ -1015,10 +1022,10 @@ main (int argc, char **argv) + #endif + + /* Construct the arguments string. */ +- int argstring_length = 1; ++ argstring_length = 1; + for (i = 1; i < argc; i++) + argstring_length += strlen (argv[i]) + 2 + 1; +- char *p = program_argstring = malloc (argstring_length * sizeof (char)); ++ p = program_argstring = malloc (argstring_length * sizeof (char)); + if (p == NULL) + { + fprintf (stderr, _("Memory allocation problem\n")); +@@ -1027,7 +1034,7 @@ main (int argc, char **argv) + for (i = 1; i < argc; i++) + { + *p++ = '"'; +- int arglen = strlen (argv[i]); ++ arglen = strlen (argv[i]); + memcpy (p, argv[i], arglen); + p += arglen; + *p++ = '"'; +@@ -1043,8 +1050,6 @@ main (int argc, char **argv) + /* This separate getopt_long is needed to find the user config file + option ("--config") and parse it before the other user options. */ + longindex = -1; +- int retconf; +- bool use_userconfig = false; + + while ((retconf = getopt_long (argc, argv, + short_options, long_options, &longindex)) != -1) +@@ -1672,10 +1677,12 @@ outputting to a regular file.\n")); + total_downloaded_bytes != 0) + { + double end_time = ptimer_measure (timer); ++ char *wall_time; ++ char *download_time; + ptimer_destroy (timer); + +- char *wall_time = xstrdup (secs_to_human_time (end_time - start_time)); +- char *download_time = xstrdup (secs_to_human_time (total_download_time)); ++ wall_time = xstrdup (secs_to_human_time (end_time - start_time)); ++ download_time = xstrdup (secs_to_human_time (total_download_time)); + logprintf (LOG_NOTQUIET, + _("FINISHED --%s--\nTotal wall clock time: %s\n" + "Downloaded: %d files, %s in %s (%s)\n"), +diff --git a/src/retr.c b/src/retr.c +index 683c811..c0a815e 100644 +--- a/src/retr.c ++++ b/src/retr.c +@@ -377,8 +377,9 @@ fd_read_body (int fd, FILE *out, wgint toread, wgint startpos, + + if (ret > 0) + { ++ int write_res; + sum_read += ret; +- int write_res = write_data (out, out2, dlbuf, ret, &skip, &sum_written); ++ write_res = write_data (out, out2, dlbuf, ret, &skip, &sum_written); + if (write_res < 0) + { + ret = (write_res == -3) ? -3 : -2; +diff --git a/src/utils.c b/src/utils.c +index 4354668..d5fecc1 100644 +--- a/src/utils.c ++++ b/src/utils.c +@@ -64,7 +64,9 @@ as that of the covered work. */ + #include + + /* For TIOCGWINSZ and friends: */ ++#ifndef __HAIKU__ + #include ++#endif + #ifdef HAVE_TERMIOS_H + # include + #endif +diff --git a/src/version.c b/src/version.c +new file mode 100644 +index 0000000..5ee99d1 +--- /dev/null ++++ b/src/version.c +@@ -0,0 +1,6 @@ ++/* version.c */ ++/* Autogenerated by Makefile - DO NOT EDIT */ ++ ++const char *version_string = "1.15"; ++const char *compilation_string = "gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC=\"/packages/wget-1.15-1/.settings/wgetrc\" -DLOCALEDIR=\"/packages/wget-1.15-1/.self/data/locale\" -I. -I../lib -I../lib -O2 -Wall"; ++const char *link_string = "gcc -O2 -Wall -lssl -lcrypto -lz -lnetwork -lnetwork -lsocket ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a"; +diff --git a/src/warc.c b/src/warc.c +index c3a5857..8dcc055 100644 +--- a/src/warc.c ++++ b/src/warc.c +@@ -160,10 +160,11 @@ warc_write_buffer (const char *buffer, size_t size) + static bool + warc_write_string (const char *str) + { ++ size_t n; + if (!warc_write_ok) + return false; + +- size_t n = strlen (str); ++ n = strlen (str); + if (n != warc_write_buffer (str, n)) + warc_write_ok = false; + +@@ -251,6 +252,8 @@ static bool + warc_write_block_from_file (FILE *data_in) + { + /* Add the Content-Length header. */ ++ char buffer[BUFSIZ]; ++ size_t s; + char content_length[MAX_INT_TO_STRING_LEN(off_t)]; + fseeko (data_in, 0L, SEEK_END); + number_to_string (content_length, ftello (data_in)); +@@ -263,8 +266,6 @@ warc_write_block_from_file (FILE *data_in) + warc_write_ok = false; + + /* Copy the data in the file to the WARC record. */ +- char buffer[BUFSIZ]; +- size_t s; + while (warc_write_ok && (s = fread (buffer, 1, BUFSIZ, data_in)) > 0) + { + if (warc_write_buffer (buffer, s) < s) +@@ -289,6 +290,12 @@ warc_write_end_record (void) + /* We start a new gzip stream for each record. */ + if (warc_write_ok && warc_current_gzfile) + { ++ size_t result; ++ char static_header[GZIP_STATIC_HEADER_SIZE]; ++ off_t current_offset; ++ off_t uncompressed_size; ++ off_t compressed_size; ++ char extra_header[EXTRA_GZIP_HEADER_SIZE]; + if (gzclose (warc_current_gzfile) != Z_OK) + { + warc_write_ok = false; +@@ -314,17 +321,16 @@ warc_write_end_record (void) + */ + + /* Calculate the uncompressed and compressed sizes. */ +- off_t current_offset = ftello (warc_current_file); +- off_t uncompressed_size = current_offset - warc_current_gzfile_offset; +- off_t compressed_size = warc_current_gzfile_uncompressed_size; ++ current_offset = ftello (warc_current_file); ++ uncompressed_size = current_offset - warc_current_gzfile_offset; ++ compressed_size = warc_current_gzfile_uncompressed_size; + + /* Go back to the static GZIP header. */ + fseeko (warc_current_file, warc_current_gzfile_offset + + EXTRA_GZIP_HEADER_SIZE, SEEK_SET); + + /* Read the header. */ +- char static_header[GZIP_STATIC_HEADER_SIZE]; +- size_t result = fread (static_header, 1, GZIP_STATIC_HEADER_SIZE, ++ result = fread (static_header, 1, GZIP_STATIC_HEADER_SIZE, + warc_current_file); + if (result != GZIP_STATIC_HEADER_SIZE) + { +@@ -341,7 +347,6 @@ warc_write_end_record (void) + fwrite (static_header, 1, GZIP_STATIC_HEADER_SIZE, warc_current_file); + + /* Prepare the extra GZIP header. */ +- char extra_header[EXTRA_GZIP_HEADER_SIZE]; + /* XLEN, the length of the extra header fields. */ + extra_header[0] = ((EXTRA_GZIP_HEADER_SIZE - 2) & 255); + extra_header[1] = ((EXTRA_GZIP_HEADER_SIZE - 2) >> 8) & 255; +@@ -653,13 +658,15 @@ warc_write_warcinfo_record (char *filename) + /* Write warc-info record as the first record of the file. */ + /* We add the record id of this info record to the other records in the + file. */ ++ char timestamp[22]; ++ char *filename_copy, *filename_basename; ++ FILE *warc_tmp; ++ + warc_current_warcinfo_uuid_str = (char *) malloc (48); + warc_uuid_str (warc_current_warcinfo_uuid_str); + +- char timestamp[22]; + warc_timestamp (timestamp); + +- char *filename_copy, *filename_basename; + filename_copy = strdup (filename); + filename_basename = strdup (basename (filename_copy)); + +@@ -671,7 +678,7 @@ warc_write_warcinfo_record (char *filename) + warc_write_header ("WARC-Filename", filename_basename); + + /* Create content. */ +- FILE *warc_tmp = warc_tempfile (); ++ warc_tmp = warc_tempfile (); + if (warc_tmp == NULL) + { + free (filename_copy); +@@ -721,6 +728,10 @@ warc_write_warcinfo_record (char *filename) + static bool + warc_start_new_file (bool meta) + { ++ int base_filename_length; ++ char *new_filename; ++ const char *extension; ++ + if (opt.warc_filename == NULL) + return false; + +@@ -732,9 +743,9 @@ warc_start_new_file (bool meta) + + warc_current_file_number++; + +- int base_filename_length = strlen (opt.warc_filename); ++ base_filename_length = strlen (opt.warc_filename); + /* filename format: base + "-" + 5 digit serial number + ".warc.gz" */ +- char *new_filename = malloc (base_filename_length + 1 + 5 + 8 + 1); ++ new_filename = malloc (base_filename_length + 1 + 5 + 8 + 1); + warc_current_filename = new_filename; + + #ifdef __VMS +@@ -744,9 +755,9 @@ warc_start_new_file (bool meta) + #endif /* def __VMS [else] */ + + #ifdef HAVE_LIBZ +- const char *extension = (opt.warc_compression_enabled ? WARC_GZ : "warc"); ++ extension = (opt.warc_compression_enabled ? WARC_GZ : "warc"); + #else +- const char *extension = "warc"; ++ extension = "warc"; + #endif + + /* If max size is enabled, we add a serial number to the file names. */ +@@ -820,12 +831,13 @@ static bool + warc_parse_cdx_header (char *lineptr, int *field_num_original_url, + int *field_num_checksum, int *field_num_record_id) + { ++ char *token; ++ char *save_ptr; ++ + *field_num_original_url = -1; + *field_num_checksum = -1; + *field_num_record_id = -1; + +- char *token; +- char *save_ptr; + token = strtok_r (lineptr, CDX_FIELDSEP, &save_ptr); + + if (token != NULL && strcmp (token, "CDX") == 0) +@@ -869,10 +881,12 @@ warc_process_cdx_line (char *lineptr, int field_num_original_url, + + char *token; + char *save_ptr; ++ int field_num; ++ + token = strtok_r (lineptr, CDX_FIELDSEP, &save_ptr); + + /* Read this line to get the fields we need. */ +- int field_num = 0; ++ field_num = 0; + while (token != NULL) + { + char **val; +@@ -934,10 +948,7 @@ warc_process_cdx_line (char *lineptr, int field_num_original_url, + static bool + warc_load_cdx_dedup_file (void) + { +- FILE *f = fopen (opt.warc_cdx_dedup_filename, "r"); +- if (f == NULL) +- return false; +- ++ FILE *f; + int field_num_original_url = -1; + int field_num_checksum = -1; + int field_num_record_id = -1; +@@ -946,6 +957,10 @@ warc_load_cdx_dedup_file (void) + size_t n = 0; + ssize_t line_length; + ++ f = fopen (opt.warc_cdx_dedup_filename, "r"); ++ if (f == NULL) ++ return false; ++ + /* The first line should contain the CDX header. + Format: " CDX x x x x x" + where x are field type indicators. For our purposes, we only +@@ -973,6 +988,7 @@ _("CDX file does not list record ids. (Missing column 'u'.)\n")); + } + else + { ++ int nrecords; + /* Initialize the table. */ + warc_cdx_dedup_table = hash_table_new (1000, warc_hash_sha1_digest, + warc_cmp_sha1_digest); +@@ -990,7 +1006,7 @@ _("CDX file does not list record ids. (Missing column 'u'.)\n")); + while (line_length != -1); + + /* Print results. */ +- int nrecords = hash_table_count (warc_cdx_dedup_table); ++ nrecords = hash_table_count (warc_cdx_dedup_table); + logprintf (LOG_VERBOSE, ngettext ("Loaded %d record from CDX.\n\n", + "Loaded %d records from CDX.\n\n", + nrecords), +@@ -1010,10 +1026,11 @@ _("CDX file does not list record ids. (Missing column 'u'.)\n")); + static struct warc_cdx_record * + warc_find_duplicate_cdx_record (char *url, char *sha1_digest_payload) + { ++ struct warc_cdx_record *rec_existing; + if (warc_cdx_dedup_table == NULL) + return NULL; + +- struct warc_cdx_record *rec_existing ++ rec_existing + = hash_table_get (warc_cdx_dedup_table, sha1_digest_payload); + + if (rec_existing && strcmp (rec_existing->url, url) == 0) +@@ -1085,11 +1102,13 @@ warc_init (void) + static void + warc_write_metadata (void) + { ++ char manifest_uuid [48]; ++ FILE * warc_tmp_fp; ++ + /* If there are multiple WARC files, the metadata should be written to a separate file. */ + if (opt.warc_maxsize > 0) + warc_start_new_file (true); + +- char manifest_uuid [48]; + warc_uuid_str (manifest_uuid); + + fflush (warc_manifest_fp); +@@ -1099,7 +1118,7 @@ warc_write_metadata (void) + warc_manifest_fp, -1); + /* warc_write_resource_record has closed warc_manifest_fp. */ + +- FILE * warc_tmp_fp = warc_tempfile (); ++ warc_tmp_fp = warc_tempfile (); + if (warc_tmp_fp == NULL) + { + logprintf (LOG_NOTQUIET, _("Could not open temporary WARC file.\n")); +@@ -1153,6 +1172,7 @@ warc_close (void) + FILE * + warc_tempfile (void) + { ++ int fd; + char filename[100]; + if (path_search (filename, 100, opt.warc_tempdir, "wget", true) == -1) + return NULL; +@@ -1172,7 +1192,7 @@ warc_tempfile (void) + return fopen (tfn, "w+", "fop=tmd"); /* Create auto-delete temp file. */ + } + #else /* def __VMS */ +- int fd = mkostemp (filename, O_TEMPORARY); ++ fd = mkostemp (filename, O_TEMPORARY); + if (fd < 0) + return NULL; + +@@ -1234,8 +1254,11 @@ warc_write_cdx_record (const char *url, const char *timestamp_str, + off_t offset, const char *warc_filename, + const char *response_uuid) + { +- /* Transform the timestamp. */ ++ char offset_string[MAX_INT_TO_STRING_LEN(off_t)]; + char timestamp_str_cdx [15]; ++ const char *checksum; ++ ++ /* Transform the timestamp. */ + memcpy (timestamp_str_cdx , timestamp_str , 4); /* "YYYY" "-" */ + memcpy (timestamp_str_cdx + 4, timestamp_str + 5, 2); /* "mm" "-" */ + memcpy (timestamp_str_cdx + 6, timestamp_str + 8, 2); /* "dd" "T" */ +@@ -1245,7 +1268,6 @@ warc_write_cdx_record (const char *url, const char *timestamp_str, + timestamp_str_cdx[14] = '\0'; + + /* Rewrite the checksum. */ +- const char *checksum; + if (payload_digest != NULL) + checksum = payload_digest + 5; /* Skip the "sha1:" */ + else +@@ -1256,7 +1278,6 @@ warc_write_cdx_record (const char *url, const char *timestamp_str, + if (redirect_location == NULL || strlen(redirect_location) == 0) + redirect_location = "-"; + +- char offset_string[MAX_INT_TO_STRING_LEN(off_t)]; + number_to_string (offset_string, offset); + + /* Print the CDX line. */ +@@ -1288,10 +1309,11 @@ warc_write_revisit_record (char *url, char *timestamp_str, + char *refers_to, ip_address *ip, FILE *body) + { + char revisit_uuid [48]; +- warc_uuid_str (revisit_uuid); +- + char *block_digest = NULL; + char sha1_res_block[SHA1_DIGEST_SIZE]; ++ ++ warc_uuid_str (revisit_uuid); ++ + sha1_stream (body, sha1_res_block); + block_digest = warc_base32_sha1_digest (sha1_res_block); + +@@ -1342,6 +1364,9 @@ warc_write_response_record (char *url, char *timestamp_str, + char sha1_res_block[SHA1_DIGEST_SIZE]; + char sha1_res_payload[SHA1_DIGEST_SIZE]; + ++ char response_uuid [48]; ++ off_t offset; ++ + if (opt.warc_digests_enabled) + { + /* Calculate the block and payload digests. */ +@@ -1385,11 +1410,10 @@ warc_write_response_record (char *url, char *timestamp_str, + + /* Not a revisit, just store the record. */ + +- char response_uuid [48]; + warc_uuid_str (response_uuid); + + fseeko (warc_current_file, 0L, SEEK_END); +- off_t offset = ftello (warc_current_file); ++ offset = ftello (warc_current_file); + + warc_write_start_record (); + warc_write_header ("WARC-Type", "response"); +-- +1.8.3.4 + diff --git a/net-misc/wget/wget-1.15.recipe b/net-misc/wget/wget-1.15.recipe new file mode 100644 index 000000000..9aa469763 --- /dev/null +++ b/net-misc/wget/wget-1.15.recipe @@ -0,0 +1,75 @@ +SUMMARY="A tool for downloading files from the internet" +DESCRIPTION=" +wget is a tool that can download files from the internet through protocols \ +such as HTTP, HTTPS and FTP. wget is non-interactive, so it can be called from \ +scripts. +" +HOMEPAGE="http://www.gnu.org/software/wget" +SRC_URI="http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz" +CHECKSUM_SHA256="52126be8cf1bddd7536886e74c053ad7d0ed2aa89b4b630f76785bac21695fcd" +LICENSE="GNU GPL v3" +COPYRIGHT="1996-2013 Free Software Foundation" +REVISION="1" +ARCHITECTURES="x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="x86 x86_gcc2" + +PROVIDES=" + wget$secondaryArchSuffix = $portVersion + cmd:wget$secondaryArchSuffix = $portVersion + " + +REQUIRES=" + haiku$secondaryArchSuffix >= $haikuVersion + lib:libcrypto$secondaryArchSuffix + lib:libssl$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel >= $haikuVersion + devel:libcrypto$secondaryArchSuffix + devel:libssl$secondaryArchSuffix + devel:libz$secondaryArchSuffix >= 1.2.3 + " +BUILD_PREREQUIRES=" + cmd:gcc$secondaryArchSuffix + cmd:aclocal + cmd:autoconf + cmd:libtoolize + cmd:make + cmd:makeinfo + cmd:pod2man + " + +USER_SETTINGS_FILES=" + settings/wgetrc + " + +GLOBAL_WRITABLE_FILES=" + settings/wgetrc keep-old +" + +PATCHES="wget-1.15.patchset" + +BUILD() +{ + libtoolize --force --copy --install + aclocal -I m4 + autoconf + runConfigure ./configure --with-ssl=openssl + make +} + +INSTALL() +{ + make install + # Tells wget where to find certificates + echo "ca_certificate=/boot/system/data/ssl/CARootCertificates.pem" > $settingsDir/wgetrc +} + +TEST() +{ + [ -d .git ] && mv .git .git-temp + make check || true + [ -d .git-temp ] && mv .git-temp .git +} diff --git a/sys-apps/coreutils/coreutils-8.22.recipe b/sys-apps/coreutils/coreutils-8.22.recipe new file mode 100644 index 000000000..6f4baadff --- /dev/null +++ b/sys-apps/coreutils/coreutils-8.22.recipe @@ -0,0 +1,265 @@ +SUMMARY="Standard GNU core utilities" +DESCRIPTION=" +Most of these programs have significant advantages over their Unix \ +counterparts, such as greater speed, additional options, and fewer \ +arbitrary limits. + +The programs that can be built with this package are: + + [ arch base64 basename cat chcon chgrp chmod chown chroot cksum comm cp \ +csplit cut date dd df dir dircolors dirname du echo env expand expr \ +factor false fmt fold groups head hostid hostname id install join kill \ +link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup \ +nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink \ +realpath rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum \ +shred shuf sleep sort split stat stdbuf stty sum sync tac tail tee test \ +timeout touch tr true truncate tsort tty uname unexpand uniq unlink \ +uptime users vdir wc who whoami yes +" +HOMEPAGE="http://www.gnu.org/software/coreutils" +COPYRIGHT="1994-2013 Free Software Foundation, Inc." +LICENSE="GNU GPL v3" +SRC_URI="http://ftp.gnu.org/gnu/coreutils/coreutils-$portVersion.tar.xz" +CHECKSUM_SHA256="5b3e94998152c017e6c75d56b9b994188eb71bf46d4038a642cb9141f6ff1212" +REVISION="1" +ARCHITECTURES="x86_gcc2 x86 x86_64 arm" + +PATCHES=" + coreutils-$portVersion.patchset + coreutils-$portVersion.gcc2.patchset + " + +PROVIDES=" + coreutils = $portVersion compat >= 8 + cmd:[ = $portVersion compat >= 8 + cmd:base64 = $portVersion compat >= 8 + cmd:basename = $portVersion compat >= 8 + cmd:cat = $portVersion compat >= 8 + cmd:chcon = $portVersion compat >= 8 + cmd:chgrp = $portVersion compat >= 8 + cmd:chmod = $portVersion compat >= 8 + cmd:chown = $portVersion compat >= 8 + cmd:chroot = $portVersion compat >= 8 + cmd:cksum = $portVersion compat >= 8 + cmd:comm = $portVersion compat >= 8 + cmd:cp = $portVersion compat >= 8 + cmd:csplit = $portVersion compat >= 8 + cmd:cut = $portVersion compat >= 8 + cmd:date = $portVersion compat >= 8 + cmd:dd = $portVersion compat >= 8 + cmd:df = $portVersion compat >= 8 + cmd:dir = $portVersion compat >= 8 + cmd:dircolors = $portVersion compat >= 8 + cmd:dirname = $portVersion compat >= 8 + cmd:du = $portVersion compat >= 8 + cmd:echo = $portVersion compat >= 8 + cmd:env = $portVersion compat >= 8 + cmd:expand = $portVersion compat >= 8 + cmd:expr = $portVersion compat >= 8 + cmd:factor = $portVersion compat >= 8 + cmd:false = $portVersion compat >= 8 + cmd:fmt = $portVersion compat >= 8 + cmd:fold = $portVersion compat >= 8 + cmd:groups = $portVersion compat >= 8 + cmd:head = $portVersion compat >= 8 + cmd:hostname = $portVersion compat >= 8 + cmd:id = $portVersion compat >= 8 + cmd:install = $portVersion compat >= 8 + cmd:join = $portVersion compat >= 8 + cmd:kill = $portVersion compat >= 8 + cmd:link = $portVersion compat >= 8 + cmd:ln = $portVersion compat >= 8 + cmd:logname = $portVersion compat >= 8 + cmd:ls = $portVersion compat >= 8 + cmd:md5sum = $portVersion compat >= 8 + cmd:mkdir = $portVersion compat >= 8 + cmd:mkfifo = $portVersion compat >= 8 + cmd:mknod = $portVersion compat >= 8 + cmd:mktemp = $portVersion compat >= 8 + cmd:mv = $portVersion compat >= 8 + cmd:nl = $portVersion compat >= 8 + cmd:nohup = $portVersion compat >= 8 + cmd:nproc = $portVersion compat >= 8 + cmd:numfmt = $portVersion compat >= 8 + cmd:od = $portVersion compat >= 8 + cmd:paste = $portVersion compat >= 8 + cmd:pathchk = $portVersion compat >= 8 + cmd:pr = $portVersion compat >= 8 + cmd:printenv = $portVersion compat >= 8 + cmd:printf = $portVersion compat >= 8 + cmd:ptx = $portVersion compat >= 8 + cmd:pwd = $portVersion compat >= 8 + cmd:readlink = $portVersion compat >= 8 + cmd:realpath = $portVersion compat >= 8 + cmd:rm = $portVersion compat >= 8 + cmd:rmdir = $portVersion compat >= 8 + cmd:runcon = $portVersion compat >= 8 + cmd:seq = $portVersion compat >= 8 + cmd:sha1sum = $portVersion compat >= 8 + cmd:sha224sum = $portVersion compat >= 8 + cmd:sha256sum = $portVersion compat >= 8 + cmd:sha384sum = $portVersion compat >= 8 + cmd:sha512sum = $portVersion compat >= 8 + cmd:shred = $portVersion compat >= 8 + cmd:shuf = $portVersion compat >= 8 + cmd:sleep = $portVersion compat >= 8 + cmd:sort = $portVersion compat >= 8 + cmd:split = $portVersion compat >= 8 + cmd:stat = $portVersion compat >= 8 + cmd:stdbuf = $portVersion compat >= 8 + cmd:stty = $portVersion compat >= 8 + cmd:sum = $portVersion compat >= 8 + cmd:sync = $portVersion compat >= 8 + cmd:tac = $portVersion compat >= 8 + cmd:tail = $portVersion compat >= 8 + cmd:tee = $portVersion compat >= 8 + cmd:test = $portVersion compat >= 8 + cmd:timeout = $portVersion compat >= 8 + cmd:touch = $portVersion compat >= 8 + cmd:tr = $portVersion compat >= 8 + cmd:true = $portVersion compat >= 8 + cmd:truncate = $portVersion compat >= 8 + cmd:tsort = $portVersion compat >= 8 + cmd:tty = $portVersion compat >= 8 + cmd:uname = $portVersion compat >= 8 + cmd:unexpand = $portVersion compat >= 8 + cmd:uniq = $portVersion compat >= 8 + cmd:unlink = $portVersion compat >= 8 + cmd:vdir = $portVersion compat >= 8 + cmd:wc = $portVersion compat >= 8 + cmd:whoami = $portVersion compat >= 8 + cmd:yes = $portVersion compat >= 8 + " +REQUIRES=" + haiku >= $haikuVersion + " +BUILD_PREREQUIRES=" + haiku_devel >= $haikuVersion + cmd:gcc + cmd:ld + cmd:make + cmd:awk + cmd:sed + cmd:help2man + " + +defineDebugInfoPackage coreutils \ + $binDir/[ \ + $binDir/base64 \ + $binDir/basename \ + $binDir/cat \ + $binDir/chcon \ + $binDir/chgrp \ + $binDir/chmod \ + $binDir/chown \ + $binDir/chroot \ + $binDir/cksum \ + $binDir/comm \ + $binDir/cp \ + $binDir/csplit \ + $binDir/cut \ + $binDir/date \ + $binDir/dd \ + $binDir/df \ + $binDir/dir \ + $binDir/dircolors \ + $binDir/dirname \ + $binDir/du \ + $binDir/echo \ + $binDir/env \ + $binDir/expand \ + $binDir/expr \ + $binDir/factor \ + $binDir/false \ + $binDir/fmt \ + $binDir/fold \ + $binDir/groups \ + $binDir/head \ + $binDir/hostname \ + $binDir/id \ + $binDir/install \ + $binDir/join \ + $binDir/kill \ + $binDir/link \ + $binDir/ln \ + $binDir/logname \ + $binDir/ls \ + $binDir/md5sum \ + $binDir/mkdir \ + $binDir/mkfifo \ + $binDir/mknod \ + $binDir/mktemp \ + $binDir/mv \ + $binDir/nl \ + $binDir/nohup \ + $binDir/nproc \ + $binDir/numfmt \ + $binDir/od \ + $binDir/paste \ + $binDir/pathchk \ + $binDir/pr \ + $binDir/printenv \ + $binDir/printf \ + $binDir/ptx \ + $binDir/pwd \ + $binDir/readlink \ + $binDir/realpath \ + $binDir/rm \ + $binDir/rmdir \ + $binDir/runcon \ + $binDir/seq \ + $binDir/sha1sum \ + $binDir/sha224sum \ + $binDir/sha256sum \ + $binDir/sha384sum \ + $binDir/sha512sum \ + $binDir/shred \ + $binDir/shuf \ + $binDir/sleep \ + $binDir/sort \ + $binDir/split \ + $binDir/stat \ + $binDir/stdbuf \ + $binDir/stty \ + $binDir/sum \ + $binDir/sync \ + $binDir/tac \ + $binDir/tail \ + $binDir/tee \ + $binDir/test \ + $binDir/timeout \ + $binDir/touch \ + $binDir/tr \ + $binDir/true \ + $binDir/truncate \ + $binDir/tsort \ + $binDir/tty \ + $binDir/uname \ + $binDir/unexpand \ + $binDir/uniq \ + $binDir/unlink \ + $binDir/vdir \ + $binDir/wc \ + $binDir/whoami \ + $binDir/yes \ + +PATCH() +{ + sed -i -e 's|O_NOCACHE|DD_NOCACHE|g' src/dd.c +} + +BUILD() +{ + FORCE_UNSAFE_CONFIGURE=1 runConfigure ./configure \ + --without-included-regex \ + --disable-rpath --with-gnu-ld \ + --enable-no-install-program=uptime \ + --enable-install-program=hostname + touch doc/*.info + make $jobArgs +} + +INSTALL() +{ + make install +} diff --git a/sys-apps/coreutils/patches/coreutils-8.22.gcc2.patchset b/sys-apps/coreutils/patches/coreutils-8.22.gcc2.patchset new file mode 100644 index 000000000..37e407701 --- /dev/null +++ b/sys-apps/coreutils/patches/coreutils-8.22.gcc2.patchset @@ -0,0 +1,3032 @@ +From ed40f7e0aa7652d5bf77c52047739a84b7acad8b Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sun, 18 May 2014 21:41:14 +0000 +Subject: gcc2 patch c89 + + +diff --git a/lib/fts.c b/lib/fts.c +index 74968b3..6134365 100644 +--- a/lib/fts.c ++++ b/lib/fts.c +@@ -1293,6 +1293,7 @@ fts_build (register FTS *sp, int type) + int dir_fd; + FTSENT *cur = sp->fts_cur; + bool continue_readdir = !!cur->fts_dirp; ++ size_t max_entries; + + /* When cur->fts_dirp is non-NULL, that means we should + continue calling readdir on that existing DIR* pointer +@@ -1354,7 +1355,7 @@ fts_build (register FTS *sp, int type) + function. But when no such function is specified, we can read + entries in batches that are large enough to help us with inode- + sorting, yet not so large that we risk exhausting memory. */ +- size_t max_entries = (sp->fts_compar == NULL ++ max_entries = (sp->fts_compar == NULL + ? FTS_MAX_READDIR_ENTRIES : SIZE_MAX); + + /* +diff --git a/lib/randperm.c b/lib/randperm.c +index ffa8faa..31c8c06 100644 +--- a/lib/randperm.c ++++ b/lib/randperm.c +@@ -114,8 +114,11 @@ sparse_new (size_t size_hint) + static void + sparse_swap (sparse_map *sv, size_t* v, size_t i, size_t j) + { +- struct sparse_ent_ *v1 = hash_delete (sv, &(struct sparse_ent_) {i,0}); +- struct sparse_ent_ *v2 = hash_delete (sv, &(struct sparse_ent_) {j,0}); ++ struct sparse_ent_ ent1 = {i,0}; ++ struct sparse_ent_ ent2 = {j,0}; ++ size_t t; ++ struct sparse_ent_ *v1 = hash_delete (sv, &ent1); ++ struct sparse_ent_ *v2 = hash_delete (sv, &ent2); + + /* FIXME: reduce the frequency of these mallocs. */ + if (!v1) +@@ -129,7 +132,7 @@ sparse_swap (sparse_map *sv, size_t* v, size_t i, size_t j) + v2->index = v2->val = j; + } + +- size_t t = v1->val; ++ t = v1->val; + v1->val = v2->val; + v2->val = t; + if (!hash_insert (sv, v1)) +diff --git a/lib/utimecmp.c b/lib/utimecmp.c +index dc622ad..895e500 100644 +--- a/lib/utimecmp.c ++++ b/lib/utimecmp.c +@@ -131,14 +131,13 @@ utimecmp (char const *dst_name, + + time_t might be unsigned. */ + +- verify (TYPE_IS_INTEGER (time_t)); +- verify (TYPE_TWOS_COMPLEMENT (int)); +- + /* Destination and source time stamps. */ + time_t dst_s = dst_stat->st_mtime; + time_t src_s = src_stat->st_mtime; + int dst_ns = get_stat_mtime_ns (dst_stat); + int src_ns = get_stat_mtime_ns (src_stat); ++ verify (TYPE_IS_INTEGER (time_t)); ++ verify (TYPE_TWOS_COMPLEMENT (int)); + + if (options & UTIMECMP_TRUNCATE_SOURCE) + { +diff --git a/lib/verify.h b/lib/verify.h +index bf40b02..4b34514 100644 +--- a/lib/verify.h ++++ b/lib/verify.h +@@ -248,7 +248,8 @@ template + /* Verify requirement R at compile-time, as a declaration without a + trailing ';'. */ + +-#define verify(R) _GL_VERIFY (R, "verify (" #R ")") ++//#define verify(R) _GL_VERIFY (R, "verify (" #R ")") ++#define verify(R) + + #ifndef __has_builtin + # define __has_builtin(x) 0 +diff --git a/src/chown-core.c b/src/chown-core.c +index a5a2b47..a8c4b07 100644 +--- a/src/chown-core.c ++++ b/src/chown-core.c +@@ -219,6 +219,7 @@ restricted_chown (int cwd_fd, char const *file, + struct stat st; + int open_flags = O_NONBLOCK | O_NOCTTY; + int fd; ++ int saved_errno; + + if (required_uid == (uid_t) -1 && required_gid == (gid_t) -1) + return RC_do_ordinary_chown; +@@ -256,7 +257,7 @@ restricted_chown (int cwd_fd, char const *file, + } + } + +- int saved_errno = errno; ++ saved_errno = errno; + close (fd); + errno = saved_errno; + return status; +diff --git a/src/chroot.c b/src/chroot.c +index 89fd392..ca4aeff 100644 +--- a/src/chroot.c ++++ b/src/chroot.c +@@ -161,6 +161,7 @@ main (int argc, char **argv) + int c; + char const *userspec = NULL; + char const *groups = NULL; ++ bool fail; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -221,7 +222,7 @@ main (int argc, char **argv) + argv += optind + 1; + } + +- bool fail = false; ++ fail = false; + + /* Attempt to set all three: supplementary groups, group ID, user ID. + Diagnose any failures. If any have failed, exit before execvp. */ +diff --git a/src/copy.c b/src/copy.c +index 0f044d0..d1cc7a0 100644 +--- a/src/copy.c ++++ b/src/copy.c +@@ -293,13 +293,15 @@ extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, + /* Keep track of the output position. + We may need this at the end, for a final ftruncate. */ + off_t dest_pos = 0; +- ++ bool wrote_hole_at_eof = true; ++ + extent_scan_init (src_fd, &scan); + + *require_normal_copy = false; +- bool wrote_hole_at_eof = true; + do + { ++ unsigned int i; ++ bool empty_extent = false; + bool ok = extent_scan_read (&scan); + if (! ok) + { +@@ -317,8 +319,6 @@ extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, + return false; + } + +- unsigned int i; +- bool empty_extent = false; + for (i = 0; i < scan.ei_count || empty_extent; i++) + { + off_t ext_start; +@@ -589,6 +589,7 @@ copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst, + char *namep; + struct cp_options non_command_line_options = *x; + bool ok = true; ++ bool new_first_dir_created = false; + + name_space = savedir (src_name_in); + if (name_space == NULL) +@@ -604,7 +605,6 @@ copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst, + if (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS) + non_command_line_options.dereference = DEREF_NEVER; + +- bool new_first_dir_created = false; + namep = name_space; + while (*namep != '\0') + { +@@ -991,7 +991,7 @@ copy_reg (char const *src_name, char const *dst_name, + if (*new_dst) + { + open_with_O_CREAT:; +- ++{ + int open_flags = O_WRONLY | O_CREAT | O_BINARY; + dest_desc = open (dst_name, open_flags | O_EXCL, + dst_mode & ~omitted_permissions); +@@ -1035,6 +1035,7 @@ copy_reg (char const *src_name, char const *dst_name, + && *dst_name && dst_name[strlen (dst_name) - 1] == '/') + dest_errno = ENOTDIR; + } ++ } + else + { + omitted_permissions = 0; +@@ -1097,12 +1098,14 @@ copy_reg (char const *src_name, char const *dst_name, + size_t buf_alignment = lcm (getpagesize (), sizeof (word)); + size_t buf_alignment_slop = sizeof (word) + buf_alignment - 1; + size_t buf_size = io_blksize (sb); ++ bool make_holes = false; ++ bool sparse_src = false; ++ off_t n_read; ++ bool wrote_hole_at_eof; + + fdadvise (source_desc, 0, 0, FADVISE_SEQUENTIAL); + + /* Deal with sparse files. */ +- bool make_holes = false; +- bool sparse_src = false; + + if (S_ISREG (sb.st_mode)) + { +@@ -1169,8 +1172,6 @@ copy_reg (char const *src_name, char const *dst_name, + } + } + +- off_t n_read; +- bool wrote_hole_at_eof; + if ( ! sparse_copy (source_desc, dest_desc, buf, buf_size, + make_holes, src_name, dst_name, + UINTMAX_MAX, &n_read, +@@ -1667,10 +1668,11 @@ create_hard_link (char const *src_name, char const *dst_name, + { + /* We want to guarantee that symlinks are not followed, unless requested. */ + int flags = 0; ++ bool link_failed; + if (dereference) + flags = AT_SYMLINK_FOLLOW; + +- bool link_failed = (linkat (AT_FDCWD, src_name, AT_FDCWD, dst_name, flags) ++ link_failed = (linkat (AT_FDCWD, src_name, AT_FDCWD, dst_name, flags) + != 0); + + /* If the link failed because of an existing destination, +@@ -1746,6 +1748,7 @@ copy_internal (char const *src_name, char const *dst_name, + bool copied_as_regular = false; + bool dest_is_symlink = false; + bool have_dst_lstat = false; ++ bool dereference; + + if (x->move_mode && rename_succeeded) + *rename_succeeded = false; +@@ -1784,7 +1787,7 @@ copy_internal (char const *src_name, char const *dst_name, + record_file (x->src_info, src_name, &src_sb); + } + +- bool dereference = should_dereference (x, command_line_arg); ++ dereference = should_dereference (x, command_line_arg); + + if (!new_dst) + { +@@ -2793,6 +2796,7 @@ copy (char const *src_name, char const *dst_name, + bool nonexistent_dst, const struct cp_options *options, + bool *copy_into_self, bool *rename_succeeded) + { ++ bool first_dir_created_per_command_line_arg = false; + assert (valid_options (options)); + + /* Record the file names: they're used in case of error, when copying +@@ -2805,7 +2809,6 @@ copy (char const *src_name, char const *dst_name, + top_level_src_name = src_name; + top_level_dst_name = dst_name; + +- bool first_dir_created_per_command_line_arg = false; + return copy_internal (src_name, dst_name, nonexistent_dst, 0, NULL, + options, true, + &first_dir_created_per_command_line_arg, +diff --git a/src/cp.c b/src/cp.c +index 9038d4e..f76a22b 100644 +--- a/src/cp.c ++++ b/src/cp.c +@@ -823,6 +823,7 @@ cp_option_init (struct cp_options *x) + static void + decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off) + { ++ char *arg_writable, *s; + enum File_attribute + { + PRESERVE_MODE, +@@ -847,8 +848,8 @@ decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off) + }; + ARGMATCH_VERIFY (preserve_args, preserve_vals); + +- char *arg_writable = xstrdup (arg); +- char *s = arg_writable; ++ arg_writable = xstrdup (arg); ++ s = arg_writable; + do + { + /* find next comma */ +diff --git a/src/csplit.c b/src/csplit.c +index 5bfca09..581c790 100644 +--- a/src/csplit.c ++++ b/src/csplit.c +@@ -1225,8 +1225,9 @@ static size_t + get_format_flags (char const *format, int *flags_ptr) + { + int flags = 0; ++ size_t count; + +- for (size_t count = 0; ; count++) ++ for (count = 0; ; count++) + { + switch (format[count]) + { +@@ -1300,15 +1301,17 @@ static size_t + max_out (char *format) + { + bool percent = false; ++ char *f; ++ int maxlen; + +- for (char *f = format; *f; f++) ++ for (f = format; *f; f++) + if (*f == '%' && *++f != '%') + { ++ int flags; + if (percent) + error (EXIT_FAILURE, 0, + _("too many %% conversion specifications in suffix")); + percent = true; +- int flags; + f += get_format_flags (f, &flags); + while (ISDIGIT (*f)) + f++; +@@ -1322,7 +1325,7 @@ max_out (char *format) + error (EXIT_FAILURE, 0, + _("missing %% conversion specification in suffix")); + +- int maxlen = snprintf (NULL, 0, format, UINT_MAX); ++ maxlen = snprintf (NULL, 0, format, UINT_MAX); + if (! (0 <= maxlen && maxlen <= SIZE_MAX)) + xalloc_die (); + return maxlen; +@@ -1333,6 +1336,8 @@ main (int argc, char **argv) + { + int optc; + unsigned long int val; ++ size_t prefix_len; ++ size_t max_digit_string_len; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -1402,8 +1407,8 @@ main (int argc, char **argv) + usage (EXIT_FAILURE); + } + +- size_t prefix_len = strlen (prefix); +- size_t max_digit_string_len ++ prefix_len = strlen (prefix); ++ max_digit_string_len + = (suffix + ? max_out (suffix) + : MAX (INT_STRLEN_BOUND (unsigned int), digits)); +diff --git a/src/cut.c b/src/cut.c +index 19ef1d9..00d4b51 100644 +--- a/src/cut.c ++++ b/src/cut.c +@@ -399,7 +399,8 @@ set_fields (const char *fieldstr) + /* Merge range pairs (e.g. `2-5,3-4' becomes `2-5'). */ + for (i = 0; i < n_rp; ++i) + { +- for (size_t j = i + 1; j < n_rp; ++j) ++ size_t j; ++ for (j = i + 1; j < n_rp; ++j) + { + if (rp[j].lo <= rp[i].hi) + { +@@ -534,6 +535,7 @@ cut_fields (FILE *stream) + + while (1) + { ++ int prev_c; + if (field_idx == 1 && buffer_first_field) + { + ssize_t len; +@@ -585,7 +587,7 @@ cut_fields (FILE *stream) + next_item (&field_idx); + } + +- int prev_c = c; ++ prev_c = c; + + if (print_kth (field_idx)) + { +diff --git a/src/dd.c b/src/dd.c +index 59d6cd1..db91ab4 100644 +--- a/src/dd.c ++++ b/src/dd.c +@@ -662,10 +662,11 @@ human_size (size_t n) + static void + alloc_ibuf (void) + { ++ char *real_buf; + if (ibuf) + return; + +- char *real_buf = malloc (input_blocksize + INPUT_BLOCK_SLOP); ++ real_buf = malloc (input_blocksize + INPUT_BLOCK_SLOP); + if (!real_buf) + error (EXIT_FAILURE, 0, + _("memory exhausted by input buffer of size %zu bytes (%s)"), +@@ -735,6 +736,7 @@ print_stats (void) + | human_space_before_unit | human_SI | human_B); + double delta_s; + char const *bytes_per_second; ++ xtime_t now; + + if (status_flags & STATUS_NONE) + return; +@@ -764,7 +766,7 @@ print_stats (void) + w_bytes, + human_readable (w_bytes, hbuf, human_opts, 1, 1)); + +- xtime_t now = gethrxtime (); ++ now = gethrxtime (); + if (start_time < now) + { + double XTIME_PRECISIONe0 = XTIME_PRECISION; +@@ -954,6 +956,7 @@ static bool + invalidate_cache (int fd, off_t len) + { + int adv_ret = -1; ++ off_t pending; + + /* Minimize syscalls. */ + off_t clen = cache_round (fd, len); +@@ -961,7 +964,7 @@ invalidate_cache (int fd, off_t len) + return true; /* Don't advise this time. */ + if (!len && !clen && max_records) + return true; /* Nothing pending. */ +- off_t pending = len ? cache_round (fd, 0) : 0; ++ pending = len ? cache_round (fd, 0) : 0; + + if (fd == STDIN_FILENO) + { +@@ -1637,6 +1640,7 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize, + } + else + { ++ char *buf; + int lseek_errno = errno; + + /* The seek request may have failed above if it was too big +@@ -1671,7 +1675,6 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize, + } + /* else file_size && offset > OFF_T_MAX or file ! seekable */ + +- char *buf; + if (fdesc == STDIN_FILENO) + { + alloc_ibuf (); +@@ -2018,8 +2021,9 @@ dd_copy (void) + + if (conversions_mask & C_NOERROR) + { ++ size_t bad_portion; + print_stats (); +- size_t bad_portion = input_blocksize - partread; ++ bad_portion = input_blocksize - partread; + + /* We already know this data is not cached, + but call this so that correct offsets are maintained. */ +diff --git a/src/df.c b/src/df.c +index 969670e..2417782 100644 +--- a/src/df.c ++++ b/src/df.c +@@ -308,6 +308,8 @@ print_table (void) + for (col = 0; col < ncolumns; col++) + { + char *cell = table[row][col]; ++ int flags; ++ size_t width; + + /* Note the SOURCE_FIELD used to be displayed on it's own line + if (!posix_format && mbswidth (cell) > 20), but that +@@ -316,11 +318,11 @@ print_table (void) + if (col != 0) + putchar (' '); + +- int flags = 0; ++ flags = 0; + if (col == ncolumns - 1) /* The last one. */ + flags = MBA_NO_RIGHT_PAD; + +- size_t width = columns[col]->width; ++ width = columns[col]->width; + cell = ambsalign (cell, &width, columns[col]->align, flags); + /* When ambsalign fails, output unaligned data. */ + fputs (cell ? cell : table[row][col], stdout); +@@ -365,6 +367,8 @@ decode_output_arg (char const *arg) + do + { + /* find next comma */ ++ display_field_t field; ++ unsigned int i; + char *comma = strchr (s, ','); + + /* If we found a comma, put a NUL in its place and advance. */ +@@ -372,8 +376,8 @@ decode_output_arg (char const *arg) + *comma++ = 0; + + /* process S. */ +- display_field_t field = -1; +- for (unsigned int i = 0; i < ARRAY_CARDINALITY (field_data); i++) ++ field = -1; ++ for (i = 0; i < ARRAY_CARDINALITY (field_data); i++) + { + if (STREQ (field_data[i].arg, s)) + { +@@ -525,6 +529,7 @@ get_header (void) + uintmax_t q1024 = output_block_size; + bool divisible_by_1000; + bool divisible_by_1024; ++ char *num; + + do + { +@@ -540,7 +545,7 @@ get_header (void) + if (! (opts & human_base_1024)) + opts |= human_B; + +- char *num = human_readable (output_block_size, buf, opts, 1, 1); ++ num = human_readable (output_block_size, buf, opts, 1, 1); + + /* Reset the header back to the default in OUTPUT_MODE. */ + header = _("blocks"); +@@ -676,12 +681,13 @@ filter_mount_list (void) + mount_list = NULL; + while (devlist_head) + { ++ struct devlist *devlist; + /* Add the mount entry. */ + me = devlist_head->me; + me->me_next = mount_list; + mount_list = me; + /* Free devlist entry and advance. */ +- struct devlist *devlist = devlist_head->next; ++ devlist = devlist_head->next; + free (devlist_head); + devlist_head = devlist; + } +@@ -847,6 +853,12 @@ get_dev (char const *disk, char const *mount_point, char const* file, + const struct fs_usage *force_fsu, + bool process_all) + { ++ struct fs_usage fsu; ++ char *dev_name; ++ char *resolved_dev; ++ struct field_values_t block_values; ++ struct field_values_t inode_values; ++ size_t col; + if (me_remote && show_local_fs) + return; + +@@ -863,7 +875,6 @@ get_dev (char const *disk, char const *mount_point, char const* file, + if (!stat_file) + stat_file = mount_point ? mount_point : disk; + +- struct fs_usage fsu; + if (force_fsu) + fsu = *force_fsu; + else if (get_fs_usage (stat_file, disk, &fsu)) +@@ -887,9 +898,8 @@ get_dev (char const *disk, char const *mount_point, char const* file, + if (! file) + file = "-"; /* unspecified */ + +- char *dev_name = xstrdup (disk); +- char *resolved_dev; +- ++ dev_name = xstrdup (disk); ++ + /* On some systems, dev_name is a long-named symlink like + /dev/disk/by-uuid/828fc648-9f30-43d8-a0b1-f7196a2edb66 pointing to a + much shorter and more useful name like /dev/sda1. It may also look +@@ -907,15 +917,12 @@ get_dev (char const *disk, char const *mount_point, char const* file, + if (! fstype) + fstype = "-"; /* unknown */ + +- struct field_values_t block_values; +- struct field_values_t inode_values; + get_field_values (&block_values, &inode_values, &fsu); + + /* Add to grand total unless processing grand total line. */ + if (print_grand_total && ! force_fsu) + add_to_grand_total (&block_values, &inode_values); + +- size_t col; + for (col = 0; col < ncolumns; col++) + { + char buf[LONGEST_HUMAN_READABLE + 2]; +@@ -1057,12 +1064,13 @@ get_disk (char const *disk) + struct mount_entry const *me; + struct mount_entry const *best_match = NULL; + char const *file = disk; ++ size_t best_match_len; + + char *resolved = canonicalize_file_name (disk); + if (resolved && resolved[0] == '/') + disk = resolved; + +- size_t best_match_len = SIZE_MAX; ++ best_match_len = SIZE_MAX; + for (me = mount_list; me; me = me->me_next) + { + if (STREQ (disk, me->me_devname)) +@@ -1305,6 +1313,8 @@ int + main (int argc, char **argv) + { + struct stat *stats IF_LINT ( = 0); ++ bool posix_format; ++ const char *msg_mut_excl; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -1326,9 +1336,9 @@ main (int argc, char **argv) + grand_fsu.fsu_blocksize = 1; + + /* If true, use the POSIX output format. */ +- bool posix_format = false; ++ posix_format = false; + +- const char *msg_mut_excl = _("options %s and %s are mutually exclusive"); ++ msg_mut_excl = _("options %s and %s are mutually exclusive"); + + while (true) + { +@@ -1528,6 +1538,7 @@ main (int argc, char **argv) + or when either of -a, -l, -t or -x is used with file name + arguments. Otherwise, merely give a warning and proceed. */ + int status = 0; ++ const char *warning; + if ( ! (optind < argc) + || (show_all_fs + || show_local_fs +@@ -1536,7 +1547,7 @@ main (int argc, char **argv) + { + status = EXIT_FAILURE; + } +- const char *warning = (status == 0 ? _("Warning: ") : ""); ++ warning = (status == 0 ? _("Warning: ") : ""); + error (status, errno, "%s%s", warning, + _("cannot read table of mounted file systems")); + } +diff --git a/src/du.c b/src/du.c +index a265b10..9a44966 100644 +--- a/src/du.c ++++ b/src/du.c +@@ -461,8 +461,9 @@ process_file (FTS *fts, FTSENT *ent) + + if (info == FTS_NSOK) + { ++ FTSENT const *e; + fts_set (fts, ent, FTS_AGAIN); +- FTSENT const *e = fts_read (fts); ++ e = fts_read (fts); + assert (e == ent); + info = ent->fts_info; + } +@@ -494,8 +495,9 @@ process_file (FTS *fts, FTSENT *ent) + visit to the same directory. */ + if (info == FTS_D) + { ++ FTSENT const *e; + fts_set (fts, ent, FTS_SKIP); +- FTSENT const *e = fts_read (fts); ++ e = fts_read (fts); + assert (e == ent); + } + +@@ -707,6 +709,8 @@ main (int argc, char **argv) + + /* If true, display only a total for each argument. */ + bool opt_summarize_only = false; ++ struct argv_iterator *ai; ++ static char *temp_argv[] = { NULL, NULL }; + + cwd_only[0] = bad_cast ("."); + cwd_only[1] = NULL; +@@ -979,7 +983,6 @@ main (int argc, char **argv) + } + } + +- struct argv_iterator *ai; + if (files_from) + { + /* When using --files0-from=F, you may not specify any files +@@ -1034,8 +1037,7 @@ main (int argc, char **argv) + bit_flags |= FTS_TIGHT_CYCLE_CHECK; + + bit_flags |= symlink_deref_bits; +- static char *temp_argv[] = { NULL, NULL }; +- ++ + while (true) + { + bool skip_file = false; +diff --git a/src/env.c b/src/env.c +index c31d165..ca9f4be 100644 +--- a/src/env.c ++++ b/src/env.c +@@ -80,6 +80,7 @@ main (int argc, char **argv) + int optc; + bool ignore_environment = false; + bool opt_nul_terminate_output = false; ++ char *eq; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -126,7 +127,6 @@ main (int argc, char **argv) + if (optind < argc && STREQ (argv[optind], "-")) + ++optind; + +- char *eq; + while (optind < argc && (eq = strchr (argv[optind], '='))) + { + if (putenv (argv[optind])) +diff --git a/src/expr.c b/src/expr.c +index 9d21ca8..bb1d58c 100644 +--- a/src/expr.c ++++ b/src/expr.c +@@ -115,8 +115,8 @@ mpz_tdiv_r (mpz_t r, mpz_t a0, mpz_t b0) + static char * + mpz_get_str (char const *str, int base, mpz_t z) + { +- (void) str; (void) base; + char buf[INT_BUFSIZE_BOUND (intmax_t)]; ++ (void) str; (void) base; + return xstrdup (imaxtostr (z[0], buf)); + } + static int +@@ -137,8 +137,8 @@ mpz_get_ui (mpz_t z) + static int + mpz_out_str (FILE *stream, int base, mpz_t z) + { +- (void) base; + char buf[INT_BUFSIZE_BOUND (intmax_t)]; ++ (void) base; + return fputs (imaxtostr (z[0], buf), stream) != EOF; + } + #endif +@@ -291,6 +291,7 @@ int + main (int argc, char **argv) + { + VALUE *v; ++ unsigned int u_argc; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -306,7 +307,7 @@ main (int argc, char **argv) + + /* The above handles --help and --version. + Since there is no other invocation of getopt, handle '--' here. */ +- unsigned int u_argc = argc; ++ u_argc = argc; + if (1 < u_argc && STREQ (argv[1], "--")) + { + --u_argc; +diff --git a/src/factor.c b/src/factor.c +index 257a7ed..bd07cf6 100644 +--- a/src/factor.c ++++ b/src/factor.c +@@ -281,12 +281,13 @@ static void factor (uintmax_t, uintmax_t, struct factors *); + # define udiv_qrnnd(q, r, n1, n0, d) \ + do { \ + uintmax_t __d1, __d0, __q, __r1, __r0; \ ++ unsigned int __i; \ + \ + assert ((n1) < (d)); \ + __d1 = (d); __d0 = 0; \ + __r1 = (n1); __r0 = (n0); \ + __q = 0; \ +- for (unsigned int __i = W_TYPE_SIZE; __i > 0; __i--) \ ++ for (__i = W_TYPE_SIZE; __i > 0; __i--) \ + { \ + rsh2 (__d1, __d0, __d1, __d0, 1); \ + __q <<= 1; \ +@@ -404,6 +405,7 @@ static uintmax_t + mod2 (uintmax_t *r1, uintmax_t a1, uintmax_t a0, uintmax_t d1, uintmax_t d0) + { + int cntd, cnta; ++ int cnt, i; + + assert (d1 != 0); + +@@ -415,9 +417,9 @@ mod2 (uintmax_t *r1, uintmax_t a1, uintmax_t a0, uintmax_t d1, uintmax_t d0) + + count_leading_zeros (cntd, d1); + count_leading_zeros (cnta, a1); +- int cnt = cntd - cnta; ++ cnt = cntd - cnta; + lsh2 (d1, d0, d1, d0, cnt); +- for (int i = 0; i < cnt; i++) ++ for (i = 0; i < cnt; i++) + { + if (ge2 (a1, a0, d1, d0)) + sub_ddmmss (a1, a0, a1, a0, d1, d0); +@@ -522,7 +524,8 @@ factor_insert_multiplicity (struct factors *factors, + + if (i < 0 || p[i] != prime) + { +- for (int j = nfactors - 1; j > i; j--) ++ int j; ++ for (j = nfactors - 1; j > i; j--) + { + p[j + 1] = p[j]; + e[j + 1] = e[j]; +@@ -711,19 +714,20 @@ static bool flag_prove_primality = true; + /* Number of Miller-Rabin tests to run when not proving primality. */ + #define MR_REPS 25 + +-#ifdef __GNUC__ +-# define LIKELY(cond) __builtin_expect ((cond), 1) +-# define UNLIKELY(cond) __builtin_expect ((cond), 0) +-#else ++//#ifdef __GNUC__ ++//# define LIKELY(cond) __builtin_expect ((cond), 1) ++//# define UNLIKELY(cond) __builtin_expect ((cond), 0) ++//#else + # define LIKELY(cond) (cond) + # define UNLIKELY(cond) (cond) +-#endif ++//#endif + + static void + factor_insert_refind (struct factors *factors, uintmax_t p, unsigned int i, + unsigned int off) + { +- for (unsigned int j = 0; j < off; j++) ++ unsigned int j; ++ for (j = 0; j < off; j++) + p += primes_diff[i + j]; + factor_insert (factors, p); + } +@@ -765,6 +769,8 @@ static uintmax_t + factor_using_division (uintmax_t *t1p, uintmax_t t1, uintmax_t t0, + struct factors *factors) + { ++ uintmax_t p = 3; ++ unsigned int i; + if (t0 % 2 == 0) + { + unsigned int cnt; +@@ -785,8 +791,6 @@ factor_using_division (uintmax_t *t1p, uintmax_t t1, uintmax_t t0, + factor_insert_multiplicity (factors, 2, cnt); + } + +- uintmax_t p = 3; +- unsigned int i; + for (i = 0; t1 > 0 && i < PRIMES_PTAB_ENTRIES; i++) + { + for (;;) +@@ -848,6 +852,7 @@ mp_factor_using_division (mpz_t t, struct mp_factors *factors) + { + mpz_t q; + unsigned long int p; ++ unsigned int i; + + devmsg ("[trial division] "); + +@@ -862,7 +867,7 @@ mp_factor_using_division (mpz_t t, struct mp_factors *factors) + } + + p = 3; +- for (unsigned int i = 1; i <= PRIMES_PTAB_ENTRIES;) ++ for (i = 1; i <= PRIMES_PTAB_ENTRIES;) + { + if (! mpz_divisible_ui_p (t, p)) + { +@@ -1132,11 +1137,12 @@ millerrabin (uintmax_t n, uintmax_t ni, uintmax_t b, uintmax_t q, + uintmax_t y = powm (b, q, n, ni, one); + + uintmax_t nm1 = n - one; /* -1, but in redc representation. */ ++ unsigned int i; + + if (y == one || y == nm1) + return true; + +- for (unsigned int i = 1; i < k; i++) ++ for (i = 1; i < k; i++) + { + y = mulredc (y, y, n, ni); + +@@ -1153,6 +1159,7 @@ millerrabin2 (const uintmax_t *np, uintmax_t ni, const uintmax_t *bp, + const uintmax_t *qp, unsigned int k, const uintmax_t *one) + { + uintmax_t y1, y0, nm1_1, nm1_0, r1m; ++ unsigned int i; + + y0 = powm2 (&r1m, bp, qp, np, ni, one); + y1 = r1m; +@@ -1165,7 +1172,7 @@ millerrabin2 (const uintmax_t *np, uintmax_t ni, const uintmax_t *bp, + if (y0 == nm1_0 && y1 == nm1_1) + return true; + +- for (unsigned int i = 1; i < k; i++) ++ for (i = 1; i < k; i++) + { + y0 = mulredc2 (&r1m, y1, y0, y1, y0, np[1], np[0], ni); + y1 = r1m; +@@ -1183,12 +1190,13 @@ static bool + mp_millerrabin (mpz_srcptr n, mpz_srcptr nm1, mpz_ptr x, mpz_ptr y, + mpz_srcptr q, unsigned long int k) + { ++ unsigned long int i; + mpz_powm (y, x, q, n); + + if (mpz_cmp_ui (y, 1) == 0 || mpz_cmp (y, nm1) == 0) + return true; + +- for (unsigned long int i = 1; i < k; i++) ++ for (i = 1; i < k; i++) + { + mpz_powm_ui (y, y, 2, n); + if (mpz_cmp (y, nm1) == 0) +@@ -1209,6 +1217,8 @@ prime_p (uintmax_t n) + bool is_prime; + uintmax_t a_prim, one, ni; + struct factors factors; ++ uintmax_t q, a; ++ unsigned int r; + + if (n <= 1) + return false; +@@ -1218,11 +1228,11 @@ prime_p (uintmax_t n) + return true; + + /* Precomputation for Miller-Rabin. */ +- uintmax_t q = n - 1; ++ q = n - 1; + for (k = 0; (q & 1) == 0; k++) + q >>= 1; + +- uintmax_t a = 2; ++ a = 2; + binv (ni, n); /* ni <- 1/n mod B */ + redcify (one, 1, n); + addmod (a_prim, one, one, n); /* i.e., redcify a = 2 */ +@@ -1239,12 +1249,13 @@ prime_p (uintmax_t n) + + /* Loop until Lucas proves our number prime, or Miller-Rabin proves our + number composite. */ +- for (unsigned int r = 0; r < PRIMES_PTAB_ENTRIES; r++) ++ for (r = 0; r < PRIMES_PTAB_ENTRIES; r++) + { + if (flag_prove_primality) + { ++ unsigned int i; + is_prime = true; +- for (unsigned int i = 0; i < factors.nfactors && is_prime; i++) ++ for (i = 0; i < factors.nfactors && is_prime; i++) + { + is_prime + = powm (a_prim, (n - 1) / factors.p[i], n, ni, one) != one; +@@ -1294,6 +1305,8 @@ prime2_p (uintmax_t n1, uintmax_t n0) + uintmax_t ni; + unsigned int k; + struct factors factors; ++ unsigned int r; ++ uintmax_t a; + + if (n1 == 0) + return prime_p (n0); +@@ -1314,7 +1327,7 @@ prime2_p (uintmax_t n1, uintmax_t n0) + rsh2 (q[1], q[0], nm1[1], nm1[0], k); + } + +- uintmax_t a = 2; ++ a = 2; + binv (ni, n0); + redcify2 (one[1], one[0], 1, n1, n0); + addmod2 (a_prim[1], a_prim[0], one[1], one[0], one[1], one[0], n1, n0); +@@ -1334,13 +1347,14 @@ prime2_p (uintmax_t n1, uintmax_t n0) + + /* Loop until Lucas proves our number prime, or Miller-Rabin proves our + number composite. */ +- for (unsigned int r = 0; r < PRIMES_PTAB_ENTRIES; r++) ++ for (r = 0; r < PRIMES_PTAB_ENTRIES; r++) + { + bool is_prime; + uintmax_t e[2], y[2]; + + if (flag_prove_primality) + { ++ unsigned int i; + is_prime = true; + if (factors.plarge[1]) + { +@@ -1351,7 +1365,7 @@ prime2_p (uintmax_t n1, uintmax_t n0) + y[0] = powm2 (&y[1], a_prim, e, na, ni, one); + is_prime = (y[0] != one[0] || y[1] != one[1]); + } +- for (unsigned int i = 0; i < factors.nfactors && is_prime; i++) ++ for (i = 0; i < factors.nfactors && is_prime; i++) + { + /* FIXME: We always have the factor 2. Do we really need to + handle it here? We have done the same powering as part +@@ -1391,6 +1405,8 @@ mp_prime_p (mpz_t n) + bool is_prime; + mpz_t q, a, nm1, tmp; + struct mp_factors factors; ++ unsigned long int k; ++ unsigned int r; + + if (mpz_cmp_ui (n, 1) <= 0) + return false; +@@ -1405,7 +1421,7 @@ mp_prime_p (mpz_t n) + mpz_sub_ui (nm1, n, 1); + + /* Find q and k, where q is odd and n = 1 + 2**k * q. */ +- unsigned long int k = mpz_scan1 (nm1, 0); ++ k = mpz_scan1 (nm1, 0); + mpz_tdiv_q_2exp (q, nm1, k); + + mpz_set_ui (a, 2); +@@ -1426,12 +1442,13 @@ mp_prime_p (mpz_t n) + + /* Loop until Lucas proves our number prime, or Miller-Rabin proves our + number composite. */ +- for (unsigned int r = 0; r < PRIMES_PTAB_ENTRIES; r++) ++ for (r = 0; r < PRIMES_PTAB_ENTRIES; r++) + { + if (flag_prove_primality) + { ++ unsigned long int i; + is_prime = true; +- for (unsigned long int i = 0; i < factors.nfactors && is_prime; i++) ++ for (i = 0; i < factors.nfactors && is_prime; i++) + { + mpz_divexact (tmp, nm1, factors.p[i]); + mpz_powm (tmp, a, tmp, n); +@@ -1490,6 +1507,7 @@ factor_using_pollard_rho (uintmax_t n, unsigned long int a, + + for (;;) + { ++ unsigned long int i; + do + { + x = mulredc (x, x, n, ni); +@@ -1510,7 +1528,7 @@ factor_using_pollard_rho (uintmax_t n, unsigned long int a, + z = x; + k = l; + l = 2 * l; +- for (unsigned long int i = 0; i < k; i++) ++ for (i = 0; i < k; i++) + { + x = mulredc (x, x, n, ni); + addmod (x, x, a, n); +@@ -1568,6 +1586,7 @@ factor_using_pollard_rho2 (uintmax_t n1, uintmax_t n0, unsigned long int a, + + for (;;) + { ++ unsigned long int i; + do + { + x0 = mulredc2 (&r1m, x1, x0, x1, x0, n1, n0, ni); +@@ -1591,7 +1610,7 @@ factor_using_pollard_rho2 (uintmax_t n1, uintmax_t n0, unsigned long int a, + z1 = x1; z0 = x0; + k = l; + l = 2 * l; +- for (unsigned long int i = 0; i < k; i++) ++ for (i = 0; i < k; i++) + { + x0 = mulredc2 (&r1m, x1, x0, x1, x0, n1, n0, ni); + x1 = r1m; +@@ -1669,6 +1688,8 @@ mp_factor_using_pollard_rho (mpz_t n, unsigned long int a, + { + mpz_t x, z, y, P; + mpz_t t, t2; ++ unsigned long long int k = 1; ++ unsigned long long int l = 1; + + devmsg ("[pollard-rho (%lu)] ", a); + +@@ -1678,13 +1699,11 @@ mp_factor_using_pollard_rho (mpz_t n, unsigned long int a, + mpz_init_set_si (z, 2); + mpz_init_set_ui (P, 1); + +- unsigned long long int k = 1; +- unsigned long long int l = 1; +- + while (mpz_cmp_ui (n, 1) != 0) + { + for (;;) + { ++ unsigned long long int i; + do + { + mpz_mul (t, x, x); +@@ -1708,7 +1727,7 @@ mp_factor_using_pollard_rho (mpz_t n, unsigned long int a, + mpz_set (z, x); + k = l; + l = 2 * l; +- for (unsigned long long int i = 0; i < k; i++) ++ for (i = 0; i < k; i++) + { + mpz_mul (t, x, x); + mpz_mod (x, t, n); +@@ -1975,13 +1994,14 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) + }; + + const unsigned int *m; ++ uintmax_t sqrt_n; + + struct { uintmax_t Q; uintmax_t P; } queue[QUEUE_SIZE]; + + if (n1 >= ((uintmax_t) 1 << (W_TYPE_SIZE - 2))) + return false; + +- uintmax_t sqrt_n = isqrt2 (n1, n0); ++ sqrt_n = isqrt2 (n1, n0); + + if (n0 == sqrt_n * sqrt_n) + { +@@ -1997,6 +2017,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) + else + { + struct factors f; ++ unsigned int i; + + f.nfactors = 0; + if (!factor_using_squfof (0, sqrt_n, &f)) +@@ -2005,7 +2026,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) + factor_using_pollard_rho (sqrt_n, 1, &f); + } + /* Duplicate the new factors */ +- for (unsigned int i = 0; i < f.nfactors; i++) ++ for (i = 0; i < f.nfactors; i++) + factor_insert_multiplicity (factors, f.p[i], 2*f.e[i]); + } + return true; +@@ -2108,7 +2129,9 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) + uintmax_t r = is_square (Q); + if (r) + { +- for (unsigned int j = 0; j < qpos; j++) ++ unsigned int j; ++ uintmax_t hi, lo; ++ for (j = 0; j < qpos; j++) + { + if (queue[j].Q == r) + { +@@ -2143,7 +2166,6 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) + for the case D = 2N. */ + /* Compute Q = (D - P*P) / Q1, but we need double + precision. */ +- uintmax_t hi, lo; + umul_ppmm (hi, lo, P, P); + sub_ddmmss (hi, lo, Dh, Dl, hi, lo); + udiv_qrnnd (Q, rem, hi, lo, Q1); +@@ -2269,6 +2291,7 @@ strto2uintmax (uintmax_t *hip, uintmax_t *lop, const char *s) + uintmax_t hi = 0, lo = 0; + + strtol_error err = LONGINT_INVALID; ++ const char *p; + + /* Skip initial spaces and '+'. */ + for (;;) +@@ -2286,7 +2309,7 @@ strto2uintmax (uintmax_t *hip, uintmax_t *lop, const char *s) + } + + /* Initial scan for invalid digits. */ +- const char *p = s; ++ p = s; + for (;;) + { + unsigned int c = *p++; +@@ -2362,14 +2385,15 @@ static void + print_factors_single (uintmax_t t1, uintmax_t t0) + { + struct factors factors; ++ unsigned int j, k; + + print_uintmaxes (t1, t0); + putchar (':'); + + factor (t1, t0, &factors); + +- for (unsigned int j = 0; j < factors.nfactors; j++) +- for (unsigned int k = 0; k < factors.e[j]; k++) ++ for (j = 0; j < factors.nfactors; j++) ++ for (k = 0; k < factors.e[j]; k++) + { + char buf[INT_BUFSIZE_BOUND (uintmax_t)]; + putchar (' '); +@@ -2393,6 +2417,7 @@ static bool + print_factors (const char *input) + { + uintmax_t t1, t0; ++ unsigned int j, k; + + /* Try converting the number to one or two words. If it fails, use GMP or + print an error message. The 2nd condition checks that the most +@@ -2430,8 +2455,8 @@ print_factors (const char *input) + gmp_printf ("%Zd:", t); + mp_factor (t, &factors); + +- for (unsigned int j = 0; j < factors.nfactors; j++) +- for (unsigned int k = 0; k < factors.e[j]; k++) ++ for (j = 0; j < factors.nfactors; j++) ++ for (k = 0; k < factors.e[j]; k++) + gmp_printf (" %Zd", factors.p[j]); + + mp_factor_clear (&factors); +@@ -2492,6 +2517,8 @@ do_stdin (void) + int + main (int argc, char **argv) + { ++ int c; ++ bool ok; + initialize_main (&argc, &argv); + set_program_name (argv[0]); + setlocale (LC_ALL, ""); +@@ -2502,7 +2529,6 @@ main (int argc, char **argv) + + alg = ALG_POLLARD_RHO; /* Default to Pollard rho */ + +- int c; + while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1) + { + switch (c) +@@ -2533,13 +2559,13 @@ main (int argc, char **argv) + memset (q_freq, 0, sizeof (q_freq)); + #endif + +- bool ok; + if (argc <= optind) + ok = do_stdin (); + else + { ++ int i; + ok = true; +- for (int i = optind; i < argc; i++) ++ for (i = optind; i < argc; i++) + if (! print_factors (argv[i])) + ok = false; + } +@@ -2548,8 +2574,9 @@ main (int argc, char **argv) + if (alg == ALG_SQUFOF && q_freq[0] > 0) + { + double acc_f; ++ unsigned int i; + printf ("q freq. cum. freq.(total: %d)\n", q_freq[0]); +- for (unsigned int i = 1, acc_f = 0.0; i <= Q_FREQ_SIZE; i++) ++ for (i = 1, acc_f = 0.0; i <= Q_FREQ_SIZE; i++) + { + double f = (double) q_freq[i] / q_freq[0]; + acc_f += f; +diff --git a/src/getlimits.c b/src/getlimits.c +index 9914025..870889c 100644 +--- a/src/getlimits.c ++++ b/src/getlimits.c +@@ -88,11 +88,12 @@ decimal_absval_add_one (char *buf) + bool negative = (buf[1] == '-'); + char *absnum = buf + 1 + negative; + char *p = absnum + strlen (absnum); ++ char *result; + absnum[-1] = '0'; + while (*--p == '9') + *p = '0'; + ++*p; +- char *result = MIN (absnum, p); ++ result = MIN (absnum, p); + if (negative) + *--result = '-'; + return result; +diff --git a/src/group-list.c b/src/group-list.c +index d54b057..33097d3 100644 +--- a/src/group-list.c ++++ b/src/group-list.c +@@ -105,6 +105,7 @@ print_group (gid_t gid, bool use_name) + { + struct group *grp = NULL; + bool ok = true; ++ char *s; + + if (use_name) + { +@@ -117,7 +118,7 @@ print_group (gid_t gid, bool use_name) + } + } + +- char *s = grp ? grp->gr_name : gidtostr (gid); ++ s = grp ? grp->gr_name : gidtostr (gid); + fputs (s, stdout); + return ok; + } +diff --git a/src/id.c b/src/id.c +index 884fd16..59e8242 100644 +--- a/src/id.c ++++ b/src/id.c +@@ -117,6 +117,7 @@ main (int argc, char **argv) + bool smack_enabled = is_smack_enabled (); + bool opt_zero = false; + char *pw_name = NULL; ++ size_t n_ids; + + /* If true, output the list of all group IDs. -G */ + bool just_group_list = false; +@@ -126,6 +127,7 @@ main (int argc, char **argv) + bool use_real = false; + /* If true, output only the user ID(s). -u */ + bool just_user = false; ++ bool default_format; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -183,7 +185,7 @@ main (int argc, char **argv) + } + } + +- size_t n_ids = argc - optind; ++ n_ids = argc - optind; + if (1 < n_ids) + { + error (0, 0, _("extra operand %s"), quote (argv[optind + 1])); +@@ -197,7 +199,7 @@ main (int argc, char **argv) + if (just_user + just_group + just_group_list + just_context > 1) + error (EXIT_FAILURE, 0, _("cannot print \"only\" of more than one choice")); + +- bool default_format = (just_user + just_group + just_group_list ++ default_format = (just_user + just_group + just_group_list + + just_context == 0); + + if (default_format && (use_real || use_name)) +@@ -345,6 +347,7 @@ static void + print_user (uid_t uid) + { + struct passwd *pwd = NULL; ++ char *s; + + if (use_name) + { +@@ -357,7 +360,7 @@ print_user (uid_t uid) + } + } + +- char *s = pwd ? pwd->pw_name : uidtostr (uid); ++ s = pwd ? pwd->pw_name : uidtostr (uid); + fputs (s, stdout); + } + +diff --git a/src/install.c b/src/install.c +index 7076655..f1a2edd 100644 +--- a/src/install.c ++++ b/src/install.c +@@ -197,8 +197,9 @@ need_copy (const char *src_name, const char *dest_name, + + if (owner_id == (uid_t) -1) + { ++ uid_t ruid; + errno = 0; +- uid_t ruid = getuid (); ++ ruid = getuid (); + if ((ruid == (uid_t) -1 && errno) || dest_sb.st_uid != ruid) + return true; + } +@@ -207,8 +208,9 @@ need_copy (const char *src_name, const char *dest_name, + + if (group_id == (uid_t) -1) + { ++ gid_t rgid; + errno = 0; +- gid_t rgid = getgid (); ++ rgid = getgid (); + if ((rgid == (uid_t) -1 && errno) || dest_sb.st_gid != rgid) + return true; + } +diff --git a/src/join.c b/src/join.c +index 1da618d..cb370ca 100644 +--- a/src/join.c ++++ b/src/join.c +@@ -655,6 +655,8 @@ join (FILE *fp1, FILE *fp2) + struct seq seq1, seq2; + int diff; + bool eof1, eof2; ++ struct line *line = NULL; ++ bool checktail = false; + + fadvise (fp1, FADVISE_SEQUENTIAL); + fadvise (fp2, FADVISE_SEQUENTIAL); +@@ -763,9 +765,7 @@ join (FILE *fp1, FILE *fp2) + tail ends of both inputs to verify that they are in order. We + skip the rest of the tail once we have issued a warning for that + file, unless we actually need to print the unpairable lines. */ +- struct line *line = NULL; +- bool checktail = false; +- ++ + if (check_input_order != CHECK_ORDER_DISABLED + && !(issued_disorder_warning[0] && issued_disorder_warning[1])) + checktail = true; +@@ -838,9 +838,10 @@ string_to_join_field (char const *str) + { + size_t result; + unsigned long int val; ++ strtol_error s_err; + verify (SIZE_MAX <= ULONG_MAX); + +- strtol_error s_err = xstrtoul (str, NULL, 10, &val, ""); ++ s_err = xstrtoul (str, NULL, 10, &val, ""); + if (s_err == LONGINT_OVERFLOW || (s_err == LONGINT_OK && SIZE_MAX < val)) + val = SIZE_MAX; + else if (s_err != LONGINT_OK || val == 0) +diff --git a/src/ls.c b/src/ls.c +index e7d1d93..6d60b4b 100644 +--- a/src/ls.c ++++ b/src/ls.c +@@ -1048,13 +1048,14 @@ static size_t + abmon_init (void) + { + #ifdef HAVE_NL_LANGINFO +- required_mon_width = MAX_MON_WIDTH; + size_t curr_max_width; ++ required_mon_width = MAX_MON_WIDTH; + do + { ++ int i; + curr_max_width = required_mon_width; + required_mon_width = 0; +- for (int i = 0; i < 12; i++) ++ for (i = 0; i < 12; i++) + { + size_t width = curr_max_width; + +@@ -2053,6 +2054,7 @@ decode_switches (int argc, char **argv) + sizeof (*time_style_types)); + if (res < 0) + { ++ char const *const *p; + /* This whole block used to be a simple use of XARGMATCH. + but that didn't print the "posix-"-prefixed variants or + the "+"-prefixed format string option upon failure. */ +@@ -2064,7 +2066,7 @@ decode_switches (int argc, char **argv) + only because all four existing time_style_types values + are distinct. */ + fputs (_("Valid arguments are:\n"), stderr); +- char const *const *p = time_style_args; ++ p = time_style_args; + while (*p) + fprintf (stderr, " - [posix-]%s\n", *p++); + fputs (_(" - +FORMAT (e.g., +%H:%M) for a 'date'-style" +@@ -2334,6 +2336,7 @@ parse_ls_color (void) + int ind_no; /* Indicator number */ + char label[3]; /* Indicator label */ + struct color_ext_type *ext; /* Extension we are working on */ ++ enum parse_state state; + + if ((p = getenv ("LS_COLORS")) == NULL || *p == '\0') + return; +@@ -2347,7 +2350,7 @@ parse_ls_color (void) + advance. */ + buf = color_buf = xstrdup (p); + +- enum parse_state state = PS_START; ++ state = PS_START; + while (true) + { + switch (state) +@@ -2812,13 +2815,14 @@ getfilecon_cache (char const *file, struct fileinfo *f, bool deref) + /* st_dev of the most recently processed device for which we've + found that [l]getfilecon fails indicating lack of support. */ + static dev_t unsupported_device; ++ int r; + + if (f->stat.st_dev == unsupported_device) + { + errno = ENOTSUP; + return -1; + } +- int r = 0; ++ r = 0; + #ifdef HAVE_SMACK + if (is_smack_enabled ()) + r = smack_new_label_from_path (file, "security.SMACK64", deref, +@@ -2842,6 +2846,7 @@ file_has_acl_cache (char const *file, struct fileinfo *f) + /* st_dev of the most recently processed device for which we've + found that file_has_acl fails indicating lack of support. */ + static dev_t unsupported_device; ++ int n; + + if (f->stat.st_dev == unsupported_device) + { +@@ -2852,7 +2857,7 @@ file_has_acl_cache (char const *file, struct fileinfo *f) + /* Zero errno so that we can distinguish between two 0-returning cases: + "has-ACL-support, but only a default ACL" and "no ACL support". */ + errno = 0; +- int n = file_has_acl (file, &f->stat); ++ n = file_has_acl (file, &f->stat); + if (n <= 0 && errno_unsupported (errno)) + unsupported_device = f->stat.st_dev; + return n; +@@ -2867,6 +2872,7 @@ has_capability_cache (char const *file, struct fileinfo *f) + /* st_dev of the most recently processed device for which we've + found that has_capability fails indicating lack of support. */ + static dev_t unsupported_device; ++ bool b; + + if (f->stat.st_dev == unsupported_device) + { +@@ -2874,7 +2880,7 @@ has_capability_cache (char const *file, struct fileinfo *f) + return 0; + } + +- bool b = has_capability (file); ++ b = has_capability (file); + if ( !b && errno_unsupported (errno)) + unsupported_device = f->stat.st_dev; + return b; +@@ -3064,9 +3070,10 @@ gobble_file (char const *name, enum filetype type, ino_t inode, + && (format == long_format || check_symlink_color)) + { + struct stat linkstats; ++ char *linkname; + + get_link_name (absolute_name, f, command_line_arg); +- char *linkname = make_link_name (absolute_name, f->linkname); ++ linkname = make_link_name (absolute_name, f->linkname); + + /* Avoid following symbolic links when possible, ie, when + they won't be traced and when no indicator is needed. */ +@@ -3220,6 +3227,8 @@ get_link_name (char const *filename, struct fileinfo *f, bool command_line_arg) + static char * + make_link_name (char const *name, char const *linkname) + { ++ char *p; ++ size_t prefix_len; + if (!linkname) + return NULL; + +@@ -3228,11 +3237,11 @@ make_link_name (char const *name, char const *linkname) + + /* The link is to a relative name. Prepend any leading directory + in 'name' to the link name. */ +- size_t prefix_len = dir_len (name); ++ prefix_len = dir_len (name); + if (prefix_len == 0) + return xstrdup (linkname); + +- char *p = xmalloc (prefix_len + 1 + strlen (linkname) + 1); ++ p = xmalloc (prefix_len + 1 + strlen (linkname) + 1); + + /* PREFIX_LEN usually specifies a string not ending in slash. + In that case, extend it by one, since the next byte *is* a slash. +@@ -3634,6 +3643,7 @@ align_nstrftime (char *buf, size_t size, char const *fmt, struct tm const *tm, + the replacement is not done. A malloc here slows ls down by 2% */ + char rpl_fmt[sizeof (abmon[0]) + 100]; + const char *pb; ++ size_t ret; + if (required_mon_width && (pb = strstr (fmt, "%b"))) + { + if (strlen (fmt) < (sizeof (rpl_fmt) - sizeof (abmon[0]) + 2)) +@@ -3646,7 +3656,7 @@ align_nstrftime (char *buf, size_t size, char const *fmt, struct tm const *tm, + strcpy (pfmt, pb + 2); + } + } +- size_t ret = nstrftime (buf, size, nfmt, tm, __utc, __ns); ++ ret = nstrftime (buf, size, nfmt, tm, __utc, __ns); + return ret; + } + +@@ -3797,6 +3807,7 @@ print_long_format (const struct fileinfo *f) + char *p; + struct timespec when_timespec; + struct tm *when_local; ++ size_t w; + + /* Compute the mode string, except remove the trailing space if no + file in this directory has an ACL or SELinux security context. */ +@@ -3984,7 +3995,7 @@ print_long_format (const struct fileinfo *f) + } + + DIRED_FPUTS (buf, stdout, p - buf); +- size_t w = print_name_with_quoting (f, false, &dired_obstack, p - buf); ++ w = print_name_with_quoting (f, false, &dired_obstack, p - buf); + + if (f->filetype == symbolic_link) + { +@@ -4172,6 +4183,7 @@ print_name_with_quoting (const struct fileinfo *f, + struct obstack *stack, + size_t start_col) + { ++ size_t width; + const char* name = symlink_target ? f->linkname : f->name; + + bool used_color_this_time +@@ -4182,7 +4194,7 @@ print_name_with_quoting (const struct fileinfo *f, + if (stack) + PUSH_CURRENT_DIRED_POS (stack); + +- size_t width = quote_name (stdout, name, filename_quoting_options, NULL); ++ width = quote_name (stdout, name, filename_quoting_options, NULL); + dired_pos += width; + + if (stack) +@@ -4219,6 +4231,7 @@ prep_non_filename_text (void) + static size_t + print_file_name_and_frills (const struct fileinfo *f, size_t start_col) + { ++ size_t width; + char buf[MAX (LONGEST_HUMAN_READABLE + 1, INT_BUFSIZE_BOUND (uintmax_t))]; + + set_normal_color (); +@@ -4236,7 +4249,7 @@ print_file_name_and_frills (const struct fileinfo *f, size_t start_col) + if (print_scontext) + printf ("%*s ", format == with_commas ? 0 : scontext_width, f->scontext); + +- size_t width = print_name_with_quoting (f, false, NULL, start_col); ++ width = print_name_with_quoting (f, false, NULL, start_col); + + if (indicator_style != none) + width += print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype); +diff --git a/src/md5sum.c b/src/md5sum.c +index ee2bbb7..b4ad49f 100644 +--- a/src/md5sum.c ++++ b/src/md5sum.c +@@ -230,8 +230,9 @@ static char * + filename_unescape (char *s, size_t s_len) + { + char *dst = s; ++ size_t i; + +- for (size_t i = 0; i < s_len; i++) ++ for (i = 0; i < s_len; i++) + { + switch (s[i]) + { +@@ -835,6 +836,7 @@ main (int argc, char **argv) + containing '\\' characters, we decided to not simplify the + output in this case. */ + bool needs_escape = strchr (file, '\\') || strchr (file, '\n'); ++ size_t i; + + if (prefix_tag) + { +@@ -847,7 +849,6 @@ main (int argc, char **argv) + fputs (") = ", stdout); + } + +- size_t i; + + /* Output a leading backslash if the file name contains + a newline or backslash. */ +diff --git a/src/mkdir.c b/src/mkdir.c +index adc2930..79e4602 100644 +--- a/src/mkdir.c ++++ b/src/mkdir.c +@@ -117,17 +117,19 @@ static int + make_ancestor (char const *dir, char const *component, void *options) + { + struct mkdir_options const *o = options; +- ++ mode_t user_wx = S_IWUSR | S_IXUSR; ++ bool self_denying_umask; ++ int r; ++ + if (o->set_security_context && defaultcon (dir, S_IFDIR) < 0 + && ! ignorable_ctx_err (errno)) + error (0, errno, _("failed to set default creation context for %s"), + quote (dir)); + +- mode_t user_wx = S_IWUSR | S_IXUSR; +- bool self_denying_umask = (o->umask_value & user_wx) != 0; ++ self_denying_umask = (o->umask_value & user_wx) != 0; + if (self_denying_umask) + umask (o->umask_value & ~user_wx); +- int r = mkdir (component, S_IRWXUGO); ++ r = mkdir (component, S_IRWXUGO); + if (self_denying_umask) + { + int mkdir_errno = errno; +@@ -148,6 +150,7 @@ process_dir (char *dir, struct savewd *wd, void *options) + { + struct mkdir_options const *o = options; + bool set_defaultcon = false; ++ int ret; + + /* If possible set context before DIR created. */ + if (o->set_security_context) +@@ -169,7 +172,7 @@ process_dir (char *dir, struct savewd *wd, void *options) + quote (dir)); + } + +- int ret = (make_dir_parents (dir, wd, o->make_ancestor_function, options, ++ ret = (make_dir_parents (dir, wd, o->make_ancestor_function, options, + o->mode, announce_mkdir, + o->mode_bits, (uid_t) -1, (gid_t) -1, true) + ? EXIT_SUCCESS +diff --git a/src/nproc.c b/src/nproc.c +index 5bd6610..cc980e2 100644 +--- a/src/nproc.c ++++ b/src/nproc.c +@@ -76,6 +76,7 @@ int + main (int argc, char **argv) + { + unsigned long nproc, ignore = 0; ++ enum nproc_query mode = NPROC_CURRENT_OVERRIDABLE; + initialize_main (&argc, &argv); + set_program_name (argv[0]); + setlocale (LC_ALL, ""); +@@ -84,8 +85,7 @@ main (int argc, char **argv) + + atexit (close_stdout); + +- enum nproc_query mode = NPROC_CURRENT_OVERRIDABLE; +- ++ + while (1) + { + int c = getopt_long (argc, argv, "", longopts, NULL); +diff --git a/src/numfmt.c b/src/numfmt.c +index 339c79f..fc67ade 100644 +--- a/src/numfmt.c ++++ b/src/numfmt.c +@@ -538,9 +538,11 @@ simple_strtod_float (const char *input_str, + char *ptr2; + long double val_frac = 0; + bool neg_frac; ++ size_t exponent; ++ enum simple_strtod_error e2; + + (*endptr) += decimal_point_length; +- enum simple_strtod_error e2 = ++ e2 = + simple_strtod_int (*endptr, &ptr2, &val_frac, &neg_frac); + if (e2 != SSE_OK && e2 != SSE_OK_PRECISION_LOSS) + return e2; +@@ -550,7 +552,7 @@ simple_strtod_float (const char *input_str, + return SSE_INVALID_NUMBER; + + /* number of digits in the fractions. */ +- size_t exponent = ptr2 - *endptr; ++ exponent = ptr2 - *endptr; + + val_frac = ((long double) val_frac) / powerld (10, exponent); + +@@ -597,12 +599,14 @@ simple_strtod_human (const char *input_str, + int power = 0; + /* 'scale_auto' is checked below. */ + int scale_base = default_scale_base (allowed_scaling); ++ enum simple_strtod_error e; ++ long double multiplier; + + devmsg ("simple_strtod_human:\n input string: %s\n " + "locale decimal-point: %s\n", + quote_n (0, input_str), quote_n (1, decimal_point)); + +- enum simple_strtod_error e = ++ e = + simple_strtod_float (input_str, endptr, value, precision); + if (e != SSE_OK && e != SSE_OK_PRECISION_LOSS) + return e; +@@ -648,7 +652,7 @@ simple_strtod_human (const char *input_str, + return SSE_MISSING_I_SUFFIX; + } + +- long double multiplier = powerld (scale_base, power); ++ multiplier = powerld (scale_base, power); + + devmsg (" suffix power=%d^%d = %Lf\n", scale_base, power, multiplier); + +@@ -705,10 +709,15 @@ double_to_human (long double val, int precision, + char *buf, size_t buf_size, + enum scale_type scale, int group, enum round_type round) + { ++ double scale_base; ++ unsigned int power; ++ int ten_or_less = 0; ++ int show_decimal_point; + devmsg ("double_to_human:\n"); + + if (scale == scale_none) + { ++ int i; + val *= powerld (10, precision); + val = simple_round (val, round); + val /= powerld (10, precision); +@@ -717,7 +726,7 @@ double_to_human (long double val, int precision, + " no scaling, returning (grouped) value: %'.*Lf\n" : + " no scaling, returning value: %.*Lf\n", precision, val); + +- int i = snprintf (buf, buf_size, (group) ? "%'.*Lf" : "%.*Lf", ++ i = snprintf (buf, buf_size, (group) ? "%'.*Lf" : "%.*Lf", + precision, val); + if (i < 0 || i >= (int) buf_size) + error (EXIT_FAILURE, 0, +@@ -726,15 +735,14 @@ double_to_human (long double val, int precision, + } + + /* Scaling requested by user. */ +- double scale_base = default_scale_base (scale); ++ scale_base = default_scale_base (scale); + + /* Normalize val to scale. */ +- unsigned int power = 0; ++ power = 0; + val = expld (val, scale_base, &power); + devmsg (" scaled value to %Lf * %0.f ^ %d\n", val, scale_base, power); + + /* Perform rounding. */ +- int ten_or_less = 0; + if (absld (val) < 10) + { + /* for values less than 10, we allow one decimal-point digit, +@@ -756,7 +764,7 @@ double_to_human (long double val, int precision, + + /* should "7.0" be printed as "7" ? + if removing the ".0" is preferred, enable the fourth condition. */ +- int show_decimal_point = (val != 0) && (absld (val) < 10) && (power > 0); ++ show_decimal_point = (val != 0) && (absld (val) < 10) && (power > 0); + /* && (absld (val) > simple_round_floor (val))) */ + + devmsg (" after rounding, value=%Lf * %0.f ^ %d\n", val, scale_base, power); +@@ -1146,6 +1154,10 @@ print_padded_number (void) + static int + process_suffixed_number (char *text, long double *result, size_t *precision) + { ++ char *p; ++ long double val = 0; ++ enum simple_strtod_error e; ++ const unsigned int skip_count; + if (suffix && strlen (text) > strlen (suffix)) + { + char *possible_suffix = text + strlen (text) - strlen (suffix); +@@ -1161,10 +1173,10 @@ process_suffixed_number (char *text, long double *result, size_t *precision) + } + + /* Skip white space - always. */ +- char *p = text; ++ p = text; + while (*p && isblank (*p)) + ++p; +- const unsigned int skip_count = text - p; ++ skip_count = text - p; + + /* setup auto-padding. */ + if (auto_padding) +@@ -1181,8 +1193,7 @@ process_suffixed_number (char *text, long double *result, size_t *precision) + devmsg ("setting Auto-Padding to %ld characters\n", padding_width); + } + +- long double val = 0; +- enum simple_strtod_error e = parse_human_number (p, &val, precision); ++ e = parse_human_number (p, &val, precision); + if (e == SSE_OK_PRECISION_LOSS && debug) + error (0, 0, _("large input value %s: possible precision loss"), + quote (p)); +@@ -1339,6 +1350,7 @@ int + main (int argc, char **argv) + { + int valid_numbers = 1; ++ int exit_status; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -1527,7 +1539,7 @@ main (int argc, char **argv) + if (debug && !valid_numbers) + error (0, 0, _("failed to convert some of the input numbers")); + +- int exit_status = EXIT_SUCCESS; ++ exit_status = EXIT_SUCCESS; + if (!valid_numbers && _invalid != inval_warn && _invalid != inval_ignore) + exit_status = EXIT_CONVERSION_WARNINGS; + +diff --git a/src/realpath.c b/src/realpath.c +index 233b98f..d76ef52 100644 +--- a/src/realpath.c ++++ b/src/realpath.c +@@ -101,8 +101,9 @@ realpath_canon (const char *fname, int can_mode) + char *can_fname = canonicalize_filename_mode (fname, can_mode); + if (logical && can_fname) /* canonicalize again to resolve symlinks. */ + { ++ char *can_fname2; + can_mode &= ~CAN_NOLINKS; +- char *can_fname2 = canonicalize_filename_mode (can_fname, can_mode); ++ can_fname2 = canonicalize_filename_mode (can_fname, can_mode); + free (can_fname); + return can_fname2; + } +@@ -176,6 +177,7 @@ main (int argc, char **argv) + int can_mode = CAN_ALL_BUT_LAST; + const char *relative_to = NULL; + const char *relative_base = NULL; ++ bool need_dir; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -240,7 +242,7 @@ main (int argc, char **argv) + if (relative_base && !relative_to) + relative_to = relative_base; + +- bool need_dir = (can_mode & CAN_MODE_MASK) == CAN_EXISTING; ++ need_dir = (can_mode & CAN_MODE_MASK) == CAN_EXISTING; + if (relative_to) + { + can_relative_to = realpath_canon (relative_to, can_mode); +diff --git a/src/relpath.c b/src/relpath.c +index 5a93afe..1042b90 100644 +--- a/src/relpath.c ++++ b/src/relpath.c +@@ -88,14 +88,16 @@ bool + relpath (const char *can_fname, const char *can_reldir, char *buf, size_t len) + { + bool buf_err = false; ++ const char *relto_suffix; ++ const char *fname_suffix; + + /* Skip the prefix common to --relative-to and path. */ + int common_index = path_common_prefix (can_reldir, can_fname); + if (!common_index) + return false; + +- const char *relto_suffix = can_reldir + common_index; +- const char *fname_suffix = can_fname + common_index; ++ relto_suffix = can_reldir + common_index; ++ fname_suffix = can_fname + common_index; + + /* Skip over extraneous '/'. */ + if (*relto_suffix == '/') +diff --git a/src/remove.c b/src/remove.c +index 3d386cf..eefbcbb 100644 +--- a/src/remove.c ++++ b/src/remove.c +@@ -180,17 +180,20 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, + int fd_cwd = fts->fts_cwd_fd; + char const *full_name = ent->fts_path; + char const *filename = ent->fts_accpath; ++ struct stat st; ++ struct stat *sbuf; ++ int dirent_type; ++ int write_protected = 0; ++ bool is_empty = false; ++ int wp_errno = 0; + if (is_empty_p) + *is_empty_p = T_UNKNOWN; + +- struct stat st; +- struct stat *sbuf = &st; ++ sbuf = &st; + cache_stat_init (sbuf); + +- int dirent_type = is_dir ? DT_DIR : DT_UNKNOWN; +- int write_protected = 0; +- +- bool is_empty = false; ++ dirent_type = is_dir ? DT_DIR : DT_UNKNOWN; ++ + if (is_empty_p) + { + is_empty = is_empty_dir (fd_cwd, filename); +@@ -206,7 +209,6 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, + if (x->interactive == RMI_NEVER) + return RM_OK; + +- int wp_errno = 0; + if (!x->ignore_missing_files + && ((x->interactive == RMI_ALWAYS) || x->stdin_tty) + && dirent_type != DT_LNK) +@@ -217,6 +219,7 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, + + if (write_protected || x->interactive == RMI_ALWAYS) + { ++ char const *quoted_name; + if (0 <= write_protected && dirent_type == DT_UNKNOWN) + { + if (cache_fstatat (fd_cwd, filename, sbuf, AT_SYMLINK_NOFOLLOW) == 0) +@@ -256,7 +259,7 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, + break; + } + +- char const *quoted_name = quote (full_name); ++ quoted_name = quote (full_name); + + if (write_protected < 0) + { +@@ -492,6 +495,8 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) + case FTS_NSOK: /* e.g., dangling symlink */ + case FTS_DEFAULT: /* none of the above */ + { ++ bool is_dir; ++ enum RM_status s; + /* With --one-file-system, do not attempt to remove a mount point. + fts' FTS_XDEV ensures that we don't process any entries under + the mount point. */ +@@ -506,8 +511,8 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) + return RM_ERROR; + } + +- bool is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR; +- enum RM_status s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL); ++ is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR; ++ s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL); + if (s != RM_OK) + return s; + return excise (fts, ent, x, is_dir); +@@ -548,15 +553,17 @@ rm (char *const *file, struct rm_options const *x) + int bit_flags = (FTS_CWDFD + | FTS_NOSTAT + | FTS_PHYSICAL); ++ FTS *fts; + + if (x->one_file_system) + bit_flags |= FTS_XDEV; + +- FTS *fts = xfts_open (file, bit_flags, NULL); ++ fts = xfts_open (file, bit_flags, NULL); + + while (1) + { + FTSENT *ent; ++ enum RM_status s; + + ent = fts_read (fts); + if (ent == NULL) +@@ -569,7 +576,7 @@ rm (char *const *file, struct rm_options const *x) + break; + } + +- enum RM_status s = rm_fts (fts, ent, x); ++ s = rm_fts (fts, ent, x); + + assert (VALID_STATUS (s)); + UPDATE_STATUS (rm_status, s); +diff --git a/src/rm.c b/src/rm.c +index 7a51eef..27cef70 100644 +--- a/src/rm.c ++++ b/src/rm.c +@@ -209,6 +209,9 @@ main (int argc, char **argv) + struct rm_options x; + bool prompt_once = false; + int c; ++ size_t n_files; ++ char **file; ++ enum RM_status status; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -332,8 +335,8 @@ main (int argc, char **argv) + quote ("/")); + } + +- size_t n_files = argc - optind; +- char **file = argv + optind; ++ n_files = argc - optind; ++ file = argv + optind; + + if (prompt_once && (x.recursive || 3 < n_files)) + { +@@ -350,7 +353,7 @@ main (int argc, char **argv) + exit (EXIT_SUCCESS); + } + +- enum RM_status status = rm (file, &x); ++ status = rm (file, &x); + assert (VALID_STATUS (status)); + exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS); + } +diff --git a/src/seq.c b/src/seq.c +index 35dfc8b..0cf99bb 100644 +--- a/src/seq.c ++++ b/src/seq.c +@@ -153,6 +153,7 @@ scan_arg (const char *arg) + if (! arg[strcspn (arg, "xX")] && isfinite (ret.value)) + { + char const *decimal_point = strchr (arg, '.'); ++ char const *e; + if (! decimal_point) + ret.precision = 0; + else +@@ -165,7 +166,7 @@ scan_arg (const char *arg) + : (decimal_point == arg /* .# -> 0.# */ + || ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */ + } +- char const *e = strchr (arg, 'e'); ++ e = strchr (arg, 'e'); + if (! e) + e = strchr (arg, 'E'); + if (e) +@@ -330,6 +331,7 @@ get_default_format (operand first, operand step, operand last) + { + if (equal_width) + { ++ size_t width; + /* increase first_width by any increased precision in step */ + size_t first_width = first.width + (prec - first.precision); + /* adjust last_width to use precision from first/step */ +@@ -340,7 +342,7 @@ get_default_format (operand first, operand step, operand last) + last_width++; /* include space for '.' */ + if (first.precision == 0 && prec) + first_width++; /* include space for '.' */ +- size_t width = MAX (first_width, last_width); ++ width = MAX (first_width, last_width); + if (width <= INT_MAX) + { + int w = width; +@@ -411,20 +413,23 @@ trim_leading_zeros (char const *s) + static bool + seq_fast (char const *a, char const *b) + { ++ size_t p_len, q_len, n; ++ char *p0, *p, *q0, *q; ++ bool ok; + /* Skip past any leading 0's. Without this, our naive cmp + function would declare 000 to be larger than 99. */ + a = trim_leading_zeros (a); + b = trim_leading_zeros (b); + +- size_t p_len = strlen (a); +- size_t q_len = strlen (b); +- size_t n = MAX (p_len, q_len); +- char *p0 = xmalloc (n + 1); +- char *p = memcpy (p0 + n - p_len, a, p_len + 1); +- char *q0 = xmalloc (n + 1); +- char *q = memcpy (q0 + n - q_len, b, q_len + 1); ++ p_len = strlen (a); ++ q_len = strlen (b); ++ n = MAX (p_len, q_len); ++ p0 = xmalloc (n + 1); ++ p = memcpy (p0 + n - p_len, a, p_len + 1); ++ q0 = xmalloc (n + 1); ++ q = memcpy (q0 + n - q_len, b, q_len + 1); + +- bool ok = cmp (p, p_len, q, q_len) <= 0; ++ ok = cmp (p, p_len, q, q_len) <= 0; + if (ok) + { + /* Buffer at least this many numbers per fwrite call. +@@ -485,6 +490,7 @@ main (int argc, char **argv) + + /* The printf(3) format used for output. */ + char const *format_str = NULL; ++ unsigned int n_args; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -536,7 +542,7 @@ main (int argc, char **argv) + } + } + +- unsigned int n_args = argc - optind; ++ n_args = argc - optind; + if (n_args < 1) + { + error (0, 0, _("missing operand")); +diff --git a/src/shred.c b/src/shred.c +index 6f5b4da..701de0e 100644 +--- a/src/shred.c ++++ b/src/shred.c +@@ -251,11 +251,12 @@ to be recovered later.\n\ + static bool + periodic_pattern (int type) + { ++ unsigned char r[3]; ++ unsigned int bits; + if (type <= 0) + return false; + +- unsigned char r[3]; +- unsigned int bits = type & 0xfff; ++ bits = type & 0xfff; + + bits |= bits << 12; + r[0] = (bits >> 4) & 255; +@@ -400,33 +401,38 @@ dopass (int fd, char const *qname, off_t *sizep, int type, + size_t lim; /* Amount of data to try writing */ + size_t soff; /* Offset into buffer for next write */ + ssize_t ssize; /* Return value from write */ ++ size_t page_size; ++ size_t output_size; ++ void *fill_pattern_mem; ++ unsigned char *pbuf; ++ ++ char pass_string[PASS_NAME_SIZE]; /* Name of current pass */ ++ bool write_error = false; ++ bool other_error = false; ++ bool tried_without_directio = false; ++ ++ /* Printable previous offset into the file */ ++ char previous_offset_buf[LONGEST_HUMAN_READABLE + 1]; ++ char const *previous_human_offset IF_LINT ( = 0); + + /* Do nothing for --size=0 or regular empty files with --exact. */ + if (size == 0) + return 0; + + /* Fill pattern buffer. Aligning it to a page so we can do direct I/O. */ +- size_t page_size = getpagesize (); ++ page_size = getpagesize (); + #define PERIODIC_OUTPUT_SIZE (60 * 1024) + #define NONPERIODIC_OUTPUT_SIZE (64 * 1024) + verify (PERIODIC_OUTPUT_SIZE % 3 == 0); +- size_t output_size = periodic_pattern (type) ++ output_size = periodic_pattern (type) + ? PERIODIC_OUTPUT_SIZE : NONPERIODIC_OUTPUT_SIZE; + #define PAGE_ALIGN_SLOP (page_size - 1) /* So directio works */ + #define FILLPATTERN_SIZE (((output_size + 2) / 3) * 3) /* Multiple of 3 */ + #define PATTERNBUF_SIZE (PAGE_ALIGN_SLOP + FILLPATTERN_SIZE) +- void *fill_pattern_mem = xmalloc (PATTERNBUF_SIZE); +- unsigned char *pbuf = ptr_align (fill_pattern_mem, page_size); +- +- char pass_string[PASS_NAME_SIZE]; /* Name of current pass */ +- bool write_error = false; +- bool other_error = false; +- bool tried_without_directio = false; +- +- /* Printable previous offset into the file */ +- char previous_offset_buf[LONGEST_HUMAN_READABLE + 1]; +- char const *previous_human_offset IF_LINT ( = 0); ++ fill_pattern_mem = xmalloc (PATTERNBUF_SIZE); ++ pbuf = ptr_align (fill_pattern_mem, page_size); + ++ + if (lseek (fd, 0, SEEK_SET) == -1) + { + error (0, errno, _("%s: cannot rewind"), qname); +@@ -457,6 +463,7 @@ dopass (int fd, char const *qname, off_t *sizep, int type, + offset = 0; + while (true) + { ++ bool done; + /* How much to write this time? */ + lim = output_size; + if (0 <= size && size - offset < output_size) +@@ -536,7 +543,7 @@ dopass (int fd, char const *qname, off_t *sizep, int type, + + offset += soff; + +- bool done = offset == size; ++ done = offset == size; + + /* Time to print progress? */ + if (n && ((done && *previous_human_offset) +diff --git a/src/shuf.c b/src/shuf.c +index 456140f..e1bbe5d 100644 +--- a/src/shuf.c ++++ b/src/shuf.c +@@ -150,6 +150,7 @@ static off_t + input_size (void) + { + off_t file_size; ++ off_t input_offset; + + struct stat stat_buf; + if (fstat (STDIN_FILENO, &stat_buf) != 0) +@@ -159,7 +160,7 @@ input_size (void) + else + return OFF_T_MAX; + +- off_t input_offset = lseek (STDIN_FILENO, 0, SEEK_CUR); ++ input_offset = lseek (STDIN_FILENO, 0, SEEK_CUR); + if (input_offset < 0) + return OFF_T_MAX; + +diff --git a/src/sort.c b/src/sort.c +index 573d6cb..392da25 100644 +--- a/src/sort.c ++++ b/src/sort.c +@@ -764,9 +764,10 @@ static bool + delete_proc (pid_t pid) + { + struct tempnode test; ++ struct tempnode *node; + + test.pid = pid; +- struct tempnode *node = hash_delete (proctab, &test); ++ node = hash_delete (proctab, &test); + if (! node) + return false; + node->state = REAPED; +@@ -1162,6 +1163,7 @@ open_temp (struct tempnode *temp) + { + int tempfd, pipefds[2]; + FILE *fp = NULL; ++ pid_t child; + + if (temp->state == UNREAPED) + wait_proc (temp->pid); +@@ -1170,7 +1172,7 @@ open_temp (struct tempnode *temp) + if (tempfd < 0) + return NULL; + +- pid_t child = pipe_fork (pipefds, MAX_FORK_TRIES_DECOMPRESS); ++ child = pipe_fork (pipefds, MAX_FORK_TRIES_DECOMPRESS); + + switch (child) + { +@@ -1446,6 +1448,7 @@ specify_nthreads (int oi, char c, char const *s) + static size_t + default_sort_size (void) + { ++ double avail, total, mem; + /* Let SIZE be MEM, but no more than the maximum object size, + total memory, or system resource limits. Don't bother to check + for values like RLIM_INFINITY since in practice they are not much +@@ -1472,9 +1475,9 @@ default_sort_size (void) + + /* Let MEM be available memory or 1/8 of total memory, whichever + is greater. */ +- double avail = physmem_available (); +- double total = physmem_total (); +- double mem = MAX (avail, total / 8); ++ avail = physmem_available (); ++ total = physmem_total (); ++ mem = MAX (avail, total / 8); + + /* Leave a 1/4 margin for physical memory. */ + if (total * 0.75 < size) +@@ -1931,12 +1934,13 @@ find_unit_order (char const *number) + static int + human_numcompare (char const *a, char const *b) + { ++ int diff; + while (blanks[to_uchar (*a)]) + a++; + while (blanks[to_uchar (*b)]) + b++; + +- int diff = find_unit_order (a) - find_unit_order (b); ++ diff = find_unit_order (a) - find_unit_order (b); + return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep)); + } + +@@ -1963,10 +1967,10 @@ static int + nan_compare (char const *sa, char const *sb) + { + long_double a; ++ long_double b; + memset (&a, 0, sizeof a); + a = strtold (sa, NULL); + +- long_double b; + memset (&b, 0, sizeof b); + b = strtold (sb, NULL); + +@@ -2068,9 +2072,9 @@ random_md5_state_init (char const *random_source) + static size_t + xstrxfrm (char *restrict dest, char const *restrict src, size_t destsize) + { +- errno = 0; + size_t translated_size = strxfrm (dest, src, destsize); +- ++ errno = 0; ++ + if (errno) + { + error (0, errno, _("string transformation failed")); +@@ -2103,6 +2107,7 @@ compare_random (char *restrict texta, size_t lena, + void *allocated = NULL; + uint32_t dig[2][MD5_DIGEST_SIZE / sizeof (uint32_t)]; + struct md5_ctx s[2]; ++ int diff; + s[0] = s[1] = random_md5_state; + + if (hard_LC_COLLATE) +@@ -2128,6 +2133,8 @@ compare_random (char *restrict texta, size_t lena, + twice on typical implementations. Don't worry about + size_t overflow, as the guess need not be correct. */ + size_t guess_bufsize = 3 * (lena + lenb) + 2; ++ size_t sizea, sizeb; ++ bool a_fits; + if (bufsize < guess_bufsize) + { + bufsize = MAX (guess_bufsize, bufsize * 3 / 2); +@@ -2140,10 +2147,10 @@ compare_random (char *restrict texta, size_t lena, + } + } + +- size_t sizea = ++ sizea = + (texta < lima ? xstrxfrm (buf, texta, bufsize) + 1 : 0); +- bool a_fits = sizea <= bufsize; +- size_t sizeb = ++ a_fits = sizea <= bufsize; ++ sizeb = + (textb < limb + ? (xstrxfrm ((a_fits ? buf + sizea : NULL), textb, + (a_fits ? bufsize - sizea : 0)) +@@ -2196,7 +2203,7 @@ compare_random (char *restrict texta, size_t lena, + /* Compute and compare the checksums. */ + md5_process_bytes (texta, lena, &s[0]); md5_finish_ctx (&s[0], dig[0]); + md5_process_bytes (textb, lenb, &s[1]); md5_finish_ctx (&s[1], dig[1]); +- int diff = memcmp (dig[0], dig[1], sizeof dig[0]); ++ diff = memcmp (dig[0], dig[1], sizeof dig[0]); + + /* Fall back on the tiebreaker if the checksums collide. */ + if (! diff) +@@ -2267,6 +2274,7 @@ debug_key (struct line const *line, struct keyfield const *key) + char *text = line->text; + char *beg = text; + char *lim = text + line->length - 1; ++ size_t offset, width; + + if (key) + { +@@ -2278,12 +2286,13 @@ debug_key (struct line const *line, struct keyfield const *key) + if (key->skipsblanks || key->month || key_numeric (key)) + { + char saved = *lim; ++ char *tighter_lim; + *lim = '\0'; + + while (blanks[to_uchar (*beg)]) + beg++; + +- char *tighter_lim = beg; ++ tighter_lim = beg; + + if (lim < beg) + tighter_lim = lim; +@@ -2319,8 +2328,8 @@ debug_key (struct line const *line, struct keyfield const *key) + } + } + +- size_t offset = debug_width (text, beg); +- size_t width = debug_width (beg, lim); ++ offset = debug_width (text, beg); ++ width = debug_width (beg, lim); + mark_key (offset, width); + } + +@@ -2394,6 +2403,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) + + for (key = keylist; key; key = key->next, keynum++) + { ++ bool implicit_skip, maybe_space_aligned, line_offset; + if (key->obsolete_used) + { + size_t sword = key->sword; +@@ -2428,10 +2438,10 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) + error (0, 0, _("key %lu has zero width and will be ignored"), keynum); + + /* Warn about significant leading blanks. */ +- bool implicit_skip = key_numeric (key) || key->month; +- bool maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key) ++ implicit_skip = key_numeric (key) || key->month; ++ maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key) + && !(key->schar || key->echar); +- bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ ++ line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ + if (!gkey_only && tab == TAB_DEFAULT && !line_offset + && ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned)) + || (!key->skipsblanks && key->schar) +@@ -2475,10 +2485,10 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) + || (ugkey.reverse && (stable || unique) && keylist)) + { + bool ugkey_reverse = ugkey.reverse; ++ char opts[sizeof short_options]; + if (!(stable || unique)) + ugkey.reverse = false; + /* The following is too big, but guaranteed to be "big enough". */ +- char opts[sizeof short_options]; + key_to_opts (&ugkey, opts); + error (0, 0, + ngettext ("option '-%s' is ignored", +@@ -2509,6 +2519,7 @@ keycompare (struct line const *a, struct line const *b) + + while (true) + { ++ size_t lena, lenb; + char const *translate = key->translate; + bool const *ignore = key->ignore; + +@@ -2517,8 +2528,8 @@ keycompare (struct line const *a, struct line const *b) + limb = MAX (textb, limb); + + /* Find the lengths. */ +- size_t lena = lima - texta; +- size_t lenb = limb - textb; ++ lena = lima - texta; ++ lenb = limb - textb; + + if (hard_LC_COLLATE || key_numeric (key) + || key->month || key->random || key->version) +@@ -3187,6 +3198,8 @@ sequential_sort (struct line *restrict lines, size_t nlines, + size_t nhi = nlines - nlo; + struct line *lo = lines; + struct line *hi = lines - nlo; ++ struct line *dest; ++ struct line const *sorted_lo; + + sequential_sort (hi, nhi, temp - (to_temp ? nlo : 0), to_temp); + if (1 < nlo) +@@ -3194,8 +3207,6 @@ sequential_sort (struct line *restrict lines, size_t nlines, + else if (!to_temp) + temp[-1] = lo[-1]; + +- struct line *dest; +- struct line const *sorted_lo; + if (to_temp) + { + dest = temp; +@@ -3822,6 +3833,8 @@ merge (struct sortfile *files, size_t ntemps, size_t nfiles, + while (true) + { + /* Merge directly into the output file if possible. */ ++ FILE *tfp; ++ struct tempnode *temp; + FILE **fps; + size_t nopened = open_input_files (files, nfiles, &fps); + +@@ -3844,8 +3857,6 @@ merge (struct sortfile *files, size_t ntemps, size_t nfiles, + file with our spare file descriptor. Retry if that failed + (e.g., some other process could open a file between the time + we closed and tried to create). */ +- FILE *tfp; +- struct tempnode *temp; + do + { + nopened--; +@@ -3874,10 +3885,10 @@ sort (char *const *files, size_t nfiles, char const *output_file, + size_t nthreads) + { + struct buffer buf; +- IF_LINT (buf.buf = NULL); + size_t ntemps = 0; + bool output_file_created = false; +- ++ IF_LINT (buf.buf = NULL); ++ + buf.alloc = 0; + + while (nfiles) +@@ -3942,10 +3953,12 @@ sort (char *const *files, size_t nfiles, char const *output_file, + if (1 < buf.nlines) + { + struct merge_node_queue queue; ++ struct merge_node *merge_tree; ++ struct merge_node *root; + queue_init (&queue, nthreads); +- struct merge_node *merge_tree = ++ merge_tree = + merge_tree_init (nthreads, buf.nlines, line); +- struct merge_node *root = merge_tree + 1; ++ root = merge_tree + 1; + + sortlines (line, nthreads, buf.nlines, root, + &queue, tfp, temp_output); +@@ -4722,6 +4735,7 @@ main (int argc, char **argv) + } + else + { ++ size_t nthreads_max; + if (!nthreads) + { + unsigned long int np = num_processors (NPROC_CURRENT_OVERRIDABLE); +@@ -4729,7 +4743,7 @@ main (int argc, char **argv) + } + + /* Avoid integer overflow later. */ +- size_t nthreads_max = SIZE_MAX / (2 * sizeof (struct merge_node)); ++ nthreads_max = SIZE_MAX / (2 * sizeof (struct merge_node)); + nthreads = MIN (nthreads, nthreads_max); + + sort (files, nfiles, outfile, nthreads); +diff --git a/src/split.c b/src/split.c +index f740652..e86668f 100644 +--- a/src/split.c ++++ b/src/split.c +@@ -309,14 +309,15 @@ new_name: + + if (numeric_suffix_start) + { +- assert (! widen); +- ++ size_t *sufindex_end; ++ + /* Update the output file name. */ + size_t i = strlen (numeric_suffix_start); ++ assert (! widen); + memcpy (outfile_mid + suffix_length - i, numeric_suffix_start, i); + + /* Update the suffix index. */ +- size_t *sufindex_end = sufindex + suffix_length; ++ sufindex_end = sufindex + suffix_length; + while (i-- != 0) + *--sufindex_end = numeric_suffix_start[i] - '0'; + } +@@ -362,13 +363,14 @@ create (const char *name) + { + if (!filter_command) + { ++ int fd; ++ struct stat out_stat_buf; + if (verbose) + fprintf (stdout, _("creating file %s\n"), quote (name)); + +- int fd = open (name, O_WRONLY | O_CREAT | O_BINARY, MODE_RW_UGO); ++ fd = open (name, O_WRONLY | O_CREAT | O_BINARY, MODE_RW_UGO); + if (fd < 0) + return fd; +- struct stat out_stat_buf; + if (fstat (fd, &out_stat_buf) != 0) + error (EXIT_FAILURE, errno, _("failed to stat %s"), quote (name)); + if (SAME_INODE (in_stat_buf, out_stat_buf)) +@@ -445,9 +447,9 @@ closeout (FILE *fp, int fd, pid_t pid, char const *name) + error (EXIT_FAILURE, errno, "%s", name); + if (fd >= 0) + { ++ int j; + if (fp == NULL && close (fd) < 0) + error (EXIT_FAILURE, errno, "%s", name); +- int j; + for (j = 0; j < n_open_pipes; ++j) + { + if (open_pipes[j] == fd) +@@ -633,11 +635,13 @@ line_bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize) + + do + { ++ size_t n_left; ++ char *sob; + n_read = full_read (STDIN_FILENO, buf, bufsize); + if (n_read < bufsize && errno) + error (EXIT_FAILURE, errno, "%s", infile); +- size_t n_left = n_read; +- char *sob = buf; ++ n_left = n_read; ++ sob = buf; + while (n_left) + { + size_t split_rest = 0; +@@ -670,8 +674,8 @@ line_bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize) + /* Output to eol if present. */ + if (eol) + { +- split_line = true; + size_t n_write = eol - sob + 1; ++ split_line = true; + cwrite (n_out == 0, sob, n_write); + n_out += n_write; + n_left -= n_write; +@@ -739,8 +743,6 @@ static void + lines_chunk_split (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, + off_t file_size) + { +- assert (n && k <= n && n <= file_size); +- + const off_t chunk_size = file_size / n; + uintmax_t chunk_no = 1; + off_t chunk_end = chunk_size - 1; +@@ -748,6 +750,8 @@ lines_chunk_split (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, + bool new_file_flag = true; + bool chunk_truncated = false; + ++ assert (n && k <= n && n <= file_size); ++ + if (k > 1) + { + /* Start reading 1 byte before kth chunk of file. */ +@@ -1136,6 +1140,8 @@ main (int argc, char **argv) + int c; + int digits_optind = 0; + off_t file_size IF_LINT (= 0); ++ void *b; ++ char *buf; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -1434,8 +1440,8 @@ main (int argc, char **argv) + file_size = MAX (file_size, n_units); + } + +- void *b = xmalloc (in_blk_size + 1 + page_size - 1); +- char *buf = ptr_align (b, page_size); ++ b = xmalloc (in_blk_size + 1 + page_size - 1); ++ buf = ptr_align (b, page_size); + + /* When filtering, closure of one pipe must not terminate the process, + as there may still be other streams expecting input from us. */ +diff --git a/src/stat.c b/src/stat.c +index ba491f4..c3e66f8 100644 +--- a/src/stat.c ++++ b/src/stat.c +@@ -604,6 +604,10 @@ out_epoch_sec (char *pformat, size_t prefix_len, + int width = 0; + int precision = 0; + bool frac_left_adjust = false; ++ int divisor = 1; ++ int frac_sec; ++ int int_len; ++ int i; + + if (dot) + { +@@ -625,6 +629,7 @@ out_epoch_sec (char *pformat, size_t prefix_len, + /* If a nontrivial width is given, subtract the width of the + decimal point and PRECISION digits that will be output + later. */ ++ long int lwidth; + char *p = dot; + *dot = '\0'; + +@@ -632,13 +637,14 @@ out_epoch_sec (char *pformat, size_t prefix_len, + --p; + while (ISDIGIT (p[-1])); + +- long int lwidth = strtol (p, NULL, 10); ++ lwidth = strtol (p, NULL, 10); + width = (lwidth <= INT_MAX ? lwidth : INT_MAX); + if (1 < width) + { ++ int w_d; + p += (*p == '0'); + sec_prefix_len = p - pformat; +- int w_d = (decimal_point_len < width ++ w_d = (decimal_point_len < width + ? width - decimal_point_len + : 0); + if (1 < w_d) +@@ -647,7 +653,8 @@ out_epoch_sec (char *pformat, size_t prefix_len, + if (1 < w) + { + char *dst = pformat; +- for (char const *src = dst; src < p; src++) ++ char const *src; ++ for (src = dst; src < p; src++) + { + if (*src == '-') + frac_left_adjust = true; +@@ -663,11 +670,9 @@ out_epoch_sec (char *pformat, size_t prefix_len, + } + } + +- int divisor = 1; +- for (int i = precision; i < 9; i++) ++ for (i = precision; i < 9; i++) + divisor *= 10; +- int frac_sec = arg.tv_nsec / divisor; +- int int_len; ++ frac_sec = arg.tv_nsec / divisor; + + if (TYPE_SIGNED (time_t)) + { +@@ -819,6 +824,7 @@ find_bind_mount (char const * name) + { + char const * bind_mount = NULL; + ++ struct mount_entry *me; + static struct mount_entry *mount_list; + static bool tried_mount_list = false; + if (!tried_mount_list) /* attempt/warn once per process. */ +@@ -828,7 +834,6 @@ find_bind_mount (char const * name) + tried_mount_list = true; + } + +- struct mount_entry *me; + for (me = mount_list; me; me = me->me_next) + { + if (me->me_dummy && me->me_devname[0] == '/' +@@ -903,9 +908,9 @@ print_mount_point: + static inline struct timespec + neg_to_zero (struct timespec ts) + { ++ struct timespec z = {0, 0}; + if (0 <= ts.tv_nsec) + return ts; +- struct timespec z = {0, 0}; + return z; + } + +@@ -1114,11 +1119,12 @@ print_it (char const *format, char const *filename, + { + size_t len = strspn (b + 1, printf_flags); + char const *fmt_char = b + len + 1; ++ unsigned int fmt_code; + fmt_char += strspn (fmt_char, digits); + if (*fmt_char == '.') + fmt_char += 1 + strspn (fmt_char + 1, digits); + len = fmt_char - (b + 1); +- unsigned int fmt_code = *fmt_char; ++ fmt_code = *fmt_char; + memcpy (dest, b, len + 1); + + b = fmt_char; +@@ -1206,6 +1212,7 @@ static bool ATTRIBUTE_WARN_UNUSED_RESULT + do_statfs (char const *filename, char const *format) + { + STRUCT_STATVFS statfsbuf; ++ bool fail; + + if (STREQ (filename, "-")) + { +@@ -1221,7 +1228,7 @@ do_statfs (char const *filename, char const *format) + return false; + } + +- bool fail = print_it (format, filename, print_statfs, &statfsbuf); ++ fail = print_it (format, filename, print_statfs, &statfsbuf); + return ! fail; + } + +@@ -1231,6 +1238,7 @@ do_stat (char const *filename, char const *format, + char const *format2) + { + struct stat statbuf; ++ bool fail; + + if (STREQ (filename, "-")) + { +@@ -1254,7 +1262,7 @@ do_stat (char const *filename, char const *format, + if (S_ISBLK (statbuf.st_mode) || S_ISCHR (statbuf.st_mode)) + format = format2; + +- bool fail = print_it (format, filename, print_stat, &statbuf); ++ fail = print_it (format, filename, print_stat, &statbuf); + return ! fail; + } + +@@ -1455,14 +1463,14 @@ main (int argc, char *argv[]) + char *format = NULL; + char *format2; + bool ok = true; +- ++ struct lconv const *locale = localeconv (); ++ + initialize_main (&argc, &argv); + set_program_name (argv[0]); + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + +- struct lconv const *locale = localeconv (); + decimal_point = (locale->decimal_point[0] ? locale->decimal_point : "."); + decimal_point_len = strlen (decimal_point); + +diff --git a/src/system.h b/src/system.h +index 6b242a8..0715a96 100644 +--- a/src/system.h ++++ b/src/system.h +@@ -502,6 +502,7 @@ is_nul (void const *buf, size_t bufsize) + void const *vp; + char const *cbuf = buf; + word const *wp = buf; ++ char const *cp; + + /* Find first nonzero *word*, or the word with the sentinel. */ + while (*wp++ == 0) +@@ -509,7 +510,7 @@ is_nul (void const *buf, size_t bufsize) + + /* Find the first nonzero *byte*, or the sentinel. */ + vp = wp - 1; +- char const *cp = vp; ++ cp = vp; + while (*cp++ == 0) + continue; + +@@ -567,10 +568,11 @@ Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).\n\ + static inline void + emit_ancillary_info (void) + { ++ const char *lc_messages; + printf (_("\n%s online help: <%s>\n"), PACKAGE_NAME, PACKAGE_URL); + /* Don't output this redundant message for English locales. + Note we still output for 'C' so that it gets included in the man page. */ +- const char *lc_messages = setlocale (LC_MESSAGES, NULL); ++ lc_messages = setlocale (LC_MESSAGES, NULL); + if (lc_messages && STRNCMP_LIT (lc_messages, "en_")) + { + /* TRANSLATORS: Replace LANG_CODE in this URL with your language code +diff --git a/src/tac.c b/src/tac.c +index 5bf40a7..7e9cbef 100644 +--- a/src/tac.c ++++ b/src/tac.c +@@ -426,6 +426,7 @@ temp_stream (FILE **fp, char **file_name) + static FILE *tmp_fp; + if (tempfile == NULL) + { ++ int fd; + char const *t = getenv ("TMPDIR"); + char const *tempdir = t ? t : DEFAULT_TMPDIR; + tempfile = mfile_name_concat (tempdir, "tacXXXXXX", NULL); +@@ -444,7 +445,7 @@ temp_stream (FILE **fp, char **file_name) + FIXME: clean up upon fatal signal. Don't block them, in case + $TMPFILE is a remote file system. */ + +- int fd = mkstemp (tempfile); ++ fd = mkstemp (tempfile); + if (fd < 0) + { + error (0, errno, _("failed to create temporary file in %s"), +@@ -536,10 +537,11 @@ tac_nonseekable (int input_fd, const char *file) + { + FILE *tmp_stream; + char *tmp_file; ++ bool ok; + if (!copy_to_temp (&tmp_stream, &tmp_file, input_fd, file)) + return false; + +- bool ok = tac_seekable (fileno (tmp_stream), tmp_file); ++ ok = tac_seekable (fileno (tmp_stream), tmp_file); + return ok; + } + +diff --git a/src/tail.c b/src/tail.c +index dc4e10d..87b2d66 100644 +--- a/src/tail.c ++++ b/src/tail.c +@@ -844,6 +844,8 @@ start_lines (const char *pretty_filename, int fd, uintmax_t n_lines, + { + char buffer[BUFSIZ]; + size_t bytes_read = safe_read (fd, buffer, BUFSIZ); ++ char *buffer_end; ++ char *p; + if (bytes_read == 0) /* EOF */ + return -1; + if (bytes_read == SAFE_READ_ERROR) /* error */ +@@ -852,11 +854,11 @@ start_lines (const char *pretty_filename, int fd, uintmax_t n_lines, + return 1; + } + +- char *buffer_end = buffer + bytes_read; ++ buffer_end = buffer + bytes_read; + + *read_pos += bytes_read; + +- char *p = buffer; ++ p = buffer; + while ((p = memchr (p, '\n', buffer_end - p))) + { + ++p; +diff --git a/src/test.c b/src/test.c +index 2038209..45a1842 100644 +--- a/src/test.c ++++ b/src/test.c +@@ -420,23 +420,27 @@ unary_operator (void) + + case 'O': /* File is owned by you? */ + { ++ uid_t euid; ++ uid_t NO_UID; + unary_advance (); + if (stat (argv[pos - 1], &stat_buf) != 0) + return false; + errno = 0; +- uid_t euid = geteuid (); +- uid_t NO_UID = -1; ++ euid = geteuid (); ++ NO_UID = -1; + return ! (euid == NO_UID && errno) && euid == stat_buf.st_uid; + } + + case 'G': /* File is owned by your group? */ + { ++ gid_t egid; ++ gid_t NO_GID; + unary_advance (); + if (stat (argv[pos - 1], &stat_buf) != 0) + return false; + errno = 0; +- gid_t egid = getegid (); +- gid_t NO_GID = -1; ++ egid = getegid (); ++ NO_GID = -1; + return ! (egid == NO_GID && errno) && egid == stat_buf.st_gid; + } + +diff --git a/src/timeout.c b/src/timeout.c +index c8749d0..95f6e46 100644 +--- a/src/timeout.c ++++ b/src/timeout.c +@@ -133,6 +133,7 @@ settimeout (double duration, bool warn) + resolution provided by alarm(). */ + + #if HAVE_TIMER_SETTIME ++{ + struct timespec ts = dtotimespec (duration); + struct itimerspec its = { {0, 0}, ts }; + timer_t timerid; +@@ -149,8 +150,10 @@ settimeout (double duration, bool warn) + } + else if (warn && errno != ENOSYS) + error (0, errno, _("warning: timer_create")); ++} + #endif + ++{ + unsigned int timeint; + if (UINT_MAX <= duration) + timeint = UINT_MAX; +@@ -161,6 +164,7 @@ settimeout (double duration, bool warn) + } + alarm (timeint); + } ++} + + /* send SIG avoiding the current process. */ + +diff --git a/src/wc.c b/src/wc.c +index 93decd7..619f44c 100644 +--- a/src/wc.c ++++ b/src/wc.c +@@ -597,6 +597,9 @@ main (int argc, char **argv) + char *files_from = NULL; + struct fstatus *fstatus; + struct Tokens tok; ++ bool read_tokens = false; ++ struct argv_iterator *ai; ++ int i; + + initialize_main (&argc, &argv); + set_program_name (argv[0]); +@@ -653,10 +656,9 @@ main (int argc, char **argv) + || print_linelength)) + print_lines = print_words = print_bytes = true; + +- bool read_tokens = false; +- struct argv_iterator *ai; + if (files_from) + { ++ struct stat st; + FILE *stream; + + /* When using --files0-from=F, you may not specify any files +@@ -681,7 +683,6 @@ main (int argc, char **argv) + + /* Read the file list into RAM if we can detect its size and that + size is reasonable. Otherwise, we'll read a name at a time. */ +- struct stat st; + if (fstat (fileno (stream), &st) == 0 + && S_ISREG (st.st_mode) + && st.st_size <= MIN (10 * 1024 * 1024, physmem_available () / 2)) +@@ -716,7 +717,6 @@ main (int argc, char **argv) + fstatus = get_input_fstatus (nfiles, files); + number_width = compute_number_width (nfiles, fstatus); + +- int i; + ok = true; + for (i = 0; /* */; i++) + { +-- +1.8.3.4 + diff --git a/sys-apps/coreutils/patches/coreutils-8.22.patchset b/sys-apps/coreutils/patches/coreutils-8.22.patchset new file mode 100644 index 000000000..49268ba54 --- /dev/null +++ b/sys-apps/coreutils/patches/coreutils-8.22.patchset @@ -0,0 +1,256 @@ +From b5e90c4656599710617ca6a24c750ef9f1c93b5f Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 13 May 2014 16:20:12 +0000 +Subject: avoid warning on gcc 4.6+ + + +diff --git a/lib/fadvise.c b/lib/fadvise.c +index 8d3af99..f9e0f27 100644 +--- a/lib/fadvise.c ++++ b/lib/fadvise.c +@@ -14,6 +14,10 @@ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + ++#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNU_C__ ++# pragma GCC diagnostic ignored "-Wsuggest-attribute=const" ++#endif ++ + #include + #include "fadvise.h" + +-- +1.8.3.4 + + +From 23a01facb7fd62c93e3df82a4302dca3aaee4944 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 13 May 2014 17:18:52 +0000 +Subject: define __USE_GNU for wempcpy + + +diff --git a/lib/fnmatch.c b/lib/fnmatch.c +index 6a09e1a..a26b0ca 100644 +--- a/lib/fnmatch.c ++++ b/lib/fnmatch.c +@@ -21,6 +21,9 @@ + #ifndef _GNU_SOURCE + # define _GNU_SOURCE 1 + #endif ++#ifndef __USE_GNU ++# define __USE_GNU 1 ++#endif + + #if ! defined __builtin_expect && __GNUC__ < 3 + # define __builtin_expect(expr, expected) (expr) +-- +1.8.3.4 + + +From a277df80f2d5dba4b4519a97ea9042fb56c9feb5 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 13 May 2014 17:22:10 +0000 +Subject: force declaration of rpl_inet_ntop + + +diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h +index ba89e97..3be3941 100644 +--- a/lib/arpa_inet.in.h ++++ b/lib/arpa_inet.in.h +@@ -72,7 +72,7 @@ + + For more details, see the POSIX:2001 specification + . */ +-# if @REPLACE_INET_NTOP@ ++# if 1 + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef inet_ntop + # define inet_ntop rpl_inet_ntop +-- +1.8.3.4 + + +From e0b54fa2760209c59364a131cd7aced2f9958790 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 13 May 2014 17:32:36 +0000 +Subject: Haiku defines mknod in unistd.h + + +diff --git a/lib/mknod.c b/lib/mknod.c +index 71e9d34..1dc218c 100644 +--- a/lib/mknod.c ++++ b/lib/mknod.c +@@ -18,6 +18,7 @@ + + #include + ++#include + #include + + #include +-- +1.8.3.4 + + +From 45cd156446cd8ac305462f48b2e871fdddc39b93 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 13 May 2014 17:35:25 +0000 +Subject: protect the label, not used on Haiku + + +diff --git a/lib/mountlist.c b/lib/mountlist.c +index b839cd1..c095a25 100644 +--- a/lib/mountlist.c ++++ b/lib/mountlist.c +@@ -953,7 +953,7 @@ read_file_system_list (bool need_fs_type) + *mtail = NULL; + return mount_list; + +- ++#ifndef __HAIKU__ + free_then_fail: + { + int saved_errno = errno; +@@ -969,6 +969,7 @@ read_file_system_list (bool need_fs_type) + errno = saved_errno; + return NULL; + } ++#endif + } + + /* Free a mount entry as returned from read_file_system_list (). */ +-- +1.8.3.4 + + +From 0dcf7067f72fdb61b8ce4705dae4a6e82ac7542f Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Tue, 13 May 2014 17:38:39 +0000 +Subject: protect a bool not used on Haiku + + +diff --git a/lib/rename.c b/lib/rename.c +index 3e463ea..8dff5d5 100644 +--- a/lib/rename.c ++++ b/lib/rename.c +@@ -285,7 +285,9 @@ rpl_rename (char const *src, char const *dst) + char *dst_temp = (char *) dst; + bool src_slash; + bool dst_slash; ++#if RENAME_DEST_EXISTS_BUG + bool dst_exists; ++#endif + int ret_val = -1; + int rename_errno = ENOTDIR; + struct stat src_st; +@@ -340,7 +342,9 @@ rpl_rename (char const *src, char const *dst) + { + if (errno != ENOENT || (!S_ISDIR (src_st.st_mode) && dst_slash)) + return -1; ++#if RENAME_DEST_EXISTS_BUG + dst_exists = false; ++#endif + } + else + { +@@ -353,7 +357,9 @@ rpl_rename (char const *src, char const *dst) + if (SAME_INODE (src_st, dst_st)) + return 0; + # endif /* RENAME_HARD_LINK_BUG */ ++#if RENAME_DEST_EXISTS_BUG + dst_exists = true; ++#endif + } + + # if (RENAME_TRAILING_SLASH_SOURCE_BUG || RENAME_DEST_EXISTS_BUG \ +-- +1.8.3.4 + + +From c75141b2cf4726e9f83a2d415c3b1585360552cc Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Thu, 15 May 2014 15:40:32 +0000 +Subject: strchrnul needs __USE_GNU on Haiku + + +diff --git a/lib/regex.h b/lib/regex.h +index 854c6ed..86f16b8 100644 +--- a/lib/regex.h ++++ b/lib/regex.h +@@ -31,8 +31,10 @@ extern "C" { + /* Define __USE_GNU to declare GNU extensions that violate the + POSIX name space rules. */ + #ifdef _GNU_SOURCE ++#ifndef __USE_GNU + # define __USE_GNU 1 + #endif ++#endif + + #ifdef _REGEX_LARGE_OFFSETS + +diff --git a/lib/string.in.h b/lib/string.in.h +index d7a6c9c..729338d 100644 +--- a/lib/string.in.h ++++ b/lib/string.in.h +@@ -23,6 +23,9 @@ + @PRAGMA_COLUMNS@ + + /* The include_next requires a split double-inclusion guard. */ ++#ifndef __USE_GNU ++#define __USE_GNU ++#endif + #@INCLUDE_NEXT@ @NEXT_STRING_H@ + + #ifndef _@GUARD_PREFIX@_STRING_H +-- +1.8.3.4 + + +From ab49c9e1edac815682126be26afd0b70d1e30f87 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Thu, 15 May 2014 20:13:58 +0000 +Subject: don't build hostid, uptime, nice, users, who, dd + + +diff --git a/Makefile.in b/Makefile.in +index dab25d0..3be1664 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -611,16 +611,15 @@ src_libver_a_LIBADD = + 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) \ +- src/stdbuf$(EXEEXT) src/stty$(EXEEXT) src/uptime$(EXEEXT) \ +- src/users$(EXEEXT) src/who$(EXEEXT) ++am__EXEEXT_2 = src/chroot$(EXEEXT) src/df$(EXEEXT) \ ++ src/libstdbuf.so$(EXEEXT) \ ++ src/stdbuf$(EXEEXT) src/stty$(EXEEXT) + am__EXEEXT_3 = src/[$(EXEEXT) src/base64$(EXEEXT) \ + src/basename$(EXEEXT) src/cat$(EXEEXT) src/chcon$(EXEEXT) \ + src/chgrp$(EXEEXT) src/chmod$(EXEEXT) src/chown$(EXEEXT) \ + src/cksum$(EXEEXT) src/comm$(EXEEXT) src/cp$(EXEEXT) \ + src/csplit$(EXEEXT) src/cut$(EXEEXT) src/date$(EXEEXT) \ +- src/dd$(EXEEXT) src/dir$(EXEEXT) src/dircolors$(EXEEXT) \ ++ src/dir$(EXEEXT) src/dircolors$(EXEEXT) \ + src/dirname$(EXEEXT) src/du$(EXEEXT) src/echo$(EXEEXT) \ + src/env$(EXEEXT) src/expand$(EXEEXT) src/expr$(EXEEXT) \ + src/factor$(EXEEXT) src/false$(EXEEXT) src/fmt$(EXEEXT) \ +@@ -3247,12 +3246,12 @@ WARN_ON_USE_H = lib/warn-on-use.h + # FIXME: once lib/ and gnulib-tests/ are also converted, hoist to Makefile.am + AM_CFLAGS = $(WERROR_CFLAGS) + no_install__progs = src/arch src/hostname +-build_if_possible__progs = src/chroot src/df src/hostid \ ++build_if_possible__progs = src/chroot src/df \ + src/libstdbuf.so src/nice src/pinky src/stdbuf src/stty \ + src/uptime src/users src/who + default__progs = src/[ src/base64 src/basename src/cat src/chcon \ + src/chgrp src/chmod src/chown src/cksum src/comm src/cp \ +- src/csplit src/cut src/date src/dd src/dir src/dircolors \ ++ src/csplit src/cut src/date src/dir src/dircolors \ + src/dirname src/du src/echo src/env src/expand src/expr \ + src/factor src/false src/fmt src/fold src/ginstall src/groups \ + src/head src/id src/join src/kill src/link src/ln src/logname \ +-- +1.8.3.4 diff --git a/sys-devel/bin86/bin86-0.16.21.recipe b/sys-devel/bin86/bin86-0.16.21.recipe new file mode 100644 index 000000000..a3b60ec9f --- /dev/null +++ b/sys-devel/bin86/bin86-0.16.21.recipe @@ -0,0 +1,56 @@ +SUMMARY="A simple assember and linker for 8086 - 80386 machine code." +DESCRIPTION=" +as86 is an assembler for the 8086..80386 processors, it's syntax is closer \ +to the intel/microsoft form rather than the more normal generic form of \ +the unix system assembler. +The linker understands only the object files produced by the as86 assembler, \ +it can link them into either an impure or a separate I&D executable. +" +HOMEPAGE="http://v3.sk/~lkundrak/dev86/" +COPYRIGHT=" + 1994 Bruce Evans + 1999 Robert de Bath +" +LICENSE="GNU GPL v2" +SRC_URI="http://v3.sk/~lkundrak/dev86/$portVersionedName.tar.gz" +CHECKSUM_SHA256="021e37cde3a20632c4c9000993cb4aa9f58cb82b1d3c26b9aeb62d6566925738" +REVISION="1" + +ARCHITECTURES="x86 x86_64 x86_gcc2" +SECONDARY_ARCHITECTURES="x86" + +PATCHES="${portVersionedName}.patchset" + +PROVIDES=" + bin86$secondaryArchSuffix = $portVersion compat >= 0 + cmd:as86 + cmd:ld86 + cmd:nm86 + cmd:objdump86 + cmd:size86 + " + +REQUIRES=" + haiku$secondaryArchSuffix >= $haikuVersion + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel >= $haikuVersion + " + +BUILD_PREREQUIRES=" + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:make + " + +BUILD() +{ + make $jobArgs +} + +INSTALL() +{ + mkdir -p $binDir $manDir + make BINDIR=$binDir MANDIR=$manDir install +} diff --git a/sys-devel/bin86/patches/bin86-0.16.21.patchset b/sys-devel/bin86/patches/bin86-0.16.21.patchset new file mode 100644 index 000000000..e8f34eab7 --- /dev/null +++ b/sys-devel/bin86/patches/bin86-0.16.21.patchset @@ -0,0 +1,24 @@ +From 5dba21d7b8b1850e0a590d2a4f58b56ee983deb1 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Wed, 21 May 2014 18:01:48 +0000 +Subject: apply amd64 patch from Gentoo. + + +diff --git a/ld/x86_aout.h b/ld/x86_aout.h +index 542a70d..a38488d 100644 +--- a/ld/x86_aout.h ++++ b/ld/x86_aout.h +@@ -19,7 +19,9 @@ typedef long Long; + typedef int32_t Long; + #define __OUT_OK 1 + #else +-typedef char Long[4]; ++#define __OUT_OK 1 ++#include ++typedef int32_t Long; + #endif + #endif + +-- +1.8.3.4 + diff --git a/sys-devel/clang/clang-3.4.recipe b/sys-devel/clang/clang-3.4.recipe index 24fc56b58..ddeac702e 100644 --- a/sys-devel/clang/clang-3.4.recipe +++ b/sys-devel/clang/clang-3.4.recipe @@ -29,13 +29,15 @@ PROVIDES=" cmd:clang = $portVersion cmd:clang++ = $portVersion cmd:c_index_test = $portVersion - lib:libLTO = $portVersion - lib:libclang = $portVersion - lib:libprofile_rt = $portVersion + lib:libLTO$secondaryArchSuffix = $portVersion + lib:libclang$secondaryArchSuffix = $portVersion + devel:libLTO$secondaryArchSuffix = $portVersion + devel:libclang$secondaryArchSuffix = $portVersion " REQUIRES=" haiku$secondaryArchSuffix >= $haikuVersion + lib:libstdc++$secondaryArchSuffix " BUILD_REQUIRES=" @@ -73,15 +75,21 @@ BUILD() # TODO: clang's build system seems to ignore doc / man / shared dirs? runConfigure ./configure --enable-optimized - make $jobArgs + make $jobArgs PROJ_datadir=$dataDir PROJ_docsdir=$docDir \ + PROJ_mandir=$manDir PROJ_includedir=$includeDir PROJ_libdir=$libDir } INSTALL() { mkdir -p $developDir mkdir -p $docDir + mkdir -p $binDir - make install-clang + make install-clang PROJ_datadir=$dataDir PROJ_docsdir=$docDir \ + PROJ_mandir=$manDir PROJ_includedir=$includeDir PROJ_libdir=$libDir + + # Remove empty dir that shouldn't be created + rmdir $prefix/include # Install static analysis tools mkdir -p $developDir/tools/clang$secondaryArchSuffix @@ -92,6 +100,8 @@ INSTALL() ln -s $developDir/tools/clang$secondaryArchSuffix/scan-view/scan-view $binDir/scan-view ln -s $binDir/clang $developDir/tools/clang$secondaryArchSuffix/scan-build/clang + prepareInstalledDevelLibs libclang libLTO + # analysis package packageEntries analysis \ $binDir/scan-build \ @@ -110,8 +120,8 @@ TEST() SUMMARY_analysis="Static analysis tools using the clang compiler" PROVIDES_analysis=" clang${secondaryArchSuffix}_analysis = $portVersion - cmd:scan_build = $portVersion - cmd:scan_view = $portVersion + cmd:scan_build$secondaryArchSuffix = $portVersion + cmd:scan_view$secondaryArchSuffix = $portVersion " REQUIRES_analysis=" diff --git a/sys-devel/clang/patches/clang-3.4.patchset b/sys-devel/clang/patches/clang-3.4.patchset index 64545c08a..fe49b7052 100644 --- a/sys-devel/clang/patches/clang-3.4.patchset +++ b/sys-devel/clang/patches/clang-3.4.patchset @@ -1,20 +1,17 @@ -From 33c9dfc71ce4a7cc0a0e5967b9110bcbc3d0a7d7 Mon Sep 17 00:00:00 2001 +From dbc97e44eaeb44908e8e71edd0f6f64f79cfef3e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 24 Jan 2014 02:22:17 +0000 -Subject: [PATCH] haiku: Fix header search paths +Subject: haiku: Fix header search paths * /boot/develop no longer exists * /boot/common no longer exists * We still need to figure something out for secondary architecture builds. ---- - lib/Frontend/InitHeaderSearch.cpp | 70 +++++++++++++++++++++------------------ - 1 file changed, 38 insertions(+), 32 deletions(-) -diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp +diff --git a/clang-3.4/lib/Frontend/InitHeaderSearch.cpp b/clang-3.4/lib/Frontend/InitHeaderSearch.cpp index d144cbb..e96e329 100644 ---- a/lib/Frontend/InitHeaderSearch.cpp -+++ b/lib/Frontend/InitHeaderSearch.cpp +--- a/clang-3.4/lib/Frontend/InitHeaderSearch.cpp ++++ b/clang-3.4/lib/Frontend/InitHeaderSearch.cpp @@ -272,38 +272,44 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, llvm_unreachable("Include management is handled in the driver."); @@ -95,3 +92,26 @@ index d144cbb..e96e329 100644 -- 1.8.3.4 + +From 67f6c48d61c2350ec3063c373f5c8ad196c456df Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sun, 18 May 2014 12:41:50 +0200 +Subject: libclang: add soname when building on Haiku. + + +diff --git a/clang-3.4/tools/libclang/Makefile b/clang-3.4/tools/libclang/Makefile +index 43ecbd1..837276d 100644 +--- a/clang-3.4/tools/libclang/Makefile ++++ b/clang-3.4/tools/libclang/Makefile +@@ -29,7 +29,7 @@ USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a \ + include $(CLANG_LEVEL)/Makefile + + # Add soname to the library. +-ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU GNU/kFreeBSD)) ++ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU GNU/kFreeBSD Haiku)) + LLVMLibsOptions += -Wl,-soname,lib$(LIBRARYNAME)$(SHLIBEXT) + endif + +-- +1.8.3.4 + diff --git a/sys-devel/clang/patches/llvm-3.4.patchset b/sys-devel/clang/patches/llvm-3.4.patchset index 9f14d94d8..0f9980987 100644 --- a/sys-devel/clang/patches/llvm-3.4.patchset +++ b/sys-devel/clang/patches/llvm-3.4.patchset @@ -1,11 +1,8 @@ -From 744634aa845c403f5a39b8257bbacd36dc1dd351 Mon Sep 17 00:00:00 2001 +From 9cc674f2aa0f54b900d1e773a6ffd201c23e4c05 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Wed, 22 Jan 2014 05:04:31 +0000 -Subject: [PATCH] haiku: fix Host.h for endian.h +Subject: haiku: fix Host.h for endian.h ---- - include/llvm/Support/Host.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/llvm/Support/Host.h b/include/llvm/Support/Host.h index 28c4cc7..ab985a4 100644 @@ -23,3 +20,28 @@ index 28c4cc7..ab985a4 100644 -- 1.8.3.4 + +From 577d261e8e74bc442fe75515e043f268db923ed3 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sun, 18 May 2014 12:41:16 +0200 +Subject: libLTO: add soname when building on Haiku. + + +diff --git a/tools/lto/Makefile b/tools/lto/Makefile +index cedbee1..5ce530d 100644 +--- a/tools/lto/Makefile ++++ b/tools/lto/Makefile +@@ -22,6 +22,10 @@ ifdef LLVM_VERSION_INFO + CXX.Flags += -DLLVM_VERSION_INFO='"$(LLVM_VERSION_INFO)"' + endif + ++ifeq ($(HOST_OS),Haiku) ++ LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-soname=$(SharedPrefix)LTO$(SHLIBEXT) ++endif ++ + ifeq ($(HOST_OS),Darwin) + # Special hack to allow libLTO to have an offset version number. + ifdef LLVM_LTO_VERSION_OFFSET +-- +1.8.3.4 +