depends: add mess of depends
authorCory Fields <theuni-nospam-@xbmc.org>
Sat, 9 Mar 2013 04:16:23 +0000 (23:16 -0500)
committerCory Fields <theuni-nospam-@xbmc.org>
Mon, 11 Mar 2013 04:16:02 +0000 (00:16 -0400)
240 files changed:
tools/depends/.gitignore [new file with mode: 0644]
tools/depends/Makefile [new file with mode: 0644]
tools/depends/Makefile.include.in [new file with mode: 0644]
tools/depends/README [new file with mode: 0644]
tools/depends/aux/config.guess [new file with mode: 0644]
tools/depends/aux/config.sub [new file with mode: 0644]
tools/depends/aux/install-sh [new file with mode: 0644]
tools/depends/bootstrap [new file with mode: 0755]
tools/depends/configure.in [new file with mode: 0644]
tools/depends/native/Makefile [new file with mode: 0644]
tools/depends/native/autoconf-native/Makefile [new file with mode: 0644]
tools/depends/native/automake-native/Makefile [new file with mode: 0644]
tools/depends/native/cmake-native/Makefile [new file with mode: 0644]
tools/depends/native/config.site.native.in [new file with mode: 0644]
tools/depends/native/dpkg-native/Makefile [new file with mode: 0644]
tools/depends/native/gas-preprocessor-native/Makefile [new file with mode: 0644]
tools/depends/native/gas-preprocessor-native/README [new file with mode: 0644]
tools/depends/native/gas-preprocessor-native/gas-preprocessor.pl [new file with mode: 0755]
tools/depends/native/gettext-native/01-gettext-tools-stpncpy.patch [new file with mode: 0644]
tools/depends/native/gettext-native/Makefile [new file with mode: 0644]
tools/depends/native/libjpeg-turbo-native/Makefile [new file with mode: 0644]
tools/depends/native/liblzo2-native/Makefile [new file with mode: 0644]
tools/depends/native/libpng-native/Makefile [new file with mode: 0644]
tools/depends/native/libsdl-native/01-SDL_SetWidthHeight.patch [new file with mode: 0644]
tools/depends/native/libsdl-native/02-mmx.patch [new file with mode: 0644]
tools/depends/native/libsdl-native/Makefile [new file with mode: 0644]
tools/depends/native/libsdl_image-native/Makefile [new file with mode: 0644]
tools/depends/native/libtool-native/Makefile [new file with mode: 0644]
tools/depends/native/libtool-native/fix-libcrystax.patch [new file with mode: 0644]
tools/depends/native/m4-native/Makefile [new file with mode: 0644]
tools/depends/native/pcre-native/Makefile [new file with mode: 0644]
tools/depends/native/pkg-config-native/Makefile [new file with mode: 0644]
tools/depends/native/python26-native/Makefile [new file with mode: 0644]
tools/depends/native/python26-native/cpython-2.6.5-multiarch.patch [new file with mode: 0644]
tools/depends/native/python26-native/cpython-2.6.5-nosslv2.patch [new file with mode: 0644]
tools/depends/native/rpl-native/Makefile [new file with mode: 0644]
tools/depends/native/rpl-native/rpl [new file with mode: 0644]
tools/depends/native/swig-native/Makefile [new file with mode: 0644]
tools/depends/native/tiff-native/Makefile [new file with mode: 0644]
tools/depends/native/yasm-native/Makefile [new file with mode: 0644]
tools/depends/native/zlib-native/Makefile [new file with mode: 0644]
tools/depends/native/zlib-native/visibility.patch [new file with mode: 0644]
tools/depends/pre-depends/autoconf-pre-depends/Makefile [new file with mode: 0644]
tools/depends/pre-depends/m4-pre-depends/Makefile [new file with mode: 0644]
tools/depends/target/Backrow/Makefile [new file with mode: 0644]
tools/depends/target/Makefile [new file with mode: 0644]
tools/depends/target/Toolchain.cmake.in [new file with mode: 0644]
tools/depends/target/afpfs-ng/01-gcrypt.patch [new file with mode: 0644]
tools/depends/target/afpfs-ng/02-pointer.patch [new file with mode: 0644]
tools/depends/target/afpfs-ng/04-boxee1.patch [new file with mode: 0644]
tools/depends/target/afpfs-ng/05-boxee2.patch [new file with mode: 0644]
tools/depends/target/afpfs-ng/06-boxee3.patch [new file with mode: 0644]
tools/depends/target/afpfs-ng/07-boxee4.patch [new file with mode: 0644]
tools/depends/target/afpfs-ng/08-boxee5.patch [new file with mode: 0644]
tools/depends/target/afpfs-ng/10-fix-errno.patch [new file with mode: 0644]
tools/depends/target/afpfs-ng/11-fix-stat.patch [new file with mode: 0644]
tools/depends/target/afpfs-ng/Makefile [new file with mode: 0644]
tools/depends/target/afpfs-ng/android.patch [new file with mode: 0644]
tools/depends/target/afpfs-ng/fix_afpfs-ng_includes.patch [new file with mode: 0644]
tools/depends/target/alsa-lib/Makefile [new file with mode: 0644]
tools/depends/target/alsa-lib/removeshm-2.patch [new file with mode: 0644]
tools/depends/target/alsa-lib/removeshm-3.patch [new file with mode: 0644]
tools/depends/target/alsa-lib/removeshm-upstream.patch [new file with mode: 0644]
tools/depends/target/alsa-lib/timeval.patch [new file with mode: 0644]
tools/depends/target/android-libc-replacements/locale.h [new file with mode: 0644]
tools/depends/target/android-sys/Makefile [new file with mode: 0644]
tools/depends/target/android-sys/iomx.cpp [new file with mode: 0644]
tools/depends/target/boost/Makefile [new file with mode: 0644]
tools/depends/target/boost/add-arm-mem-barrier.patch [new file with mode: 0644]
tools/depends/target/boost/fix-deprecated-swp.patch [new file with mode: 0644]
tools/depends/target/bzip2/Makefile [new file with mode: 0644]
tools/depends/target/bzip2/Makefile.patch [new file with mode: 0644]
tools/depends/target/config.site.in [new file with mode: 0644]
tools/depends/target/curl/Makefile [new file with mode: 0644]
tools/depends/target/dbus/Makefile [new file with mode: 0644]
tools/depends/target/dummy-libxbmc/Makefile [new file with mode: 0644]
tools/depends/target/dummy-libxbmc/dummy-libxbmc.c [new file with mode: 0644]
tools/depends/target/expat/Makefile [new file with mode: 0644]
tools/depends/target/fontconfig/01-fontconfig-cross-compile-fix.patch [new file with mode: 0644]
tools/depends/target/fontconfig/Makefile [new file with mode: 0644]
tools/depends/target/fontconfig/lconv.patch [new file with mode: 0644]
tools/depends/target/freetype2/Makefile [new file with mode: 0644]
tools/depends/target/fribidi/Makefile [new file with mode: 0644]
tools/depends/target/gettext/Makefile [new file with mode: 0644]
tools/depends/target/jasper/Makefile [new file with mode: 0644]
tools/depends/target/jpeg/Makefile [new file with mode: 0644]
tools/depends/target/libGLEW/Makefile [new file with mode: 0644]
tools/depends/target/libamplayer/Makefile [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/amports/aformat.h [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/amports/amstream.h [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/amports/vformat.h [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/log_print.h [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/message.h [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/player.h [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/player_error.h [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/player_id.h [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/player_set_sys.h [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/player_thumbnail.h [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/player_type.h [new file with mode: 0644]
tools/depends/target/libamplayer/libamplayer/include/stream_format.h [new file with mode: 0644]
tools/depends/target/libass/Makefile [new file with mode: 0644]
tools/depends/target/libbluray/Makefile [new file with mode: 0644]
tools/depends/target/libcdio-gplv3/Makefile [new file with mode: 0644]
tools/depends/target/libcdio-gplv3/osx.patch [new file with mode: 0644]
tools/depends/target/libcdio/Makefile [new file with mode: 0644]
tools/depends/target/libcdio/configure.patch [new file with mode: 0644]
tools/depends/target/libcdio/cross.patch [new file with mode: 0644]
tools/depends/target/libcec/Makefile [new file with mode: 0644]
tools/depends/target/libcrystalhd/Makefile [new file with mode: 0644]
tools/depends/target/libcrystalhd/libcrystalhd/bc_dts_defs.h [new file with mode: 0644]
tools/depends/target/libcrystalhd/libcrystalhd/bc_dts_types.h [new file with mode: 0644]
tools/depends/target/libcrystalhd/libcrystalhd/libcrystalhd_if.h [new file with mode: 0644]
tools/depends/target/libcrystalhd/libcrystalhd/libcrystalhd_version.h [new file with mode: 0644]
tools/depends/target/libffi/Makefile [new file with mode: 0644]
tools/depends/target/libflac/Makefile [new file with mode: 0644]
tools/depends/target/libflac/autoreconf.patch [new file with mode: 0644]
tools/depends/target/libflac/nasm.patch [new file with mode: 0644]
tools/depends/target/libgcrypt/01-static-mpi_mpi-internal.patch [new file with mode: 0644]
tools/depends/target/libgcrypt/02-armasm.patch [new file with mode: 0644]
tools/depends/target/libgcrypt/03-gcrypt-android-select.patch [new file with mode: 0644]
tools/depends/target/libgcrypt/Makefile [new file with mode: 0644]
tools/depends/target/libgpg-error/Makefile [new file with mode: 0644]
tools/depends/target/libiconv/Makefile [new file with mode: 0644]
tools/depends/target/libjpeg-turbo/Makefile [new file with mode: 0644]
tools/depends/target/liblzo2/Makefile [new file with mode: 0644]
tools/depends/target/libmad/01-libmad-pkgconfig.patch [new file with mode: 0644]
tools/depends/target/libmad/02-libmad-thumb-fix.patch [new file with mode: 0644]
tools/depends/target/libmad/Makefile [new file with mode: 0644]
tools/depends/target/libmicrohttpd/Makefile [new file with mode: 0644]
tools/depends/target/libmicrohttpd/fix-android-include.patch [new file with mode: 0644]
tools/depends/target/libmodplug/Makefile [new file with mode: 0644]
tools/depends/target/libmp3lame/Makefile [new file with mode: 0644]
tools/depends/target/libmpeg2/01-libmpeg2-add-asm-leading-underscores.patch [new file with mode: 0644]
tools/depends/target/libmpeg2/02-neon.patch [new file with mode: 0644]
tools/depends/target/libmpeg2/03-config-fix.patch [new file with mode: 0644]
tools/depends/target/libmpeg2/Makefile [new file with mode: 0644]
tools/depends/target/libnfs/Makefile [new file with mode: 0644]
tools/depends/target/libnfs/timeval.patch [new file with mode: 0644]
tools/depends/target/libogg/Makefile [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/Makefile [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/android-fix-build.patch [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/oscl_base_macros.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_ansi_memory.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_check.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_compiler_warnings.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_error.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_error_check.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_global_new_delete.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_global_placement_new.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_io.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_io_check.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_ix86.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_lib.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_lib_check.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_limits_typedefs.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_memory.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_memory_check.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_no_os.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc_check.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc_unix_android.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc_unix_common.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_time.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_time_check.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_unix_android.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_unix_common.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_util.h [new file with mode: 0644]
tools/depends/target/libomxil-bellagio/oscl/osclconfig_util_check.h [new file with mode: 0644]
tools/depends/target/libplist/0001-dontbuildswig.patch [new file with mode: 0644]
tools/depends/target/libplist/Makefile [new file with mode: 0644]
tools/depends/target/libpng/Makefile [new file with mode: 0644]
tools/depends/target/librtmp/Makefile [new file with mode: 0644]
tools/depends/target/librtmp/librtmp-60-second-fix.patch [new file with mode: 0644]
tools/depends/target/librtmp/prefix.patch [new file with mode: 0644]
tools/depends/target/libsamplerate/Makefile [new file with mode: 0644]
tools/depends/target/libsdl/01-SDL_SetWidthHeight.patch [new file with mode: 0644]
tools/depends/target/libsdl/02-mmx.patch [new file with mode: 0644]
tools/depends/target/libsdl/Makefile [new file with mode: 0644]
tools/depends/target/libsdl_image/Makefile [new file with mode: 0644]
tools/depends/target/libshairport/001_add_ao.patch [new file with mode: 0644]
tools/depends/target/libshairport/002_fix_install_header.patch [new file with mode: 0644]
tools/depends/target/libshairport/003_fix_deadlock.patch [new file with mode: 0644]
tools/depends/target/libshairport/004_fix_bad_access.patch [new file with mode: 0644]
tools/depends/target/libshairport/005_fix_shutdown.patch [new file with mode: 0644]
tools/depends/target/libshairport/006_no_printf.patch [new file with mode: 0644]
tools/depends/target/libshairport/007_fix_syslog_defines.patch [new file with mode: 0644]
tools/depends/target/libshairport/008-add-missing-libs.patch [new file with mode: 0644]
tools/depends/target/libshairport/009_fix_ipv6.patch [new file with mode: 0644]
tools/depends/target/libshairport/010_handle_metadata.patch [new file with mode: 0644]
tools/depends/target/libshairport/011_fix_ipv4_fallback.patch [new file with mode: 0644]
tools/depends/target/libshairport/Makefile [new file with mode: 0644]
tools/depends/target/libshairport/android.patch [new file with mode: 0644]
tools/depends/target/libssh/Makefile [new file with mode: 0644]
tools/depends/target/libssh/android.patch [new file with mode: 0644]
tools/depends/target/libssh/md5.patch [new file with mode: 0644]
tools/depends/target/libssh/removelegacy.patch [new file with mode: 0644]
tools/depends/target/libssh2/Makefile [new file with mode: 0644]
tools/depends/target/libssh2/libdl.patch [new file with mode: 0644]
tools/depends/target/libusb/Makefile [new file with mode: 0644]
tools/depends/target/libvorbis/Makefile [new file with mode: 0644]
tools/depends/target/libxml2/Makefile [new file with mode: 0644]
tools/depends/target/libzip/Makefile [new file with mode: 0644]
tools/depends/target/mysql/01-mysqlclient-cross-compile.patch [new file with mode: 0644]
tools/depends/target/mysql/02-mysqlclient-ios.patch [new file with mode: 0644]
tools/depends/target/mysql/03-mysqlclient-android.patch [new file with mode: 0644]
tools/depends/target/mysql/04-strnlen.patch [new file with mode: 0644]
tools/depends/target/mysql/Makefile [new file with mode: 0644]
tools/depends/target/openssl/Makefile [new file with mode: 0644]
tools/depends/target/openssl/libz.patch [new file with mode: 0644]
tools/depends/target/pcre/Makefile [new file with mode: 0644]
tools/depends/target/python26/Makefile [new file with mode: 0644]
tools/depends/target/python26/Python-2.6-ctypes.patch [new file with mode: 0644]
tools/depends/target/python26/Python-2.6.2-android.patch [new file with mode: 0644]
tools/depends/target/python26/Python-2.6.5-ffi-static.patch [new file with mode: 0644]
tools/depends/target/python26/Python-2.6.5-scproxy.patch [new file with mode: 0644]
tools/depends/target/python26/Python-2.6.5-xcompile.patch [new file with mode: 0644]
tools/depends/target/python26/Python-no-export-path.patch [new file with mode: 0644]
tools/depends/target/python26/Python-no-modules.patch [new file with mode: 0644]
tools/depends/target/python26/modules.setup [new file with mode: 0644]
tools/depends/target/python26/python-osx-environ-fix.patch [new file with mode: 0644]
tools/depends/target/samba-gplv3/Makefile [new file with mode: 0644]
tools/depends/target/samba/Makefile [new file with mode: 0644]
tools/depends/target/samba/samba30-3.0.37-CVE-2010-2063.patch [new file with mode: 0644]
tools/depends/target/samba/samba30-3.0.37-configure.in.patch [new file with mode: 0644]
tools/depends/target/samba/samba30-3.0.37-silence-receive-warning.patch [new file with mode: 0644]
tools/depends/target/samba/samba30-3.0.37-vfs_default.c.patch [new file with mode: 0644]
tools/depends/target/samba/samba30-3.0.37-wle-fix.patch [new file with mode: 0644]
tools/depends/target/samba/samba_android.patch [new file with mode: 0644]
tools/depends/target/sqlite3/Makefile [new file with mode: 0644]
tools/depends/target/taglib/Makefile [new file with mode: 0644]
tools/depends/target/tiff/Makefile [new file with mode: 0644]
tools/depends/target/tinyxml/Makefile [new file with mode: 0644]
tools/depends/target/xbmc-pvr-addons/Makefile [new file with mode: 0644]
tools/depends/target/xbmc/Makefile [new file with mode: 0644]
tools/depends/target/yajl/Makefile [new file with mode: 0644]
tools/depends/target/yajl/shared.patch [new file with mode: 0644]
tools/depends/target/yajl/static.patch [new file with mode: 0644]
tools/depends/target/zlib/Makefile [new file with mode: 0644]
tools/depends/target/zlib/visibility.patch [new file with mode: 0644]

diff --git a/tools/depends/.gitignore b/tools/depends/.gitignore
new file mode 100644 (file)
index 0000000..755370a
--- /dev/null
@@ -0,0 +1,23 @@
+/configure
+/Makefile.include
+/autom4te.cache/
+/**/.gitignore
+/**/.installed-*
+/target/*/.installed-*
+/native/*/.installed-*
+/target/*/x86/*
+/native/*/x86-native/*
+/target/*/armeabi-v7a/*
+/native/*/armeabi-v7a-native/*
+/target/*/arm-linux-gnueabihf/*
+/native/*/x86_64-linux-gnu-native/*
+/target/*/arm-linux-androideabi-*/*
+/target/*/x86_64-linux-gnu/*
+/target/*/arm-linux-gnueabi/*
+/native/*/x86_64-darwin10.8.0-native/*
+/target/*/arm-apple-darwin/*
+/target/*/x86_64-apple-darwin/*
+/target/*/i386-apple-darwin/*
+Toolchain.cmake
+config.site
+config.site.native
diff --git a/tools/depends/Makefile b/tools/depends/Makefile
new file mode 100644 (file)
index 0000000..8f53370
--- /dev/null
@@ -0,0 +1,25 @@
+include Makefile.include
+
+NATIVE=native/.installed-$(NATIVEPLATFORM)
+target=target/.installed-$(PLATFORM)
+all: $(target)
+
+$(NATIVE):
+       $(MAKE) -C native
+
+$(target): $(NATIVE)
+       $(MAKE) -C target
+
+clean:
+       $(MAKE) -C native clean
+       $(MAKE) -C target clean
+
+test-dependencies:
+       $(MAKE) -C native test-dependencies
+       $(MAKE) -C native
+       $(MAKE) -C target test-dependencies
+
+distclean::
+       $(MAKE) -C native distclean
+       $(MAKE) -C target distclean
+
diff --git a/tools/depends/Makefile.include.in b/tools/depends/Makefile.include.in
new file mode 100644 (file)
index 0000000..3cf627b
--- /dev/null
@@ -0,0 +1,81 @@
+TOOLCHAIN=@use_toolchain@
+NDKROOT=@use_ndk@
+SDKROOT=@use_sdk_path@
+TARBALLS_LOCATION=@use_tarballs@
+PLATFORM=@deps_dir@
+HOST=@use_host@
+CPU=@use_cpu@
+NATIVEPLATFORM=@build_cpu@-@build_os@-native
+SDK_PLATFORM=@use_sdk@
+RETRIEVE_TOOL=@CURL@
+ARCHIVE_TOOL=@TAR@
+PREFIX=@prefix@/@deps_dir@
+NATIVEPREFIX=@prefix@/@build_cpu@-@build_os@-native
+OS=@platform_os@
+CROSS_COMPILING=@cross_compiling@
+
+HAS_ZLIB=@has_zlib@
+NEED_LIBICONV=@need_libiconv@
+LINK_ICONV=@link_iconv@
+ENABLE_GPLV3=@use_gplv3@
+HAS_LIBCRYSTAX=@has_libcrystax@
+
+BASE_URL=http://mirrors.xbmc.org/build-deps/sources
+RETRIEVE_TOOL_FLAGS=-Ls --create-dirs -f -O
+ARCHIVE_TOOL_FLAGS=--strip-components=1 -xf
+CONFIG_SUB=@prefix@/@build_cpu@-@build_os@-native/share/automake-1.11/config.sub
+CONFIG_GUESS=@prefix@/@build_cpu@-@build_os@-native/share/automake-1.11/config.guess
+
+RPL=@prefix@/@build_cpu@-@build_os@-native/bin/python @prefix@/@build_cpu@-@build_os@-native/bin/rpl
+
+LD=@LD@
+CC=@CC@
+CXX=@CXX@
+CPP=@CPP@
+AR=@AR@
+RANLIB=@RANLIB@
+AS=@AS@
+NM=@NM@
+STRIP=@STRIP@
+READELF=@READELF@
+OBJDUMP=@OBJDUMP@
+
+CMAKE=@prefix@/@build_cpu@-@build_os@-native/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$(PREFIX)/share/Toolchain.cmake -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+CFLAGS=@platform_cflags@ @platform_includes@ -I@prefix@/@deps_dir@/include
+LDFLAGS=-L@prefix@/@deps_dir@/lib @platform_ldflags@
+CXXFLAGS=@platform_cxxflags@ @platform_includes@ -I@prefix@/@deps_dir@/include
+CPPFLAGS=@platform_cflags@ @platform_includes@ -I@prefix@/@deps_dir@/include
+
+PATH:=@prefix@/@build_cpu@-@build_os@-native/bin:$(PATH)
+ifneq (@use_build_toolchain@,)
+  PATH:=@use_build_toolchain@/bin:@use_build_toolchain@/usr/bin:$(PATH)
+endif
+LD_FOR_BUILD=@LD_FOR_BUILD@
+CC_FOR_BUILD=@CC_FOR_BUILD@
+CXX_FOR_BUILD=@CXX_FOR_BUILD@
+AR_FOR_BUILD=@AR_FOR_BUILD@
+RANLIB_FOR_BUILD=@RANLIB_FOR_BUILD@
+AS_FOR_BUILD=@AS_FOR_BUILD@
+NM_FOR_BUILD=@NM_FOR_BUILD@
+STRIP_FOR_BUILD=@STRIP_FOR_BUILD@
+READELF_FOR_BUILD=@READELF_FOR_BUILD@
+OBJDUMP_FOR_BUILD=@OBJDUMP_FOR_BUILD@
+
+NATIVE_CFLAGS=-I@prefix@/@build_cpu@-@build_os@-native/include
+NATIVE_LDFLAGS=-L@prefix@/@build_cpu@-@build_os@-native/lib
+NATIVE_CPPFLAGS=-I@prefix@/@build_cpu@-@build_os@-native/include
+NATIVE_CXXFLAGS=-I@prefix@/@build_cpu@-@build_os@-native/include
+
+
+export AUTOM4TE=@prefix@/@build_cpu@-@build_os@-native/bin/autom4te
+export AUTOMAKE=@prefix@/@build_cpu@-@build_os@-native/bin/automake
+export AUTOCONF=@prefix@/@build_cpu@-@build_os@-native/bin/autoconf
+export ACLOCAL=@prefix@/@build_cpu@-@build_os@-native/bin/aclocal
+export ACLOCAL_PATH=@prefix@/@deps_dir@/share/aclocal:@prefix@/@build_cpu@-@build_os@-native/share/aclocal
+export AUTOPOINT=@prefix@/@build_cpu@-@build_os@-native/bin/autopoint
+export AUTOHEADER=@prefix@/@build_cpu@-@build_os@-native/bin/autoheader
+export LIBTOOL=@prefix@/@build_cpu@-@build_os@-native/bin/libtool
+export LIBTOOLIZE=@prefix@/@build_cpu@-@build_os@-native/bin/libtoolize
+
+export AUTORECONF=@prefix@/@build_cpu@-@build_os@-native/bin/autoreconf
+
diff --git a/tools/depends/README b/tools/depends/README
new file mode 100644 (file)
index 0000000..63373c4
--- /dev/null
@@ -0,0 +1,22 @@
+Temporary readme:
+
+Examples:
+
+OSX:
+  x64:
+    ./configure --host=x86_64-apple-darwin # (defaults chosen)
+  x86:
+    ./configure --host=i386-apple-darwin
+
+IOS:
+  ./configure --host=arm-apple-darwin # (defaults chosen)
+  ./configure --host=arm-apple-darwin --with-sdk=4.3 --prefix=home/foo/xbmc-deps
+
+Android:
+  ./configure --with-toolchain=/opt/toolchains/android-ndk-r7-crystax-5.beta3-toolchain --prefix=/opt/xbmc-deps --host=arm-linux-androideabi
+
+Linux:
+  ARM toolchain (codesourcery/lenaro/etc)
+    ./configure --with-toolchain=/opt/toolchains/my-example-toolchain/  --prefix=/opt/xbmc-deps --host=arm-linux-gnueabi
+  Native toolchain
+    ./configure --with-toolchain=/usr --prefix=/opt/xbmc-deps --host=x86_64-linux-gnu
diff --git a/tools/depends/aux/config.guess b/tools/depends/aux/config.guess
new file mode 100644 (file)
index 0000000..49ba16f
--- /dev/null
@@ -0,0 +1,1522 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-01-01'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           sh5el) machine=sh5le-unknown ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE_ARCH}" in
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep -q __ELF__
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       exit ;;
+    *:OpenBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+       exit ;;
+    *:ekkoBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       exit ;;
+    *:SolidBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+       exit ;;
+    macppc:MirBSD:*:*)
+       echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    *:MirBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    alpha:OSF1:*:*)
+       case $UNAME_RELEASE in
+       *4.0)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               ;;
+       *5.*)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               ;;
+       esac
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE="alpha" ;;
+           "EV5 (21164)")
+               UNAME_MACHINE="alphaev5" ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE="alphaev56" ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE="alphapca56" ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE="alphapca57" ;;
+           "EV6 (21264)")
+               UNAME_MACHINE="alphaev6" ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE="alphaev67" ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE="alphaev69" ;;
+           "EV7 (21364)")
+               UNAME_MACHINE="alphaev7" ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE="alphaev79" ;;
+       esac
+       # A Pn.n version is a patched version.
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+       exitcode=$?
+       trap '' 0
+       exit $exitcode ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-unknown-sysv4
+       exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit ;;
+    *:z/VM:*:*)
+       echo s390-ibm-zvmoe
+       exit ;;
+    *:OS400:*:*)
+       echo powerpc-ibm-os400
+       exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+       echo arm-unknown-riscos
+       exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit ;;
+    NILE*:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit ;;
+    DRS?6000:unix:4.0:6*)
+       echo sparc-icl-nx6
+       exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7; exit ;;
+       esac ;;
+    s390x:SunOS:*:*)
+       echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+       echo i386-pc-auroraux${UNAME_RELEASE}
+       exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+       eval $set_cc_for_build
+       SUN_ARCH="i386"
+       # If there is a compiler, see if it is configured for 64-bit objects.
+       # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+       # This test works for both compilers.
+       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+           if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+               (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+               grep IS_64BIT_ARCH >/dev/null
+           then
+               SUN_ARCH="x86_64"
+           fi
+       fi
+       echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+       echo m68k-milan-mint${UNAME_RELEASE}
+       exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+       echo m68k-hades-mint${UNAME_RELEASE}
+       exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+       echo m68k-unknown-mint${UNAME_RELEASE}
+       exit ;;
+    m68k:machten:*:*)
+       echo m68k-apple-machten${UNAME_RELEASE}
+       exit ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c &&
+         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+         SYSTEM_NAME=`$dummy $dummyarg` &&
+           { echo "$SYSTEM_NAME"; exit; }
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit ;;
+    AViiON:dgux:*:*)
+       # DG/UX returns AViiON for all architectures
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+           else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
+       fi
+       exit ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+       echo i386-ibm-aix
+       exit ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+               then
+                       echo "$SYSTEM_NAME"
+               else
+                       echo rs6000-ibm-aix3.2.5
+               fi
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit ;;
+    *:AIX:*:[4567])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                   sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                   case "${sc_cpu_version}" in
+                     523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                     528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                     532)                      # CPU_PA_RISC2_0
+                       case "${sc_kernel_bits}" in
+                         32) HP_ARCH="hppa2.0n" ;;
+                         64) HP_ARCH="hppa2.0w" ;;
+                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                       esac ;;
+                   esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^            //' << EOF >$dummy.c
+
+               #define _HPUX_SOURCE
+               #include <stdlib.h>
+               #include <unistd.h>
+
+               int main ()
+               {
+               #if defined(_SC_KERNEL_BITS)
+                   long bits = sysconf(_SC_KERNEL_BITS);
+               #endif
+                   long cpu  = sysconf (_SC_CPU_VERSION);
+
+                   switch (cpu)
+                       {
+                       case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+                       case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+                       case CPU_PA_RISC2_0:
+               #if defined(_SC_KERNEL_BITS)
+                           switch (bits)
+                               {
+                               case 64: puts ("hppa2.0w"); break;
+                               case 32: puts ("hppa2.0n"); break;
+                               default: puts ("hppa2.0"); break;
+                               } break;
+               #else  /* !defined(_SC_KERNEL_BITS) */
+                           puts ("hppa2.0"); break;
+               #endif
+                       default: puts ("hppa1.0"); break;
+                       }
+                   exit (0);
+               }
+EOF
+                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   test -z "$HP_ARCH" && HP_ARCH=hppa
+               fi ;;
+       esac
+       if [ ${HP_ARCH} = "hppa2.0w" ]
+       then
+           eval $set_cc_for_build
+
+           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+           # generating 64-bit code.  GNU and HP use different nomenclature:
+           #
+           # $ CC_FOR_BUILD=cc ./config.guess
+           # => hppa2.0w-hp-hpux11.23
+           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+           # => hppa64-hp-hpux11.23
+
+           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+               grep -q __LP64__
+           then
+               HP_ARCH="hppa2.0w"
+           else
+               HP_ARCH="hppa64"
+           fi
+       fi
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit ;;
+    3050*:HI-UX:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+               { echo "$SYSTEM_NAME"; exit; }
+       echo unknown-hitachi-hiuxwe2
+       exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit ;;
+    i*86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+       exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+       exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+       exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+       exit ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    *:UNICOS/mp:*:*)
+       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+       echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    5000:UNIX_System_V:4.*:*)
+       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+       echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:FreeBSD:*:*)
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
+       case ${UNAME_PROCESSOR} in
+           amd64)
+               echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           *)
+               echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+       esac
+       exit ;;
+    i*:CYGWIN*:*)
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit ;;
+    *:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit ;;
+    i*:MSYS*:*)
+       echo ${UNAME_MACHINE}-pc-msys
+       exit ;;
+    i*:windows32*:*)
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
+       exit ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit ;;
+    *:Interix*:*)
+       case ${UNAME_MACHINE} in
+           x86)
+               echo i586-pc-interix${UNAME_RELEASE}
+               exit ;;
+           authenticamd | genuineintel | EM64T)
+               echo x86_64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+           IA64)
+               echo ia64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+       esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit ;;
+    8664:Windows_NT:*)
+       echo x86_64-pc-mks
+       exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+       echo x86_64-unknown-cygwin
+       exit ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin
+       exit ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    *:GNU:*:*)
+       # the GNU system
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit ;;
+    *:GNU/*:*:*)
+       # other systems with GNU libc and userland
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       exit ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+       esac
+       objdump --private-headers /bin/sh | grep -q ld.so.1
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       exit ;;
+    arm*:Linux:*:*)
+       eval $set_cc_for_build
+       if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+           | grep -q __ARM_EABI__
+       then
+           echo ${UNAME_MACHINE}-unknown-linux-gnu
+       else
+           if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+               | grep -q __ARM_PCS_VFP
+           then
+               echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+           else
+               echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+           fi
+       fi
+       exit ;;
+    avr32*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    cris:Linux:*:*)
+       echo ${UNAME_MACHINE}-axis-linux-gnu
+       exit ;;
+    crisv32:Linux:*:*)
+       echo ${UNAME_MACHINE}-axis-linux-gnu
+       exit ;;
+    frv:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    hexagon:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    i*86:Linux:*:*)
+       LIBC=gnu
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #ifdef __dietlibc__
+       LIBC=dietlibc
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+       echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+       exit ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m32r*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef ${UNAME_MACHINE}
+       #undef ${UNAME_MACHINE}el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=${UNAME_MACHINE}el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=${UNAME_MACHINE}
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    or32:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    padre:Linux:*:*)
+       echo sparc-unknown-linux-gnu
+       exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
+       exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-unknown-linux-gnu ;;
+         PA8*) echo hppa2.0-unknown-linux-gnu ;;
+         *)    echo hppa-unknown-linux-gnu ;;
+       esac
+       exit ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-gnu
+       exit ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-gnu
+       exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-ibm-linux
+       exit ;;
+    sh64*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    tile*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    vax:Linux:*:*)
+       echo ${UNAME_MACHINE}-dec-linux-gnu
+       exit ;;
+    x86_64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    xtensa*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    i*86:DYNIX/ptx:4*:*)
+       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+       # earlier versions are messed up and put the nodename in both
+       # sysname and nodename.
+       echo i386-sequent-sysv4
+       exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+       # Unixware is an offshoot of SVR4, but it has its own version
+       # number series starting with 2...
+       # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+       # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit ;;
+    i*86:syllable:*:*)
+       echo ${UNAME_MACHINE}-pc-syllable
+       exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+       fi
+       exit ;;
+    i*86:*:5:[678]*)
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit ;;
+    i*86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+       # uname -m prints for DJGPP always 'pc', but it prints nothing about
+       # the processor, so we play safe by assuming i586.
+       # Note: whatever this is, it MUST be the same as what config.sub
+       # prints for the "djgpp" host, or else GDB configury will decide that
+       # this is a cross-build.
+       echo i586-pc-msdosdjgpp
+       exit ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit ;;
+    M68*:*:R3V[5678]*:*)
+       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+       OS_REL=''
+       test -r /etc/.relid \
+       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+       OS_REL='.3'
+       test -r /etc/.relid \
+           && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+           && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+           && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+           && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    rs6000:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit ;;
+    PENTIUM:*:4.0*:*)  # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                       # says <Richard.M.Bartel@ccMail.Census.GOV>
+       echo i586-unisys-sysv4
+       exit ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit ;;
+    i*86:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo ${UNAME_MACHINE}-stratus-vos
+       exit ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+       exit ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit ;;
+    BePC:Haiku:*:*)    # Haiku running on Intel PC compatible.
+       echo i586-pc-haiku
+       exit ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-7:SUPER-UX:*:*)
+       echo sx7-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8:SUPER-UX:*:*)
+       echo sx8-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8R:SUPER-UX:*:*)
+       echo sx8r-nec-superux${UNAME_RELEASE}
+       exit ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Darwin:*:*)
+       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+       case $UNAME_PROCESSOR in
+           i386)
+               eval $set_cc_for_build
+               if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+                 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+                     (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+                     grep IS_64BIT_ARCH >/dev/null
+                 then
+                     UNAME_PROCESSOR="x86_64"
+                 fi
+               fi ;;
+           unknown) UNAME_PROCESSOR=powerpc ;;
+       esac
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = "x86"; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+       echo neo-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+       echo nse-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit ;;
+    SEI:*:*:SEIUX)
+       echo mips-sei-seiux${UNAME_RELEASE}
+       exit ;;
+    *:DragonFly:*:*)
+       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    *:*VMS:*:*)
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       case "${UNAME_MACHINE}" in
+           A*) echo alpha-dec-vms ; exit ;;
+           I*) echo ia64-dec-vms ; exit ;;
+           V*) echo vax-dec-vms ; exit ;;
+       esac ;;
+    *:XENIX:*:SysV)
+       echo i386-pc-xenix
+       exit ;;
+    i*86:skyos:*:*)
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       exit ;;
+    i*86:rdos:*:*)
+       echo ${UNAME_MACHINE}-pc-rdos
+       exit ;;
+    i*86:AROS:*:*)
+       echo ${UNAME_MACHINE}-pc-aros
+       exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+       "4"
+#else
+       ""
+#endif
+       ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+       printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+       printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+       { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+       echo c1-convex-bsd
+       exit ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit ;;
+    c34*)
+       echo c34-convex-bsd
+       exit ;;
+    c38*)
+       echo c38-convex-bsd
+       exit ;;
+    c4*)
+       echo c4-convex-bsd
+       exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/tools/depends/aux/config.sub b/tools/depends/aux/config.sub
new file mode 100644 (file)
index 0000000..d6b6b3c
--- /dev/null
@@ -0,0 +1,1766 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-01-01'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple | -axis | -knuth | -cray | -microblaze)
+               os=
+               basic_machine=$1
+               ;;
+       -bluegene*)
+               os=-cnk
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
+               os=
+               basic_machine=$1
+               ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco6)
+               os=-sco5v6
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco5)
+               os=-sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco5v6*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       1750a | 580 \
+       | a29k \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | am33_2.0 \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+        | be32 | be64 \
+       | bfin \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | epiphany \
+       | fido | fr30 | frv \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | hexagon \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k | iq2000 \
+       | le32 | le64 \
+       | lm32 \
+       | m32c | m32r | m32rle | m68000 | m68k | m88k \
+       | maxq | mb | microblaze | mcore | mep | metag \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64octeon | mips64octeonel \
+       | mips64orion | mips64orionel \
+       | mips64r5900 | mips64r5900el \
+       | mips64vr | mips64vrel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mips64vr5900 | mips64vr5900el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | moxie \
+       | mt \
+       | msp430 \
+       | nds32 | nds32le | nds32be \
+       | nios | nios2 \
+       | ns16k | ns32k \
+       | open8 \
+       | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle \
+       | pyramid \
+       | rl78 | rx \
+       | score \
+       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+       | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+       | spu \
+       | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+       | ubicom32 \
+       | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+       | we32k \
+       | x86 | xc16x | xstormy16 | xtensa \
+       | z8k | z80)
+               basic_machine=$basic_machine-unknown
+               ;;
+       c54x)
+               basic_machine=tic54x-unknown
+               ;;
+       c55x)
+               basic_machine=tic55x-unknown
+               ;;
+       c6x)
+               basic_machine=tic6x-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+       ms1)
+               basic_machine=mt-unknown
+               ;;
+
+       strongarm | thumb | xscale)
+               basic_machine=arm-unknown
+               ;;
+
+       xscaleeb)
+               basic_machine=armeb-unknown
+               ;;
+
+       xscaleel)
+               basic_machine=armel-unknown
+               ;;
+
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       580-* \
+       | a29k-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* | avr32-* \
+       | be32-* | be64-* \
+       | bfin-* | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* \
+       | clipper-* | craynv-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | elxsi-* \
+       | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | hexagon-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* | iq2000-* \
+       | le32-* | le64-* \
+       | lm32-* \
+       | m32c-* | m32r-* | m32rle-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64octeon-* | mips64octeonel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64r5900-* | mips64r5900el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mips64vr5900-* | mips64vr5900el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipstx39-* | mipstx39el-* \
+       | mmix-* \
+       | mt-* \
+       | msp430-* \
+       | nds32-* | nds32le-* | nds32be-* \
+       | nios-* | nios2-* \
+       | none-* | np1-* | ns16k-* | ns32k-* \
+       | open8-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+       | pyramid-* \
+       | rl78-* | romp-* | rs6000-* | rx-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+       | sparclite-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+       | tahoe-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tile*-* \
+       | tron-* \
+       | ubicom32-* \
+       | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+       | vax-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xc16x-* | xps100-* \
+       | xstormy16-* | xtensa*-* \
+       | ymp-* \
+       | z8k-* | z80-*)
+               ;;
+       # Recognize the basic CPU types without company name, with glob match.
+       xtensa*)
+               basic_machine=$basic_machine-unknown
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       abacus)
+               basic_machine=abacus-unknown
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amd64)
+               basic_machine=x86_64-pc
+               ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-unknown
+               ;;
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-unknown
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
+       aros)
+               basic_machine=i386-pc
+               os=-aros
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       blackfin)
+               basic_machine=bfin-unknown
+               os=-linux
+               ;;
+       blackfin-*)
+               basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       bluegene*)
+               basic_machine=powerpc-ibm
+               os=-cnk
+               ;;
+       c54x-*)
+               basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c55x-*)
+               basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c6x-*)
+               basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       cegcc)
+               basic_machine=arm-unknown
+               os=-cegcc
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | j90)
+               basic_machine=j90-cray
+               os=-unicos
+               ;;
+       craynv)
+               basic_machine=craynv-cray
+               os=-unicosmp
+               ;;
+       cr16 | cr16-*)
+               basic_machine=cr16-unknown
+               os=-elf
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       crisv32 | crisv32-* | etraxfs*)
+               basic_machine=crisv32-axis
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       crx)
+               basic_machine=crx-unknown
+               os=-elf
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       dicos)
+               basic_machine=i686-pc
+               os=-dicos
+               ;;
+       djgpp)
+               basic_machine=i586-pc
+               os=-msdosdjgpp
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+       i*86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i*86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i*86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i*86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m68knommu)
+               basic_machine=m68k-unknown
+               os=-linux
+               ;;
+       m68knommu-*)
+               basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       microblaze)
+               basic_machine=microblaze-xilinx
+               ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
+       mingw32ce)
+               basic_machine=arm-unknown
+               os=-mingw32ce
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       ms1-*)
+               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+               ;;
+       msys)
+               basic_machine=i386-pc
+               os=-msys
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+       nacl)
+               basic_machine=le32-unknown
+               os=-nacl
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       neo-tandem)
+               basic_machine=neo-tandem
+               ;;
+       nse-tandem)
+               basic_machine=nse-tandem
+               ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       openrisc | openrisc-*)
+               basic_machine=or32-unknown
+               ;;
+       os400)
+               basic_machine=powerpc-ibm
+               os=-os400
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       parisc)
+               basic_machine=hppa-unknown
+               os=-linux
+               ;;
+       parisc-*)
+               basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+       pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pc98)
+               basic_machine=i386-pc
+               ;;
+       pc98-*)
+               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
+               ;;
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2 | pentiumiii | pentium3)
+               basic_machine=i686-pc
+               ;;
+       pentium4)
+               basic_machine=i786-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium4-*)
+               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=power-ibm
+               ;;
+       ppc | ppcbe)    basic_machine=powerpc-unknown
+               ;;
+       ppc-* | ppcbe-*)
+               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rdos)
+               basic_machine=i386-pc
+               os=-rdos
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       s390 | s390-*)
+               basic_machine=s390-ibm
+               ;;
+       s390x | s390x-*)
+               basic_machine=s390x-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sde)
+               basic_machine=mipsisa32-sde
+               os=-elf
+               ;;
+       sei)
+               basic_machine=mips-sei
+               os=-seiux
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sh5el)
+               basic_machine=sh5le-unknown
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
+       strongarm-* | thumb-*)
+               basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+       tile*)
+               basic_machine=$basic_machine-unknown
+               os=-linux-gnu
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       tpf)
+               basic_machine=s390x-ibm
+               os=-tpf
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
+               ;;
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xbox)
+               basic_machine=i686-pc
+               os=-mingw32
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       xscale-* | xscalee[bl]-*)
+               basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+               ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
+       z80-*-coff)
+               basic_machine=z80-unknown
+               os=-sim
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+               basic_machine=sh-unknown
+               ;;
+       sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+               basic_machine=sparc-sun
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+       # First match some system type aliases
+       # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -auroraux)
+               os=-auroraux
+               ;;
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -svr4*)
+               os=-sysv4
+               ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+             | -sym* | -kopensolaris* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+             | -aos* | -aros* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+             | -openbsd* | -solidbsd* \
+             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -chorusos* | -chorusrdb* | -cegcc* \
+             | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -mingw32* | -linux-gnu* | -linux-android* \
+             | -linux-newlib* | -linux-uclibc* \
+             | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux-dietlibc)
+               os=-linux-dietlibc
+               ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -opened*)
+               os=-openedition
+               ;;
+       -os400*)
+               os=-os400
+               ;;
+       -wince*)
+               os=-wince
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -syllable*)
+               os=-syllable
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+       -tpf*)
+               os=-tpf
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -aros*)
+               os=-aros
+               ;;
+       -kaos*)
+               os=-kaos
+               ;;
+       -zvmoe)
+               os=-zvmoe
+               ;;
+       -dicos*)
+               os=-dicos
+               ;;
+       -nacl*)
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       score-*)
+               os=-elf
+               ;;
+       spu-*)
+               os=-elf
+               ;;
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-rebel)
+               os=-linux
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+       c4x-* | tic4x-*)
+               os=-coff
+               ;;
+       tic54x-*)
+               os=-coff
+               ;;
+       tic55x-*)
+               os=-coff
+               ;;
+       tic6x-*)
+               os=-coff
+               ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+       mep-*)
+               os=-elf
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-be)
+               os=-beos
+               ;;
+       *-haiku)
+               os=-haiku
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-knuth)
+               os=-mmixware
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigaos
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+       *-gould)
+               os=-sysv
+               ;;
+       *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+       *-sgi)
+               os=-irix
+               ;;
+       *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f30[01]-fujitsu | f700-fujitsu)
+               os=-uxpv
+               ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -cnk*|-aix*)
+                               vendor=ibm
+                               ;;
+                       -beos*)
+                               vendor=be
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -os400*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -tpf*)
+                               vendor=ibm
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/tools/depends/aux/install-sh b/tools/depends/aux/install-sh
new file mode 100644 (file)
index 0000000..a9244eb
--- /dev/null
@@ -0,0 +1,527 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2011-01-19.21; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" ""       $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) ;;
+
+    -C) copy_on_change=true;;
+
+    -d) dir_arg=true;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+       shift;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+       case $mode in
+         *' '* | *'    '* | *'
+'*       | *'*'* | *'?'* | *'['*)
+           echo "$0: invalid mode: $mode" >&2
+           exit 1;;
+       esac
+       shift;;
+
+    -o) chowncmd="$chownprog $2"
+       shift;;
+
+    -s) stripcmd=$stripprog;;
+
+    -t) dst_arg=$2
+       # Protect names problematic for `test' and other utilities.
+       case $dst_arg in
+         -* | [=\(\)!]) dst_arg=./$dst_arg;;
+       esac
+       shift;;
+
+    -T) no_target_directory=true;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)        shift
+       break;;
+
+    -*)        echo "$0: invalid option: $1" >&2
+       exit 1;;
+
+    *)  break;;
+  esac
+  shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+    # Protect names problematic for `test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+       u_plus_rw=
+      else
+       u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+       u_plus_rw=
+      else
+       u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names problematic for `test' and other utilities.
+  case $src in
+    -* | [=\(\)!]) src=./$src;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dst_arg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+    dst=$dst_arg
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+       echo "$0: $dst_arg: Is a directory" >&2
+       exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+       (dirname "$dst") 2>/dev/null ||
+       expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+            X"$dst" : 'X\(//\)[^/]' \| \
+            X"$dst" : 'X\(//\)$' \| \
+            X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+       echo X"$dst" |
+           sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\/\)[^/].*/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\/\)$/{
+                  s//\1/
+                  q
+                }
+                /^X\(\/\).*/{
+                  s//\1/
+                  q
+                }
+                s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+       # Create intermediate dirs using mode 755 as modified by the umask.
+       # This is like FreeBSD 'install' as of 1997-10-28.
+       umask=`umask`
+       case $stripcmd.$umask in
+         # Optimize common cases.
+         *[2367][2367]) mkdir_umask=$umask;;
+         .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+         *[0-7])
+           mkdir_umask=`expr $umask + 22 \
+             - $umask % 100 % 40 + $umask % 20 \
+             - $umask % 10 % 4 + $umask % 2
+           `;;
+         *) mkdir_umask=$umask,go-w;;
+       esac
+
+       # With -d, create the new directory with the user-specified mode.
+       # Otherwise, rely on $mkdir_umask.
+       if test -n "$dir_arg"; then
+         mkdir_mode=-m$mode
+       else
+         mkdir_mode=
+       fi
+
+       posix_mkdir=false
+       case $umask in
+         *[123567][0-7][0-7])
+           # POSIX mkdir -p sets u+wx bits regardless of umask, which
+           # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+           ;;
+         *)
+           tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+           trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+           if (umask $mkdir_umask &&
+               exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+           then
+             if test -z "$dir_arg" || {
+                  # Check for POSIX incompatibilities with -m.
+                  # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+                  # other-writeable bit of parent directory when it shouldn't.
+                  # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+                  ls_ld_tmpdir=`ls -ld "$tmpdir"`
+                  case $ls_ld_tmpdir in
+                    d????-?r-*) different_mode=700;;
+                    d????-?--*) different_mode=755;;
+                    *) false;;
+                  esac &&
+                  $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+                    ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+                    test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+                  }
+                }
+             then posix_mkdir=:
+             fi
+             rmdir "$tmpdir/d" "$tmpdir"
+           else
+             # Remove any dirs left behind by ancient mkdir implementations.
+             rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+           fi
+           trap '' 0;;
+       esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+       umask $mkdir_umask &&
+       $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+       /*) prefix='/';;
+       [-=\(\)!]*) prefix='./';;
+       *)  prefix='';;
+      esac
+
+      eval "$initialize_posix_glob"
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob set -f
+      set fnord $dstdir
+      shift
+      $posix_glob set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+       test X"$d" = X && continue
+
+       prefix=$prefix$d
+       if test -d "$prefix"; then
+         prefixes=
+       else
+         if $posix_mkdir; then
+           (umask=$mkdir_umask &&
+            $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+           # Don't fail if two instances are running concurrently.
+           test -d "$prefix" || exit 1
+         else
+           case $prefix in
+             *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+             *) qprefix=$prefix;;
+           esac
+           prefixes="$prefixes '$qprefix'"
+         fi
+       fi
+       prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+       # Don't fail if two instances are running concurrently.
+       (umask $mkdir_umask &&
+        eval "\$doit_exec \$mkdirprog $prefixes") ||
+         test -d "$dstdir" || exit 1
+       obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"    2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
+
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+       # Now remove or move aside any old file at destination location.
+       # We try this two ways since rm can't unlink itself on some
+       # systems and the destination file might be busy for other
+       # reasons.  In this case, the final cleanup might fail but the new
+       # file should still install successfully.
+       {
+         test ! -f "$dst" ||
+         $doit $rmcmd -f "$dst" 2>/dev/null ||
+         { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+           { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+         } ||
+         { echo "$0: cannot unlink or rename $dst" >&2
+           (exit 1); exit 1
+         }
+       } &&
+
+       # Now rename the file to the real destination.
+       $doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/tools/depends/bootstrap b/tools/depends/bootstrap
new file mode 100755 (executable)
index 0000000..d9e14e7
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Some platforms may not have m4/autoconf. If not, build temporary copies in
+# order to bootstrap.
+DEPENDS=`dirname $0`
+export PATH=$DEPENDS/pre-build-deps/bin:$PATH
+which m4 >/dev/null 2>/dev/null || make -C $DEPENDS/pre-depends/m4-pre-depends
+which autoconf >/dev/null 2>/dev/null || make -C $DEPENDS/pre-depends/autoconf-pre-depends
+which autoconf >/dev/null 2>/dev/null || \
+  (echo "autoconf was not found and could not be built. Aborting." && exit 1)
+
+autoconf -f
diff --git a/tools/depends/configure.in b/tools/depends/configure.in
new file mode 100644 (file)
index 0000000..1d9308b
--- /dev/null
@@ -0,0 +1,409 @@
+AC_PREREQ(2.59)
+AC_INIT([xbmc-depends], [2.00], [http://trac.xbmc.org])
+:${CFLAGS=""}
+AC_CONFIG_AUX_DIR([aux])
+AC_CONFIG_FILES([target/config.site native/config.site.native Makefile.include target/Toolchain.cmake])
+AC_CANONICAL_HOST
+
+AC_ARG_WITH([toolchain],
+  [AS_HELP_STRING([--with-toolchain],
+  [specify path to toolchain. Required for android. Defaults to xcode root for darwin, /usr for linux])],
+  [use_toolchain=$withval])
+
+AC_ARG_WITH([tarballs],
+  [AS_HELP_STRING([--with-tarballs],
+  [path where tarballs will be saved [prefix/xbmc-tarballs]])],
+  [use_tarballs=$withval])
+
+AC_ARG_WITH([cpu],
+  [AS_HELP_STRING([--with-cpu],
+  [optional. specify target cpu. guessed if not specified])],
+  [use_cpu=$withval],use_cpu=auto)
+
+AC_ARG_WITH([ndk],
+  [AS_HELP_STRING([--with-ndk],
+  [specify path to ndk (required for android only)])],
+  [use_ndk=$withval])
+
+AC_ARG_WITH([sdk-path],
+  [AS_HELP_STRING([--with-sdk-path],
+  [specify path to sdk (required for android only)])],
+  [use_sdk_path=$withval])
+
+AC_ARG_WITH([sdk],
+  [AS_HELP_STRING([--with-sdk],
+  [spcify sdk platform version (optional for android). default is android-10])],
+  [use_sdk=$withval])
+
+AC_ARG_ENABLE([gplv3],
+  [AS_HELP_STRING([--enable-gplv3],
+  [enable gplv3 components. default off for android, on everywhere else])],
+  [use_gplv3=1], [use_gplv3=auto])
+
+
+AC_CHECK_PROG(HAVE_UNZIP,unzip,"yes","no",)
+if test "x$HAVE_UNZIP" = "xno" ; then
+  AC_MSG_ERROR("Missing program: unzip")
+fi
+
+AC_CHECK_PROG(HAVE_ZIP,zip,"yes","no",)
+if test "x$HAVE_ZIP" = "xno" ; then
+  AC_MSG_ERROR("Missing program: zip")
+fi
+
+AC_PATH_PROG(CURL,curl,"no")
+if test "x$CURL" = "xno" ; then
+  AC_MSG_ERROR("Missing program: curl")
+fi
+
+AC_PATH_PROG(TAR,tar,"no")
+if test "x$TAR" = "xno" ; then
+  AC_MSG_ERROR("Missing program: tar")
+fi
+
+use_host=$host_alias
+
+if test "x$host" = "x$build"; then
+use_host=$build_cpu-$build_os
+fi
+
+deps_dir=$use_host
+cross_compiling="yes"
+
+if test "x$host" = "x$build"; then
+  cross_compiling="no"
+fi
+
+passed_cflags="$CFLAGS"
+passed_ldflags="$LDFLAGS"
+passed_cxxflags="$CXXFLAGS"
+platform_cc=gcc
+platform_cxx=g++
+case $host in
+  arm*-*linux-android*)
+    if test "x$use_cpu" = "xauto"; then
+      use_cpu="armeabi-v7a"
+    fi
+    if test "x$use_cpu" = "xarmeabi-v7a"; then
+      platform_cflags+=" -march=armv7-a -mtune=cortex-a9 -mfloat-abi=softfp -mfpu=neon "
+    fi
+    use_sdk="${use_sdk:-android-10}"
+    deps_dir="$use_host-$use_sdk"
+    platform_cflags+=" -DANDROID -Os -fexceptions"
+    platform_cxxflags="$platform_cflags -frtti"
+    platform_ldflags=" -L$prefix/$deps_dir/lib/$use_sdk"
+    platform_includes=" -I$prefix/$deps_dir/include/$use_sdk"
+    platform_os="android"
+    if test "x$use_gplv3" = "xauto"; then
+      use_gplv3=0
+    fi
+    #android builds are always cross
+    cross_compiling="yes"
+  ;;     
+  i*86*-android-linux-gnu*)
+    if test "x$use_cpu" = "xauto"; then
+      use_cpu=$host_cpu
+    fi
+    use_sdk="${use_sdk:-android-10}"
+    deps_dir="$use_host-$use_sdk"
+    platform_cflags="-DANDROID -Os -fexceptions"
+    platform_cxxflags="$platform_cflags -frtti"
+    platform_ldflags="-L$prefix/$deps_dir/lib/$use_sdk"
+    platform_includes="-I$prefix/$deps_dir/include/$use_sdk"
+    platform_os="android"
+    if test "x$use_gplv3" = "xauto"; then
+      use_gplv3=0
+    fi
+    #android builds are always cross
+    cross_compiling="yes"
+  ;;
+  arm*-*-linux-gnu*)
+    if test "x$use_cpu" = "xauto"; then
+      use_cpu=$host_cpu
+    fi
+    use_toolchain="${use_toolchain:-/usr}"
+    platform_cflags+="-Os -fPIC -DPIC"
+    platform_cxxflags="$platform_cflags"
+    platform_ldflags="-Wl,-rpath-link=$prefix/$deps_dir/lib"
+    platform_os="linux"
+  ;;
+  *i686*-linux-gnu*)
+    use_cpu=$host_cpu
+    use_toolchain="${use_toolchain:-/usr}"
+    platform_os="linux"
+  ;;
+  x86_64*-linux-gnu*)
+    use_cpu=$host_cpu
+    use_toolchain="${use_toolchain:-/usr}"
+    platform_cflags="-fPIC -DPIC"
+    platform_cxxflags="$platform_cflags"
+    platform_os="linux"
+  ;;
+  *darwin*)
+    if test "x$prefix" = "xNONE"; then
+      prefix=/Users/Shared/xbmc-depends
+    fi
+    use_tarballs="${use_tarballs:-$prefix/tarballs}"
+    use_xcodepath=`xcode-select -print-path`
+    use_xcodebuild=$use_xcodepath/usr/bin/xcodebuild
+    use_xcode=[`$use_xcodebuild -version | grep Xcode | awk '{ print $2}'`]
+    AC_MSG_RESULT(found xcodebuild at $use_xcodebuild)
+    use_build_toolchain=$use_xcodepath
+
+    #darwin builds are always cross
+    cross_compiling="yes"
+
+    platform_cflags="-Wl,-search_paths_first -no_compact_linkedit -std=gnu99 -no-cpp-precomp "
+    platform_ldflags="-Wl,-search_paths_first -no_compact_linkedit "
+
+    case $use_xcode in
+      3.*.*)
+        platform_cc=gcc-4.2
+        platform_cxx=g++-4.2
+        ;;
+      *)
+        platform_cc=llvm-gcc-4.2
+        platform_cxx=llvm-g++-4.2
+        ;;
+    esac
+    case $host in
+      *86*-apple-darwin)
+        found_sdk_version=[`$use_xcodebuild -showsdks | grep macosx | sort |  tail -n 1 | grep -oE 'macosx[0-9.0-9]+' | cut -c 7-$NF`]
+        use_sdk="${use_sdk:-$found_sdk_version}"
+        use_toolchain="${use_toolchain:-$use_xcodepath}"
+        if test "$use_cpu" = "armv7"; then
+          AC_MSG_ERROR(error in configure of --with-arch=$use_cpu)
+        fi
+        case $use_sdk in
+          10.5);;
+          10.6);;
+          10.7);;
+          10.8);;
+          *)
+            AC_MSG_ERROR(error in configure of --with-sdk=$use_sdk)
+        esac
+        sdk_name=macosx$use_sdk
+        use_sdk_path=[`$use_xcodebuild -version -sdk $sdk_name Path`]
+
+        case $host in
+          x86_64-apple-darwin*)
+            if test "x$use_cpu" = "xauto"; then
+              use_cpu=x86_64
+            fi
+          ;;
+          i*86-apple-darwin*)
+            if test "x$use_cpu" = "xauto"; then
+              use_cpu=i386
+            fi
+          ;;
+          *)
+            AC_MSG_ERROR(error in configure of --with-arch=$use_cpu)
+        esac
+        platform_os="osx"
+        platform_min_version=macosx-version-min=10.6
+      ;;
+
+      arm-apple-darwin*)
+        if test "x$use_cpu" = "xauto"; then
+          use_cpu=armv7
+        fi
+        if test "$use_cpu" != "armv7"; then
+          AC_MSG_ERROR(error in configure of --with-arch=$use_cpu)
+        fi
+        platform_min_version="iphoneos-version-min=4.2"
+        found_sdk_version=[`$use_xcodebuild -showsdks | grep iphoneos | sort | tail -n 1 | awk '{ print $2}'`]
+        use_sdk="${use_sdk:-$found_sdk_version}"
+        sdk_name=iphoneos$use_sdk
+        use_toolchain="${use_toolchain:-`$use_xcodebuild -version -sdk $sdk_name PlatformPath`/Developer}"
+       case $use_sdk in
+          4.*);;
+          5.*);;
+          6.*);;
+            *)
+              AC_MSG_ERROR(error in configure of --with-sdk=$use_sdk)
+            ;;
+        esac
+        use_sdk_path=[`$use_xcodebuild -version -sdk $sdk_name | grep ^Path | awk '{ print $2}'`]
+        platform_os="ios"
+        platform_ldflags+=" -L$use_sdk_path/usr/lib/system "
+        platform_cflags="-mcpu=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp -pipe -Wno-trigraphs -fpascal-strings -O3 -Wreturn-type -Wunused-variable -fmessage-length=0 -gdwarf-2 "
+      ;;
+    esac
+    platform_includes="-isysroot $use_sdk_path"
+    platform_cflags+=" -arch $use_cpu -m$platform_min_version "
+    platform_ldflags+=" -arch $use_cpu -m$platform_min_version -isysroot $use_sdk_path "
+    platform_cxxflags="$platform_cflags"
+    deps_dir=$sdk_name"_"$use_cpu
+  ;;
+  *)
+    AC_MSG_ERROR(unsupported host ($use_host))
+esac
+
+platform_cflags+=" $passed_cflags"
+platform_cxxflags+=" $passed_cxxflags"
+platform_ldflags+=" $passed_ldflags"
+platform_ldflags+=" $LIBS"
+
+if test -n $use_build_toolchain; then
+  PATH_FOR_HOST=$use_toolchain:$use_toolchain/usr/bin:$use_toolchain/bin:$PATH
+else
+  PATH_FOR_HOST=$PATH
+fi
+if test -n $use_build_toolchain; then
+  PATH_FOR_BUILD=$use_build_toolchain:$use_build_toolchain/usr/bin:$use_toolchain/bin:$PATH
+else
+  PATH_FOR_BUILD=$PATH
+fi
+
+AC_PATH_TOOL([RANLIB], [ranlib],, $PATH_FOR_HOST)
+AC_PATH_TOOL([LD], [ld],, $PATH_FOR_HOST)
+AC_PATH_TOOL([AR], [ar],, $PATH_FOR_HOST)
+AC_PATH_TOOL([READELF], [readelf],, $PATH_FOR_HOST)
+AC_PATH_TOOL([STRIP], [strip],, $PATH_FOR_HOST)
+AC_PATH_TOOL([AS], [as],, $PATH_FOR_HOST)
+AC_PATH_TOOL([NM], [nm],, $PATH_FOR_HOST)
+AC_PATH_TOOL([OBJDUMP], [objdump],, $PATH_FOR_HOST)
+AC_PATH_TOOL([CC],[$platform_cc],,$PATH_FOR_HOST)
+AC_PATH_TOOL([CXX],[$platform_cxx],,$PATH_FOR_HOST)
+AC_PROG_CPP
+
+AC_PATH_PROG([RANLIB_FOR_BUILD], [ranlib], ranlib, $PATH_FOR_BUILD)
+AC_PATH_PROG([LD_FOR_BUILD], [ld], ld, $PATH_FOR_BUILD)
+AC_PATH_PROG([AR_FOR_BUILD], [ar], ar, $PATH_FOR_BUILD)
+AC_PATH_PROG([READELF_FOR_BUILD], [readelf], readelf, $PATH_FOR_BUILD)
+AC_PATH_PROG([STRIP_FOR_BUILD], [strip], strip, $PATH_FOR_BUILD)
+AC_PATH_PROG([AS_FOR_BUILD], [as], as, $PATH_FOR_BUILD)
+AC_PATH_PROG([NM_FOR_BUILD], [nm], nm, $PATH_FOR_BUILD)
+AC_PATH_PROG([OBJDUMP_FOR_BUILD], [objdump], objdump, $PATH_FOR_BUILD)
+AC_PATH_PROG([CC_FOR_BUILD],[gcc llvm-gcc $platform_cc], gcc, $PATH_FOR_BUILD)
+AC_PATH_PROG([CXX_FOR_BUILD],[g++ llvm-g++ $platform_cxx], g++, $PATH_FOR_BUILD)
+
+AC_CHECK_LIB([z],   [main], has_zlib=1, AC_MSG_WARN("No zlib support in toolchain. Will build libz."); has_zlib=0)
+AC_SEARCH_LIBS([iconv_open],iconv, link_iconv=$ac_cv_search_iconv_open, link_iconv=-liconv; AC_MSG_WARN("No iconv support in toolchain. Will build libiconv."); need_libiconv=1)
+AC_TRY_LINK([#include <locale.h>],[struct lconv* test=localeconv();], has_localeconv=yes, AC_MSG_WARN("No localeconv support in toolchain. Using replacement."); has_localeconv=no)
+AC_CHECK_LIB([crystax],   [main], has_libcrystax=1, has_libcrystax=0)
+
+if test "x$use_gplv3" = "xauto"; then
+  use_gplv3=1
+fi
+
+if test "$link_iconv" = "none required"; then
+  link_iconv=
+fi
+
+if test "x$prefix" = "xNONE"; then
+  AC_MSG_ERROR([No prefix path defined. Use for ex: --prefix=/opt/xbmc-depends]);
+fi
+
+if test -z $use_tarballs; then
+  use_tarballs=$prefix/xbmc-tarballs
+fi
+
+if test "$platform_os" == "android"; then
+  if test -z $use_ndk; then
+    AC_MSG_ERROR("NDK path is required for android")
+  fi
+
+  if test -z $use_sdk_path; then
+    AC_MSG_ERROR("SDK path is required for android")
+  fi
+
+  if [ ! test -f $use_sdk_path/tools/zipalign ]; then
+    AC_MSG_ERROR(verify sdk path)
+  fi
+
+  if [ ! test -f $use_ndk/sources/android/native_app_glue/android_native_app_glue.h ]; then
+    AC_MSG_ERROR(verify ndk path)
+  fi
+fi
+
+# Some dumb checks to see if paths might be correct.
+if [ ! `mkdir -p $prefix/$deps_dir/include` ]; then
+  AC_MSG_ERROR(unable to create $prefix/$deps_dir/include. verify that the path and permissions are correct.)
+fi
+
+if [ ! `mkdir -p $prefix/$deps_dir/lib` ]; then
+  AC_MSG_ERROR(unable to create $prefix/$deps_dir/lib. verify that the path and permissions are correct.)
+fi
+
+if [ ! `mkdir -p $prefix/$deps_dir/share` ]; then
+  AC_MSG_ERROR(unable to create $prefix/$deps_dir/share. verify that the path and permissions are correct.)
+fi
+
+if [ ! `mkdir -p $prefix/$build_cpu-$build_os-native/include` ]; then
+  AC_MSG_ERROR(unable to create $prefix/$build_cpu-$build_os-native/include. verify that the path and permissions are correct.)
+fi
+
+if [ ! `mkdir -p $prefix/$build_cpu-$build_os-native/lib` ]; then
+  AC_MSG_ERROR(unable to create $prefix/$build_cpu-$build_os-native/lib. verify that the path and permissions are correct.)
+fi
+
+if [ ! `mkdir -p $prefix/$build_cpu-$build_os-native/share` ]; then
+  AC_MSG_ERROR(unable to create $prefix/$build_cpu-$build_os-native/share. verify that the path and permissions are correct.)
+fi
+
+if [ ! `mkdir -p $prefix/$build_cpu-$build_os-native/bin` ]; then
+  AC_MSG_ERROR(unable to create $prefix/$build_cpu-$build_os-native/share. verify that the path and permissions are correct.)
+fi
+
+if [ ! `mkdir -p $use_tarballs` ]; then
+  AC_MSG_ERROR(unable to create tarballs dir. verify that the path and permissions are correct.)
+fi
+
+if test "$platform_os" == "android"; then
+  echo
+
+  if [ ! `mkdir -p $prefix/$deps_dir/include/$use_sdk` ]; then
+    AC_MSG_ERROR(unable to create $prefix/$deps_dir/include/$use_sdk. verify that the path and permissions are correct.)
+  fi
+
+  if [ ! `mkdir -p $prefix/$deps_dir/lib/$use_sdk` ]; then
+    AC_MSG_ERROR(unable to create $prefix/$deps_dir/lib/$use_sdk. verify that the path and permissions are correct.)
+  fi
+fi
+
+if test "$platform_os" == "android"; then
+echo -e
+  AC_SUBST(use_sdk_path)
+  AC_SUBST(use_ndk)
+  AC_SUBST(use_sdk)
+fi
+
+AC_SUBST(use_host)
+AC_SUBST(deps_dir)
+AC_SUBST(use_cpu)
+AC_SUBST(use_toolchain)
+AC_SUBST(use_build_toolchain)
+AC_SUBST(use_tarballs)
+AC_SUBST(cross_compiling)
+AC_SUBST(platform_cflags)
+AC_SUBST(platform_cxxflags)
+AC_SUBST(platform_ldflags)
+AC_SUBST(platform_includes)
+AC_SUBST(platform_os)
+AC_SUBST(has_zlib)
+AC_SUBST(link_iconv)
+AC_SUBST(need_libiconv)
+AC_SUBST(use_gplv3)
+AC_SUBST(has_libcrystax)
+
+AC_OUTPUT
+echo -e "toolchain:\t $use_toolchain"
+echo -e "cpu:\t\t $use_cpu"
+echo -e "host:\t\t $use_host"
+if test "$platform_os" == "android"; then
+  echo -e "sdk-platform:\t $use_sdk"
+fi
+
+if test "$platform_os" == "ios"; then
+  simulator_sdk_path=[`$use_xcodebuild -version -sdk iphonesimulator$use_sdk | grep ^Path | awk '{ print $2}'`]
+  cp -vf $simulator_sdk_path/usr/include/crt_externs.h $prefix/$deps_dir/include
+fi
+
+if test "x$has_localeconv" == "xno" && test "$platform_os" == "android"; then
+  cp -vf target/android-libc-replacements/locale.h $prefix/$deps_dir/include/
+fi
+
+cp -vf target/config.site $prefix/$deps_dir/share
+cp -vf target/Toolchain.cmake $prefix/$deps_dir/share
+cp -vf native/config.site.native $prefix/$build_cpu-$build_os-native/share/config.site
diff --git a/tools/depends/native/Makefile b/tools/depends/native/Makefile
new file mode 100644 (file)
index 0000000..24c2ae0
--- /dev/null
@@ -0,0 +1,53 @@
+include ../Makefile.include
+
+ifneq ($(shell test -f $(NATIVEPREFIX)/share/config.site && echo 1),1)
+  $(error Error: $(NATIVEPREFIX)/share/config.site  is missing. Please reconfigure depends to generate it)
+endif
+
+NATIVE= m4-native gettext-native autoconf-native automake-native \
+        libtool-native pkg-config-native yasm-native cmake-native \
+        gas-preprocessor-native python26-native zlib-native \
+        pcre-native swig-native rpl-native libsdl_image-native \
+        tiff-native libpng-native libjpeg-turbo-native liblzo2-native \
+        libsdl-native
+
+
+ifeq ($(OS),ios)
+  NATIVE += dpkg-native
+endif
+
+.PHONY: $(NATIVE) native
+
+all: native
+       @echo "Dependencies built successfully."
+
+# Dependency layout for parallel builds
+autoconf-native: m4-native
+automake-native: autoconf-native
+libtool-native: automake-native
+libpng-native: zlib-native
+tiff-native: libjpeg-turbo-native
+swig-native: pcre-native
+libsdl_image-native: libsdl-native libpng-native libjpeg-turbo-native tiff-native
+
+#liblzo2 has stale packaged automake files that cause borked host/build detection
+liblzo2-native: automake-native
+
+native: $(NATIVE)
+$(NATIVE):
+       $(MAKE) -C $@
+clean:
+       for d in $(NATIVE); do $(MAKE) -C $$d clean; done
+
+# Debug target, this will DELETE all data in staging!
+test-dependencies:
+       ( for d in $(NATIVE); do \
+       rm -rf $(NATIVEPREFIX); \
+        mkdir -p $(NATIVEPREFIX)/include $(NATIVEPREFIX)/share $(NATIVEPREFIX)/bin; \
+       cp -f config.site $(NATIVEPREFIX)/share/; \
+       $(MAKE) distclean; \
+       $(MAKE) $$d; done ) && echo "$@ built successfully"
+
+distclean::
+       for d in $(NATIVE); do $(MAKE) -C $$d distclean; done
+
diff --git a/tools/depends/native/autoconf-native/Makefile b/tools/depends/native/autoconf-native/Makefile
new file mode 100644 (file)
index 0000000..efa8277
--- /dev/null
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=autoconf
+VERSION=2.68
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/bin/autoconf
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       -rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+
+$(LIBDYLIB): $(PLATFORM)
+       cd $(PLATFORM); $(CONFIGURE)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/automake-native/Makefile b/tools/depends/native/automake-native/Makefile
new file mode 100644 (file)
index 0000000..eaf7517
--- /dev/null
@@ -0,0 +1,40 @@
+include ../../Makefile.include
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=automake
+VERSION=1.11.3
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(NATIVEPREFIX)
+
+LIBDYLIB=$(PLATFORM)/automake
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       -rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/cmake-native/Makefile b/tools/depends/native/cmake-native/Makefile
new file mode 100644 (file)
index 0000000..8c46e98
--- /dev/null
@@ -0,0 +1,44 @@
+include ../../Makefile.include
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+APPNAME=cmake
+VERSION=2.8.8
+SOURCE=$(APPNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+
+SETENV=CC=$(CC_FOR_BUILD) CXX=$(CXX_FOR_BUILD) LD=$(LD_FOR_BUILD) CFLAGS=$(NATIVE_CFLAGS) \
+       CXXFLAGS=$(NATIVE_CXXFLAGS) LDFLAGS=$(NATIVE_LDFLAGS)
+CONFIGURE=./bootstrap --prefix=$(NATIVEPREFIX)
+
+APP=$(PLATFORM)/bin/$(APPNAME)
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       -rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(SETENV) $(CONFIGURE)
+
+$(APP): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+       touch $@
+
+.installed-$(PLATFORM): $(APP)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/native/config.site.native.in b/tools/depends/native/config.site.native.in
new file mode 100644 (file)
index 0000000..0418d5b
--- /dev/null
@@ -0,0 +1,26 @@
+LD="${LD:-@LD_FOR_BUILD@}"
+CC="${CC:-@CC_FOR_BUILD@}"
+CXX="${CXX:-@CXX_FOR_BUILD@}"
+AR="${AR:-@AR_FOR_BUILD@}"
+RANLIB="${RANLIB:-@RANLIB_FOR_BUILD@}"
+AS="${AS:-@AS_FOR_BUILD@}"
+NM="${NM:-@NM_FOR_BUILD@}"
+STRIP="${STRIP:-@STRIP_FOR_BUILD@}"
+READELF="${READELF:-@READELF_FOR_BUILD@}"
+OBJDUMP="${OBJDUMP:-@OBJDUMP_FOR_BUILD@}"
+
+CFLAGS="-I@prefix@/@build_cpu@-@build_os@-native/include $CFLAGS"
+LDFLAGS="-L@prefix@/@build_cpu@-@build_os@-native/lib $LDFLAGS"
+CPPFLAGS="-I@prefix@/@build_cpu@-@build_os@-native/include $CPPFLAGS"
+CXXFLAGS="-I@prefix@/@build_cpu@-@build_os@-native/include $CXXFLAGS"
+
+PKG_CONFIG=@prefix@/@build_cpu@-@build_os@-native/bin/pkg-config
+export PKG_CONFIG_PATH=@prefix@/@build_cpu@-@build_os@-native/lib/pkgconfig
+
+PATH=@prefix@/@build_cpu@-@build_os@-native/bin:$PATH
+if test -n "@use_build_toolchain@"; then
+  PATH=@use_build_toolchain@/usr/bin:@use_build_toolchain@/bin:$PATH
+fi
+
+LD_LIBRARY_PATH=@prefix@/@build_cpu@-@build_os@-native/lib:$LD_LIBRARY_PATH
+NASM=@prefix@/@build_cpu@-@build_os@-native/bin/yasm
diff --git a/tools/depends/native/dpkg-native/Makefile b/tools/depends/native/dpkg-native/Makefile
new file mode 100644 (file)
index 0000000..9aacca6
--- /dev/null
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=dpkg
+VERSION=1.14.30
+SOURCE=$(LIBNAME)_$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --enable-static --disable-shared \
+         --disable-linker-optimisations --disable-nls --without-dselect --without-start-stop-daemon \
+         ac_cv_header_libintl_h=no
+
+LIBDYLIB=$(PLATFORM)/dpkg-deb/dpkg-deb
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/dpkg-deb install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/gas-preprocessor-native/Makefile b/tools/depends/native/gas-preprocessor-native/Makefile
new file mode 100644 (file)
index 0000000..d257890
--- /dev/null
@@ -0,0 +1,13 @@
+include ../../Makefile.include
+
+GASBIN=$(NATIVEPREFIX)/bin/gas-preprocessor.pl
+
+all: $(GASBIN)
+
+$(GASBIN):
+       mkdir -p $(NATIVEPREFIX)/bin
+       cp gas-preprocessor.pl $(GASBIN)
+
+clean:
+distclean::
+       rm -f $(GASBIN)
diff --git a/tools/depends/native/gas-preprocessor-native/README b/tools/depends/native/gas-preprocessor-native/README
new file mode 100644 (file)
index 0000000..d903ba1
--- /dev/null
@@ -0,0 +1,20 @@
+To configure ffmpeg for the iPhone 3gs and iPod touch 3g:
+
+./configure --enable-cross-compile --arch=arm --target-os=darwin --cc='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk --cpu=cortex-a8 --enable-pic
+
+To configure ffmpeg for all other iPhones and iPods:
+
+./configure --enable-cross-compile --arch=arm --target-os=darwin --cc='/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv6' --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk --cpu=arm1176jzf-s
+
+Make sure to replace the iPhone SDK version with the version that you're using.
+Pre-3.0 versions aren't supported and probably won't work.
+
+If deploying to all generations, it's recommended to do separate out-of-tree
+builds for each architecture, then lipo together the resulting libs. For
+instance, assuming separate builds in armv6 and armv7:
+
+lipo -create -arch armv6 armv6/libavcodec/libavcodec.a -arch armv7 armv7/libavcodec/libavcodec.a -output universal/libavcodec.a
+
+and similar for each library. Then in XCode, make sure to build for both armv6
+and armv7. If you only care about one generation (since the armv6 devices are
+too slow for instance), then lipo is unnecessary of course.
diff --git a/tools/depends/native/gas-preprocessor-native/gas-preprocessor.pl b/tools/depends/native/gas-preprocessor-native/gas-preprocessor.pl
new file mode 100755 (executable)
index 0000000..b9decc2
--- /dev/null
@@ -0,0 +1,497 @@
+#!/usr/bin/env perl
+# by David Conrad
+# This code is licensed under GPLv2 or later; go to gnu.org to read it
+#  (not that it much matters for an asm preprocessor)
+# usage: set your assembler to be something like "perl gas-preprocessor.pl gcc"
+use strict;
+
+# Apple's gas is ancient and doesn't support modern preprocessing features like
+# .rept and has ugly macro syntax, among other things. Thus, this script
+# implements the subset of the gas preprocessor used by x264 and ffmpeg
+# that isn't supported by Apple's gas.
+
+my @gcc_cmd = @ARGV;
+my @preprocess_c_cmd;
+
+my $fix_unreq = $^O eq "darwin";
+
+if ($gcc_cmd[0] eq "-fix-unreq") {
+    $fix_unreq = 1;
+    shift @gcc_cmd;
+} elsif ($gcc_cmd[0] eq "-no-fix-unreq") {
+    $fix_unreq = 0;
+    shift @gcc_cmd;
+}
+
+if (grep /\.c$/, @gcc_cmd) {
+    # C file (inline asm?) - compile
+    @preprocess_c_cmd = (@gcc_cmd, "-S");
+} elsif (grep /\.[sS]$/, @gcc_cmd) {
+    # asm file, just do C preprocessor
+    @preprocess_c_cmd = (@gcc_cmd, "-E");
+} else {
+    die "Unrecognized input filetype";
+}
+
+# if compiling, avoid creating an output file named '-.o'
+if ((grep /^-c$/, @gcc_cmd) && !(grep /^-o/, @gcc_cmd)) {
+    foreach my $i (@gcc_cmd) {
+        if ($i =~ /\.[csS]$/) {
+            my $outputfile = $i;
+            $outputfile =~ s/\.[csS]$/.o/;
+            push(@gcc_cmd, "-o");
+            push(@gcc_cmd, $outputfile);
+            last;
+        }
+    }
+}
+@gcc_cmd = map { /\.[csS]$/ ? qw(-x assembler -) : $_ } @gcc_cmd;
+@preprocess_c_cmd = map { /\.o$/ ? "-" : $_ } @preprocess_c_cmd;
+
+my $comm;
+
+# detect architecture from gcc binary name
+if      ($gcc_cmd[0] =~ /arm/) {
+    $comm = '@';
+} elsif ($gcc_cmd[0] =~ /powerpc|ppc/) {
+    $comm = '#';
+}
+
+# look for -arch flag
+foreach my $i (1 .. $#gcc_cmd-1) {
+    if ($gcc_cmd[$i] eq "-arch") {
+        if ($gcc_cmd[$i+1] =~ /arm/) {
+            $comm = '@';
+        } elsif ($gcc_cmd[$i+1] =~ /powerpc|ppc/) {
+            $comm = '#';
+        }
+    }
+}
+
+# assume we're not cross-compiling if no -arch or the binary doesn't have the arch name
+if (!$comm) {
+    my $native_arch = qx/arch/;
+    if ($native_arch =~ /arm/) {
+        $comm = '@';
+    } elsif ($native_arch =~ /powerpc|ppc/) {
+        $comm = '#';
+    }
+}
+
+if (!$comm) {
+    die "Unable to identify target architecture";
+}
+
+my %ppc_spr = (ctr    => 9,
+               vrsave => 256);
+
+open(ASMFILE, "-|", @preprocess_c_cmd) || die "Error running preprocessor";
+
+my $current_macro = '';
+my $macro_level = 0;
+my %macro_lines;
+my %macro_args;
+my %macro_args_default;
+my $macro_count = 0;
+my $altmacro = 0;
+
+my @pass1_lines;
+my @ifstack;
+
+my %symbols;
+
+# pass 1: parse .macro
+# note that the handling of arguments is probably overly permissive vs. gas
+# but it should be the same for valid cases
+while (<ASMFILE>) {
+    # remove all comments (to avoid interfering with evaluating directives)
+    s/(?<!\\)$comm.*//x;
+
+    # comment out unsupported directives
+    s/\.type/$comm.type/x;
+    s/\.func/$comm.func/x;
+    s/\.endfunc/$comm.endfunc/x;
+    s/\.ltorg/$comm.ltorg/x;
+    s/\.size/$comm.size/x;
+    s/\.fpu/$comm.fpu/x;
+    s/\.arch/$comm.arch/x;
+    s/\.object_arch/$comm.object_arch/x;
+
+    # the syntax for these is a little different
+    s/\.global/.globl/x;
+    # also catch .section .rodata since the equivalent to .const_data is .section __DATA,__const
+    s/(.*)\.rodata/.const_data/x;
+    s/\.int/.long/x;
+    s/\.float/.single/x;
+
+    # catch unknown section names that aren't mach-o style (with a comma)
+    if (/.section ([^,]*)$/) {
+        die ".section $1 unsupported; figure out the mach-o section name and add it";
+    }
+
+    parse_line($_);
+}
+
+sub eval_expr {
+    my $expr = $_[0];
+    $expr =~ s/([A-Za-z._][A-Za-z0-9._]*)/$symbols{$1}/g;
+    eval $expr;
+}
+
+sub handle_if {
+    my $line = $_[0];
+    # handle .if directives; apple's assembler doesn't support important non-basic ones
+    # evaluating them is also needed to handle recursive macros
+    if ($line =~ /\.if(n?)([a-z]*)\s+(.*)/) {
+        my $result = $1 eq "n";
+        my $type   = $2;
+        my $expr   = $3;
+
+        if ($type eq "b") {
+            $expr =~ s/\s//g;
+            $result ^= $expr eq "";
+        } elsif ($type eq "c") {
+            if ($expr =~ /(.*)\s*,\s*(.*)/) {
+                $result ^= $1 eq $2;
+            } else {
+                die "argument to .ifc not recognized";
+            }
+        } elsif ($type eq "") {
+            $result ^= eval_expr($expr) != 0;
+        } elsif ($type eq "eq") {
+            $result = eval_expr($expr) == 0;
+        } elsif ($type eq "lt") {
+            $result = eval_expr($expr) < 0;
+        } else {
+           chomp($line);
+            die "unhandled .if varient. \"$line\"";
+        }
+        push (@ifstack, $result);
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+sub parse_line {
+    my $line = @_[0];
+
+    # evaluate .if blocks
+    if (scalar(@ifstack)) {
+        if (/\.endif/) {
+            pop(@ifstack);
+            return;
+        } elsif ($line =~ /\.elseif\s+(.*)/) {
+            if ($ifstack[-1] == 0) {
+                $ifstack[-1] = !!eval_expr($1);
+            } elsif ($ifstack[-1] > 0) {
+                $ifstack[-1] = -$ifstack[-1];
+            }
+            return;
+        } elsif (/\.else/) {
+            $ifstack[-1] = !$ifstack[-1];
+            return;
+        } elsif (handle_if($line)) {
+            return;
+        }
+
+        # discard lines in false .if blocks
+        foreach my $i (0 .. $#ifstack) {
+            if ($ifstack[$i] <= 0) {
+                return;
+            }
+        }
+    }
+
+    if (/\.macro/) {
+        $macro_level++;
+        if ($macro_level > 1 && !$current_macro) {
+            die "nested macros but we don't have master macro";
+        }
+    } elsif (/\.endm/) {
+        $macro_level--;
+        if ($macro_level < 0) {
+            die "unmatched .endm";
+        } elsif ($macro_level == 0) {
+            $current_macro = '';
+            return;
+        }
+    }
+
+    if ($macro_level > 1) {
+        push(@{$macro_lines{$current_macro}}, $line);
+    } elsif ($macro_level == 0) {
+        expand_macros($line);
+    } else {
+        if ($line =~ /\.macro\s+([\d\w\.]+)\s*(.*)/) {
+            $current_macro = $1;
+
+            # commas in the argument list are optional, so only use whitespace as the separator
+            my $arglist = $2;
+            $arglist =~ s/,/ /g;
+
+            my @args = split(/\s+/, $arglist);
+            foreach my $i (0 .. $#args) {
+                my @argpair = split(/=/, $args[$i]);
+                $macro_args{$current_macro}[$i] = $argpair[0];
+                $argpair[0] =~ s/:vararg$//;
+                $macro_args_default{$current_macro}{$argpair[0]} = $argpair[1];
+            }
+            # ensure %macro_lines has the macro name added as a key
+            $macro_lines{$current_macro} = [];
+
+        } elsif ($current_macro) {
+            push(@{$macro_lines{$current_macro}}, $line);
+        } else {
+            die "macro level without a macro name";
+        }
+    }
+}
+
+sub expand_macros {
+    my $line = @_[0];
+
+    # handle .if directives; apple's assembler doesn't support important non-basic ones
+    # evaluating them is also needed to handle recursive macros
+    if (handle_if($line)) {
+        return;
+    }
+
+    if (/\.purgem\s+([\d\w\.]+)/) {
+        delete $macro_lines{$1};
+        delete $macro_args{$1};
+        delete $macro_args_default{$1};
+        return;
+    }
+
+    if ($line =~ /\.altmacro/) {
+        $altmacro = 1;
+        return;
+    }
+
+    if ($line =~ /\.noaltmacro/) {
+        $altmacro = 0;
+        return;
+    }
+
+    $line =~ s/\%([^,]*)/eval_expr($1)/eg if $altmacro;
+
+    if ($line =~ /\.set\s+(.*),\s*(.*)/) {
+        $symbols{$1} = eval_expr($2);
+    }
+
+    if ($line =~ /(\S+:|)\s*([\w\d\.]+)\s*(.*)/ && exists $macro_lines{$2}) {
+        push(@pass1_lines, $1);
+        my $macro = $2;
+
+        # commas are optional here too, but are syntactically important because
+        # parameters can be blank
+        my @arglist = split(/,/, $3);
+        my @args;
+        my @args_seperator;
+
+        my $comma_sep_required = 0;
+        foreach (@arglist) {
+            # allow arithmetic/shift operators in macro arguments
+            $_ =~ s/\s*(\+|-|\*|\/|<<|>>)\s*/$1/g;
+
+            my @whitespace_split = split(/\s+/, $_);
+            if (!@whitespace_split) {
+                push(@args, '');
+                push(@args_seperator, '');
+            } else {
+                foreach (@whitespace_split) {
+                        #print ("arglist = \"$_\"\n");
+                    if (length($_)) {
+                        push(@args, $_);
+                        my $sep = $comma_sep_required ? "," : " ";
+                        push(@args_seperator, $sep);
+                        #print ("sep = \"$sep\", arg = \"$_\"\n");
+                        $comma_sep_required = 0;
+                    }
+                }
+            }
+
+            $comma_sep_required = 1;
+        }
+
+        my %replacements;
+        if ($macro_args_default{$macro}){
+            %replacements = %{$macro_args_default{$macro}};
+        }
+
+        # construct hashtable of text to replace
+        foreach my $i (0 .. $#args) {
+            my $argname = $macro_args{$macro}[$i];
+            my @macro_args = @{ $macro_args{$macro} };
+            if ($args[$i] =~ m/=/) {
+                # arg=val references the argument name
+                # XXX: I'm not sure what the expected behaviour if a lot of
+                # these are mixed with unnamed args
+                my @named_arg = split(/=/, $args[$i]);
+                $replacements{$named_arg[0]} = $named_arg[1];
+            } elsif ($i > $#{$macro_args{$macro}}) {
+                # more args given than the macro has named args
+                # XXX: is vararg allowed on arguments before the last?
+                $argname = $macro_args{$macro}[-1];
+                if ($argname =~ s/:vararg$//) {
+                    #print "macro = $macro, args[$i] = $args[$i], args_seperator=@args_seperator, argname = $argname, arglist[$i] = $arglist[$i], arglist = @arglist, args=@args, macro_args=@macro_args\n";
+                    #$replacements{$argname} .= ", $args[$i]";
+                    $replacements{$argname} .= "$args_seperator[$i] $args[$i]";
+                } else {
+                    die "Too many arguments to macro $macro";
+                }
+            } else {
+                $argname =~ s/:vararg$//;
+                $replacements{$argname} = $args[$i];
+            }
+        }
+
+        my $count = $macro_count++;
+
+        # apply replacements as regex
+        foreach (@{$macro_lines{$macro}}) {
+            my $macro_line = $_;
+            # do replacements by longest first, this avoids wrong replacement
+            # when argument names are subsets of each other
+            foreach (reverse sort {length $a <=> length $b} keys %replacements) {
+                $macro_line =~ s/\\$_/$replacements{$_}/g;
+            }
+            $macro_line =~ s/\\\@/$count/g;
+            $macro_line =~ s/\\\(\)//g;     # remove \()
+            parse_line($macro_line);
+        }
+    } else {
+        push(@pass1_lines, $line);
+    }
+}
+
+close(ASMFILE) or exit 1;
+open(ASMFILE, "|-", @gcc_cmd) or die "Error running assembler";
+#open(ASMFILE, ">/tmp/a.S") or die "Error running assembler";
+
+my @sections;
+my $num_repts;
+my $rept_lines;
+
+my %literal_labels;     # for ldr <reg>, =<expr>
+my $literal_num = 0;
+
+my $in_irp = 0;
+my @irp_args;
+my $irp_param;
+
+# pass 2: parse .rept and .if variants
+# NOTE: since we don't implement a proper parser, using .rept with a
+# variable assigned from .set is not supported
+foreach my $line (@pass1_lines) {
+    # handle .previous (only with regard to .section not .subsection)
+    if ($line =~ /\.(section|text|const_data)/) {
+        push(@sections, $line);
+    } elsif ($line =~ /\.previous/) {
+        if (!$sections[-2]) {
+            die ".previous without a previous section";
+        }
+        $line = $sections[-2];
+        push(@sections, $line);
+    }
+
+    # handle ldr <reg>, =<expr>
+    if ($line =~ /(.*)\s*ldr([\w\s\d]+)\s*,\s*=(.*)/) {
+        my $label = $literal_labels{$3};
+        if (!$label) {
+            $label = ".Literal_$literal_num";
+            $literal_num++;
+            $literal_labels{$3} = $label;
+        }
+        $line = "$1 ldr$2, $label\n";
+    } elsif ($line =~ /\.ltorg/) {
+        foreach my $literal (keys %literal_labels) {
+            $line .= "$literal_labels{$literal}:\n .word $literal\n";
+        }
+        %literal_labels = ();
+    }
+
+    # @l -> lo16()  @ha -> ha16()
+    $line =~ s/,\s+([^,]+)\@l\b/, lo16($1)/g;
+    $line =~ s/,\s+([^,]+)\@ha\b/, ha16($1)/g;
+
+    # move to/from SPR
+    if ($line =~ /(\s+)(m[ft])([a-z]+)\s+(\w+)/ and exists $ppc_spr{$3}) {
+        if ($2 eq 'mt') {
+            $line = "$1${2}spr $ppc_spr{$3}, $4\n";
+        } else {
+            $line = "$1${2}spr $4, $ppc_spr{$3}\n";
+        }
+    }
+
+    # old gas versions store upper and lower case names on .req,
+    # but they remove only one on .unreq
+    if ($fix_unreq) {
+        if ($line =~ /\.unreq\s+(.*)/) {
+            $line = ".unreq " . lc($1) . "\n";
+            print ASMFILE ".unreq " . uc($1) . "\n";
+        }
+    }
+
+    if ($line =~ /\.rept\s+(.*)/) {
+        $num_repts = $1;
+        $rept_lines = "\n";
+
+        # handle the possibility of repeating another directive on the same line
+        # .endr on the same line is not valid, I don't know if a non-directive is
+        if ($num_repts =~ s/(\.\w+.*)//) {
+            $rept_lines .= "$1\n";
+        }
+        $num_repts = eval($num_repts);
+    } elsif ($line =~ /\.irp\s+([\d\w\.]+)\s*(.*)/) {
+        $in_irp = 1;
+        $num_repts = 1;
+        $rept_lines = "\n";
+        $irp_param = $1;
+
+        # only use whitespace as the separator
+        my $irp_arglist = $2;
+        $irp_arglist =~ s/,/ /g;
+        $irp_arglist =~ s/^\s+//;
+        @irp_args = split(/\s+/, $irp_arglist);
+    } elsif ($line =~ /\.irpc\s+([\d\w\.]+)\s*(.*)/) {
+        $in_irp = 1;
+        $num_repts = 1;
+        $rept_lines = "\n";
+        $irp_param = $1;
+
+        my $irp_arglist = $2;
+        $irp_arglist =~ s/,/ /g;
+        $irp_arglist =~ s/^\s+//;
+        @irp_args = split(//, $irp_arglist);
+    } elsif ($line =~ /\.endr/) {
+        if ($in_irp != 0) {
+            foreach my $i (@irp_args) {
+                my $line = $rept_lines;
+                $line =~ s/\\$irp_param/$i/g;
+                $line =~ s/\\\(\)//g;     # remove \()
+                print ASMFILE $line;
+            }
+        } else {
+            for (1 .. $num_repts) {
+                print ASMFILE $rept_lines;
+            }
+        }
+        $rept_lines = '';
+        $in_irp = 0;
+        @irp_args = '';
+    } elsif ($rept_lines) {
+        $rept_lines .= $line;
+    } else {
+        print ASMFILE $line;
+    }
+}
+
+print ASMFILE ".text\n";
+foreach my $literal (keys %literal_labels) {
+    print ASMFILE "$literal_labels{$literal}:\n .word $literal\n";
+}
+
+close(ASMFILE) or exit 1;
+#exit 1
diff --git a/tools/depends/native/gettext-native/01-gettext-tools-stpncpy.patch b/tools/depends/native/gettext-native/01-gettext-tools-stpncpy.patch
new file mode 100644 (file)
index 0000000..e5f4869
--- /dev/null
@@ -0,0 +1,11 @@
+--- gettext-0.17.orig/gettext-tools/gnulib-lib/stpncpy.c       2010-05-24 05:42:47.000000000 -0400
++++ gettext-0.17/gettext-tools/gnulib-lib/stpncpy.c    2013-01-18 00:46:43.000000000 -0500
+@@ -24,7 +24,7 @@
+ /* Specification.  */
+ #include <string.h>
+-#ifndef weak_alias
++#ifndef HAVE_STPNCPY
+ # define __stpncpy stpncpy
+ #endif
diff --git a/tools/depends/native/gettext-native/Makefile b/tools/depends/native/gettext-native/Makefile
new file mode 100644 (file)
index 0000000..6c94a3b
--- /dev/null
@@ -0,0 +1,55 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=gettext
+VERSION=0.18.2
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) \
+    --disable-csharp --disable-native-java --disable-java --without-emacs \
+    --disable-libasprintf --disable-openmp \
+    --with-included-gettext \
+    --with-included-glib \
+    --with-included-libcroco \
+    --with-included-libxml \
+    --without-git --without-cvs \
+    --disable-shared --disable-curses --disable-acl --disable-c++ --disable-nls
+
+LIBDYLIB=$(PLATFORM)/gettext-tools/src/.libs/libgettextsrc.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); sed -ie '/gets is a security hole/d' gettext-tools/gnulib-lib/stdio.in.h
+       cd $(PLATFORM); sed -ie '/gets is a security hole/d' gettext-tools/libgettextpo/stdio.in.h
+       cd $(PLATFORM); sed -ie '/gets is a security hole/d' gettext-runtime/gnulib-lib/stdio.in.h
+       cd $(PLATFORM); sed -ie 's/SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests gnulib-tests examples/SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4/' gettext-tools/Makefile.in
+       cd $(PLATFORM); patch -p1 < ../01-gettext-tools-stpncpy.patch
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/gettext-tools
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/gettext-tools install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/native/libjpeg-turbo-native/Makefile b/tools/depends/native/libjpeg-turbo-native/Makefile
new file mode 100644 (file)
index 0000000..eb30f00
--- /dev/null
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=libjpeg-turbo
+VERSION=1.2.0
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --with-jpeg8 --without-simd
+
+CFLAGS+=-O3
+
+LIBDYLIB=$(PLATFORM)/.libs/libjpeg.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+jpegtest: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -j 1 -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/liblzo2-native/Makefile b/tools/depends/native/liblzo2-native/Makefile
new file mode 100644 (file)
index 0000000..41809ea
--- /dev/null
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=lzo
+VERSION=2.03
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) autoconf/; \
+          ./configure --prefix=$(PREFIX) --enable-shared
+
+LIBDYLIB=$(PLATFORM)/src/.libs/lib$(LIBNAME)2.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/native/libpng-native/Makefile b/tools/depends/native/libpng-native/Makefile
new file mode 100644 (file)
index 0000000..908841d
--- /dev/null
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=libpng
+#VERSION=1.4.4
+VERSION=1.2.38
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/libsdl-native/01-SDL_SetWidthHeight.patch b/tools/depends/native/libsdl-native/01-SDL_SetWidthHeight.patch
new file mode 100644 (file)
index 0000000..0e26023
--- /dev/null
@@ -0,0 +1,33 @@
+Index: include/SDL_video.h
+===================================================================
+--- include/SDL_video.h        (revision 4116)
++++ include/SDL_video.h        (working copy)
+@@ -324,6 +324,11 @@
+ extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
+ /**
++* Alter the width and height of the current surface to the given sizes.
++*/
++extern DECLSPEC void SDLCALL SDL_SetWidthHeight(int width, int height);
++
++/**
+  * Set up a video mode with the specified width, height and bits-per-pixel.
+  *
+  * If 'bpp' is 0, it is treated as the current display bits per pixel.
+
+Index: src/video/SDL_video.c
+===================================================================
+--- src/video/SDL_video.c      (revision 4116)
++++ src/video/SDL_video.c      (working copy)
+@@ -1956,3 +1956,11 @@
+               return(0);
+       }
+ }
++
++void SDL_SetWidthHeight(int width, int height)
++{
++  if (current_video != NULL && current_video->screen != NULL) {
++    current_video->screen->w = width;
++    current_video->screen->h = height;
++  }
++}
diff --git a/tools/depends/native/libsdl-native/02-mmx.patch b/tools/depends/native/libsdl-native/02-mmx.patch
new file mode 100644 (file)
index 0000000..82f51aa
--- /dev/null
@@ -0,0 +1,12 @@
+--- src/video/mmx.h    Mon Feb 06 08:28:51 2006 +0000
++++ src/video/mmx.h    Sun Jan 30 13:38:57 2011 -0800
+@@ -355,7 +355,7 @@
+ #define       mmx_r2m(op, reg, mem) \
+       __asm__ __volatile__ (#op " %%" #reg ", %0" \
+-                            : "=X" (mem) \
++                            : "=m" (mem) \
+                             : /* nothing */ )
+ #define       mmx_r2r(op, regs, regd) \
+
diff --git a/tools/depends/native/libsdl-native/Makefile b/tools/depends/native/libsdl-native/Makefile
new file mode 100644 (file)
index 0000000..db5b88d
--- /dev/null
@@ -0,0 +1,42 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in 01-SDL_SetWidthHeight.patch 02-mmx.patch Makefile
+
+# lib name, version
+LIBNAME=SDL
+VERSION=1.2.14
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) \
+  --without-x --disable-video-x11 --disable-video-directfb --enable-nasm=no
+
+LIBDYLIB=$(PLATFORM)/build/.libs/lib$(LIBNAME).a
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p0 < ../01-SDL_SetWidthHeight.patch
+       cd $(PLATFORM); patch -p0 < ../02-mmx.patch
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -j 1 -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/libsdl_image-native/Makefile b/tools/depends/native/libsdl_image-native/Makefile
new file mode 100644 (file)
index 0000000..546bf43
--- /dev/null
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS=Makefile ../../Makefile.include.in
+
+# lib name, version
+LIBNAME=SDL_image
+VERSION=1.2.7
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) \
+   --disable-jpg-shared --disable-png-shared --disable-tif-shared --disable-sdltest
+
+LIBDYLIB=$(PLATFORM)/.libs/lib$(LIBNAME).a
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       echo $(PLATFORM) > .gitignore
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/libtool-native/Makefile b/tools/depends/native/libtool-native/Makefile
new file mode 100644 (file)
index 0000000..f1a80d6
--- /dev/null
@@ -0,0 +1,45 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=libtool
+VERSION=2.2.6
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE)a.tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) \
+  --disable-shared --disable-ltdl-install
+
+LIBDYLIB=$(PLATFORM)/libtool
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       -rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ifeq ($(HAS_LIBCRYSTAX),1)
+       cd $(PLATFORM); patch -p0 < ../fix-libcrystax.patch
+endif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/libtool-native/fix-libcrystax.patch b/tools/depends/native/libtool-native/fix-libcrystax.patch
new file mode 100644 (file)
index 0000000..4963cb6
--- /dev/null
@@ -0,0 +1,13 @@
+--- libltdl/m4/libtool.m4      2008-09-05 07:54:41.000000000 -0400
++++ libltdl/m4/libtool.m4      2012-11-27 23:25:25.414701465 -0500
+@@ -6489,6 +6489,10 @@
+   _LT_TAGVAR(postdeps,$1)=
+   ;;
++linux-android*)
++  _LT_TAGVAR(postdeps, $1)="$_LT_TAGVAR(postdeps, $1) -lcrystax"
++  ;;
++ 
+ linux*)
+   case `$CC -V 2>&1 | sed 5q` in
+   *Sun\ C*)
diff --git a/tools/depends/native/m4-native/Makefile b/tools/depends/native/m4-native/Makefile
new file mode 100644 (file)
index 0000000..bc0f864
--- /dev/null
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=m4
+VERSION=1.4.9
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/src/$(LIBNAME)
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       -rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+
+$(LIBDYLIB): $(PLATFORM)
+       cd $(PLATFORM); $(CONFIGURE)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/pcre-native/Makefile b/tools/depends/native/pcre-native/Makefile
new file mode 100644 (file)
index 0000000..2dc2c2b
--- /dev/null
@@ -0,0 +1,42 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=pcre
+VERSION=7.9
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --disable-cpp --disable-shared
+
+
+LIBDYLIB=$(PLATFORM)/.libs/lib$(LIBNAME).so
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $(LIBDYLIB)
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/pkg-config-native/Makefile b/tools/depends/native/pkg-config-native/Makefile
new file mode 100644 (file)
index 0000000..fe072e7
--- /dev/null
@@ -0,0 +1,46 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+# lib name, version
+LIBNAME=pkg-config
+VERSION=0.23
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+PC_PATH=$(PREFIX)/lib/pkgconfig:$(PREFIX)/share/pkgconfig
+ifeq ($(CROSS_COMPILING),no)
+PC_PATH:=$(PC_PATH):/usr/lib/pkgconfig:/usr/lib/$(HOST)/pkgconfig:/usr/share/pkgconfig
+endif
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --enable-indirect-deps --with-pc-path=$(PC_PATH)
+LIBDYLIB=$(PLATFORM)/pkg-config
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       -rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/python26-native/Makefile b/tools/depends/native/python26-native/Makefile
new file mode 100644 (file)
index 0000000..c7226fa
--- /dev/null
@@ -0,0 +1,39 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=Python
+VERSION=2.6.5
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+CWD=$(shell pwd)
+HOSTPYTHONDIR=$(CWD)/$(PLATFORM)/hostpython
+
+CONFIGURE=./configure --prefix=$(PREFIX) --disable-shared --disable-toolbox-glue --disable-framework
+
+LIBDYLIB=$(PLATFORM)/python
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       cd $(PLATFORM); $(MAKE)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       cd $(PLATFORM); make install -j1
+       touch $@
+
+clean:
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/python26-native/cpython-2.6.5-multiarch.patch b/tools/depends/native/python26-native/cpython-2.6.5-multiarch.patch
new file mode 100644 (file)
index 0000000..e1f756c
--- /dev/null
@@ -0,0 +1,36 @@
+diff -rupN setup.py setup.py
+--- setup.py   2010-03-08 08:08:25.000000000 +0100
++++ setup.py   2012-07-13 11:15:27.000000000 +0200
+@@ -308,10 +308,32 @@ class PyBuildExt(build_ext):
+                 return platform
+         return sys.platform
++    def add_multiarch_paths(self):
++        # Debian/Ubuntu multiarch support.
++        # https://wiki.ubuntu.com/MultiarchSpec
++        # self.build_temp 
++        tmpfile = os.path.join(self.build_temp, 'multiarch')
++        if not os.path.exists(self.build_temp):
++            os.makedirs(self.build_temp)
++        ret = os.system('dpkg-architecture -qDEB_HOST_MULTIARCH > %s' %
++                        tmpfile)
++        try:
++            if ret >> 8 == 0:
++                with open(tmpfile) as fp:
++                    multiarch_path_component = fp.readline().strip()
++                add_dir_to_list(self.compiler.library_dirs,
++                                '/usr/lib/' + multiarch_path_component)
++                add_dir_to_list(self.compiler.include_dirs,
++                                '/usr/include/' + multiarch_path_component)
++        finally:
++            os.unlink(tmpfile)
++
++
+     def detect_modules(self):
+         # Ensure that /usr/local is always used
+         add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+         add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
++        self.add_multiarch_paths()
+         # Add paths specified in the environment variables LDFLAGS and
+         # CPPFLAGS for header and library files.
diff --git a/tools/depends/native/python26-native/cpython-2.6.5-nosslv2.patch b/tools/depends/native/python26-native/cpython-2.6.5-nosslv2.patch
new file mode 100644 (file)
index 0000000..087fc89
--- /dev/null
@@ -0,0 +1,127 @@
+diff -rupN Doc/library/ssl.rst Doc/library/ssl.rst
+--- Doc/library/ssl.rst        2009-10-27 15:50:20.000000000 +0100
++++ Doc/library/ssl.rst        2012-07-13 11:23:12.000000000 +0200
+@@ -113,7 +113,6 @@ Functions, Constants, and Exceptions
+        ========================  =========  =========  ==========  =========
+         *client* / **server**    **SSLv2**  **SSLv3**  **SSLv23**  **TLSv1**
+        ------------------------  ---------  ---------  ----------  ---------
+-        *SSLv2*                    yes        no         yes*        no
+         *SSLv3*                    yes        yes        yes         no
+         *SSLv23*                   yes        no         yes         no
+         *TLSv1*                    no         no         yes         yes
+@@ -218,10 +217,6 @@ Functions, Constants, and Exceptions
+    Note that use of this setting requires a valid certificate validation file
+    also be passed as a value of the ``ca_certs`` parameter.
+-.. data:: PROTOCOL_SSLv2
+-
+-   Selects SSL version 2 as the channel encryption protocol.
+-
+ .. data:: PROTOCOL_SSLv23
+    Selects SSL version 2 or 3 as the channel encryption protocol.  This is a
+diff -rupN Lib/ssl.py Lib/ssl.py
+--- Lib/ssl.py 2010-01-18 10:12:06.000000000 +0100
++++ Lib/ssl.py 2012-07-13 11:27:10.000000000 +0200
+@@ -49,7 +49,6 @@ CERT_REQUIRED - certificates are require
+ The following constants identify various SSL protocol variants:
+-PROTOCOL_SSLv2
+ PROTOCOL_SSLv3
+ PROTOCOL_SSLv23
+ PROTOCOL_TLSv1
+@@ -61,7 +60,7 @@ import _ssl             # if we can't im
+ from _ssl import SSLError
+ from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
+-from _ssl import PROTOCOL_SSLv2, PROTOCOL_SSLv3, PROTOCOL_SSLv23, PROTOCOL_TLSv1
++from _ssl import PROTOCOL_SSLv3, PROTOCOL_SSLv23, PROTOCOL_TLSv1
+ from _ssl import RAND_status, RAND_egd, RAND_add
+ from _ssl import \
+      SSL_ERROR_ZERO_RETURN, \
+@@ -418,8 +417,6 @@ def get_protocol_name(protocol_code):
+         return "TLSv1"
+     elif protocol_code == PROTOCOL_SSLv23:
+         return "SSLv23"
+-    elif protocol_code == PROTOCOL_SSLv2:
+-        return "SSLv2"
+     elif protocol_code == PROTOCOL_SSLv3:
+         return "SSLv3"
+     else:
+diff -rupN Lib/test/test_ssl.py Lib/test/test_ssl.py
+--- Lib/test/test_ssl.py       2008-09-29 20:56:38.000000000 +0200
++++ Lib/test/test_ssl.py       2012-07-13 11:26:29.000000000 +0200
+@@ -74,7 +74,6 @@ class BasicTests(unittest.TestCase):
+             s.close()
+     def testCrucialConstants(self):
+-        ssl.PROTOCOL_SSLv2
+         ssl.PROTOCOL_SSLv23
+         ssl.PROTOCOL_SSLv3
+         ssl.PROTOCOL_TLSv1
+@@ -834,27 +833,9 @@ else:
+             badCertTest(os.path.join(os.path.dirname(__file__) or os.curdir,
+                                      "badkey.pem"))
+-        def testProtocolSSL2(self):
+-            if test_support.verbose:
+-                sys.stdout.write("\n")
+-            tryProtocolCombo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True)
+-            tryProtocolCombo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL)
+-            tryProtocolCombo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED)
+-            tryProtocolCombo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, True)
+-            tryProtocolCombo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False)
+-            tryProtocolCombo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False)
+-
+         def testProtocolSSL23(self):
+             if test_support.verbose:
+                 sys.stdout.write("\n")
+-            try:
+-                tryProtocolCombo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True)
+-            except test_support.TestFailed, x:
+-                # this fails on some older versions of OpenSSL (0.9.7l, for instance)
+-                if test_support.verbose:
+-                    sys.stdout.write(
+-                        " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n"
+-                        % str(x))
+             tryProtocolCombo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True)
+             tryProtocolCombo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True)
+             tryProtocolCombo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True)
+@@ -873,7 +854,6 @@ else:
+             tryProtocolCombo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True)
+             tryProtocolCombo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_OPTIONAL)
+             tryProtocolCombo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_REQUIRED)
+-            tryProtocolCombo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False)
+             tryProtocolCombo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, False)
+             tryProtocolCombo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False)
+@@ -883,7 +863,6 @@ else:
+             tryProtocolCombo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True)
+             tryProtocolCombo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_OPTIONAL)
+             tryProtocolCombo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_REQUIRED)
+-            tryProtocolCombo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False)
+             tryProtocolCombo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv3, False)
+             tryProtocolCombo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv23, False)
+diff -rupN Modules/_ssl.c Modules/_ssl.c
+--- Modules/_ssl.c     2010-03-03 13:34:43.000000000 +0100
++++ Modules/_ssl.c     2012-07-13 11:26:52.000000000 +0200
+@@ -300,8 +300,6 @@ newPySSLObject(PySocketSockObject *Sock,
+               self->ctx = SSL_CTX_new(TLSv1_method()); /* Set up context */
+       else if (proto_version == PY_SSL_VERSION_SSL3)
+               self->ctx = SSL_CTX_new(SSLv3_method()); /* Set up context */
+-      else if (proto_version == PY_SSL_VERSION_SSL2)
+-              self->ctx = SSL_CTX_new(SSLv2_method()); /* Set up context */
+       else if (proto_version == PY_SSL_VERSION_SSL23)
+               self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */
+       PySSL_END_ALLOW_THREADS
+@@ -1627,8 +1625,6 @@ init_ssl(void)
+                               PY_SSL_CERT_REQUIRED);
+       /* protocol versions */
+-      PyModule_AddIntConstant(m, "PROTOCOL_SSLv2",
+-                              PY_SSL_VERSION_SSL2);
+       PyModule_AddIntConstant(m, "PROTOCOL_SSLv3",
+                               PY_SSL_VERSION_SSL3);
+       PyModule_AddIntConstant(m, "PROTOCOL_SSLv23",
diff --git a/tools/depends/native/rpl-native/Makefile b/tools/depends/native/rpl-native/Makefile
new file mode 100644 (file)
index 0000000..6ffeb6d
--- /dev/null
@@ -0,0 +1,17 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile rpl
+
+all: .installed-$(PLATFORM)
+
+.installed-$(PLATFORM): $(DEPS)
+       mkdir -p $(PREFIX)/bin
+       cp rpl $(PREFIX)/bin
+       touch $@
+
+clean:
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -f .installed-$(PLATFORM)
diff --git a/tools/depends/native/rpl-native/rpl b/tools/depends/native/rpl-native/rpl
new file mode 100644 (file)
index 0000000..d528850
--- /dev/null
@@ -0,0 +1,310 @@
+#!/usr/bin/python
+
+import optparse, sys, os, tempfile, re
+try: import readline
+except ImportError: pass
+from stat import *
+
+def show_license(*eat):
+       print """rpl - replace strings in files
+Copyright (C) 2004-2005 Goran Weinholt <weinholt@debian.org>
+Copyright (C) 2004 Christian Haggstrom <chm@c00.info>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+"""
+       sys.exit(0)
+
+def get_files(filenames, recurse, suffixen, verbose, hidden_files):
+       new_files = []
+       for filename in filenames:
+               try:
+                       perms = os.lstat(filename)
+               except OSError, e:
+                       sys.stderr.write("\nrpl: Unable to read permissions of %s."
+                                                        % filename)
+                       sys.stderr.write("\nrpl: Error: %s" % e)
+                       sys.stderr.write("\nrpl: SKIPPING %s\n\n" % filename)
+                       continue
+
+               if S_ISDIR(perms.st_mode):
+                       if recurse:
+                               if verbose:
+                                       sys.stderr.write("Scanning Directory: %s\n" % filename)
+                               for f in os.listdir(filename):
+                                       if not hidden_files and f.startswith('.'):
+                                               if verbose:
+                                                       sys.stderr.write("Skipping: %s (hidden)\n"
+                                                                                        % os.path.join(filename, f))
+                                               continue
+                                       new_files += get_files([os.path.join(filename, f)],
+                                                                                  recurse, suffixen, verbose,
+                                                                                  hidden_files)
+                       else:
+                               if verbose:
+                                       sys.stderr.write("Directory: %s skipped.\n" % filename)
+                               continue
+               elif S_ISREG(perms.st_mode):
+                       if suffixen != [] and \
+                                  not True in [ filename.endswith(s) for s in suffixen ]:
+                               sys.stderr.write("Skipping: %s (suffix not in list)\n"
+                                                                % filename)
+                               continue
+                       new_files += [(filename, perms)]
+               else:
+                       sys.stderr.write("Skipping: %s (not a regular file)\n"
+                                                        % filename)
+       return new_files
+
+def unescape(s):
+       regex = re.compile(r'\\([0-7]{1,3}|x[0-9a-fA-F]{2}|[nrtvafb\\])')
+       return regex.sub(lambda match: eval('"%s"' % match.group()), s)
+
+def blockrepl(instream, outstream, regex, before, after, blocksize=None):
+       patlen = len(before)
+       sum = 0
+       if not blocksize: blocksize = 2*patlen
+       tonext = ''
+       while 1:
+               block = instream.read(blocksize)
+               if not block: break
+               parts = regex.split(tonext+block)
+               sum += len(parts)-1
+               lastpart = parts[-1]
+               if lastpart:
+                       tonext = lastpart[-patlen:]
+                       parts[-1] = lastpart[:-len(tonext)]
+               else:
+                       tonext = ''
+               outstream.write(after.join(parts))
+       outstream.write(tonext)
+       return sum
+
+def main():
+       # First we parse the command line arguments...
+       usage = "usage: %prog [options] old_string new_string target_file(s)"
+       parser = optparse.OptionParser(usage, version="%prog 1.5.2")
+       parser.add_option("-L", "--license", action="callback",
+                                         callback=show_license, help="show the software license")
+       parser.add_option("-x", metavar="SUFFIX",
+                                         action="append", dest="suffixen", default=[],
+                                         help="specify file suffix to match")
+       parser.add_option("-i", "--ignore-case",
+                                         action="store_true", dest="ignore_case", default=False,
+                                         help="do a case insensitive match")
+       parser.add_option("-w", "--whole-words",
+                                         action="store_true", dest="whole_words", default=False,
+                                         help="whole words (old_string matches on word boundaries only)")
+       parser.add_option("-b", "--backup",
+                                         action="store_true", dest="do_backup", default=False,
+                                         help="make a backup before overwriting files")
+       parser.add_option("-q", "--quiet",
+                                         action="store_true", dest="quiet", default=False,
+                                         help="quiet mode")
+       parser.add_option("-v", "--verbose",
+                                         action="store_true", dest="verbose", default=False,
+                                         help="verbose mode")
+       parser.add_option("-s", "--dry-run",
+                                         action="store_true", dest="dry_run", default=False,
+                                         help="simulation mode")
+       parser.add_option("-R", "--recursive",
+                                         action="store_true", dest="recurse", default=False,
+                                         help="recurse into subdirectories")
+       parser.add_option("-e", "--escape",
+                                         action="store_true", dest="escapes", default=False,
+                                         help="expand escapes in old_string and new_string")
+       parser.add_option("-p", "--prompt",
+                                         action="store_true", dest="prompt", default=False,
+                                         help="prompt before modifying each file")
+       parser.add_option("-f", "--force",
+                                         action="store_true", dest="force", default=False,
+                                         help="ignore errors when trying to preserve permissions")
+       parser.add_option("-d", "--keep-times",
+                                         action="store_true", dest="keep_times", default=False,
+                                         help="keep the modification times on modified files")
+       parser.add_option("-t", "--use-tmpdir",
+                                         action="store_true", dest="use_tmpdir", default=False,
+                                         help="use $TMPDIR for storing temporary files")
+       parser.add_option("-a", "--all",
+                                         action="store_true", dest="hidden_files", default=False,
+                                         help="do not ignore files and directories starting with .")
+       (opts, args) = parser.parse_args()
+
+       # args should now contain old_str, new_str and a list of files/dirs
+       if len(args) < 3:
+               parser.error("must have at least three arguments")
+       if args[0] == "":
+               parser.error("must have something to replace")
+
+       old_str = args[0]
+       new_str = args[1]
+       files = args[2:]
+
+       # See if all the files actually exist
+       for file in files:
+               if not os.path.exists(file):
+                       sys.stderr.write("\nrpl: File \"%s\" not found.\n" % file)
+                       sys.exit(os.EX_DATAERR)
+
+       if new_str == "" and not opts.quiet:
+               sys.stderr.write("Really DELETE all occurences of %s " % old_str)
+               if opts.ignore_case:
+                       sys.stderr.write("(ignoring case)? (Y/[N]) ")
+               else:
+                       sys.stderr.write("(case sensitive)? (Y/[N]) ")
+               line = raw_input()
+               if line != "" and line[0] in "nN":
+                       sys.stderr.write("\nrpl:  User cancelled operation.\n")
+                       sys.exit(os.EX_TEMPFAIL)
+
+       # Tell the user what is going to happen
+       if opts.dry_run:
+               sys.stderr.write("Simulating replacement of \"%s\" with \"%s\" "
+                                                % (old_str, new_str))
+       else:
+               sys.stderr.write("Replacing \"%s\" with \"%s\" " % (old_str, new_str))
+       if opts.ignore_case: sys.stderr.write("(ignoring case) ")
+       else:                sys.stderr.write("(case sensitive) ")
+       if opts.whole_words: sys.stderr.write("(whole words only)\n")
+       else:                sys.stderr.write("(partial words matched)\n")
+       if opts.dry_run and not opts.quiet:
+               sys.stderr.write("The files listed below would be modified in a replace operation.\n")
+
+       if opts.escapes:
+               old_str = unescape(old_str)
+               new_str = unescape(new_str)
+       if opts.whole_words:
+               regex = re.compile(r"(?:(?<=\s)|^)" + re.escape(old_str) + r"(?=\s|$)",
+                                                  opts.ignore_case and re.I or 0)
+       else:
+               regex = re.compile(re.escape(old_str), opts.ignore_case and re.I or 0)
+
+       total_matches = 0
+       files = get_files(files, opts.recurse, opts.suffixen, opts.verbose, opts.hidden_files)
+       for filename, perms in files:
+               # Open the input file
+               try: f = open(filename, "rb")
+               except IOError, e:
+                       sys.stderr.write("\nrpl: Unable to open %s for reading." % fn)
+                       sys.stderr.write("\nrpl: Error: %s" % e)
+                       sys.stderr.write("\nrpl: SKIPPING %s\n\n" % fn)
+                       continue
+
+               # Find out where we should put the temporary file
+               if opts.use_tmpdir: tempfile.tempdir = None
+               else:               tempfile.tempdir = os.path.dirname(filename)
+
+               # Create the output file
+               try:
+                       o, tmp_path = tempfile.mkstemp("", ".tmp.")
+                       o = os.fdopen(o, "wb")
+               except OSError, e:
+                       sys.stderr.write("\nrpl: Unable to create temp file.")
+                       sys.stderr.write("\nrpl: Error: %s" % e)
+                       sys.stderr.write("\nrpl: (Type \"rpl -h\" and consider \"-t\" to specify temp file location.)")
+                       sys.stderr.write("\nrpl: SKIPPING %s\n\n" % filename)
+                       continue
+
+               # Set permissions and owner
+               try:
+                       os.chown(tmp_path, perms.st_uid, perms.st_gid)
+                       os.chmod(tmp_path, perms.st_mode)
+               except OSError, e:
+                       sys.stderr.write("\nrpl: Unable to set owner/group/perms of %s"
+                                                        % filename)
+                       sys.stderr.write("\nrpl: Error: %s" % e)
+                       if opts.force:
+                               sys.stderr.write("\nrpl: WARNING: New owner/group/perms may not match!\n\n")
+                       else:
+                               sys.stderr.write("\nrpl: SKIPPING %s!\n\n" % filename)
+                               os.unlink(tmp_path)
+                               continue
+                               
+               if opts.verbose and not opts.dry_run:
+                       sys.stderr.write("Processing:  %s\n" % filename)
+               elif not opts.quiet and not opts.dry_run:
+                       sys.stderr.write(".")
+                       sys.stderr.flush()
+
+               # Do the actual work now
+               matches = blockrepl(f, o, regex, old_str, new_str, 1024)
+
+               f.close()
+               o.close()
+
+               if matches == 0:
+                       os.unlink(tmp_path)
+                       continue
+
+               if opts.dry_run:
+                       try:
+                               fn = os.path.realpath(filename)
+                       except OSError, e:
+                               fn = filename
+                       if not opts.quiet: sys.stderr.write("  %s\n" % fn)
+                       os.unlink(tmp_path)
+                       total_matches += matches
+                       continue
+
+               if opts.prompt:
+                       sys.stderr.write("\nSave '%s' ? ([Y]/N) " % filename)
+                       line = ""
+                       while line == "" or line[0] not in "Yy\nnN":
+                               line = raw_input()
+                       if line[0] in "nN":
+                               sys.stderr.write("Not Saved.\n")
+                               os.unlink(tmp_path)
+                               continue
+                       sys.stderr.write("Saved.\n")
+
+               if opts.do_backup:
+                       try: os.rename(filename, filename + "~")
+                       except OSError, e:
+                               sys.stderr.write("rpl: An error occured renaming %s to %s." % (filename, filename + "~"))
+                               sys.stderr.write("\nrpl: Error: %s" % e)
+                               continue
+
+               # Rename the file
+               try: os.rename(tmp_path, filename)
+               except OSError, e:
+                       sys.stderr.write("rpl: An error occured replacing %s with %s."
+                                                        % (tmp_path, filename))
+                       sys.stderr.write("\nrpl: Error: %s" % e)
+                       os.unlink(tmp_path)
+                       continue
+
+               # Restore the times
+               if opts.keep_times:
+                       try: os.utime(filename, (perms.st_atime, perms.st_mtime))
+                       except OSError, e:
+                               sys.stderr.write("\nrpl: An error occured setting the access time and mod time of the file %s.", filename)
+                               sys.stderr.write("\nrpl: Error: %s" % e)
+               total_matches += matches
+
+       # We're about to exit, give a summary
+       if not opts.quiet:
+               if opts.dry_run:
+                       sys.stderr.write("\nA Total of %lu matches found in %lu file%s searched."
+                                                        % (total_matches,
+                                                               len(files),
+                                                               len(files) != 1 and "s" or ""))
+                       sys.stderr.write("\nNone replaced (simulation mode).\n")
+               else:
+                       sys.stderr.write("\nA Total of %lu matches replaced in %lu file%s searched.\n"
+                                                        % (total_matches,
+                                                               len(files),
+                                                               len(files) != 1 and "s" or ""))
+
+if __name__ == "__main__":
+       main()
diff --git a/tools/depends/native/swig-native/Makefile b/tools/depends/native/swig-native/Makefile
new file mode 100644 (file)
index 0000000..9067b2a
--- /dev/null
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=swig
+VERSION=2.0.8
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --without-alllang --without-x --disable-ccache
+
+LIBDYLIB=$(PLATFORM)/swig
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/native/tiff-native/Makefile b/tools/depends/native/tiff-native/Makefile
new file mode 100644 (file)
index 0000000..8d19959
--- /dev/null
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+# lib name, version
+LIBNAME=tiff
+VERSION=3.9.7
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) config/; \
+          ./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/libtiff/.libs/lib$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/native/yasm-native/Makefile b/tools/depends/native/yasm-native/Makefile
new file mode 100644 (file)
index 0000000..b9bfec1
--- /dev/null
@@ -0,0 +1,42 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include.in Makefile
+
+APPNAME=yasm
+VERSION=1.1.0
+SOURCE=$(APPNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --disable-nls --disable-python
+
+APP=$(PLATFORM)/$(APPNAME)
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       -rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(APP): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(APP)
+       $(MAKE) -C $(PLATFORM) install
+       rm -rf $(PREFIX)/lib/libyasm.a
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm  .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/native/zlib-native/Makefile b/tools/depends/native/zlib-native/Makefile
new file mode 100644 (file)
index 0000000..31154ee
--- /dev/null
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+PREFIX=$(NATIVEPREFIX)
+PLATFORM=$(NATIVEPLATFORM)
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=zlib
+VERSION=1.2.7
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+BASE_URL=http://zlib.net/
+# configuration settings
+CONFIGURE= CC="$(CC_FOR_BUILD)" CFLAGS="$(BUILD_CFLAGS)" ./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p0 < ../visibility.patch
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+       touch $@
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/native/zlib-native/visibility.patch b/tools/depends/native/zlib-native/visibility.patch
new file mode 100644 (file)
index 0000000..af49fbf
--- /dev/null
@@ -0,0 +1,15 @@
+--- zconf.h.in 2013-01-23 21:22:22.512584179 -0500
++++ zconf.h.in 2013-01-23 21:21:56.312584196 -0500
+@@ -348,7 +348,11 @@
+ #endif
+ #ifndef ZEXTERN
+-#  define ZEXTERN extern
++#  ifdef HAVE_HIDDEN
++#    define ZEXTERN extern __attribute__((visibility ("default")))
++#  else
++#    define ZEXTERN extern
++#  endif
+ #endif
+ #ifndef ZEXPORT
+ #  define ZEXPORT
diff --git a/tools/depends/pre-depends/autoconf-pre-depends/Makefile b/tools/depends/pre-depends/autoconf-pre-depends/Makefile
new file mode 100644 (file)
index 0000000..6cb60fd
--- /dev/null
@@ -0,0 +1,45 @@
+include ../../Makefile.include.in
+PREFIX=$(CURDIR)/../../pre-build-deps
+PLATFORM=native
+TARBALLS_LOCATION=$(PREFIX)
+RETRIEVE_TOOL=curl
+ARCHIVE_TOOL=tar
+# lib name, version
+LIBNAME=autoconf
+VERSION=2.68
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+export PATH:=$(CURDIR)/../pre-build-deps/bin:$(PATH)
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/bin/autoconf
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: $(PREFIX)/bin/$(LIBNAME)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       mkdir -p $(TARBALLS_LOCATION)
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       -rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+
+$(LIBDYLIB): $(PLATFORM)
+       cd $(PLATFORM); $(CONFIGURE)
+       $(MAKE) -C $(PLATFORM)
+
+$(PREFIX)/bin/$(LIBNAME): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/pre-depends/m4-pre-depends/Makefile b/tools/depends/pre-depends/m4-pre-depends/Makefile
new file mode 100644 (file)
index 0000000..5b35e78
--- /dev/null
@@ -0,0 +1,42 @@
+include ....//Makefile.include.in
+PREFIX=$(CURDIR)/../../pre-build-deps
+PLATFORM=native
+TARBALLS_LOCATION=$(PREFIX)
+RETRIEVE_TOOL=curl
+ARCHIVE_TOOL=tar
+# lib name, version
+LIBNAME=m4
+VERSION=1.4.9
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/bin/$(LIBNAME)
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: $(PREFIX)/bin/$(LIBNAME)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       mkdir -p $(TARBALLS_LOCATION)
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       -rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+
+$(LIBDYLIB): $(PLATFORM)
+       cd $(PLATFORM); $(CONFIGURE)
+       $(MAKE) -C $(PLATFORM)
+
+$(PREFIX)/bin/$(LIBNAME): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+
+distclean::
+       rm -rf $(PLATFORM)
diff --git a/tools/depends/target/Backrow/Makefile b/tools/depends/target/Backrow/Makefile
new file mode 100644 (file)
index 0000000..22cc1b8
--- /dev/null
@@ -0,0 +1,25 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include
+
+SOURCE=Backrow
+ARCHIVE=$(SOURCE).tar.gz
+# Specific download location
+BASE_URL=http://xbmc-for-atv2.googlecode.com/svn/trunk/Backrow
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):                                                                                                                                                                                 
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM)/$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+       mkdir -p $(PLATFORM)/$(SOURCE)
+       cd $(PLATFORM)/$(SOURCE);$(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+
+.installed-$(PLATFORM): $(PLATFORM)/$(SOURCE)
+       mkdir -p $(PREFIX)/include
+       cp -rf $(PLATFORM)/$(SOURCE) $(PREFIX)/include/
+       touch $@
+
+clean:
+distclean::
+       rm -rf $(SOURCE) .installed-$(PLATFORM)
diff --git a/tools/depends/target/Makefile b/tools/depends/target/Makefile
new file mode 100644 (file)
index 0000000..7f66740
--- /dev/null
@@ -0,0 +1,108 @@
+include ../Makefile.include
+
+ifneq ($(shell test -f $(PREFIX)/share/config.site && echo 1),1)
+  $(error Error: $(PREFIX)/share/config.site  is missing. Please reconfigure depends to generate it)
+endif
+
+DEPENDS = \
+       pcre expat gettext sqlite3 libgpg-error \
+       libgcrypt bzip2 liblzo2 libzip freetype2 fontconfig \
+       openssl libssh2 curl \
+       libjpeg-turbo tiff jasper libpng \
+       libogg libvorbis libflac libmad fribidi libmpeg2 \
+       libass libsamplerate \
+       libmodplug librtmp libxml2 yajl libmicrohttpd mysql libffi \
+       python26 afpfs-ng libshairport \
+       libplist libcec libbluray boost tinyxml dummy-libxbmc \
+       libamplayer libssh taglib xbmc-pvr-addons libusb libnfs libmp3lame
+
+ifeq ($(ENABLE_GPLV3),1)
+  DEPENDS+=samba-gplv3 libcdio-gplv3
+else
+  DEPENDS+=samba libcdio
+endif
+
+ifeq ($(OS),ios)
+  DEPENDS += Backrow
+  EXCLUDED_DEPENDS = libcec libcrystalhd libusb
+endif
+
+ifeq ($(OS),osx)
+  DEPENDS += libGLEW libsdl libcrystalhd
+  EXCLUDED_DEPENDS = libusb
+endif
+
+DEPENDS := $(filter-out $(EXCLUDED_DEPENDS),$(DEPENDS))
+
+ZLIB=
+ifneq ($(HAS_ZLIB),1)
+  DEPENDS += zlib
+  ZLIB = zlib
+endif
+
+ICONV=
+ifeq ($(NEED_LIBICONV),1)
+  DEPENDS += libiconv
+  ICONV = libiconv
+endif
+
+ALSA_LIB=
+ifeq ($(OS),linux)
+  DEPENDS += alsa-lib
+  ALSA_LIB = alsa-lib
+endif
+
+.PHONY: $(DEPENDS)
+
+all: .installed-$(PLATFORM)
+
+gettext: $(ICONV)
+libgcrypt: libgpg-error
+fontconfig: freetype2 expat $(ICONV)
+libssh2: libgcrypt openssl
+curl: openssl libssh2
+tiff: libjpeg-turbo
+jasper: libjpeg-turbo
+libvorbis: libogg
+libflac: libogg gettext
+libass: fontconfig libpng freetype2 expat $(ICONV)
+librtmp: openssl
+libxml2: $(ICONV)
+libmicrohttpd: openssl libgpg-error libgcrypt
+python26: expat gettext libxml2 sqlite3 openssl libffi
+libcdio: $(ICONV)
+afpfs-ng: libgcrypt $(ICONV)
+libshairport: openssl
+libplist: libxml2 $(ZLIB)
+libbluray: $(ICONV) libxml2
+libssh: openssl
+xbmc-pvr-addons: boost mysql
+mysql: openssl
+libzip: $(ZLIB)
+libmp3lame: $(ICONV)
+libpng: $(ZLIB)
+openssl: $(ZLIB)
+
+.installed-$(PLATFORM): $(DEPENDS)
+       touch $@
+       @echo "Dependencies built successfully."
+
+$(DEPENDS):
+       $(MAKE) -C $@
+
+clean:
+       for d in $(DEPENDS); do $(MAKE) -C $$d clean; done
+
+# Debug target, this will DELETE all data in staging!
+test-dependencies:
+       ( for d in $(DEPENDS); do \
+       rm -rf $(PREFIX); \
+       mkdir -p $(PREFIX)/include $(PREFIX)/share $(PREFIX)/bin; \
+       cp -f config.site Toolchain.cmake $(PREFIX)/share/; \
+       $(MAKE) distclean; \
+       $(MAKE) $$d; done ) && echo "$@ built successfully"
+
+
+distclean::
+       for d in $(DEPENDS); do $(MAKE) -C $$d distclean; done
+
diff --git a/tools/depends/target/Toolchain.cmake.in b/tools/depends/target/Toolchain.cmake.in
new file mode 100644 (file)
index 0000000..aefbbe4
--- /dev/null
@@ -0,0 +1,26 @@
+SET(OS "@platform_os@")
+IF("${OS}" STREQUAL "linux" OR "${OS}" STREQUAL "android")
+SET(CMAKE_SYSTEM_NAME Linux)
+ENDIF()
+SET(CMAKE_SYSTEM_VERSION 1)
+
+# specify the cross compiler
+SET(CMAKE_C_COMPILER   @CC@)
+SET(CMAKE_CXX_COMPILER @CXX@)
+
+# where is the target environment 
+SET(CMAKE_FIND_ROOT_PATH  @prefix@/@deps_dir@ @use_toolchain@ @use_toolchain@/usr @use_sdk_path@ @use_sdk_path@/usr @use_toolchain@/sysroot/usr)
+SET(CMAKE_LIBRARY_PATH @prefix@/@deps_dir@/lib:@use_toolchain@/usr/lib/@use_host@:@use_toolchain@/lib/@use_host@)
+
+SET(CMAKE_C_FLAGS "@platform_cflags@ @platform_includes@ -I@prefix@/@deps_dir@/include")
+SET(CMAKE_CXX_FLAGS "@platform_cxxflags@ @platform_includes@ -I@prefix@/@deps_dir@/include")
+SET(CMAKE_CPP_FLAGS "@platform_cflags@ @platform_includes@ -I@prefix@/@deps_dir@/include")
+SET(ENV{CFLAGS} ${CMAKE_C_FLAGS})
+SET(ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS})
+SET(ENV{CPPFLAGS} ${CMAKE_CPP_FLAGS})
+SET(ENV{LDFLAGS} "-L@prefix@/@deps_dir@/lib @platform_ldflags@")
+# search for programs in the build host directories
+SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+# for libraries and headers in the target directories
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/tools/depends/target/afpfs-ng/01-gcrypt.patch b/tools/depends/target/afpfs-ng/01-gcrypt.patch
new file mode 100644 (file)
index 0000000..7bcace2
--- /dev/null
@@ -0,0 +1,26 @@
+diff -ru afpfs-ng-0.8.1/configure.ac afpfs-ng-0.8.1+iPhone/configure.ac
+--- afpfs-ng-0.8.1/configure.ac        2008-03-08 16:23:12.000000000 +0000
++++ afpfs-ng-0.8.1+iPhone/configure.ac 2010-10-24 05:26:15.000000000 +0000
+@@ -50,21 +50,6 @@
+       case $host in
+               *-*-darwin*) 
+               AC_MSG_CHECKING([for correct gcrypt version])
+-              AC_RUN_IFELSE(
+-                      [AC_LANG_PROGRAM([
+-                              #include <gcrypt.h>
+-                              #include <stdio.h>],[
+-                              char*p= GCRYPT_VERSION;
+-                              unsigned int vers;
+-                              vers=atoi(p)*10000;
+-                              p=strchr(p,'.')+1;
+-                              vers+=atoi(p)*100;
+-                              p=strchr(p,'.')+1;
+-                              vers+=atoi(p);
+-                              if (vers<10400) return 1;
+-                      ])],
+-                      [AC_MSG_RESULT([yes])],
+-                      [AC_MSG_ERROR([version is < 1.4.0])])
+               AM_CONDITIONAL(HAVE_LIBGCRYPT, true)
+               AC_DEFINE([HAVE_LIBGCRYPT], [1] )
+               ;;
+
diff --git a/tools/depends/target/afpfs-ng/02-pointer.patch b/tools/depends/target/afpfs-ng/02-pointer.patch
new file mode 100644 (file)
index 0000000..80507b5
--- /dev/null
@@ -0,0 +1,280 @@
+diff -up afpfs-ng-0.8.1/cmdline/getstatus.c.pointer afpfs-ng-0.8.1/cmdline/getstatus.c
+--- afpfs-ng-0.8.1/cmdline/getstatus.c.pointer 2011-06-14 17:06:35.000000000 +0200
++++ afpfs-ng-0.8.1/cmdline/getstatus.c 2011-06-14 17:07:25.000000000 +0200
+@@ -1,4 +1,5 @@
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+ #include <pthread.h>
+diff -up afpfs-ng-0.8.1/fuse/client.c.pointer afpfs-ng-0.8.1/fuse/client.c
+--- afpfs-ng-0.8.1/fuse/client.c.pointer       2008-03-08 03:44:16.000000000 +0100
++++ afpfs-ng-0.8.1/fuse/client.c       2011-06-14 17:02:15.000000000 +0200
+@@ -61,8 +61,9 @@ static int start_afpfsd(void)
+                       snprintf(filename, PATH_MAX,
+                               "/usr/local/bin/%s",AFPFSD_FILENAME);
+                       if (access(filename,X_OK)) {
+-                              snprintf(filename, "/usr/bin/%s",
++                              snprintf(filename, sizeof(filename), "/usr/bin/%s",
+                                       AFPFSD_FILENAME);
++                              filename[sizeof(filename) - 1] = 0;
+                               if (access(filename,X_OK)) {
+                                       printf("Could not find server (%s)\n",
+                                               filename);
+diff -up afpfs-ng-0.8.1/fuse/fuse_int.c.pointer afpfs-ng-0.8.1/fuse/fuse_int.c
+--- afpfs-ng-0.8.1/fuse/fuse_int.c.pointer     2008-03-02 06:06:24.000000000 +0100
++++ afpfs-ng-0.8.1/fuse/fuse_int.c     2011-06-14 17:02:15.000000000 +0200
+@@ -197,7 +197,7 @@ static int fuse_open(const char *path, s
+       ret = ml_open(volume,path,flags,&fp);
+       if (ret==0) 
+-              fi->fh=(void *) fp;
++              fi->fh=(unsigned long) fp;
+       return ret;
+ }
+diff -up afpfs-ng-0.8.1/include/afpfs-ng/afp.h.pointer afpfs-ng-0.8.1/include/afp.h
+--- afpfs-ng-0.8.1/include/afpfs-ng/afp.h.pointer      2008-03-08 17:08:18.000000000 +0100
++++ afpfs-ng-0.8.1/include/afpfs-ng/afp.h      2011-06-14 17:02:15.000000000 +0200
+@@ -370,7 +370,7 @@ int afp_unmount_all_volumes(struct afp_s
+ int afp_opendt(struct afp_volume *volume, unsigned short * refnum);
+-int afp_closedt(struct afp_server * server, unsigned short * refnum);
++int afp_closedt(struct afp_server * server, unsigned short refnum);
+ int afp_getcomment(struct afp_volume *volume, unsigned int did,
+         const char * pathname, struct afp_comment * comment);
+diff -up afpfs-ng-0.8.1/include/afpfs-gn/utils.h.pointer afpfs-ng-0.8.1/include/utils.h
+--- afpfs-ng-0.8.1/include/afpfs-ng/utils.h.pointer    2008-02-18 04:33:58.000000000 +0100
++++ afpfs-ng-0.8.1/include/afpfs-ng/utils.h    2011-06-14 17:02:15.000000000 +0200
+@@ -8,8 +8,8 @@
+ #define hton64(x)       (x)
+ #define ntoh64(x)       (x)
+ #else /* BYTE_ORDER == BIG_ENDIAN */
+-#define hton64(x)       ((u_int64_t) (htonl(((x) >> 32) & 0xffffffffLL)) | \
+-                         (u_int64_t) ((htonl(x) & 0xffffffffLL) << 32))
++#define hton64(x)       ((u_int64_t) (htonl((((unsigned long long)(x)) >> 32) & 0xffffffffLL)) | \
++                         (u_int64_t) ((htonl((unsigned long long)(x)) & 0xffffffffLL) << 32))
+ #define ntoh64(x)       (hton64(x))
+ #endif /* BYTE_ORDER == BIG_ENDIAN */
+diff -up afpfs-ng-0.8.1/lib/afp_url.c.pointer afpfs-ng-0.8.1/lib/afp_url.c
+--- afpfs-ng-0.8.1/lib/afp_url.c.pointer       2008-03-04 21:16:49.000000000 +0100
++++ afpfs-ng-0.8.1/lib/afp_url.c       2011-06-14 17:02:15.000000000 +0200
+@@ -33,7 +33,7 @@ static int check_port(char * port) 
+ static int check_uamname(const char * uam) 
+ {
+       char * p;
+-      for (p=uam;*p;p++) {
++      for (p=(char *)uam;*p;p++) {
+               if (*p==' ') continue;
+               if ((*p<'A') || (*p>'z')) return -1;
+       }
+@@ -188,7 +188,7 @@ int afp_parse_url(struct afp_url * url, 
+               return -1;
+       }
+-      if (p==NULL) p=toparse;
++      if (p==NULL) p=(char *)toparse;
+       /* Now split on the first / */
+       if (sscanf(p,"%[^/]/%[^$]",
+diff -up afpfs-ng-0.8.1/lib/did.c.pointer afpfs-ng-0.8.1/lib/did.c
+--- afpfs-ng-0.8.1/lib/did.c.pointer   2008-02-18 04:39:17.000000000 +0100
++++ afpfs-ng-0.8.1/lib/did.c   2011-06-14 17:02:15.000000000 +0200
+@@ -226,7 +226,7 @@ int get_dirid(struct afp_volume * volume
+       /* Go to the end of last known entry */
+-      p=path+(p-copy);
++      p=(char *)path+(p-copy);
+       p2=p;
+       while ((p=strchr(p+1,'/'))) {
+diff -up afpfs-ng-0.8.1/lib/dsi.c.pointer afpfs-ng-0.8.1/lib/dsi.c
+--- afpfs-ng-0.8.1/lib/dsi.c.pointer   2008-02-18 04:53:03.000000000 +0100
++++ afpfs-ng-0.8.1/lib/dsi.c   2011-06-14 17:02:15.000000000 +0200
+@@ -474,7 +474,7 @@ void dsi_getstatus_reply(struct afp_serv
+       }
+       server->flags=ntohs(reply1->flags);
+-      p=(void *)((unsigned int) server->incoming_buffer + sizeof(*reply1));
++      p=(void *)((unsigned long) server->incoming_buffer + sizeof(*reply1));
+       p+=copy_from_pascal(server->server_name,p,AFP_SERVER_NAME_LEN)+1;
+       /* Now work our way through the variable bits */
+@@ -757,7 +757,7 @@ gotenough:
+               printf("<<< read() of rest of AFP, %d bytes\n",amount_to_read);
+               #endif
+               ret = read(server->fd, (void *)
+-              (((unsigned int) server->incoming_buffer)+server->data_read),
++              (((unsigned long) server->incoming_buffer)+server->data_read),
+                       amount_to_read);
+               if (ret<0) return -1;
+               if (ret==0) {
+diff -up afpfs-ng-0.8.1/lib/loop.c.pointer afpfs-ng-0.8.1/lib/loop.c
+--- afpfs-ng-0.8.1/lib/loop.c.pointer  2008-02-18 04:40:11.000000000 +0100
++++ afpfs-ng-0.8.1/lib/loop.c  2011-06-14 17:02:15.000000000 +0200
+@@ -25,7 +25,7 @@
+ static unsigned char exit_program=0;
+ static pthread_t ending_thread;
+-static pthread_t main_thread = NULL;
++static pthread_t main_thread = (pthread_t)NULL;
+ static int loop_started=0;
+ static pthread_cond_t loop_started_condition;
+diff -up afpfs-ng-0.8.1/lib/lowlevel.c.pointer afpfs-ng-0.8.1/lib/lowlevel.c
+--- afpfs-ng-0.8.1/lib/lowlevel.c.pointer      2008-02-20 02:33:17.000000000 +0100
++++ afpfs-ng-0.8.1/lib/lowlevel.c      2011-06-14 17:02:15.000000000 +0200
+@@ -582,7 +582,7 @@ int ll_getattr(struct afp_volume * volum
+       if (volume->server->using_version->av_number>=30)
+               stbuf->st_mode |= fp.unixprivs.permissions;
+       else
+-              set_nonunix_perms(stbuf,&fp);
++              set_nonunix_perms(&stbuf->st_mode,&fp);
+       stbuf->st_uid=fp.unixprivs.uid;
+       stbuf->st_gid=fp.unixprivs.gid;
+diff -up afpfs-ng-0.8.1/lib/midlevel.c.pointer afpfs-ng-0.8.1/lib/midlevel.c
+--- afpfs-ng-0.8.1/lib/midlevel.c.pointer      2008-03-08 17:08:18.000000000 +0100
++++ afpfs-ng-0.8.1/lib/midlevel.c      2011-06-14 17:02:15.000000000 +0200
+@@ -713,7 +713,7 @@ int ml_write(struct afp_volume * volume,
+ {
+       int ret,err=0;
+-      int totalwritten = 0;
++      size_t totalwritten = 0;
+       uint64_t sizetowrite, ignored;
+       unsigned char flags = 0;
+       unsigned int max_packet_size=volume->server->tx_quantum;
+diff -up afpfs-ng-0.8.1/lib/proto_attr.c.pointer afpfs-ng-0.8.1/lib/proto_attr.c
+--- afpfs-ng-0.8.1/lib/proto_attr.c.pointer    2008-01-30 05:37:58.000000000 +0100
++++ afpfs-ng-0.8.1/lib/proto_attr.c    2011-06-14 17:02:15.000000000 +0200
+@@ -166,7 +166,7 @@ int afp_getextattr(struct afp_volume * v
+       copy_path(server,p,pathname,strlen(pathname));
+       unixpath_to_afppath(server,p);
+       p2=p+sizeof_path_header(server)+strlen(pathname);
+-      if (((unsigned int ) p2) & 0x1) p2++;
++      if (((unsigned long) p2) & 0x1) p2++;
+       req2=(void *) p2;
+       req2->len=htons(namelen);
+diff -up afpfs-ng-0.8.1/lib/proto_desktop.c.pointer afpfs-ng-0.8.1/lib/proto_desktop.c
+--- afpfs-ng-0.8.1/lib/proto_desktop.c.pointer 2008-02-18 04:44:11.000000000 +0100
++++ afpfs-ng-0.8.1/lib/proto_desktop.c 2011-06-14 17:02:15.000000000 +0200
+@@ -168,7 +168,7 @@ int afp_getcomment_reply(struct afp_serv
+       return 0;
+ }
+-int afp_closedt(struct afp_server * server, unsigned short * refnum) 
++int afp_closedt(struct afp_server * server, unsigned short refnum) 
+ {
+       struct {
+               struct dsi_header dsi_header __attribute__((__packed__));
+diff -up afpfs-ng-0.8.1/lib/proto_directory.c.pointer afpfs-ng-0.8.1/lib/proto_directory.c
+--- afpfs-ng-0.8.1/lib/proto_directory.c.pointer       2008-02-19 03:39:29.000000000 +0100
++++ afpfs-ng-0.8.1/lib/proto_directory.c       2011-06-14 17:02:15.000000000 +0200
+@@ -248,6 +248,7 @@ int afp_enumerate_reply(struct afp_serve
+       return 0;
+ }
++
+ int afp_enumerateext2_reply(struct afp_server *server, char * buf, unsigned int size, void * other) 
+ {
+@@ -266,8 +267,7 @@ int afp_enumerateext2_reply(struct afp_s
+       char * p = buf + sizeof(*reply);
+       int i;
+       char  *max=buf+size;
+-      struct afp_file_info * filebase = NULL, *filecur=NULL, *new_file=NULL;
+-      void ** x = other;
++      struct afp_file_info * filebase = NULL, *filecur = NULL, *new_file = NULL, **x = (struct afp_file_info **) other;
+       if (reply->dsi_header.return_code.error_code) {
+               return reply->dsi_header.return_code.error_code;
+diff -up afpfs-ng-0.8.1/lib/proto_map.c.pointer afpfs-ng-0.8.1/lib/proto_map.c
+--- afpfs-ng-0.8.1/lib/proto_map.c.pointer     2008-01-30 05:37:59.000000000 +0100
++++ afpfs-ng-0.8.1/lib/proto_map.c     2011-06-14 17:02:15.000000000 +0200
+@@ -122,7 +122,7 @@ int afp_mapid_reply(struct afp_server *s
+       if (reply->header.return_code.error_code!=kFPNoErr) return -1;
+-      copy_from_pascal_two(name,&reply->name,255);
++      copy_from_pascal_two(name,reply->name,255);
+       return 0;
+ }
+diff -up afpfs-ng-0.8.1/lib/proto_session.c.pointer afpfs-ng-0.8.1/lib/proto_session.c
+--- afpfs-ng-0.8.1/lib/proto_session.c.pointer 2008-02-18 04:46:19.000000000 +0100
++++ afpfs-ng-0.8.1/lib/proto_session.c 2011-06-14 17:02:15.000000000 +0200
+@@ -39,7 +39,7 @@ int afp_getsessiontoken(struct afp_serve
+       switch (type) {
+       case kLoginWithTimeAndID:
+       case kReconnWithTimeAndID: {
+-              uint32_t *p = (void *) (((unsigned int) request)+
++              uint32_t *p = (void *) (((unsigned long) request)+
+                       sizeof(*request));
+               offset=sizeof(timestamp);
+@@ -63,7 +63,7 @@ int afp_getsessiontoken(struct afp_serve
+               goto error;
+       }
+-      data=(void *) (((unsigned int) request)+sizeof(*request)+offset);
++      data=(void *) (((unsigned long) request)+sizeof(*request)+offset);
+       request->idlength=htonl(datalen);
+       request->pad=0;
+       request->type=htons(type);
+@@ -127,7 +127,7 @@ int afp_disconnectoldsession(struct afp_
+       if ((request=malloc(sizeof(*request) + AFP_TOKEN_MAX_LEN))==NULL)
+               return -1;
+-      token_data  = request + sizeof(*request);
++      token_data  = (char *)request + sizeof(*request);
+       request->type=htons(type);
+diff -up afpfs-ng-0.8.1/lib/uams.c.pointer afpfs-ng-0.8.1/lib/uams.c
+--- afpfs-ng-0.8.1/lib/uams.c.pointer  2008-01-04 04:52:44.000000000 +0100
++++ afpfs-ng-0.8.1/lib/uams.c  2011-06-14 17:02:15.000000000 +0200
+@@ -180,7 +180,7 @@ static int cleartxt_login(struct afp_ser
+               goto cleartxt_fail;
+       p += copy_to_pascal(p, username) + 1;
+-      if ((int)p & 0x1)
++      if ((long)p & 0x1)
+               len--;
+       else
+               p++;
+@@ -230,7 +230,7 @@ static int cleartxt_passwd(struct afp_se
+               goto cleartxt_fail;
+       p += copy_to_pascal(p, username) + 1;
+-      if ((int)p & 0x1)
++      if ((long)p & 0x1)
+               len--;
+       else
+               p++;
+@@ -580,7 +580,7 @@ static int dhx_login(struct afp_server *
+       if (ai == NULL)
+               goto dhx_noctx_fail;
+       d += copy_to_pascal(ai, username) + 1;
+-      if (((int)d) % 2)
++      if (((long)d) % 2)
+               d++;
+       else
+               ai_len--;
+diff -up afpfs-ng-0.8.1/lib/utils.c.pointer afpfs-ng-0.8.1/lib/utils.c
+--- afpfs-ng-0.8.1/lib/utils.c.pointer 2008-02-18 04:53:37.000000000 +0100
++++ afpfs-ng-0.8.1/lib/utils.c 2011-06-14 17:02:15.000000000 +0200
+@@ -196,7 +196,7 @@ int invalid_filename(struct afp_server *
+                       maxlen=255;
+-      p=filename+1;
++      p=(char *)filename+1;
+       while ((q=strchr(p,'/'))) {
+               if (q>p+maxlen)
+                       return 1;
diff --git a/tools/depends/target/afpfs-ng/04-boxee1.patch b/tools/depends/target/afpfs-ng/04-boxee1.patch
new file mode 100644 (file)
index 0000000..9f3c20f
--- /dev/null
@@ -0,0 +1,25 @@
+--- afpfs-ng-0.8.1/include/afpfs-ng/dsi.h      2008-02-18 04:33:24.000000000 +0100
++++ afpfs-ng-0.8.1/include/afpfs-ng/dsi.h      2011-08-26 21:33:33.000000000 +0200
+@@ -6,13 +6,15 @@
+ struct dsi_request
+ {
+-      unsigned short requestid;
+-      unsigned char subcommand;
+-      void * other;
+-      unsigned char wait;
+-      pthread_cond_t  condition_cond;
+-      struct dsi_request * next;
+-      int return_code;
++        unsigned short requestid;
++        unsigned char subcommand;
++        void * other;
++        int wait;
++        int done_waiting;
++        pthread_cond_t  waiting_cond;
++        pthread_mutex_t waiting_mutex;
++        struct dsi_request * next;
++        int return_code;
+ };
+ int dsi_receive(struct afp_server * server, void * data, int size);
diff --git a/tools/depends/target/afpfs-ng/05-boxee2.patch b/tools/depends/target/afpfs-ng/05-boxee2.patch
new file mode 100644 (file)
index 0000000..50250bc
--- /dev/null
@@ -0,0 +1,89 @@
+--- afpfs-ng-0.8.1/lib/afp.c   2008-03-08 03:44:16.000000000 +0100
++++ afpfs-ng-0.8.1/lib/afp.c   2011-08-26 21:33:33.000000000 +0200
+@@ -68,7 +68,7 @@
+       afp_getsessiontoken_reply,afp_blank_reply, NULL, NULL,
+       afp_enumerateext2_reply, NULL, NULL, NULL,    /*64 - 71 */
+       afp_listextattrs_reply, NULL, NULL, NULL,
+-      afp_blank_reply, NULL, NULL, NULL,                       /*72 - 79 */
++      afp_blank_reply, NULL, afp_blank_reply, afp_blank_reply,                       /*72 - 79 */
+       NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL,
+@@ -320,8 +320,16 @@
+       
+       struct dsi_request * p;
+       struct afp_server *s2;
++
++
++      if (s==NULL) 
++              goto out;
++
+       for (p=s->command_requests;p;p=p->next) {
+-              pthread_cond_signal(&p->condition_cond);
++              pthread_mutex_lock(&p->waiting_mutex);
++              p->done_waiting=1;
++              pthread_cond_signal(&p->waiting_cond);
++              pthread_mutex_unlock(&p->waiting_mutex);
+       }
+       if (s==server_base) {
+@@ -354,7 +362,7 @@
+       s->exit_flag = 0;
+       s->path_encoding=kFPUTF8Name;  /* This is a default */
+       s->next=NULL;
+-      s->bufsize=2048;
++      s->bufsize=4096;
+       s->incoming_buffer=malloc(s->bufsize);
+       s->attention_quantum=AFP_DEFAULT_ATTENTION_QUANTUM;
+@@ -524,13 +532,14 @@
+                       kFPVolCreateDateBit|kFPVolIDBit |
+                       kFPVolNameBit;
+       char new_encoding;
++      int ret;
+       if (server->using_version->av_number>=30) 
+               bitmap|= kFPVolNameBit|kFPVolBlockSizeBit;
+-      switch (afp_volopen(volume,bitmap,
+-              (strlen(volume->volpassword)>0) ? volume->volpassword : NULL)) 
+-      {
++      ret = afp_volopen(volume,bitmap,
++              (strlen(volume->volpassword)>0) ? volume->volpassword : NULL);
++      switch(ret){
+       case kFPAccessDenied:
+               *l+=snprintf(mesg,max-*l,
+                       "Incorrect volume password\n");
+@@ -544,6 +553,10 @@
+               *l+=snprintf(mesg,max-*l,
+                       "Could not open volume\n");
+               goto error;
++      case ETIMEDOUT:
++              *l+=snprintf(mesg,max-*l,
++                      "Timed out waiting to open volume\n");
++              goto error;
+       }
+       /* It is said that if a volume's encoding will be the same 
+@@ -641,7 +654,6 @@
+       add_server(server);
+       add_fd_and_signal(server->fd);
+-
+       if (!full) {
+               return 0;
+       }
+@@ -649,10 +661,13 @@
+       /* Get the status, and calculate the transmit time.  We use this to
+       * calculate our rx quantum. */
+       gettimeofday(&t1,NULL);
++
+       if ((error=dsi_getstatus(server))!=0) 
+               goto error;
+       gettimeofday(&t2,NULL);
++        afp_server_identify(server);
++
+       if ((t2.tv_sec - t1.tv_sec) > 0)
+               server->tx_delay= (t2.tv_sec - t1.tv_sec) * 1000;
+       else
diff --git a/tools/depends/target/afpfs-ng/06-boxee3.patch b/tools/depends/target/afpfs-ng/06-boxee3.patch
new file mode 100644 (file)
index 0000000..4b7c916
--- /dev/null
@@ -0,0 +1,141 @@
+--- afpfs-ng-0.8.1/lib/dsi.c   2011-08-26 17:27:16.000000000 +0200
++++ afpfs-ng-0.8.1/lib/dsi.c   2011-08-26 21:33:33.000000000 +0200
+@@ -64,7 +64,7 @@
+       rx.size=0;
+       dsi_setup_header(server,&header,DSI_DSIGetStatus);
+       /* We're intentionally ignoring the results */
+-      ret=dsi_send(server,(char *) &header,sizeof(struct dsi_header),20,
++      ret=dsi_send(server,(char *) &header,sizeof(struct dsi_header),60,
+               0,(void *) &rx);
+       free(rx.data);
+@@ -197,6 +197,7 @@
+       new_request->other=other;
+       new_request->wait=wait;
+       new_request->next=NULL;
++              new_request->done_waiting=0;
+       pthread_mutex_lock(&server->request_queue_mutex);
+       if (server->command_requests==NULL) {
+@@ -208,7 +209,8 @@
+       server->stats.requests_pending++;
+       pthread_mutex_unlock(&server->request_queue_mutex);
+-      pthread_cond_init(&new_request->condition_cond,NULL);
++      pthread_cond_init(&new_request->waiting_cond,NULL);
++      pthread_mutex_init(&new_request->waiting_mutex,NULL);
+       if (server->connect_state==SERVER_STATE_DISCONNECTED) {
+               char mesg[1024];
+@@ -240,16 +242,12 @@
+       server->stats.tx_bytes+=size;
+       pthread_mutex_unlock(&server->send_mutex);
+-      int tmpwait=new_request->wait;
+       #ifdef DEBUG_DSI
+       printf("=== Waiting for response for %d %s\n",
+               new_request->requestid,
+               afp_get_command_name(new_request->subcommand));
+       #endif
+-      if (tmpwait<0) {
+-
+-              pthread_mutex_t     mutex = PTHREAD_MUTEX_INITIALIZER;
+-              pthread_mutex_lock(&mutex);
++      if (new_request->wait<0) {
+               /* Wait forever */
+               #ifdef DEBUG_DSI
+@@ -258,14 +256,17 @@
+                       afp_get_command_name(new_request->subcommand));
+               #endif
+-              rc=pthread_cond_wait( 
+-                      &new_request->condition_cond, 
+-                              &mutex );
+-              pthread_mutex_unlock(&mutex);
+-
+-      } else if (tmpwait>0) {
+-              pthread_mutex_t     mutex = PTHREAD_MUTEX_INITIALIZER;
+-              pthread_mutex_lock(&mutex);
++              pthread_mutex_lock(&new_request->waiting_mutex);
++
++              if (new_request->done_waiting==0)
++                      rc=pthread_cond_wait( 
++                              &new_request->waiting_cond, 
++                                      &new_request->waiting_mutex );
++
++              pthread_mutex_unlock(&new_request->waiting_mutex);
++
++      } else if (new_request->wait>0) {
++              /* wait for new_request->wait seconds */
+               #ifdef DEBUG_DSI
+               printf("=== Waiting for %d %s, for %ds\n",
+@@ -283,13 +284,15 @@
+                       printf("=== Changing my mind, no longer waiting for %d\n",
+                               new_request->requestid);
+                       #endif
+-                      pthread_mutex_unlock(&mutex);
+                       goto skip;
+               }
+-              rc=pthread_cond_timedwait( 
+-                      &new_request->condition_cond, 
+-                      &mutex,&ts);
+-              pthread_mutex_unlock(&mutex);
++              pthread_mutex_lock(&new_request->waiting_mutex);
++              if (new_request->done_waiting==0) 
++                      rc=pthread_cond_timedwait( 
++                              &new_request->waiting_cond, 
++                              &new_request->waiting_mutex,&ts);
++              pthread_mutex_unlock(&new_request->waiting_mutex);
++
+               if (rc==ETIMEDOUT) {
+ /* FIXME: should handle this case properly */
+                       #ifdef DEBUG_DSI
+@@ -299,6 +302,7 @@
+                       goto out;
+               }
+       } else {
++                /* Don't wait */
+               #ifdef DEBUG_DSI
+               printf("=== Skipping wait altogether for %d\n",new_request->requestid);
+               #endif
+@@ -474,7 +478,7 @@
+       }
+       server->flags=ntohs(reply1->flags);
+-      p=(void *)((unsigned long) server->incoming_buffer + sizeof(*reply1));
++      p=(void *)((unsigned int) server->incoming_buffer + sizeof(*reply1));
+       p+=copy_from_pascal(server->server_name,p,AFP_SERVER_NAME_LEN)+1;
+       /* Now work our way through the variable bits */
+@@ -577,6 +581,7 @@
+       unsigned char mins=0;
+       unsigned char checkmessage=0;
++      memset(mesg,0,AFP_LOGINMESG_LEN);
+       /* The logic here's undocumented.  If we get an attention packet and
+          there's no flag, then go check the message.  Also, go check the
+@@ -757,7 +762,7 @@
+               printf("<<< read() of rest of AFP, %d bytes\n",amount_to_read);
+               #endif
+               ret = read(server->fd, (void *)
+-              (((unsigned long) server->incoming_buffer)+server->data_read),
++              (((unsigned int) server->incoming_buffer)+server->data_read),
+                       amount_to_read);
+               if (ret<0) return -1;
+               if (ret==0) {
+@@ -862,8 +867,11 @@
+                       #ifdef DEBUG_DSI
+                       printf("<<< Signalling %d, returning %d or %d\n",request->requestid,request->return_code,rc);
+                       #endif
++                      pthread_mutex_lock(&request->waiting_mutex);
+                       request->wait=0;
+-                      pthread_cond_signal(&request->condition_cond);
++                      request->done_waiting=1;
++                      pthread_cond_signal(&request->waiting_cond);
++                      pthread_mutex_unlock(&request->waiting_mutex);
+               } else {
+                       dsi_remove_from_request_queue(server,request);
+               }
diff --git a/tools/depends/target/afpfs-ng/07-boxee4.patch b/tools/depends/target/afpfs-ng/07-boxee4.patch
new file mode 100644 (file)
index 0000000..3e09f40
--- /dev/null
@@ -0,0 +1,27 @@
+--- afpfs-ng-0.8.1/lib/identify.c      1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1/lib/identify.c      2011-08-26 21:33:33.000000000 +0200
+@@ -0,0 +1,24 @@
++#include <string.h>
++#include <afpfs-ng/afp.h>
++
++
++/* 
++ * afp_server_identify()
++ *
++ * Identifies a server
++ *
++ * Right now, this only does identification using the machine_type
++ * given in getsrvrinfo, but this could later use mDNS to get 
++ * more details.
++ */
++void afp_server_identify(struct afp_server * s)
++{
++      if (strcmp(s->machine_type,"Netatalk")==0)
++              s->server_type=AFPFS_SERVER_TYPE_NETATALK;
++      else if (strcmp(s->machine_type,"AirPort")==0)
++              s->server_type=AFPFS_SERVER_TYPE_AIRPORT;
++      else if (strcmp(s->machine_type,"Macintosh")==0)
++              s->server_type=AFPFS_SERVER_TYPE_MACINTOSH;
++      else
++              s->server_type=AFPFS_SERVER_TYPE_UNKNOWN;
++}
diff --git a/tools/depends/target/afpfs-ng/08-boxee5.patch b/tools/depends/target/afpfs-ng/08-boxee5.patch
new file mode 100644 (file)
index 0000000..253fb05
--- /dev/null
@@ -0,0 +1,11 @@
+--- afpfs-ng-0.8.1/lib/Makefile.am     2008-02-18 04:34:32.000000000 +0100
++++ afpfs-ng-0.8.1/lib/Makefile.am     2011-08-26 21:33:33.000000000 +0200
+@@ -4,7 +4,7 @@
+ lib_LTLIBRARIES = libafpclient.la
+-libafpclient_la_SOURCES = afp.c codepage.c did.c dsi.c map_def.c uams.c uams_def.c unicode.c users.c utils.c resource.c log.c client.c server.c connect.c loop.c midlevel.c proto_attr.c proto_desktop.c proto_directory.c proto_files.c proto_fork.c proto_login.c proto_map.c proto_replyblock.c proto_server.c proto_volume.c proto_session.c afp_url.c status.c forklist.c debug.c lowlevel.c
++libafpclient_la_SOURCES = afp.c codepage.c did.c dsi.c map_def.c uams.c uams_def.c unicode.c users.c utils.c resource.c log.c client.c server.c connect.c loop.c midlevel.c proto_attr.c proto_desktop.c proto_directory.c proto_files.c proto_fork.c proto_login.c proto_map.c proto_replyblock.c proto_server.c proto_volume.c proto_session.c afp_url.c status.c forklist.c debug.c lowlevel.c identify.c
+ # libafpclient_la_LDFLAGS = -module -avoid-version
diff --git a/tools/depends/target/afpfs-ng/10-fix-errno.patch b/tools/depends/target/afpfs-ng/10-fix-errno.patch
new file mode 100644 (file)
index 0000000..ff7ce44
--- /dev/null
@@ -0,0 +1,23 @@
+--- afpfs-ng-0.8.1/lib/afp.c   2011-09-04 19:42:42.000000000 +0200
++++ afpfs-ng-0.8.1/lib/afp.c   2011-09-04 19:39:44.000000000 +0200
+@@ -19,7 +19,6 @@
+ #include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+-#include <errno.h>
+ #include <afpfs-ng/afp_protocol.h>
+ #include <afpfs-ng/libafpclient.h>
+--- afpfs-ng-0.8.1/lib/afp_url.c       2011-09-04 19:42:42.000000000 +0200
++++ afpfs-ng-0.8.1/lib/afp_url.c       2011-09-04 19:40:27.000000000 +0200
+@@ -21,7 +21,9 @@
+ static int check_port(char * port) 
+ {
+-      long long ret = strtol(port,NULL,10);
++      long long ret = 0;
++      errno = 0;
++      ret = strtol(port,NULL,10);
+       if ((ret<0) || (ret>32767)) return -1;
+       if (errno) {
+               printf("port error\n");
diff --git a/tools/depends/target/afpfs-ng/11-fix-stat.patch b/tools/depends/target/afpfs-ng/11-fix-stat.patch
new file mode 100644 (file)
index 0000000..09e9a35
--- /dev/null
@@ -0,0 +1,11 @@
+--- afpfs-ng-0.8.1/lib/lowlevel.c      2011-10-01 20:36:55.000000000 +0200
++++ afpfs-ng-0.8.1/lib/lowlevel.c      2011-10-01 20:46:00.000000000 +0200
+@@ -579,7 +579,7 @@
+               return -EIO;
+       }
+-      if (volume->server->using_version->av_number>=30)
++      if (volume->server->using_version->av_number>=30 && fp.unixprivs.permissions != 0)
+               stbuf->st_mode |= fp.unixprivs.permissions;
+       else
+               set_nonunix_perms(&stbuf->st_mode,&fp);
diff --git a/tools/depends/target/afpfs-ng/Makefile b/tools/depends/target/afpfs-ng/Makefile
new file mode 100644 (file)
index 0000000..d664be8
--- /dev/null
@@ -0,0 +1,62 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include 01-gcrypt.patch 02-pointer.patch 04-boxee1.patch \
+      05-boxee2.patch 06-boxee3.patch 07-boxee4.patch \
+      08-boxee5.patch 10-fix-errno.patch 11-fix-stat.patch \
+      android.patch fix_afpfs-ng_includes.patch Makefile
+
+# lib name, version
+LIBNAME=afpfs-ng
+VERSION=0.8.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+# configuration settings
+export LIBS+=$(LINK_ICONV)
+
+CONFIGURE=./configure --prefix=$(PREFIX) \
+  --disable-fuse
+
+LIBDYLIB=$(PLATFORM)/lib/.libs/libafpclient.so.0.0.0
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p1 <../fix_afpfs-ng_includes.patch
+       cd $(PLATFORM); patch -p1 <../01-gcrypt.patch
+       cd $(PLATFORM); patch -p1 <../02-pointer.patch
+       cd $(PLATFORM); patch -p1 <../04-boxee1.patch
+       cd $(PLATFORM); patch -p1 <../05-boxee2.patch   
+       cd $(PLATFORM); patch -p1 <../06-boxee3.patch
+       cd $(PLATFORM); patch -p1 <../07-boxee4.patch
+       cd $(PLATFORM); patch -p1 <../08-boxee5.patch
+       cd $(PLATFORM); patch -p1 <../10-fix-errno.patch
+       cd $(PLATFORM); patch -p1 <../11-fix-stat.patch
+       cd $(PLATFORM); patch -p0 < ../android.patch
+       cd $(PLATFORM); $(AUTORECONF) -vif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -j 1 -C $(PLATFORM)/lib
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/lib install
+       $(MAKE) -C $(PLATFORM)/include install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libafpclient.la $(PREFIX)/lib/libafpclient.so $(PREFIX)/lib/libafpclient.so.0
+       mv -f $(PREFIX)/lib/libafpclient.so.0.0.0 $(PREFIX)/lib/libafpclient.so
+       $(RPL) -e "libafpclient.so.0" "libafpclient.so\x00\x00" $(PREFIX)/lib/libafpclient.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libafpclient.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/afpfs-ng/android.patch b/tools/depends/target/afpfs-ng/android.patch
new file mode 100644 (file)
index 0000000..85dcfce
--- /dev/null
@@ -0,0 +1,70 @@
+--- include/afpfs-ng/afp.h     2012-06-03 22:47:49.014348648 -0400
++++ include/afpfs-ng/afp.h     2012-06-03 22:46:28.924348698 -0400
+@@ -5,7 +5,13 @@
+ #include <arpa/inet.h>
+ #include <pthread.h>
+ #include <netdb.h>
++#ifndef ANDROID
+ #include <sys/statvfs.h>
++#else
++#include <sys/vfs.h>
++#define statvfs statfs
++#define fstatvfs fstatfs
++#endif
+ #include <pwd.h>
+ #include <afpfs-ng/afp_protocol.h>
+ #include <afpfs-ng/libafpclient.h>
+--- lib/midlevel.c     2012-06-03 22:47:49.014348648 -0400
++++ lib/midlevel.c     2012-06-03 22:46:28.924348698 -0400
+@@ -1388,10 +1388,12 @@
+       stat->f_frsize=0;
+       stat->f_files=0;
+       stat->f_ffree=0;
++#ifndef ANDROID
+       stat->f_favail=0;
+       stat->f_fsid=0;
+       stat->f_flag=0;
+       stat->f_namemax=255;
++#endif
+       return 0;
+ }
+--- lib/lowlevel.c     2012-06-03 22:47:49.054348648 -0400
++++ lib/lowlevel.c     2012-06-03 22:46:28.914348698 -0400
+@@ -612,7 +612,7 @@
+               modification_date=fp.modification_date;
+       }
+-#ifdef __linux__
++#if defined(__linux__) && !defined(ANDROID)
+       stbuf->st_ctim.tv_sec=creation_date;
+       stbuf->st_mtim.tv_sec=modification_date;
+ #else
+--- lib/dsi.c  2012-06-03 23:24:15.454347269 -0400
++++ lib/dsi.c  2012-06-03 23:25:01.634347240 -0400
+@@ -610,7 +610,11 @@
+               afp_getsrvrmsg(server,AFPMESG_SERVER,
+                       ((server->using_version->av_number>=30)?1:0),
+                       DSI_DEFAULT_TIMEOUT,mesg); 
++#if defined(ANDROID)
++              if(memcmp(mesg,"The server is going down for maintenance.",41)==0)
++#else
+               if(bcmp(mesg,"The server is going down for maintenance.",41)==0)
++#endif
+                       shutdown=1;
+       }
+--- lib/afp.c  2012-06-03 23:24:15.474347269 -0400
++++ lib/afp.c  2012-06-03 23:25:12.464347233 -0400
+@@ -205,7 +205,11 @@
+ {
+         struct afp_server *s;
+       for (s=server_base;s;s=s->next) {
++#if defined(ANDROID)
++                if (memcmp(&s->address,address,sizeof(struct sockaddr_in))==0)
++#else
+                 if (bcmp(&s->address,address,sizeof(struct sockaddr_in))==0)
++#endif
+                         return s;
+       }
+         return NULL;
diff --git a/tools/depends/target/afpfs-ng/fix_afpfs-ng_includes.patch b/tools/depends/target/afpfs-ng/fix_afpfs-ng_includes.patch
new file mode 100644 (file)
index 0000000..f507a48
--- /dev/null
@@ -0,0 +1,3082 @@
+diff -Naur afpfs-ng-0.8.1/cmdline/cmdline_afp.c afpfs-ng-0.8.1.patch/cmdline/cmdline_afp.c
+--- afpfs-ng-0.8.1/cmdline/cmdline_afp.c       2008-02-19 02:54:19.000000000 +0100
++++ afpfs-ng-0.8.1.patch/cmdline/cmdline_afp.c 2011-09-10 12:13:50.102124369 +0200
+@@ -3,9 +3,9 @@
+       
+ */
+-#include "afp.h"
+-#include "midlevel.h"
+-#include "map_def.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/midlevel.h"
++#include "afpfs-ng/map_def.h"
+ #include <string.h>
+ #include <stdio.h>
+diff -Naur afpfs-ng-0.8.1/cmdline/cmdline_testafp.c afpfs-ng-0.8.1.patch/cmdline/cmdline_testafp.c
+--- afpfs-ng-0.8.1/cmdline/cmdline_testafp.c   2008-03-04 21:16:50.000000000 +0100
++++ afpfs-ng-0.8.1.patch/cmdline/cmdline_testafp.c     2011-09-10 12:13:50.102124369 +0200
+@@ -3,8 +3,8 @@
+       
+ */
+-#include "afp.h"
+-#include "midlevel.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/midlevel.h"
+ #include "cmdline_main.h"
+diff -Naur afpfs-ng-0.8.1/cmdline/getstatus.c afpfs-ng-0.8.1.patch/cmdline/getstatus.c
+--- afpfs-ng-0.8.1/cmdline/getstatus.c 2008-02-18 04:28:09.000000000 +0100
++++ afpfs-ng-0.8.1.patch/cmdline/getstatus.c   2011-09-10 12:13:50.109124463 +0200
+@@ -2,7 +2,7 @@
+ #include <string.h>
+ #include <pthread.h>
+-#include "afp.h"
++#include "afpfs-ng/afp.h"
+ static int getstatus(char * address_string, unsigned int port)
+ {
+diff -Naur afpfs-ng-0.8.1/configure.ac afpfs-ng-0.8.1.patch/configure.ac
+--- afpfs-ng-0.8.1/configure.ac        2008-03-08 17:23:12.000000000 +0100
++++ afpfs-ng-0.8.1.patch/configure.ac  2011-09-10 12:13:50.109124463 +0200
+@@ -11,6 +11,7 @@
+ AC_PROG_CC
+ AC_PROG_INSTALL
+ AC_PROG_LIBTOOL
++AM_PROG_CC_C_O
+ # Checks for libraries.
+ # FIXME: Replace `main' with a function in `-lncurses':
+@@ -105,7 +106,7 @@
+-AC_CONFIG_FILES([lib/Makefile fuse/Makefile cmdline/Makefile Makefile docs/Makefile])
++AC_CONFIG_FILES([lib/Makefile fuse/Makefile cmdline/Makefile Makefile include/Makefile include/afpfs-ng/Makefile docs/Makefile])
+ AC_OUTPUT
+diff -Naur afpfs-ng-0.8.1/fuse/client.c afpfs-ng-0.8.1.patch/fuse/client.c
+--- afpfs-ng-0.8.1/fuse/client.c       2008-03-08 03:44:16.000000000 +0100
++++ afpfs-ng-0.8.1.patch/fuse/client.c 2011-09-10 12:13:50.110124477 +0200
+@@ -12,11 +12,11 @@
+ #include <grp.h>
+ #include "config.h"
+-#include <afp.h>
++#include <afpfs-ng/afp.h>
+ #include "afp_server.h"
+-#include "uams_def.h"
+-#include "map_def.h"
+-#include "libafpclient.h"
++#include "afpfs-ng/uams_def.h"
++#include "afpfs-ng/map_def.h"
++#include "afpfs-ng/libafpclient.h"
+ #define default_uam "Cleartxt Passwrd"
+diff -Naur afpfs-ng-0.8.1/fuse/commands.c afpfs-ng-0.8.1.patch/fuse/commands.c
+--- afpfs-ng-0.8.1/fuse/commands.c     2008-03-08 17:06:25.000000000 +0100
++++ afpfs-ng-0.8.1.patch/fuse/commands.c       2011-09-10 12:13:50.110124477 +0200
+@@ -19,15 +19,15 @@
+ #include <getopt.h>
+ #include <signal.h>
+-#include "afp.h"
+-#include "dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/dsi.h"
+ #include "afp_server.h"
+-#include "utils.h"
++#include "afpfs-ng/utils.h"
+ #include "daemon.h"
+-#include "uams_def.h"
+-#include "codepage.h"
+-#include "libafpclient.h"
+-#include "map_def.h"
++#include "afpfs-ng/uams_def.h"
++#include "afpfs-ng/codepage.h"
++#include "afpfs-ng/libafpclient.h"
++#include "afpfs-ng/map_def.h"
+ #include "fuse_int.h"
+ #include "fuse_error.h"
+ #include "fuse_internal.h"
+diff -Naur afpfs-ng-0.8.1/fuse/daemon.c afpfs-ng-0.8.1.patch/fuse/daemon.c
+--- afpfs-ng-0.8.1/fuse/daemon.c       2008-03-04 18:26:05.000000000 +0100
++++ afpfs-ng-0.8.1.patch/fuse/daemon.c 2011-09-10 12:13:50.110124477 +0200
+@@ -23,11 +23,11 @@
+ #include <signal.h>
+ #include <sys/socket.h>
+-#include "afp.h"
++#include "afpfs-ng/afp.h"
+-#include "dsi.h"
++#include "afpfs-ng/dsi.h"
+ #include "afp_server.h"
+-#include "utils.h"
++#include "afpfs-ng/utils.h"
+ #include "daemon.h"
+ #include "commands.h"
+diff -Naur afpfs-ng-0.8.1/fuse/fuse_error.c afpfs-ng-0.8.1.patch/fuse/fuse_error.c
+--- afpfs-ng-0.8.1/fuse/fuse_error.c   2008-01-18 05:40:10.000000000 +0100
++++ afpfs-ng-0.8.1.patch/fuse/fuse_error.c     2011-09-10 12:13:50.111124491 +0200
+@@ -4,7 +4,7 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <stdio.h>
+-#include "libafpclient.h"
++#include "afpfs-ng/libafpclient.h"
+ #include "fuse_internal.h"
+ #define TMP_FILE "/tmp/fuse_stderr"
+diff -Naur afpfs-ng-0.8.1/fuse/fuse_int.c afpfs-ng-0.8.1.patch/fuse/fuse_int.c
+--- afpfs-ng-0.8.1/fuse/fuse_int.c     2008-03-02 06:06:24.000000000 +0100
++++ afpfs-ng-0.8.1.patch/fuse/fuse_int.c       2011-09-10 12:13:50.111124491 +0200
+@@ -18,7 +18,7 @@
+ #define FUSE_USE_VERSION 25
+-#include "afp.h"
++#include "afpfs-ng/afp.h"
+ #include <fuse.h>
+ #include <stdio.h>
+@@ -39,10 +39,10 @@
+ #include <pwd.h>
+ #include <stdarg.h>
+-#include "dsi.h"
+-#include "afp_protocol.h"
+-#include "codepage.h"
+-#include "midlevel.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp_protocol.h"
++#include "afpfs-ng/codepage.h"
++#include "afpfs-ng/midlevel.h"
+ #include "fuse_error.h"
+ /* Uncomment the following line to enable full debugging: */
+diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/afp.h afpfs-ng-0.8.1.patch/include/afpfs-ng/afp.h
+--- afpfs-ng-0.8.1/include/afpfs-ng/afp.h      1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/afp.h        2011-09-10 12:13:50.112124505 +0200
+@@ -0,0 +1,533 @@
++
++#ifndef _AFP_H_
++#define _AFP_H_
++
++#include <arpa/inet.h>
++#include <pthread.h>
++#include <netdb.h>
++#include <sys/statvfs.h>
++#include <pwd.h>
++#include <afpfs-ng/afp_protocol.h>
++#include <afpfs-ng/libafpclient.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <unistd.h>
++#include <netinet/in.h>
++
++
++#define AFPFS_VERSION "0.8.1"
++
++/* This is the maximum AFP version this library supports */
++#define AFP_MAX_SUPPORTED_VERSION 32
++
++/* afp_url is used to pass locations around */
++struct afp_url {
++      enum {TCPIP,AT} protocol;
++      char username[AFP_MAX_USERNAME_LEN];
++      char uamname[50];
++      char password[AFP_MAX_PASSWORD_LEN];
++      char servername[AFP_SERVER_NAME_UTF8_LEN];
++      int port;
++      char volumename[AFP_VOLUME_NAME_UTF8_LEN];
++      char path[AFP_MAX_PATH];
++
++      int requested_version;
++      char zone[AFP_ZONE_LEN]; /* Only used for Appletalk */
++      char volpassword[9];;
++};
++
++struct afp_token {
++      unsigned int length;
++      char data[AFP_TOKEN_MAX_LEN];
++};
++
++#define SERVER_MAX_VERSIONS 10
++#define SERVER_MAX_UAMS 10
++
++struct afp_rx_buffer {
++      unsigned int size;
++      unsigned int maxsize;
++      char * data;
++      int errorcode;
++};
++
++
++struct afp_file_info {
++      unsigned short attributes;
++      unsigned int did;
++      unsigned int creation_date;
++      unsigned int modification_date;
++      unsigned int backup_date;
++      unsigned int fileid;
++      unsigned short offspring;
++      char sync;
++      char finderinfo[32];
++      char name[AFP_MAX_PATH];
++      char basename[AFP_MAX_PATH];
++      char translated_name[AFP_MAX_PATH];
++      struct afp_unixprivs unixprivs;
++      unsigned int accessrights;
++      struct afp_file_info * next;
++      struct afp_file_info * largelist_next;
++      unsigned char isdir;
++      unsigned long long size;
++      unsigned short resourcesize;
++      unsigned int resource;
++      unsigned short forkid;
++      struct afp_icon * icon;
++      int eof;
++};
++
++
++#define VOLUME_EXTRA_FLAGS_VOL_CHMOD_KNOWN 0x1
++#define VOLUME_EXTRA_FLAGS_VOL_CHMOD_BROKEN 0x2
++#define VOLUME_EXTRA_FLAGS_SHOW_APPLEDOUBLE 0x4
++#define VOLUME_EXTRA_FLAGS_VOL_SUPPORTS_UNIX 0x8
++#define VOLUME_EXTRA_FLAGS_NO_LOCKING 0x10
++#define VOLUME_EXTRA_FLAGS_IGNORE_UNIXPRIVS 0x20
++#define VOLUME_EXTRA_FLAGS_READONLY 0x40
++
++#define AFP_VOLUME_UNMOUNTED 0
++#define AFP_VOLUME_MOUNTED 1
++#define AFP_VOLUME_UNMOUNTING 2
++
++struct afp_volume {
++      unsigned short volid;
++      char flags;  /* This is from afpGetSrvrParms */
++      unsigned short attributes; /* This is from VolOpen */
++      unsigned short signature;  /* This is fixed or variable */
++      unsigned int creation_date;
++      unsigned int modification_date;
++      unsigned int backup_date;
++      struct statvfs stat;
++      unsigned char mounted;
++      char mountpoint[255];
++      struct afp_server * server;
++      char volume_name[AFP_VOLUME_NAME_LEN];
++      char volume_name_printable[AFP_VOLUME_NAME_UTF8_LEN];
++      unsigned short dtrefnum;
++      char volpassword[AFP_VOLPASS_LEN];
++      unsigned int extra_flags; /* This is an afpfs-ng specific field */
++
++      /* Our directory ID cache */
++      struct did_cache_entry * did_cache_base;
++      pthread_mutex_t did_cache_mutex;
++
++      /* Our journal of open forks */
++      struct afp_file_info * open_forks;
++      pthread_mutex_t open_forks_mutex;
++
++      /* Used to trigger startup */
++        pthread_cond_t  startup_condition_cond;
++
++      struct {
++              uint64_t hits;
++              uint64_t misses;
++              uint64_t expired;
++              uint64_t force_removed;
++      } did_cache_stats;
++
++      void * priv;  /* This is a private structure for fuse/cmdline, etc */
++      pthread_t thread; /* This is the per-volume thread */
++
++      int mapping;
++
++};
++
++#define SERVER_STATE_CONNECTED 1
++#define SERVER_STATE_DISCONNECTED 2
++
++enum server_type{
++      AFPFS_SERVER_TYPE_UNKNOWN,
++      AFPFS_SERVER_TYPE_NETATALK,
++      AFPFS_SERVER_TYPE_AIRPORT,
++      AFPFS_SERVER_TYPE_MACINTOSH,
++};
++
++#define is_netatalk(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_NETATALK )
++#define is_airport(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_AIRPORT )
++#define is_macintosh(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_MACINTOSH )
++
++
++
++struct afp_versions {
++        char        *av_name;
++        int         av_number;
++};
++extern struct afp_versions afp_versions[];
++
++struct afp_server {
++
++      /* Our buffer sizes */
++      unsigned int tx_quantum;
++      unsigned int rx_quantum;
++
++      unsigned int tx_delay;
++
++      /* Connection information */
++      struct sockaddr_in address;
++      int fd;
++
++      /* Some stats, for information only */
++      struct {
++              uint64_t runt_packets;
++              uint64_t incoming_dsi;
++              uint64_t rx_bytes;
++              uint64_t tx_bytes;
++              uint64_t requests_pending;
++      } stats;
++
++      /* General information */
++      char server_name[AFP_SERVER_NAME_LEN];
++      char server_name_utf8[AFP_SERVER_NAME_UTF8_LEN];
++        char server_name_printable[AFP_SERVER_NAME_UTF8_LEN];
++
++      char machine_type[17];
++      char icon[256];
++      char signature[16];
++      unsigned short flags;
++      int connect_state;
++      enum server_type server_type;
++
++      /* This is the time we connected */
++      time_t connect_time;
++
++      /* UAMs */
++      unsigned int supported_uams;
++      unsigned int using_uam;
++
++      /* Authentication */
++      char username[AFP_MAX_USERNAME_LEN];
++      char password[AFP_MAX_PASSWORD_LEN];
++
++      /* Session */
++      struct afp_token token;
++      char need_resume;
++
++      /* Versions */
++      unsigned char requested_version;
++      unsigned char versions[SERVER_MAX_VERSIONS];
++      struct afp_versions *using_version;
++
++      /* Volumes */
++      unsigned char num_volumes;
++      struct afp_volume * volumes;
++
++      void * dsi;
++      unsigned int exit_flag;
++
++      /* Our DSI request queue */
++      pthread_mutex_t requestid_mutex;
++      pthread_mutex_t request_queue_mutex;
++      unsigned short lastrequestid;
++      unsigned short expectedrequestid;
++      struct dsi_request * command_requests;
++
++
++      char loginmesg[200];
++      char servermesg[200];
++      char path_encoding;
++
++      /* This is the data for the incoming buffer */
++      char * incoming_buffer;
++      int data_read;
++      int bufsize;
++
++      /* And this is for the outgoing queue */
++      pthread_mutex_t send_mutex;
++
++      /* This is for user mapping */
++      struct passwd passwd;
++      unsigned int server_uid, server_gid;
++      int server_gid_valid;
++
++      struct afp_server *next;
++
++      /* These are for DSI attention packets */
++      unsigned int attention_quantum;
++      unsigned int attention_len;
++      char * attention_buffer;
++
++};
++
++struct afp_extattr_info {
++      unsigned int maxsize;
++      unsigned int size;
++      char data[1024];
++};
++struct afp_comment {
++      unsigned int maxsize;
++      unsigned int size;
++      char *data;
++};
++
++struct afp_icon {
++      unsigned int maxsize;
++      unsigned int size;
++      char *data;
++};
++
++#define AFP_DEFAULT_ATTENTION_QUANTUM 1024
++
++void afp_unixpriv_to_stat(struct afp_file_info *fp,
++      struct stat *stat);
++
++int init_uams(void) ;
++
++unsigned int find_uam_by_name(const char * name);
++char * uam_bitmap_to_string(unsigned int bitmap);
++
++
++char * get_uam_names_list(void);
++
++unsigned int default_uams_mask(void);
++
++struct afp_volume * find_volume_by_name(struct afp_server * server,
++        const char * volname);
++
++struct afp_connection_request {
++        unsigned int uam_mask;
++      struct afp_url url;
++};
++
++void afp_default_url(struct afp_url *url);
++int afp_parse_url(struct afp_url * url, const char * toparse, int verbose);
++void afp_print_url(struct afp_url * url);
++int afp_url_validate(char * url_string, struct afp_url * valid_url);
++
++int afp_list_volnames(struct afp_server * server, char * names, int max);
++
++/* User mapping */
++int afp_detect_mapping(struct afp_volume * volume);
++
++/* These are some functions that help with simple status text generation */
++
++int afp_status_header(char * text, int * len);
++int afp_status_server(struct afp_server * s,char * text, int * len);
++
++
++struct afp_server * afp_server_full_connect(void * priv, struct afp_connection_request * req);
++
++void * just_end_it_now(void *other);
++void add_fd_and_signal(int fd);
++void loop_disconnect(struct afp_server *s);
++void afp_wait_for_started_loop(void);
++
++
++struct afp_versions * pick_version(unsigned char *versions,
++      unsigned char requested) ;
++int pick_uam(unsigned int u1, unsigned int u2);
++
++int afp_server_login(struct afp_server *server,
++        char * mesg, unsigned int *l, unsigned int max);
++
++
++int afp_dologin(struct afp_server *server,
++      unsigned int uam, char * username, char * passwd);
++
++void afp_free_server(struct afp_server **server);
++
++struct afp_server * afp_server_init(struct sockaddr_in * address);
++int afp_get_address(void * priv, const char * hostname, unsigned int port,
++      struct sockaddr_in * address);
++
++
++int afp_main_loop(int command_fd);
++int afp_main_quick_startup(pthread_t * thread);
++
++int afp_server_destroy(struct afp_server *s) ;
++int afp_server_reconnect(struct afp_server * s, char * mesg,
++        unsigned int *l, unsigned int max);
++int afp_server_connect(struct afp_server *s, int full);
++
++struct afp_server * afp_server_complete_connection(
++      void * priv,
++      struct afp_server * server,
++      struct sockaddr_in * address, unsigned char * versions,
++      unsigned int uams, char * username, char * password,
++      unsigned int requested_version, unsigned int uam_mask);
++
++int afp_connect_volume(struct afp_volume * volume, struct afp_server * server,
++      char * mesg, unsigned int * l, unsigned int max);
++int something_is_mounted(struct afp_server * server);
++
++int add_cache_entry(struct afp_file_info * file) ;
++struct afp_file_info * get_cache_by_name(char * name);
++struct afp_server * find_server_by_address(struct sockaddr_in * address);
++struct afp_server * find_server_by_signature(char * signature);
++struct afp_server * find_server_by_name(char * name);
++int server_still_valid(struct afp_server * server);
++
++
++struct afp_server * get_server_base(void);
++int afp_server_remove(struct afp_server * server);
++
++int afp_unmount_volume(struct afp_volume * volume);
++int afp_unmount_all_volumes(struct afp_server * server);
++
++#define volume_is_readonly(x) (((x)->attributes&kReadOnly) || \
++      ((x)->extra_flags & VOLUME_EXTRA_FLAGS_READONLY))
++
++int afp_opendt(struct afp_volume *volume, unsigned short * refnum);
++
++int afp_closedt(struct afp_server * server, unsigned short * refnum);
++
++int afp_getcomment(struct afp_volume *volume, unsigned int did,
++        const char * pathname, struct afp_comment * comment);
++
++int afp_addcomment(struct afp_volume *volume, unsigned int did,
++        const char * pathname, char * comment,uint64_t *size);
++
++int afp_geticon(struct afp_volume * volume, unsigned int filecreator,
++        unsigned int filetype, unsigned char icontype, 
++      unsigned short length, struct afp_icon * icon);
++
++/* Things you want to do to a server */
++
++int afp_getsrvrmsg(struct afp_server *server, unsigned short messagetype,unsigned char utf8, unsigned char block, char * mesg);
++
++int afp_login(struct afp_server *server, char * uaname,
++        char * userauthinfo, unsigned int userauthinfo_len,
++      struct afp_rx_buffer *rx);
++
++int afp_changepassword(struct afp_server *server, char * uaname,
++        char * userauthinfo, unsigned int userauthinfo_len,
++      struct afp_rx_buffer *rx);
++
++int afp_logincont(struct afp_server *server, unsigned short id,
++        char * userauthinfo, unsigned int userauthinfo_len,
++      struct afp_rx_buffer *rx);
++
++int afp_getsessiontoken(struct afp_server * server, int type,
++        unsigned int timestamp, struct afp_token *outgoing_token,
++        struct afp_token * incoming_token);
++
++int afp_getsrvrparms(struct afp_server *server);
++
++int afp_logout(struct afp_server *server,unsigned char wait);
++
++int afp_mapname(struct afp_server * server, unsigned char subfunction,
++        char * name, unsigned int * id);
++
++int afp_mapid(struct afp_server * server, unsigned char subfunction,
++      unsigned int id, char *name);
++
++int afp_getuserinfo(struct afp_server * server, int thisuser,
++      unsigned int userid, unsigned short bitmap, 
++      unsigned int *newuid, unsigned int *newgid);
++
++int afp_zzzzz(struct afp_server *server);
++
++int afp_volopen(struct afp_volume * volume, 
++              unsigned short bitmap, char * password);
++
++int afp_flush(struct afp_volume * volume);
++
++int afp_getfiledirparms(struct afp_volume *volume, unsigned int did, 
++      unsigned int filebitmap, unsigned int dirbitmap, const char * pathname,
++      struct afp_file_info *fp);
++
++int afp_enumerate(struct afp_volume * volume, 
++      unsigned int dirid, 
++      unsigned int filebitmap, unsigned int dirbitmap, 
++        unsigned short reqcount,
++        unsigned short startindex,
++        char * path,
++      struct afp_file_info ** file_p);
++
++int afp_enumerateext2(struct afp_volume * volume, 
++      unsigned int dirid, 
++      unsigned int filebitmap, unsigned int dirbitmap, 
++        unsigned short reqcount,
++        unsigned long startindex,
++        char * path,
++      struct afp_file_info ** file_p);
++
++int afp_openfork(struct afp_volume * volume,
++        unsigned char forktype,
++        unsigned int dirid,
++        unsigned short accessmode,
++        char * filename, 
++      struct afp_file_info *fp);
++
++int afp_read(struct afp_volume * volume, unsigned short forkid,
++                uint32_t offset,
++                uint32_t count, struct afp_rx_buffer * rx);
++
++int afp_readext(struct afp_volume * volume, unsigned short forkid,
++                uint64_t offset,
++                uint64_t count, struct afp_rx_buffer * rx);
++
++int afp_getvolparms(struct afp_volume * volume, unsigned short bitmap);
++
++
++int afp_createdir(struct afp_volume * volume, unsigned int dirid, const char * pathname, unsigned int *did_p);
++
++int afp_delete(struct afp_volume * volume,
++        unsigned int dirid, char * pathname);
++
++
++int afp_createfile(struct afp_volume * volume, unsigned char flag,
++        unsigned int did, char * pathname);
++
++int afp_write(struct afp_volume * volume, unsigned short forkid,
++        uint32_t offset, uint32_t reqcount,
++        char * data, uint32_t * written);
++
++int afp_writeext(struct afp_volume * volume, unsigned short forkid,
++        uint64_t offset, uint64_t reqcount,
++        char * data, uint64_t * written);
++
++int afp_flushfork(struct afp_volume * volume, unsigned short forkid);
++
++int afp_closefork(struct afp_volume * volume, unsigned short forkid);
++int afp_setfileparms(struct afp_volume * volume,
++        unsigned int dirid, const char * pathname, unsigned short bitmap,
++        struct afp_file_info *fp);
++int afp_setfiledirparms(struct afp_volume * volume, 
++        unsigned int dirid, const char * pathname, unsigned short bitmap,
++        struct afp_file_info *fp);
++
++int afp_setdirparms(struct afp_volume * volume,
++        unsigned int dirid, const char * pathname, unsigned short bitmap,
++        struct afp_file_info *fp);
++
++int afp_volclose(struct afp_volume * volume);
++
++
++int afp_setforkparms(struct afp_volume *volume,
++        unsigned short forkid, unsigned short bitmap, unsigned long len);
++
++int afp_byterangelock(struct afp_volume * volume,
++        unsigned char flag,
++        unsigned short forkid,
++        uint32_t offset,
++        uint32_t len, uint32_t *generated_offset);
++
++int afp_byterangelockext(struct afp_volume * volume,
++        unsigned char flag,
++        unsigned short forkid,
++        uint64_t offset,
++        uint64_t len, uint64_t *generated_offset);
++
++int afp_moveandrename(struct afp_volume *volume,
++      unsigned int src_did,
++      unsigned int dst_did,
++      char * src_path, char * dst_path, char *new_name);
++
++int afp_rename(struct afp_volume * volume,
++        unsigned int dirid,
++        char * path_from, char * path_to);
++
++int afp_listextattr(struct afp_volume * volume,
++        unsigned int dirid, unsigned short bitmap,
++        char * pathname, struct afp_extattr_info * info);
++
++/* This is a currently undocumented command */
++int afp_newcommand76(struct afp_volume * volume, unsigned int dlen, char * data);
++
++/* For debugging */
++char * afp_get_command_name(char code);
++
++
++#endif
+diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/afp_protocol.h afpfs-ng-0.8.1.patch/include/afpfs-ng/afp_protocol.h
+--- afpfs-ng-0.8.1/include/afpfs-ng/afp_protocol.h     1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/afp_protocol.h       2011-09-10 12:13:50.112124505 +0200
+@@ -0,0 +1,361 @@
++
++#ifndef _AFP_PROTOCOL_H_
++#define _AFP_PROTOCOL_H_
++
++#include <sys/types.h>
++#include <stddef.h>
++#include <unistd.h>
++#include <stdint.h>
++
++/* This file defines constants for the Apple File Protocol.
++   All page references are from "Apple Filing Protocol Programming" version 3.2.
++   except where noted.
++*/
++
++#define AFP_SERVER_NAME_LEN 33
++#define AFP_SERVER_NAME_UTF8_LEN 255
++#define AFP_VOLUME_NAME_LEN 33
++#define AFP_VOLUME_NAME_UTF8_LEN 33
++#define AFP_SIGNATURE_LEN 16
++#define AFP_MACHINETYPE_LEN 33
++#define AFP_LOGINMESG_LEN 200
++#define AFP_VOLPASS_LEN 8
++#define AFP_HOSTNAME_LEN 255
++/* This is actually just a guess, and only used for appletalk */
++#define AFP_ZONE_LEN 255
++
++#define AFP_SERVER_ICON_LEN 256
++
++
++#define AFP_MAX_USERNAME_LEN 127
++#define AFP_MAX_PASSWORD_LEN 127
++
++
++/* This is the maximum length of any UAM string */
++#define AFP_UAM_LENGTH 24
++
++/* This is the maximum length of any path description */
++#define AFP_MAX_PATH 768
++
++#define AFP_VOL_FLAT 1
++#define AFP_VOL_FIXED 2
++#define AFP_VOL_VARIABLE 3
++
++/* The root directory ID, p.26 */
++
++#define AFP_ROOT_DID 2
++
++/* Path type constants, p.249 */
++
++enum {
++kFPShortName = 1,
++kFPLongName = 2,
++kFPUTF8Name = 3
++};
++
++/* fork types */
++
++#define AFP_FORKTYPE_DATA 0x0
++#define AFP_FORKTYPE_RESOURCE 0x80
++
++/* openfork access modes, from p.196 */
++
++#define AFP_OPENFORK_ALLOWREAD 1
++#define AFP_OPENFORK_ALLOWWRITE 2
++#define AFP_OPENFORK_DENYREAD 0x10
++#define AFP_OPENFORK_DENYWRITE 0x20
++
++/* Message type for getsrvmesg, p. 169*/
++
++typedef enum {
++  AFPMESG_LOGIN = 0,
++  AFPMESG_SERVER = 1
++} afpmessage_t;
++
++/* Message bitmap for getsrvrmsg */
++
++#define AFP_GETSRVRMSG_UTF8 0x2
++#define AFP_GETSRVRMSG_GETMSG 0x1
++
++
++/* Maximum Version length, p.17 */
++#define AFP_MAX_VERSION_LENGTH 16
++
++/* Maximum length of a token, this is undocumented */
++#define AFP_TOKEN_MAX_LEN 256
++
++/* The maximum size of a file for AFP 2 */
++#define AFP_MAX_AFP2_FILESIZE (4294967296)
++
++/* Unix privs, p.240 */
++
++struct afp_unixprivs {
++      uint32_t uid __attribute__((__packed__));
++      uint32_t gid __attribute__((__packed__));
++      uint32_t permissions __attribute__((__packed__));
++      uint32_t ua_permissions __attribute__((__packed__));
++
++};
++
++
++/* AFP Volume attributes bitmap, p.241 */
++
++enum {
++    kReadOnly = 0x01,
++    kHasVolumePassword = 0x02,
++    kSupportsFileIDs = 0x04,
++    kSupportsCatSearch = 0x08,
++    kSupportsBlankAccessPrivs = 0x10,
++    kSupportsUnixPrivs = 0x20,
++    kSupportsUTF8Names = 0x40,
++    kNoNetworkUserIDs = 0x80,
++    kDefaultPrivsFromParent = 0x100,
++    kNoExchangeFiles = 0x200,
++    kSupportsExtAttrs = 0x400,
++    kSupportsACLs=0x800
++};
++
++/* AFP file creation constantes, p.250 */
++enum {
++kFPSoftCreate = 0,
++kFPHardCreate = 0x80
++};
++
++/* AFP Directory attributes, taken from the protocol guide p.236 */
++
++enum {
++    kFPAttributeBit = 0x1,
++    kFPParentDirIDBit = 0x2,
++    kFPCreateDateBit = 0x4,
++    kFPModDateBit = 0x8,
++    kFPBackupDateBit = 0x10,
++    kFPFinderInfoBit = 0x20,
++    kFPLongNameBit = 0x40,
++    kFPShortNameBit = 0x80,
++    kFPNodeIDBit = 0x100,
++    kFPOffspringCountBit = 0x0200,
++    kFPOwnerIDBit = 0x0400,
++    kFPGroupIDBit = 0x0800,
++    kFPAccessRightsBit = 0x1000,
++    kFPProDOSInfoBit = 0x2000, // AFP version 2.2 and earlier
++    kFPUTF8NameBit = 0x2000, // AFP version 3.0 and later
++    kFPUnixPrivsBit = 0x8000 // AFP version 3.0 and later
++};
++
++/* AFP File bitmap, p.238.  These are the ones not in the AFP Directory
++   attributes map. */
++
++enum {
++      kFPDataForkLenBit = 0x0200,
++      kFPRsrcForkLenBit = 0x0400,
++      kFPExtDataForkLenBit = 0x0800, // AFP version 3.0 and later
++      kFPLaunchLimitBit = 0x1000,
++      kFPExtRsrcForkLenBit = 0x4000, // AFP version 3.0 and later
++};
++
++/* AFP Extended Attributes Bitmap, p.238  */
++
++enum {
++      kXAttrNoFollow = 0x1,
++      kXAttrCreate = 0x2,
++      kXAttrREplace=0x4
++};
++
++
++/* AFP function codes */
++enum AFPFunction
++{
++        afpByteRangeLock = 1, afpCloseVol, afpCloseDir, afpCloseFork,
++        afpCopyFile, afpCreateDir, afpCreateFile,
++        afpDelete, afpEnumerate, afpFlush, afpFlushFork,
++        afpGetForkParms = 14, afpGetSrvrInfo, afpGetSrvrParms,
++        afpGetVolParms, afpLogin, afpLoginCont, afpLogout, afpMapID,
++        afpMapName, afpMoveAndRename, afpOpenVol, afpOpenDir, afpOpenFork,
++        afpRead, afpRename, afpSetDirParms, afpSetFileParms,
++        afpSetForkParms, afpSetVolParms, afpWrite, afpGetFileDirParms,
++      afpSetFileDirParms, afpChangePassword,
++        afpGetUserInfo=37,afpGetSrvrMsg = 38,
++      afpOpenDT=48,
++      afpCloseDT=49,
++      afpGetIcon=51, afpGetIconInfo=52,
++      afpAddComment=56, afpRemoveComment=57, afpGetComment=58,
++      afpByteRangeLockExt=59, afpReadExt, afpWriteExt,
++      afpGetAuthMethods=62,
++      afp_LoginExt=63,
++      afpGetSessionToken=64,
++      afpDisconnectOldSession=65,
++      afpEnumerateExt=66,
++      afpCatSearchExt = 67,
++      afpEnumerateExt2 = 68, afpGetExtAttr, afpSetExtAttr, 
++      afpRemoveExtAttr , afpListExtAttrs,
++      afpZzzzz = 122,
++      afpAddIcon=192,
++};
++
++/* AFP Volume bitmap.  Take from 242 of the protocol guide. */
++enum {
++      kFPBadVolPre222Bitmap = 0xFe00,
++      kFPBadVolBitmap = 0xF000,
++      kFPVolAttributeBit = 0x1,
++      kFPVolSignatureBit = 0x2,
++      kFPVolCreateDateBit = 0x4,
++      kFPVolModDateBit = 0x8,
++      kFPVolBackupDateBit = 0x10,
++      kFPVolIDBit = 0x20,
++      kFPVolBytesFreeBit = 0x40,
++      kFPVolBytesTotalBit = 0x80,
++      kFPVolNameBit = 0x100,
++      kFPVolExtBytesFreeBit = 0x200,
++      kFPVolExtBytesTotalBit = 0x400,
++      kFPVolBlockSizeBit = 0x800
++};
++
++/* AFP Attention Codes -- 4 bits */
++#define AFPATTN_SHUTDOWN     (1 << 15)            /* shutdown/disconnect */
++#define AFPATTN_CRASH        (1 << 14)            /* server crashed */
++#define AFPATTN_MESG         (1 << 13)            /* server has message */
++#define AFPATTN_NORECONNECT  (1 << 12)            /* don't reconnect */
++/* server notification */
++#define AFPATTN_NOTIFY       (AFPATTN_MESG | AFPATTN_NORECONNECT) 
++
++/* extended bitmap -- 12 bits. volchanged is only useful w/ a server
++ * notification, and time is only useful for shutdown. */
++#define AFPATTN_VOLCHANGED   (1 << 0)             /* volume has changed */
++#define AFPATTN_TIME(x)      ((x) & 0xfff)        /* time in minutes */
++
++#define kFPNoErr 0
++
++/* AFP result codes, p252 */
++#define kASPSessClosed -1072
++#define kFPAccessDenied -5000
++#define kFPAuthContinue -5001
++#define kFPBadUAM -5002
++#define kFPBadVersNum -5003
++#define kFPBitmapErr -5004
++#define kFPCantMove -5005
++#define kFPDenyConflict -5006
++#define kFPDirNotEmpty -5007
++#define kFPDiskFull -5008
++#define kFPEOFErr -5009
++#define kFPFileBusy -5010
++#define kFPFlatVol -5011
++#define kFPItemNotFound -5012
++#define kFPLockErr -5013
++#define kFPMiscErr -5014
++#define kFPNoMoreLocks -5015
++#define kFPNoServer -5016
++#define kFPObjectExists -5017
++#define kFPObjectNotFound -5018
++#define kFPParamErr -5019
++#define kFPRangeNotLocked -5020
++#define kFPRangeOverlap -5021
++#define kFPSessClosed -5022
++#define kFPUserNotAuth -5023
++#define kFPCallNotSupported -5024
++#define kFPObjectTypeErr -5025
++#define kFPTooManyFilesOpen -5026
++#define kFPServerGoingDown -5027
++#define kFPCantRename -5028
++#define kFPDirNotFound -5029
++#define kFPIconTypeError -5030
++#define kFPVolLocked -5031
++#define kFPObjectLocked -5032
++#define kFPContainsSharedErr -5033
++#define kFPIDNotFound -5034
++#define kFPIDExists -5035
++#define kFPDiffVolErr  -5036
++#define kFPCatalogChanged -5037
++#define kFPSameObjectErr -5038
++#define kFPBadIDErr -5039
++#define kFPPwdSameErr -5040
++#define kFPPwdTooShortErr -5041
++#define kFPPwdExpiredErr -5042
++#define kFPInsideSharedErr -5043
++#define kFPInsideTrashErr -5044
++#define kFPPwdNeedsChangeErr -5045
++#define kFPPwdPolicyErr -5046
++#define kFPDiskQuotaExceeded â€“5047 
++
++
++
++/* These flags determine to lock or unlock in ByteRangeLock(Ext) */
++
++enum {
++ByteRangeLock_Lock = 0,
++ByteRangeLock_Unlock = 1
++};
++
++/* These flags are used in volopen and getsrvrparm replies, p.171 */
++
++#define HasConfigInfo 0x1
++#define HasPassword 0x80
++
++/* These are the subfunction for kFPMapID, as per p.248 */
++
++enum {
++kUserIDToName = 1,
++kGroupIDToName = 2,
++kUserIDToUTF8Name = 3,
++kGroupIDToUTF8Name = 4,
++kUserUUIDToUTF8Name = 5,
++kGroupUUIDToUTF8Name = 6
++};
++
++
++/* These are the subfunction flags described in the FPMapName command, p.286.
++   Note that this is different than what's described on p. 186. */
++
++enum {
++kNameToUserID = 1,
++kNameToGroupID = 2,
++kUTF8NameToUserID = 3,
++kUTF8NameToGroupID = 4,
++kUTF8NameToUserUUID = 5,
++kUTF8NameToGroupUUID = 6
++};
++
++/* These are bits for FPGetUserInfo, p.173. */
++#define kFPGetUserInfo_USER_ID 1
++#define kFPGetUserInfo_PRI_GROUPID 2
++
++/* Flags for the replies of GetSrvrInfo and DSI GetStatus, p.240 */
++
++enum {
++      kSupportsCopyfile = 0x01,
++      kSupportsChgPwd = 0x02,
++      kDontAllowSavePwd = 0x04,
++      kSupportsSrvrMsg = 0x08,
++      kSrvrSig = 0x10,
++      kSupportsTCP = 0x20,
++      kSupportsSrvrNotify = 0x40,
++      kSupportsReconnect = 0x80,
++      kSupportsDirServices = 0x100,
++      kSupportsUTF8SrvrName = 0x200,
++      kSupportsUUIDs = 0x400,
++      kSupportsSuperClient = 0x8000
++};
++
++
++/* p.247 */
++
++enum {
++      kLoginWithoutID = 0,
++      kLoginWithID = 1,
++      kReconnWithID = 2,
++      kLoginWithTimeAndID = 3,
++      kReconnWithTimeAndID = 4,
++      kRecon1Login = 5,
++      kRecon1ReconnectLogin = 6,
++      kRecon1Refresh = 7, kGetKerberosSessionKey = 8
++};
++
++
++#define AFP_CHMOD_ALLOWED_BITS_22 \
++      (S_IRUSR |S_IWUSR | S_IRGRP | S_IWGRP |S_IROTH | S_IWOTH | S_IFREG )
++
++
++#endif
++
++
++
++
+diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/codepage.h afpfs-ng-0.8.1.patch/include/afpfs-ng/codepage.h
+--- afpfs-ng-0.8.1/include/afpfs-ng/codepage.h 1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/codepage.h   2011-09-10 12:13:50.113124518 +0200
+@@ -0,0 +1,11 @@
++#ifndef __CODE_PAGE_H_
++#define __CODE_PAGE_H_
++int convert_utf8dec_to_utf8pre(const char *src, int src_len,
++      char * dest, int dest_len);
++int convert_utf8pre_to_utf8dec(const char * src, int src_len, 
++      char * dest, int dest_len);
++int convert_path_to_unix(char encoding, char * dest, 
++      char * src, int dest_len);
++int convert_path_to_afp(char encoding, char * dest, 
++      char * src, int dest_len);
++#endif
+diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/dsi.h afpfs-ng-0.8.1.patch/include/afpfs-ng/dsi.h
+--- afpfs-ng-0.8.1/include/afpfs-ng/dsi.h      1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/dsi.h        2011-09-10 12:13:50.115124544 +0200
+@@ -0,0 +1,33 @@
++
++#ifndef __DSI_H_
++#define __DSI_H_
++
++#include "afpfs-ng/afp.h"
++
++struct dsi_request
++{
++      unsigned short requestid;
++      unsigned char subcommand;
++      void * other;
++      unsigned char wait;
++      pthread_cond_t  condition_cond;
++      struct dsi_request * next;
++      int return_code;
++};
++
++int dsi_receive(struct afp_server * server, void * data, int size);
++int dsi_getstatus(struct afp_server * server);
++
++int dsi_opensession(struct afp_server *server);
++
++int dsi_send(struct afp_server *server, char * msg, int size,int wait,unsigned char subcommand, void ** other);
++struct dsi_session * dsi_create(struct afp_server *server);
++int dsi_restart(struct afp_server *server);
++int dsi_recv(struct afp_server * server);
++
++#define DSI_BLOCK_TIMEOUT -1
++#define DSI_DONT_WAIT 0
++#define DSI_DEFAULT_TIMEOUT 5
++
++
++#endif
+diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/libafpclient.h afpfs-ng-0.8.1.patch/include/afpfs-ng/libafpclient.h
+--- afpfs-ng-0.8.1/include/afpfs-ng/libafpclient.h     1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/libafpclient.h       2011-09-10 12:13:50.115124544 +0200
+@@ -0,0 +1,50 @@
++
++#ifndef __CLIENT_H_
++#define __CLIENT_H_
++
++#include <unistd.h>
++#include <syslog.h>
++
++#define MAX_CLIENT_RESPONSE 2048
++
++
++enum loglevels {
++        AFPFSD,
++};
++
++struct afp_server;
++struct afp_volume;
++
++struct libafpclient {
++        int (*unmount_volume) (struct afp_volume * volume);
++      void (*log_for_client)(void * priv,
++              enum loglevels loglevel, int logtype, const char *message);
++      void (*forced_ending_hook)(void);
++      int (*scan_extra_fds)(int command_fd,fd_set *set, int * max_fd);
++      void (*loop_started)(void);
++} ;
++
++extern struct libafpclient * libafpclient;
++
++void libafpclient_register(struct libafpclient * tmpclient);
++
++
++void signal_main_thread(void);
++
++/* These are logging functions */
++
++#define MAXLOGSIZE 2048
++
++#define LOG_METHOD_SYSLOG 1
++#define LOG_METHOD_STDOUT 2
++
++void set_log_method(int m);
++
++
++void log_for_client(void * priv,
++        enum loglevels loglevel, int logtype, char * message,...);
++
++void stdout_log_for_client(void * priv,
++      enum loglevels loglevel, int logtype, const char *message);
++
++#endif
+diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/Makefile.am afpfs-ng-0.8.1.patch/include/afpfs-ng/Makefile.am
+--- afpfs-ng-0.8.1/include/afpfs-ng/Makefile.am        1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/Makefile.am  2011-09-10 12:13:50.115124544 +0200
+@@ -0,0 +1,6 @@
++## Process this file with automake to produce Makefile.in
++
++afpfsincludedir = $(includedir)/afpfs-ng
++
++afpfsinclude_HEADERS = afp.h afp_protocol.h libafpclient.h
++nodist_afpfsinclude_HEADERS =  codepage.h dsi.h  map_def.h midlevel.h uams_def.h utils.h
+diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/map_def.h afpfs-ng-0.8.1.patch/include/afpfs-ng/map_def.h
+--- afpfs-ng-0.8.1/include/afpfs-ng/map_def.h  1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/map_def.h    2011-09-10 12:13:50.116124557 +0200
+@@ -0,0 +1,15 @@
++#ifndef __MAP_H_
++#define __MAP_H_
++
++#include "afpfs-ng/afp.h"
++
++#define AFP_MAPPING_UNKNOWN 0
++#define AFP_MAPPING_COMMON 1
++#define AFP_MAPPING_LOGINIDS 2
++#define AFP_MAPPING_NAME 3
++
++unsigned int map_string_to_num(char * name);
++char * get_mapping_name(struct afp_volume * volume);
++
++
++#endif
+diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/midlevel.h afpfs-ng-0.8.1.patch/include/afpfs-ng/midlevel.h
+--- afpfs-ng-0.8.1/include/afpfs-ng/midlevel.h 1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/midlevel.h   2011-09-10 12:13:50.116124557 +0200
+@@ -0,0 +1,64 @@
++#ifndef __MIDLEVEL_H_
++#define __MIDLEVEL_H_ 
++
++#include <utime.h>
++#include "afpfs-ng/afp.h"
++
++int ml_open(struct afp_volume * volume, const char *path, int flags, 
++        struct afp_file_info **newfp);
++
++int ml_creat(struct afp_volume * volume, const char *path,mode_t mode);
++
++int ml_readdir(struct afp_volume * volume, 
++      const char *path, 
++      struct afp_file_info **base);
++
++int ml_read(struct afp_volume * volume, const char *path,
++      char *buf, size_t size, off_t offset,
++      struct afp_file_info *fp, int * eof);
++
++int ml_chmod(struct afp_volume * vol, const char * path, mode_t mode);
++
++int ml_unlink(struct afp_volume * vol, const char *path);
++
++int ml_mkdir(struct afp_volume * vol, const char * path, mode_t mode);
++
++int ml_close(struct afp_volume * volume, const char * path,
++        struct afp_file_info * fp);
++
++int ml_getattr(struct afp_volume * volume, const char *path, 
++      struct stat *stbuf);
++
++int ml_write(struct afp_volume * volume, const char * path, 
++      const char *data, size_t size, off_t offset,
++      struct afp_file_info * fp, uid_t uid,
++      gid_t gid);
++
++int ml_readlink(struct afp_volume * vol, const char * path,
++        char *buf, size_t size);
++
++int ml_rmdir(struct afp_volume * vol, const char *path);
++
++int ml_chown(struct afp_volume * vol, const char * path,   
++        uid_t uid, gid_t gid);
++
++int ml_truncate(struct afp_volume * vol, const char * path, off_t offset);
++
++int ml_utime(struct afp_volume * vol, const char * path,
++      struct utimbuf * timebuf);
++
++int ml_symlink(struct afp_volume *vol, const char * path1, const char * path2);
++
++int ml_rename(struct afp_volume * vol,
++      const char * path_from, const char * path_to);
++
++int ml_statfs(struct afp_volume * vol, const char *path, struct statvfs *stat);
++
++void afp_ml_filebase_free(struct afp_file_info **filebase);
++
++int ml_passwd(struct afp_server *server,
++                char * username, char * oldpasswd, char * newpasswd);
++
++
++
++#endif
+diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/uams_def.h afpfs-ng-0.8.1.patch/include/afpfs-ng/uams_def.h
+--- afpfs-ng-0.8.1/include/afpfs-ng/uams_def.h 1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/uams_def.h   2011-09-10 12:13:50.116124557 +0200
+@@ -0,0 +1,16 @@
++#ifndef __UAM_DEFS_H_
++#define __UAM_DEFS_H_
++
++#define UAM_NOUSERAUTHENT 0x1
++#define UAM_CLEARTXTPASSWRD 0x2
++#define UAM_RANDNUMEXCHANGE 0x4
++#define UAM_2WAYRANDNUM 0x8
++#define UAM_DHCAST128 0x10
++#define UAM_CLIENTKRB 0x20
++#define UAM_DHX2 0x40
++#define UAM_RECON1 0x80
++
++int uam_string_to_bitmap(char * name);
++char * uam_bitmap_to_string(unsigned int bitmap);
++
++#endif
+diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/utils.h afpfs-ng-0.8.1.patch/include/afpfs-ng/utils.h
+--- afpfs-ng-0.8.1/include/afpfs-ng/utils.h    1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/utils.h      2011-09-10 12:13:50.116124557 +0200
+@@ -0,0 +1,43 @@
++#ifndef __UTILS_H_
++#define __UTILS_H_
++#include <stdio.h>
++
++#include "afpfs-ng/afp.h"
++
++#if BYTE_ORDER == BIG_ENDIAN
++#define hton64(x)       (x)
++#define ntoh64(x)       (x)
++#else /* BYTE_ORDER == BIG_ENDIAN */
++#define hton64(x)       ((u_int64_t) (htonl(((x) >> 32) & 0xffffffffLL)) | \
++                         (u_int64_t) ((htonl(x) & 0xffffffffLL) << 32))
++#define ntoh64(x)       (hton64(x))
++#endif /* BYTE_ORDER == BIG_ENDIAN */
++
++#define min(a,b) (((a)<(b)) ? (a) : (b))
++#define max(a,b) (((a)>(b)) ? (a) : (b))
++
++
++
++unsigned char unixpath_to_afppath(
++        struct afp_server * server,
++        char * buf);
++
++unsigned char sizeof_path_header(struct afp_server * server);
++
++
++
++unsigned char copy_from_pascal(char *dest, char *pascal,unsigned int max_len) ;
++unsigned short copy_from_pascal_two(char *dest, char *pascal,unsigned int max_len);
++
++unsigned char copy_to_pascal(char *dest, const char *src);
++unsigned short copy_to_pascal_two(char *dest, const char *src);
++
++void copy_path(struct afp_server * server, char * dest, const char * pathname, unsigned char len);
++
++
++char * create_path(struct afp_server * server, char * pathname, unsigned short * len);
++
++
++int invalid_filename(struct afp_server * server, const char * filename);
++
++#endif
+diff -Naur afpfs-ng-0.8.1/include/afp.h afpfs-ng-0.8.1.patch/include/afp.h
+--- afpfs-ng-0.8.1/include/afp.h       2008-03-08 17:08:18.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afp.h 1970-01-01 01:00:00.000000000 +0100
+@@ -1,533 +0,0 @@
+-
+-#ifndef _AFP_H_
+-#define _AFP_H_
+-
+-#include <arpa/inet.h>
+-#include <pthread.h>
+-#include <netdb.h>
+-#include <sys/statvfs.h>
+-#include <pwd.h>
+-#include <afp_protocol.h>
+-#include <libafpclient.h>
+-#include <sys/types.h>
+-#include <sys/stat.h>
+-#include <unistd.h>
+-#include <netinet/in.h>
+-
+-
+-#define AFPFS_VERSION "0.8.1"
+-
+-/* This is the maximum AFP version this library supports */
+-#define AFP_MAX_SUPPORTED_VERSION 32
+-
+-/* afp_url is used to pass locations around */
+-struct afp_url {
+-      enum {TCPIP,AT} protocol;
+-      char username[AFP_MAX_USERNAME_LEN];
+-      char uamname[50];
+-      char password[AFP_MAX_PASSWORD_LEN];
+-      char servername[AFP_SERVER_NAME_UTF8_LEN];
+-      int port;
+-      char volumename[AFP_VOLUME_NAME_UTF8_LEN];
+-      char path[AFP_MAX_PATH];
+-
+-      int requested_version;
+-      char zone[AFP_ZONE_LEN]; /* Only used for Appletalk */
+-      char volpassword[9];;
+-};
+-
+-struct afp_token {
+-      unsigned int length;
+-      char data[AFP_TOKEN_MAX_LEN];
+-};
+-
+-#define SERVER_MAX_VERSIONS 10
+-#define SERVER_MAX_UAMS 10
+-
+-struct afp_rx_buffer {
+-      unsigned int size;
+-      unsigned int maxsize;
+-      char * data;
+-      int errorcode;
+-};
+-
+-
+-struct afp_file_info {
+-      unsigned short attributes;
+-      unsigned int did;
+-      unsigned int creation_date;
+-      unsigned int modification_date;
+-      unsigned int backup_date;
+-      unsigned int fileid;
+-      unsigned short offspring;
+-      char sync;
+-      char finderinfo[32];
+-      char name[AFP_MAX_PATH];
+-      char basename[AFP_MAX_PATH];
+-      char translated_name[AFP_MAX_PATH];
+-      struct afp_unixprivs unixprivs;
+-      unsigned int accessrights;
+-      struct afp_file_info * next;
+-      struct afp_file_info * largelist_next;
+-      unsigned char isdir;
+-      unsigned long long size;
+-      unsigned short resourcesize;
+-      unsigned int resource;
+-      unsigned short forkid;
+-      struct afp_icon * icon;
+-      int eof;
+-};
+-
+-
+-#define VOLUME_EXTRA_FLAGS_VOL_CHMOD_KNOWN 0x1
+-#define VOLUME_EXTRA_FLAGS_VOL_CHMOD_BROKEN 0x2
+-#define VOLUME_EXTRA_FLAGS_SHOW_APPLEDOUBLE 0x4
+-#define VOLUME_EXTRA_FLAGS_VOL_SUPPORTS_UNIX 0x8
+-#define VOLUME_EXTRA_FLAGS_NO_LOCKING 0x10
+-#define VOLUME_EXTRA_FLAGS_IGNORE_UNIXPRIVS 0x20
+-#define VOLUME_EXTRA_FLAGS_READONLY 0x40
+-
+-#define AFP_VOLUME_UNMOUNTED 0
+-#define AFP_VOLUME_MOUNTED 1
+-#define AFP_VOLUME_UNMOUNTING 2
+-
+-struct afp_volume {
+-      unsigned short volid;
+-      char flags;  /* This is from afpGetSrvrParms */
+-      unsigned short attributes; /* This is from VolOpen */
+-      unsigned short signature;  /* This is fixed or variable */
+-      unsigned int creation_date;
+-      unsigned int modification_date;
+-      unsigned int backup_date;
+-      struct statvfs stat;
+-      unsigned char mounted;
+-      char mountpoint[255];
+-      struct afp_server * server;
+-      char volume_name[AFP_VOLUME_NAME_LEN];
+-      char volume_name_printable[AFP_VOLUME_NAME_UTF8_LEN];
+-      unsigned short dtrefnum;
+-      char volpassword[AFP_VOLPASS_LEN];
+-      unsigned int extra_flags; /* This is an afpfs-ng specific field */
+-
+-      /* Our directory ID cache */
+-      struct did_cache_entry * did_cache_base;
+-      pthread_mutex_t did_cache_mutex;
+-
+-      /* Our journal of open forks */
+-      struct afp_file_info * open_forks;
+-      pthread_mutex_t open_forks_mutex;
+-
+-      /* Used to trigger startup */
+-        pthread_cond_t  startup_condition_cond;
+-
+-      struct {
+-              uint64_t hits;
+-              uint64_t misses;
+-              uint64_t expired;
+-              uint64_t force_removed;
+-      } did_cache_stats;
+-
+-      void * priv;  /* This is a private structure for fuse/cmdline, etc */
+-      pthread_t thread; /* This is the per-volume thread */
+-
+-      int mapping;
+-
+-};
+-
+-#define SERVER_STATE_CONNECTED 1
+-#define SERVER_STATE_DISCONNECTED 2
+-
+-enum server_type{
+-      AFPFS_SERVER_TYPE_UNKNOWN,
+-      AFPFS_SERVER_TYPE_NETATALK,
+-      AFPFS_SERVER_TYPE_AIRPORT,
+-      AFPFS_SERVER_TYPE_MACINTOSH,
+-};
+-
+-#define is_netatalk(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_NETATALK )
+-#define is_airport(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_AIRPORT )
+-#define is_macintosh(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_MACINTOSH )
+-
+-
+-
+-struct afp_versions {
+-        char        *av_name;
+-        int         av_number;
+-};
+-extern struct afp_versions afp_versions[];
+-
+-struct afp_server {
+-
+-      /* Our buffer sizes */
+-      unsigned int tx_quantum;
+-      unsigned int rx_quantum;
+-
+-      unsigned int tx_delay;
+-
+-      /* Connection information */
+-      struct sockaddr_in address;
+-      int fd;
+-
+-      /* Some stats, for information only */
+-      struct {
+-              uint64_t runt_packets;
+-              uint64_t incoming_dsi;
+-              uint64_t rx_bytes;
+-              uint64_t tx_bytes;
+-              uint64_t requests_pending;
+-      } stats;
+-
+-      /* General information */
+-      char server_name[AFP_SERVER_NAME_LEN];
+-      char server_name_utf8[AFP_SERVER_NAME_UTF8_LEN];
+-        char server_name_printable[AFP_SERVER_NAME_UTF8_LEN];
+-
+-      char machine_type[17];
+-      char icon[256];
+-      char signature[16];
+-      unsigned short flags;
+-      int connect_state;
+-      enum server_type server_type;
+-
+-      /* This is the time we connected */
+-      time_t connect_time;
+-
+-      /* UAMs */
+-      unsigned int supported_uams;
+-      unsigned int using_uam;
+-
+-      /* Authentication */
+-      char username[AFP_MAX_USERNAME_LEN];
+-      char password[AFP_MAX_PASSWORD_LEN];
+-
+-      /* Session */
+-      struct afp_token token;
+-      char need_resume;
+-
+-      /* Versions */
+-      unsigned char requested_version;
+-      unsigned char versions[SERVER_MAX_VERSIONS];
+-      struct afp_versions *using_version;
+-
+-      /* Volumes */
+-      unsigned char num_volumes;
+-      struct afp_volume * volumes;
+-
+-      void * dsi;
+-      unsigned int exit_flag;
+-
+-      /* Our DSI request queue */
+-      pthread_mutex_t requestid_mutex;
+-      pthread_mutex_t request_queue_mutex;
+-      unsigned short lastrequestid;
+-      unsigned short expectedrequestid;
+-      struct dsi_request * command_requests;
+-
+-
+-      char loginmesg[200];
+-      char servermesg[200];
+-      char path_encoding;
+-
+-      /* This is the data for the incoming buffer */
+-      char * incoming_buffer;
+-      int data_read;
+-      int bufsize;
+-
+-      /* And this is for the outgoing queue */
+-      pthread_mutex_t send_mutex;
+-
+-      /* This is for user mapping */
+-      struct passwd passwd;
+-      unsigned int server_uid, server_gid;
+-      int server_gid_valid;
+-
+-      struct afp_server *next;
+-
+-      /* These are for DSI attention packets */
+-      unsigned int attention_quantum;
+-      unsigned int attention_len;
+-      char * attention_buffer;
+-
+-};
+-
+-struct afp_extattr_info {
+-      unsigned int maxsize;
+-      unsigned int size;
+-      char data[1024];
+-};
+-struct afp_comment {
+-      unsigned int maxsize;
+-      unsigned int size;
+-      char *data;
+-};
+-
+-struct afp_icon {
+-      unsigned int maxsize;
+-      unsigned int size;
+-      char *data;
+-};
+-
+-#define AFP_DEFAULT_ATTENTION_QUANTUM 1024
+-
+-void afp_unixpriv_to_stat(struct afp_file_info *fp,
+-      struct stat *stat);
+-
+-int init_uams(void) ;
+-
+-unsigned int find_uam_by_name(const char * name);
+-char * uam_bitmap_to_string(unsigned int bitmap);
+-
+-
+-char * get_uam_names_list(void);
+-
+-unsigned int default_uams_mask(void);
+-
+-struct afp_volume * find_volume_by_name(struct afp_server * server,
+-        const char * volname);
+-
+-struct afp_connection_request {
+-        unsigned int uam_mask;
+-      struct afp_url url;
+-};
+-
+-void afp_default_url(struct afp_url *url);
+-int afp_parse_url(struct afp_url * url, const char * toparse, int verbose);
+-void afp_print_url(struct afp_url * url);
+-int afp_url_validate(char * url_string, struct afp_url * valid_url);
+-
+-int afp_list_volnames(struct afp_server * server, char * names, int max);
+-
+-/* User mapping */
+-int afp_detect_mapping(struct afp_volume * volume);
+-
+-/* These are some functions that help with simple status text generation */
+-
+-int afp_status_header(char * text, int * len);
+-int afp_status_server(struct afp_server * s,char * text, int * len);
+-
+-
+-struct afp_server * afp_server_full_connect(void * priv, struct afp_connection_request * req);
+-
+-void * just_end_it_now(void *other);
+-void add_fd_and_signal(int fd);
+-void loop_disconnect(struct afp_server *s);
+-void afp_wait_for_started_loop(void);
+-
+-
+-struct afp_versions * pick_version(unsigned char *versions,
+-      unsigned char requested) ;
+-int pick_uam(unsigned int u1, unsigned int u2);
+-
+-int afp_server_login(struct afp_server *server,
+-        char * mesg, unsigned int *l, unsigned int max);
+-
+-
+-int afp_dologin(struct afp_server *server,
+-      unsigned int uam, char * username, char * passwd);
+-
+-void afp_free_server(struct afp_server **server);
+-
+-struct afp_server * afp_server_init(struct sockaddr_in * address);
+-int afp_get_address(void * priv, const char * hostname, unsigned int port,
+-      struct sockaddr_in * address);
+-
+-
+-int afp_main_loop(int command_fd);
+-int afp_main_quick_startup(pthread_t * thread);
+-
+-int afp_server_destroy(struct afp_server *s) ;
+-int afp_server_reconnect(struct afp_server * s, char * mesg,
+-        unsigned int *l, unsigned int max);
+-int afp_server_connect(struct afp_server *s, int full);
+-
+-struct afp_server * afp_server_complete_connection(
+-      void * priv,
+-      struct afp_server * server,
+-      struct sockaddr_in * address, unsigned char * versions,
+-      unsigned int uams, char * username, char * password,
+-      unsigned int requested_version, unsigned int uam_mask);
+-
+-int afp_connect_volume(struct afp_volume * volume, struct afp_server * server,
+-      char * mesg, unsigned int * l, unsigned int max);
+-int something_is_mounted(struct afp_server * server);
+-
+-int add_cache_entry(struct afp_file_info * file) ;
+-struct afp_file_info * get_cache_by_name(char * name);
+-struct afp_server * find_server_by_address(struct sockaddr_in * address);
+-struct afp_server * find_server_by_signature(char * signature);
+-struct afp_server * find_server_by_name(char * name);
+-int server_still_valid(struct afp_server * server);
+-
+-
+-struct afp_server * get_server_base(void);
+-int afp_server_remove(struct afp_server * server);
+-
+-int afp_unmount_volume(struct afp_volume * volume);
+-int afp_unmount_all_volumes(struct afp_server * server);
+-
+-#define volume_is_readonly(x) (((x)->attributes&kReadOnly) || \
+-      ((x)->extra_flags & VOLUME_EXTRA_FLAGS_READONLY))
+-
+-int afp_opendt(struct afp_volume *volume, unsigned short * refnum);
+-
+-int afp_closedt(struct afp_server * server, unsigned short * refnum);
+-
+-int afp_getcomment(struct afp_volume *volume, unsigned int did,
+-        const char * pathname, struct afp_comment * comment);
+-
+-int afp_addcomment(struct afp_volume *volume, unsigned int did,
+-        const char * pathname, char * comment,uint64_t *size);
+-
+-int afp_geticon(struct afp_volume * volume, unsigned int filecreator,
+-        unsigned int filetype, unsigned char icontype, 
+-      unsigned short length, struct afp_icon * icon);
+-
+-/* Things you want to do to a server */
+-
+-int afp_getsrvrmsg(struct afp_server *server, unsigned short messagetype,unsigned char utf8, unsigned char block, char * mesg);
+-
+-int afp_login(struct afp_server *server, char * uaname,
+-        char * userauthinfo, unsigned int userauthinfo_len,
+-      struct afp_rx_buffer *rx);
+-
+-int afp_changepassword(struct afp_server *server, char * uaname,
+-        char * userauthinfo, unsigned int userauthinfo_len,
+-      struct afp_rx_buffer *rx);
+-
+-int afp_logincont(struct afp_server *server, unsigned short id,
+-        char * userauthinfo, unsigned int userauthinfo_len,
+-      struct afp_rx_buffer *rx);
+-
+-int afp_getsessiontoken(struct afp_server * server, int type,
+-        unsigned int timestamp, struct afp_token *outgoing_token,
+-        struct afp_token * incoming_token);
+-
+-int afp_getsrvrparms(struct afp_server *server);
+-
+-int afp_logout(struct afp_server *server,unsigned char wait);
+-
+-int afp_mapname(struct afp_server * server, unsigned char subfunction,
+-        char * name, unsigned int * id);
+-
+-int afp_mapid(struct afp_server * server, unsigned char subfunction,
+-      unsigned int id, char *name);
+-
+-int afp_getuserinfo(struct afp_server * server, int thisuser,
+-      unsigned int userid, unsigned short bitmap, 
+-      unsigned int *newuid, unsigned int *newgid);
+-
+-int afp_zzzzz(struct afp_server *server);
+-
+-int afp_volopen(struct afp_volume * volume, 
+-              unsigned short bitmap, char * password);
+-
+-int afp_flush(struct afp_volume * volume);
+-
+-int afp_getfiledirparms(struct afp_volume *volume, unsigned int did, 
+-      unsigned int filebitmap, unsigned int dirbitmap, const char * pathname,
+-      struct afp_file_info *fp);
+-
+-int afp_enumerate(struct afp_volume * volume, 
+-      unsigned int dirid, 
+-      unsigned int filebitmap, unsigned int dirbitmap, 
+-        unsigned short reqcount,
+-        unsigned short startindex,
+-        char * path,
+-      struct afp_file_info ** file_p);
+-
+-int afp_enumerateext2(struct afp_volume * volume, 
+-      unsigned int dirid, 
+-      unsigned int filebitmap, unsigned int dirbitmap, 
+-        unsigned short reqcount,
+-        unsigned long startindex,
+-        char * path,
+-      struct afp_file_info ** file_p);
+-
+-int afp_openfork(struct afp_volume * volume,
+-        unsigned char forktype,
+-        unsigned int dirid,
+-        unsigned short accessmode,
+-        char * filename, 
+-      struct afp_file_info *fp);
+-
+-int afp_read(struct afp_volume * volume, unsigned short forkid,
+-                uint32_t offset,
+-                uint32_t count, struct afp_rx_buffer * rx);
+-
+-int afp_readext(struct afp_volume * volume, unsigned short forkid,
+-                uint64_t offset,
+-                uint64_t count, struct afp_rx_buffer * rx);
+-
+-int afp_getvolparms(struct afp_volume * volume, unsigned short bitmap);
+-
+-
+-int afp_createdir(struct afp_volume * volume, unsigned int dirid, const char * pathname, unsigned int *did_p);
+-
+-int afp_delete(struct afp_volume * volume,
+-        unsigned int dirid, char * pathname);
+-
+-
+-int afp_createfile(struct afp_volume * volume, unsigned char flag,
+-        unsigned int did, char * pathname);
+-
+-int afp_write(struct afp_volume * volume, unsigned short forkid,
+-        uint32_t offset, uint32_t reqcount,
+-        char * data, uint32_t * written);
+-
+-int afp_writeext(struct afp_volume * volume, unsigned short forkid,
+-        uint64_t offset, uint64_t reqcount,
+-        char * data, uint64_t * written);
+-
+-int afp_flushfork(struct afp_volume * volume, unsigned short forkid);
+-
+-int afp_closefork(struct afp_volume * volume, unsigned short forkid);
+-int afp_setfileparms(struct afp_volume * volume,
+-        unsigned int dirid, const char * pathname, unsigned short bitmap,
+-        struct afp_file_info *fp);
+-int afp_setfiledirparms(struct afp_volume * volume, 
+-        unsigned int dirid, const char * pathname, unsigned short bitmap,
+-        struct afp_file_info *fp);
+-
+-int afp_setdirparms(struct afp_volume * volume,
+-        unsigned int dirid, const char * pathname, unsigned short bitmap,
+-        struct afp_file_info *fp);
+-
+-int afp_volclose(struct afp_volume * volume);
+-
+-
+-int afp_setforkparms(struct afp_volume *volume,
+-        unsigned short forkid, unsigned short bitmap, unsigned long len);
+-
+-int afp_byterangelock(struct afp_volume * volume,
+-        unsigned char flag,
+-        unsigned short forkid,
+-        uint32_t offset,
+-        uint32_t len, uint32_t *generated_offset);
+-
+-int afp_byterangelockext(struct afp_volume * volume,
+-        unsigned char flag,
+-        unsigned short forkid,
+-        uint64_t offset,
+-        uint64_t len, uint64_t *generated_offset);
+-
+-int afp_moveandrename(struct afp_volume *volume,
+-      unsigned int src_did,
+-      unsigned int dst_did,
+-      char * src_path, char * dst_path, char *new_name);
+-
+-int afp_rename(struct afp_volume * volume,
+-        unsigned int dirid,
+-        char * path_from, char * path_to);
+-
+-int afp_listextattr(struct afp_volume * volume,
+-        unsigned int dirid, unsigned short bitmap,
+-        char * pathname, struct afp_extattr_info * info);
+-
+-/* This is a currently undocumented command */
+-int afp_newcommand76(struct afp_volume * volume, unsigned int dlen, char * data);
+-
+-/* For debugging */
+-char * afp_get_command_name(char code);
+-
+-
+-#endif
+diff -Naur afpfs-ng-0.8.1/include/afp_protocol.h afpfs-ng-0.8.1.patch/include/afp_protocol.h
+--- afpfs-ng-0.8.1/include/afp_protocol.h      2008-02-18 04:33:43.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/afp_protocol.h        1970-01-01 01:00:00.000000000 +0100
+@@ -1,361 +0,0 @@
+-
+-#ifndef _AFP_PROTOCOL_H_
+-#define _AFP_PROTOCOL_H_
+-
+-#include <sys/types.h>
+-#include <stddef.h>
+-#include <unistd.h>
+-#include <stdint.h>
+-
+-/* This file defines constants for the Apple File Protocol.
+-   All page references are from "Apple Filing Protocol Programming" version 3.2.
+-   except where noted.
+-*/
+-
+-#define AFP_SERVER_NAME_LEN 33
+-#define AFP_SERVER_NAME_UTF8_LEN 255
+-#define AFP_VOLUME_NAME_LEN 33
+-#define AFP_VOLUME_NAME_UTF8_LEN 33
+-#define AFP_SIGNATURE_LEN 16
+-#define AFP_MACHINETYPE_LEN 33
+-#define AFP_LOGINMESG_LEN 200
+-#define AFP_VOLPASS_LEN 8
+-#define AFP_HOSTNAME_LEN 255
+-/* This is actually just a guess, and only used for appletalk */
+-#define AFP_ZONE_LEN 255
+-
+-#define AFP_SERVER_ICON_LEN 256
+-
+-
+-#define AFP_MAX_USERNAME_LEN 127
+-#define AFP_MAX_PASSWORD_LEN 127
+-
+-
+-/* This is the maximum length of any UAM string */
+-#define AFP_UAM_LENGTH 24
+-
+-/* This is the maximum length of any path description */
+-#define AFP_MAX_PATH 768
+-
+-#define AFP_VOL_FLAT 1
+-#define AFP_VOL_FIXED 2
+-#define AFP_VOL_VARIABLE 3
+-
+-/* The root directory ID, p.26 */
+-
+-#define AFP_ROOT_DID 2
+-
+-/* Path type constants, p.249 */
+-
+-enum {
+-kFPShortName = 1,
+-kFPLongName = 2,
+-kFPUTF8Name = 3
+-};
+-
+-/* fork types */
+-
+-#define AFP_FORKTYPE_DATA 0x0
+-#define AFP_FORKTYPE_RESOURCE 0x80
+-
+-/* openfork access modes, from p.196 */
+-
+-#define AFP_OPENFORK_ALLOWREAD 1
+-#define AFP_OPENFORK_ALLOWWRITE 2
+-#define AFP_OPENFORK_DENYREAD 0x10
+-#define AFP_OPENFORK_DENYWRITE 0x20
+-
+-/* Message type for getsrvmesg, p. 169*/
+-
+-typedef enum {
+-  AFPMESG_LOGIN = 0,
+-  AFPMESG_SERVER = 1
+-} afpmessage_t;
+-
+-/* Message bitmap for getsrvrmsg */
+-
+-#define AFP_GETSRVRMSG_UTF8 0x2
+-#define AFP_GETSRVRMSG_GETMSG 0x1
+-
+-
+-/* Maximum Version length, p.17 */
+-#define AFP_MAX_VERSION_LENGTH 16
+-
+-/* Maximum length of a token, this is undocumented */
+-#define AFP_TOKEN_MAX_LEN 256
+-
+-/* The maximum size of a file for AFP 2 */
+-#define AFP_MAX_AFP2_FILESIZE (4294967296)
+-
+-/* Unix privs, p.240 */
+-
+-struct afp_unixprivs {
+-      uint32_t uid __attribute__((__packed__));
+-      uint32_t gid __attribute__((__packed__));
+-      uint32_t permissions __attribute__((__packed__));
+-      uint32_t ua_permissions __attribute__((__packed__));
+-
+-};
+-
+-
+-/* AFP Volume attributes bitmap, p.241 */
+-
+-enum {
+-    kReadOnly = 0x01,
+-    kHasVolumePassword = 0x02,
+-    kSupportsFileIDs = 0x04,
+-    kSupportsCatSearch = 0x08,
+-    kSupportsBlankAccessPrivs = 0x10,
+-    kSupportsUnixPrivs = 0x20,
+-    kSupportsUTF8Names = 0x40,
+-    kNoNetworkUserIDs = 0x80,
+-    kDefaultPrivsFromParent = 0x100,
+-    kNoExchangeFiles = 0x200,
+-    kSupportsExtAttrs = 0x400,
+-    kSupportsACLs=0x800
+-};
+-
+-/* AFP file creation constantes, p.250 */
+-enum {
+-kFPSoftCreate = 0,
+-kFPHardCreate = 0x80
+-};
+-
+-/* AFP Directory attributes, taken from the protocol guide p.236 */
+-
+-enum {
+-    kFPAttributeBit = 0x1,
+-    kFPParentDirIDBit = 0x2,
+-    kFPCreateDateBit = 0x4,
+-    kFPModDateBit = 0x8,
+-    kFPBackupDateBit = 0x10,
+-    kFPFinderInfoBit = 0x20,
+-    kFPLongNameBit = 0x40,
+-    kFPShortNameBit = 0x80,
+-    kFPNodeIDBit = 0x100,
+-    kFPOffspringCountBit = 0x0200,
+-    kFPOwnerIDBit = 0x0400,
+-    kFPGroupIDBit = 0x0800,
+-    kFPAccessRightsBit = 0x1000,
+-    kFPProDOSInfoBit = 0x2000, // AFP version 2.2 and earlier
+-    kFPUTF8NameBit = 0x2000, // AFP version 3.0 and later
+-    kFPUnixPrivsBit = 0x8000 // AFP version 3.0 and later
+-};
+-
+-/* AFP File bitmap, p.238.  These are the ones not in the AFP Directory
+-   attributes map. */
+-
+-enum {
+-      kFPDataForkLenBit = 0x0200,
+-      kFPRsrcForkLenBit = 0x0400,
+-      kFPExtDataForkLenBit = 0x0800, // AFP version 3.0 and later
+-      kFPLaunchLimitBit = 0x1000,
+-      kFPExtRsrcForkLenBit = 0x4000, // AFP version 3.0 and later
+-};
+-
+-/* AFP Extended Attributes Bitmap, p.238  */
+-
+-enum {
+-      kXAttrNoFollow = 0x1,
+-      kXAttrCreate = 0x2,
+-      kXAttrREplace=0x4
+-};
+-
+-
+-/* AFP function codes */
+-enum AFPFunction
+-{
+-        afpByteRangeLock = 1, afpCloseVol, afpCloseDir, afpCloseFork,
+-        afpCopyFile, afpCreateDir, afpCreateFile,
+-        afpDelete, afpEnumerate, afpFlush, afpFlushFork,
+-        afpGetForkParms = 14, afpGetSrvrInfo, afpGetSrvrParms,
+-        afpGetVolParms, afpLogin, afpLoginCont, afpLogout, afpMapID,
+-        afpMapName, afpMoveAndRename, afpOpenVol, afpOpenDir, afpOpenFork,
+-        afpRead, afpRename, afpSetDirParms, afpSetFileParms,
+-        afpSetForkParms, afpSetVolParms, afpWrite, afpGetFileDirParms,
+-      afpSetFileDirParms, afpChangePassword,
+-        afpGetUserInfo=37,afpGetSrvrMsg = 38,
+-      afpOpenDT=48,
+-      afpCloseDT=49,
+-      afpGetIcon=51, afpGetIconInfo=52,
+-      afpAddComment=56, afpRemoveComment=57, afpGetComment=58,
+-      afpByteRangeLockExt=59, afpReadExt, afpWriteExt,
+-      afpGetAuthMethods=62,
+-      afp_LoginExt=63,
+-      afpGetSessionToken=64,
+-      afpDisconnectOldSession=65,
+-      afpEnumerateExt=66,
+-      afpCatSearchExt = 67,
+-      afpEnumerateExt2 = 68, afpGetExtAttr, afpSetExtAttr, 
+-      afpRemoveExtAttr , afpListExtAttrs,
+-      afpZzzzz = 122,
+-      afpAddIcon=192,
+-};
+-
+-/* AFP Volume bitmap.  Take from 242 of the protocol guide. */
+-enum {
+-      kFPBadVolPre222Bitmap = 0xFe00,
+-      kFPBadVolBitmap = 0xF000,
+-      kFPVolAttributeBit = 0x1,
+-      kFPVolSignatureBit = 0x2,
+-      kFPVolCreateDateBit = 0x4,
+-      kFPVolModDateBit = 0x8,
+-      kFPVolBackupDateBit = 0x10,
+-      kFPVolIDBit = 0x20,
+-      kFPVolBytesFreeBit = 0x40,
+-      kFPVolBytesTotalBit = 0x80,
+-      kFPVolNameBit = 0x100,
+-      kFPVolExtBytesFreeBit = 0x200,
+-      kFPVolExtBytesTotalBit = 0x400,
+-      kFPVolBlockSizeBit = 0x800
+-};
+-
+-/* AFP Attention Codes -- 4 bits */
+-#define AFPATTN_SHUTDOWN     (1 << 15)            /* shutdown/disconnect */
+-#define AFPATTN_CRASH        (1 << 14)            /* server crashed */
+-#define AFPATTN_MESG         (1 << 13)            /* server has message */
+-#define AFPATTN_NORECONNECT  (1 << 12)            /* don't reconnect */
+-/* server notification */
+-#define AFPATTN_NOTIFY       (AFPATTN_MESG | AFPATTN_NORECONNECT) 
+-
+-/* extended bitmap -- 12 bits. volchanged is only useful w/ a server
+- * notification, and time is only useful for shutdown. */
+-#define AFPATTN_VOLCHANGED   (1 << 0)             /* volume has changed */
+-#define AFPATTN_TIME(x)      ((x) & 0xfff)        /* time in minutes */
+-
+-#define kFPNoErr 0
+-
+-/* AFP result codes, p252 */
+-#define kASPSessClosed -1072
+-#define kFPAccessDenied -5000
+-#define kFPAuthContinue -5001
+-#define kFPBadUAM -5002
+-#define kFPBadVersNum -5003
+-#define kFPBitmapErr -5004
+-#define kFPCantMove -5005
+-#define kFPDenyConflict -5006
+-#define kFPDirNotEmpty -5007
+-#define kFPDiskFull -5008
+-#define kFPEOFErr -5009
+-#define kFPFileBusy -5010
+-#define kFPFlatVol -5011
+-#define kFPItemNotFound -5012
+-#define kFPLockErr -5013
+-#define kFPMiscErr -5014
+-#define kFPNoMoreLocks -5015
+-#define kFPNoServer -5016
+-#define kFPObjectExists -5017
+-#define kFPObjectNotFound -5018
+-#define kFPParamErr -5019
+-#define kFPRangeNotLocked -5020
+-#define kFPRangeOverlap -5021
+-#define kFPSessClosed -5022
+-#define kFPUserNotAuth -5023
+-#define kFPCallNotSupported -5024
+-#define kFPObjectTypeErr -5025
+-#define kFPTooManyFilesOpen -5026
+-#define kFPServerGoingDown -5027
+-#define kFPCantRename -5028
+-#define kFPDirNotFound -5029
+-#define kFPIconTypeError -5030
+-#define kFPVolLocked -5031
+-#define kFPObjectLocked -5032
+-#define kFPContainsSharedErr -5033
+-#define kFPIDNotFound -5034
+-#define kFPIDExists -5035
+-#define kFPDiffVolErr  -5036
+-#define kFPCatalogChanged -5037
+-#define kFPSameObjectErr -5038
+-#define kFPBadIDErr -5039
+-#define kFPPwdSameErr -5040
+-#define kFPPwdTooShortErr -5041
+-#define kFPPwdExpiredErr -5042
+-#define kFPInsideSharedErr -5043
+-#define kFPInsideTrashErr -5044
+-#define kFPPwdNeedsChangeErr -5045
+-#define kFPPwdPolicyErr -5046
+-#define kFPDiskQuotaExceeded â€“5047 
+-
+-
+-
+-/* These flags determine to lock or unlock in ByteRangeLock(Ext) */
+-
+-enum {
+-ByteRangeLock_Lock = 0,
+-ByteRangeLock_Unlock = 1
+-};
+-
+-/* These flags are used in volopen and getsrvrparm replies, p.171 */
+-
+-#define HasConfigInfo 0x1
+-#define HasPassword 0x80
+-
+-/* These are the subfunction for kFPMapID, as per p.248 */
+-
+-enum {
+-kUserIDToName = 1,
+-kGroupIDToName = 2,
+-kUserIDToUTF8Name = 3,
+-kGroupIDToUTF8Name = 4,
+-kUserUUIDToUTF8Name = 5,
+-kGroupUUIDToUTF8Name = 6
+-};
+-
+-
+-/* These are the subfunction flags described in the FPMapName command, p.286.
+-   Note that this is different than what's described on p. 186. */
+-
+-enum {
+-kNameToUserID = 1,
+-kNameToGroupID = 2,
+-kUTF8NameToUserID = 3,
+-kUTF8NameToGroupID = 4,
+-kUTF8NameToUserUUID = 5,
+-kUTF8NameToGroupUUID = 6
+-};
+-
+-/* These are bits for FPGetUserInfo, p.173. */
+-#define kFPGetUserInfo_USER_ID 1
+-#define kFPGetUserInfo_PRI_GROUPID 2
+-
+-/* Flags for the replies of GetSrvrInfo and DSI GetStatus, p.240 */
+-
+-enum {
+-      kSupportsCopyfile = 0x01,
+-      kSupportsChgPwd = 0x02,
+-      kDontAllowSavePwd = 0x04,
+-      kSupportsSrvrMsg = 0x08,
+-      kSrvrSig = 0x10,
+-      kSupportsTCP = 0x20,
+-      kSupportsSrvrNotify = 0x40,
+-      kSupportsReconnect = 0x80,
+-      kSupportsDirServices = 0x100,
+-      kSupportsUTF8SrvrName = 0x200,
+-      kSupportsUUIDs = 0x400,
+-      kSupportsSuperClient = 0x8000
+-};
+-
+-
+-/* p.247 */
+-
+-enum {
+-      kLoginWithoutID = 0,
+-      kLoginWithID = 1,
+-      kReconnWithID = 2,
+-      kLoginWithTimeAndID = 3,
+-      kReconnWithTimeAndID = 4,
+-      kRecon1Login = 5,
+-      kRecon1ReconnectLogin = 6,
+-      kRecon1Refresh = 7, kGetKerberosSessionKey = 8
+-};
+-
+-
+-#define AFP_CHMOD_ALLOWED_BITS_22 \
+-      (S_IRUSR |S_IWUSR | S_IRGRP | S_IWGRP |S_IROTH | S_IWOTH | S_IFREG )
+-
+-
+-#endif
+-
+-
+-
+-
+diff -Naur afpfs-ng-0.8.1/include/codepage.h afpfs-ng-0.8.1.patch/include/codepage.h
+--- afpfs-ng-0.8.1/include/codepage.h  2007-09-23 16:21:30.000000000 +0200
++++ afpfs-ng-0.8.1.patch/include/codepage.h    1970-01-01 01:00:00.000000000 +0100
+@@ -1,11 +0,0 @@
+-#ifndef __CODE_PAGE_H_
+-#define __CODE_PAGE_H_
+-int convert_utf8dec_to_utf8pre(const char *src, int src_len,
+-      char * dest, int dest_len);
+-int convert_utf8pre_to_utf8dec(const char * src, int src_len, 
+-      char * dest, int dest_len);
+-int convert_path_to_unix(char encoding, char * dest, 
+-      char * src, int dest_len);
+-int convert_path_to_afp(char encoding, char * dest, 
+-      char * src, int dest_len);
+-#endif
+diff -Naur afpfs-ng-0.8.1/include/dsi.h afpfs-ng-0.8.1.patch/include/dsi.h
+--- afpfs-ng-0.8.1/include/dsi.h       2008-02-18 04:33:24.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/dsi.h 1970-01-01 01:00:00.000000000 +0100
+@@ -1,33 +0,0 @@
+-
+-#ifndef __DSI_H_
+-#define __DSI_H_
+-
+-#include "afp.h"
+-
+-struct dsi_request
+-{
+-      unsigned short requestid;
+-      unsigned char subcommand;
+-      void * other;
+-      unsigned char wait;
+-      pthread_cond_t  condition_cond;
+-      struct dsi_request * next;
+-      int return_code;
+-};
+-
+-int dsi_receive(struct afp_server * server, void * data, int size);
+-int dsi_getstatus(struct afp_server * server);
+-
+-int dsi_opensession(struct afp_server *server);
+-
+-int dsi_send(struct afp_server *server, char * msg, int size,int wait,unsigned char subcommand, void ** other);
+-struct dsi_session * dsi_create(struct afp_server *server);
+-int dsi_restart(struct afp_server *server);
+-int dsi_recv(struct afp_server * server);
+-
+-#define DSI_BLOCK_TIMEOUT -1
+-#define DSI_DONT_WAIT 0
+-#define DSI_DEFAULT_TIMEOUT 5
+-
+-
+-#endif
+diff -Naur afpfs-ng-0.8.1/include/libafpclient.h afpfs-ng-0.8.1.patch/include/libafpclient.h
+--- afpfs-ng-0.8.1/include/libafpclient.h      2008-01-30 05:37:59.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/libafpclient.h        1970-01-01 01:00:00.000000000 +0100
+@@ -1,50 +0,0 @@
+-
+-#ifndef __CLIENT_H_
+-#define __CLIENT_H_
+-
+-#include <unistd.h>
+-#include <syslog.h>
+-
+-#define MAX_CLIENT_RESPONSE 2048
+-
+-
+-enum loglevels {
+-        AFPFSD,
+-};
+-
+-struct afp_server;
+-struct afp_volume;
+-
+-struct libafpclient {
+-        int (*unmount_volume) (struct afp_volume * volume);
+-      void (*log_for_client)(void * priv,
+-              enum loglevels loglevel, int logtype, const char *message);
+-      void (*forced_ending_hook)(void);
+-      int (*scan_extra_fds)(int command_fd,fd_set *set, int * max_fd);
+-      void (*loop_started)(void);
+-} ;
+-
+-extern struct libafpclient * libafpclient;
+-
+-void libafpclient_register(struct libafpclient * tmpclient);
+-
+-
+-void signal_main_thread(void);
+-
+-/* These are logging functions */
+-
+-#define MAXLOGSIZE 2048
+-
+-#define LOG_METHOD_SYSLOG 1
+-#define LOG_METHOD_STDOUT 2
+-
+-void set_log_method(int m);
+-
+-
+-void log_for_client(void * priv,
+-        enum loglevels loglevel, int logtype, char * message,...);
+-
+-void stdout_log_for_client(void * priv,
+-      enum loglevels loglevel, int logtype, const char *message);
+-
+-#endif
+diff -Naur afpfs-ng-0.8.1/include/Makefile.am afpfs-ng-0.8.1.patch/include/Makefile.am
+--- afpfs-ng-0.8.1/include/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/Makefile.am   2011-09-10 12:13:50.126124692 +0200
+@@ -0,0 +1,3 @@
++## Process this file with automake to produce Makefile.in
++
++SUBDIRS = afpfs-ng
+diff -Naur afpfs-ng-0.8.1/include/map_def.h afpfs-ng-0.8.1.patch/include/map_def.h
+--- afpfs-ng-0.8.1/include/map_def.h   2008-01-17 05:55:46.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/map_def.h     1970-01-01 01:00:00.000000000 +0100
+@@ -1,15 +0,0 @@
+-#ifndef __MAP_H_
+-#define __MAP_H_
+-
+-#include "afp.h"
+-
+-#define AFP_MAPPING_UNKNOWN 0
+-#define AFP_MAPPING_COMMON 1
+-#define AFP_MAPPING_LOGINIDS 2
+-#define AFP_MAPPING_NAME 3
+-
+-unsigned int map_string_to_num(char * name);
+-char * get_mapping_name(struct afp_volume * volume);
+-
+-
+-#endif
+diff -Naur afpfs-ng-0.8.1/include/midlevel.h afpfs-ng-0.8.1.patch/include/midlevel.h
+--- afpfs-ng-0.8.1/include/midlevel.h  2007-12-24 20:39:25.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/midlevel.h    1970-01-01 01:00:00.000000000 +0100
+@@ -1,64 +0,0 @@
+-#ifndef __MIDLEVEL_H_
+-#define __MIDLEVEL_H_ 
+-
+-#include <utime.h>
+-#include "afp.h"
+-
+-int ml_open(struct afp_volume * volume, const char *path, int flags, 
+-        struct afp_file_info **newfp);
+-
+-int ml_creat(struct afp_volume * volume, const char *path,mode_t mode);
+-
+-int ml_readdir(struct afp_volume * volume, 
+-      const char *path, 
+-      struct afp_file_info **base);
+-
+-int ml_read(struct afp_volume * volume, const char *path,
+-      char *buf, size_t size, off_t offset,
+-      struct afp_file_info *fp, int * eof);
+-
+-int ml_chmod(struct afp_volume * vol, const char * path, mode_t mode);
+-
+-int ml_unlink(struct afp_volume * vol, const char *path);
+-
+-int ml_mkdir(struct afp_volume * vol, const char * path, mode_t mode);
+-
+-int ml_close(struct afp_volume * volume, const char * path,
+-        struct afp_file_info * fp);
+-
+-int ml_getattr(struct afp_volume * volume, const char *path, 
+-      struct stat *stbuf);
+-
+-int ml_write(struct afp_volume * volume, const char * path, 
+-      const char *data, size_t size, off_t offset,
+-      struct afp_file_info * fp, uid_t uid,
+-      gid_t gid);
+-
+-int ml_readlink(struct afp_volume * vol, const char * path,
+-        char *buf, size_t size);
+-
+-int ml_rmdir(struct afp_volume * vol, const char *path);
+-
+-int ml_chown(struct afp_volume * vol, const char * path,   
+-        uid_t uid, gid_t gid);
+-
+-int ml_truncate(struct afp_volume * vol, const char * path, off_t offset);
+-
+-int ml_utime(struct afp_volume * vol, const char * path,
+-      struct utimbuf * timebuf);
+-
+-int ml_symlink(struct afp_volume *vol, const char * path1, const char * path2);
+-
+-int ml_rename(struct afp_volume * vol,
+-      const char * path_from, const char * path_to);
+-
+-int ml_statfs(struct afp_volume * vol, const char *path, struct statvfs *stat);
+-
+-void afp_ml_filebase_free(struct afp_file_info **filebase);
+-
+-int ml_passwd(struct afp_server *server,
+-                char * username, char * oldpasswd, char * newpasswd);
+-
+-
+-
+-#endif
+diff -Naur afpfs-ng-0.8.1/include/uams_def.h afpfs-ng-0.8.1.patch/include/uams_def.h
+--- afpfs-ng-0.8.1/include/uams_def.h  2007-09-07 15:10:51.000000000 +0200
++++ afpfs-ng-0.8.1.patch/include/uams_def.h    1970-01-01 01:00:00.000000000 +0100
+@@ -1,16 +0,0 @@
+-#ifndef __UAM_DEFS_H_
+-#define __UAM_DEFS_H_
+-
+-#define UAM_NOUSERAUTHENT 0x1
+-#define UAM_CLEARTXTPASSWRD 0x2
+-#define UAM_RANDNUMEXCHANGE 0x4
+-#define UAM_2WAYRANDNUM 0x8
+-#define UAM_DHCAST128 0x10
+-#define UAM_CLIENTKRB 0x20
+-#define UAM_DHX2 0x40
+-#define UAM_RECON1 0x80
+-
+-int uam_string_to_bitmap(char * name);
+-char * uam_bitmap_to_string(unsigned int bitmap);
+-
+-#endif
+diff -Naur afpfs-ng-0.8.1/include/utils.h afpfs-ng-0.8.1.patch/include/utils.h
+--- afpfs-ng-0.8.1/include/utils.h     2008-02-18 04:33:58.000000000 +0100
++++ afpfs-ng-0.8.1.patch/include/utils.h       1970-01-01 01:00:00.000000000 +0100
+@@ -1,43 +0,0 @@
+-#ifndef __UTILS_H_
+-#define __UTILS_H_
+-#include <stdio.h>
+-
+-#include "afp.h"
+-
+-#if BYTE_ORDER == BIG_ENDIAN
+-#define hton64(x)       (x)
+-#define ntoh64(x)       (x)
+-#else /* BYTE_ORDER == BIG_ENDIAN */
+-#define hton64(x)       ((u_int64_t) (htonl(((x) >> 32) & 0xffffffffLL)) | \
+-                         (u_int64_t) ((htonl(x) & 0xffffffffLL) << 32))
+-#define ntoh64(x)       (hton64(x))
+-#endif /* BYTE_ORDER == BIG_ENDIAN */
+-
+-#define min(a,b) (((a)<(b)) ? (a) : (b))
+-#define max(a,b) (((a)>(b)) ? (a) : (b))
+-
+-
+-
+-unsigned char unixpath_to_afppath(
+-        struct afp_server * server,
+-        char * buf);
+-
+-unsigned char sizeof_path_header(struct afp_server * server);
+-
+-
+-
+-unsigned char copy_from_pascal(char *dest, char *pascal,unsigned int max_len) ;
+-unsigned short copy_from_pascal_two(char *dest, char *pascal,unsigned int max_len);
+-
+-unsigned char copy_to_pascal(char *dest, const char *src);
+-unsigned short copy_to_pascal_two(char *dest, const char *src);
+-
+-void copy_path(struct afp_server * server, char * dest, const char * pathname, unsigned char len);
+-
+-
+-char * create_path(struct afp_server * server, char * pathname, unsigned short * len);
+-
+-
+-int invalid_filename(struct afp_server * server, const char * filename);
+-
+-#endif
+diff -Naur afpfs-ng-0.8.1/lib/afp.c afpfs-ng-0.8.1.patch/lib/afp.c
+--- afpfs-ng-0.8.1/lib/afp.c   2008-03-08 03:44:16.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/afp.c     2011-09-10 12:13:50.131124759 +0200
+@@ -9,7 +9,7 @@
+-#include "afp.h"
++#include "afpfs-ng/afp.h"
+ #include <config.h>
+ #include <stdio.h>
+@@ -21,17 +21,17 @@
+ #include <sys/socket.h>
+ #include <errno.h>
+-#include "afp_protocol.h"
+-#include "libafpclient.h"
++#include "afpfs-ng/afp_protocol.h"
++#include "afpfs-ng/libafpclient.h"
+ #include "server.h"
+-#include "dsi.h"
++#include "afpfs-ng/dsi.h"
+ #include "dsi_protocol.h"
+-#include "utils.h"
++#include "afpfs-ng/utils.h"
+ #include "afp_replies.h"
+ #include "afp_internal.h"
+ #include "did.h"
+ #include "forklist.h"
+-#include "codepage.h"
++#include "afpfs-ng/codepage.h"
+ struct afp_versions      afp_versions[] = {
+             { "AFPVersion 1.1", 11 },
+diff -Naur afpfs-ng-0.8.1/lib/afp_internal.h afpfs-ng-0.8.1.patch/lib/afp_internal.h
+--- afpfs-ng-0.8.1/lib/afp_internal.h  2007-11-09 05:27:20.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/afp_internal.h    2011-09-10 12:13:50.132124772 +0200
+@@ -1,7 +1,7 @@
+ #ifndef _AFP_INTERNAL_H_
+ #define _AFP_INTERNAL_H_
+-#include "afp.h"
++#include "afpfs-ng/afp.h"
+ extern struct afp_versions afp_versions[];
+diff -Naur afpfs-ng-0.8.1/lib/afp_url.c afpfs-ng-0.8.1.patch/lib/afp_url.c
+--- afpfs-ng-0.8.1/lib/afp_url.c       2008-03-04 21:16:49.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/afp_url.c 2011-09-10 12:13:50.132124772 +0200
+@@ -3,7 +3,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <errno.h>
+-#include "afp.h"
++#include "afpfs-ng/afp.h"
+ void afp_default_url(struct afp_url *url)
+ {
+diff -Naur afpfs-ng-0.8.1/lib/client.c afpfs-ng-0.8.1.patch/lib/client.c
+--- afpfs-ng-0.8.1/lib/client.c        2008-02-18 04:36:30.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/client.c  2011-09-10 12:13:50.132124772 +0200
+@@ -1,5 +1,5 @@
+-#include <afp.h>
+-#include <libafpclient.h>
++#include <afpfs-ng/afp.h>
++#include <afpfs-ng/libafpclient.h>
+ struct libafpclient * libafpclient = NULL;
+diff -Naur afpfs-ng-0.8.1/lib/codepage.c afpfs-ng-0.8.1.patch/lib/codepage.c
+--- afpfs-ng-0.8.1/lib/codepage.c      2008-02-18 04:36:54.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/codepage.c        2011-09-10 12:13:50.133124786 +0200
+@@ -14,8 +14,8 @@
+ #include <string.h>
+ #include <stdlib.h>
+-#include "afp_protocol.h"
+-#include "utils.h"
++#include "afpfs-ng/afp_protocol.h"
++#include "afpfs-ng/utils.h"
+ #include "unicode.h"
+ int convert_utf8dec_to_utf8pre(const char *src, int src_len,
+diff -Naur afpfs-ng-0.8.1/lib/connect.c afpfs-ng-0.8.1.patch/lib/connect.c
+--- afpfs-ng-0.8.1/lib/connect.c       2008-02-18 04:38:59.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/connect.c 2011-09-10 12:13:50.133124786 +0200
+@@ -10,13 +10,13 @@
+ #include <string.h>
+ #include <sys/socket.h>
+-#include "afp.h"
+-#include "dsi.h"
+-#include "utils.h"
+-#include "uams_def.h"
+-#include "codepage.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/utils.h"
++#include "afpfs-ng/uams_def.h"
++#include "afpfs-ng/codepage.h"
+ #include "users.h"
+-#include "libafpclient.h"
++#include "afpfs-ng/libafpclient.h"
+ #include "server.h"
+diff -Naur afpfs-ng-0.8.1/lib/did.c afpfs-ng-0.8.1.patch/lib/did.c
+--- afpfs-ng-0.8.1/lib/did.c   2008-02-18 04:39:17.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/did.c     2011-09-10 12:13:50.133124786 +0200
+@@ -9,8 +9,8 @@
+ #include <string.h>
+ #include <stdio.h>
+-#include "afp.h"
+-#include "afp_protocol.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/afp_protocol.h"
+ #undef DID_CACHE_DISABLE
+diff -Naur afpfs-ng-0.8.1/lib/dsi.c afpfs-ng-0.8.1.patch/lib/dsi.c
+--- afpfs-ng-0.8.1/lib/dsi.c   2008-02-18 04:53:03.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/dsi.c     2011-09-10 12:13:50.134124800 +0200
+@@ -19,12 +19,12 @@
+ #include <signal.h>
+ #include <iconv.h>
+-#include "utils.h"
+-#include "dsi.h"
+-#include "afp.h"
+-#include "uams_def.h"
++#include "afpfs-ng/utils.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/uams_def.h"
+ #include "dsi_protocol.h"
+-#include "libafpclient.h"
++#include "afpfs-ng/libafpclient.h"
+ #include "afp_internal.h"
+ #include "afp_replies.h"
+diff -Naur afpfs-ng-0.8.1/lib/forklist.c afpfs-ng-0.8.1.patch/lib/forklist.c
+--- afpfs-ng-0.8.1/lib/forklist.c      2008-01-17 05:49:16.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/forklist.c        2011-09-10 12:13:50.135124814 +0200
+@@ -10,7 +10,7 @@
+ */
+-#include "afp.h"
++#include "afpfs-ng/afp.h"
+ #include <stdlib.h>
+ #include <pthread.h>
+diff -Naur afpfs-ng-0.8.1/lib/log.c afpfs-ng-0.8.1.patch/lib/log.c
+--- afpfs-ng-0.8.1/lib/log.c   2008-01-30 05:37:58.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/log.c     2011-09-10 12:13:50.135124814 +0200
+@@ -3,7 +3,7 @@
+ #include <stdarg.h>
+ #include <string.h>
+ #include <stdlib.h>
+-#include "libafpclient.h"
++#include "afpfs-ng/libafpclient.h"
+ void log_for_client(void * priv,
+       enum loglevels loglevel, int logtype, char *format, ...) {
+diff -Naur afpfs-ng-0.8.1/lib/loop.c afpfs-ng-0.8.1.patch/lib/loop.c
+--- afpfs-ng-0.8.1/lib/loop.c  2008-02-18 04:40:11.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/loop.c    2011-09-10 12:13:50.135124814 +0200
+@@ -16,9 +16,9 @@
+ #include <sys/time.h>
+ #include <signal.h>
+-#include "afp.h"
+-#include "dsi.h"
+-#include "utils.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/utils.h"
+ #define SIGNAL_TO_USE SIGUSR2
+diff -Naur afpfs-ng-0.8.1/lib/lowlevel.c afpfs-ng-0.8.1.patch/lib/lowlevel.c
+--- afpfs-ng-0.8.1/lib/lowlevel.c      2008-02-20 02:33:17.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/lowlevel.c        2011-09-10 12:13:50.136124828 +0200
+@@ -19,10 +19,10 @@
+ #else
+ #include <fcntl.h>
+ #endif
+-#include "afp.h"
+-#include "afp_protocol.h"
+-#include "codepage.h"
+-#include "utils.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/afp_protocol.h"
++#include "afpfs-ng/codepage.h"
++#include "afpfs-ng/utils.h"
+ #include "did.h"
+ #include "users.h"
+diff -Naur afpfs-ng-0.8.1/lib/map_def.c afpfs-ng-0.8.1.patch/lib/map_def.c
+--- afpfs-ng-0.8.1/lib/map_def.c       2007-09-07 15:10:59.000000000 +0200
++++ afpfs-ng-0.8.1.patch/lib/map_def.c 2011-09-10 12:13:50.136124828 +0200
+@@ -1,6 +1,6 @@
+ #include <string.h>
+-#include "afp.h"
+-#include "map_def.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/map_def.h"
+ static char *afp_map_strings[] = {
+       "Unknown",
+diff -Naur afpfs-ng-0.8.1/lib/meta.c afpfs-ng-0.8.1.patch/lib/meta.c
+--- afpfs-ng-0.8.1/lib/meta.c  2008-01-04 04:52:44.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/meta.c    2011-09-10 12:13:50.137124841 +0200
+@@ -17,10 +17,10 @@
+ #include <unistd.h>
+ #include <sys/time.h>
+-#include "afp.h"
+-#include "dsi.h"
+-#include "afp_protocol.h"
+-#include "utils.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp_protocol.h"
++#include "afpfs-ng/utils.h"
+ int afp_meta_getattr(const char *path, struct stat *stbuf)
+diff -Naur afpfs-ng-0.8.1/lib/midlevel.c afpfs-ng-0.8.1.patch/lib/midlevel.c
+--- afpfs-ng-0.8.1/lib/midlevel.c      2008-03-08 17:08:18.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/midlevel.c        2011-09-10 12:13:50.160125150 +0200
+@@ -10,7 +10,7 @@
+ */
+-#include "afp.h"
++#include "afpfs-ng/afp.h"
+ #include <sys/stat.h>
+ #include <string.h>
+@@ -28,9 +28,9 @@
+ #include "users.h"
+ #include "did.h"
+ #include "resource.h"
+-#include "utils.h"
+-#include "codepage.h"
+-#include "midlevel.h"
++#include "afpfs-ng/utils.h"
++#include "afpfs-ng/codepage.h"
++#include "afpfs-ng/midlevel.h"
+ #include "afp_internal.h"
+ #include "forklist.h"
+ #include "uams.h"
+diff -Naur afpfs-ng-0.8.1/lib/proto_attr.c afpfs-ng-0.8.1.patch/lib/proto_attr.c
+--- afpfs-ng-0.8.1/lib/proto_attr.c    2008-01-30 05:37:58.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/proto_attr.c      2011-09-10 12:13:50.168125257 +0200
+@@ -7,10 +7,10 @@
+ #include <string.h>
+ #include <stdlib.h>
+-#include "dsi.h"
+-#include "afp.h"
+-#include "utils.h"
+-#include "afp_protocol.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
++#include "afpfs-ng/afp_protocol.h"
+ #include "dsi_protocol.h"
+ /* This is a new command, function 76.  There are currently no docs, so this 
+diff -Naur afpfs-ng-0.8.1/lib/proto_desktop.c afpfs-ng-0.8.1.patch/lib/proto_desktop.c
+--- afpfs-ng-0.8.1/lib/proto_desktop.c 2008-02-18 04:44:11.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/proto_desktop.c   2011-09-10 12:13:50.168125257 +0200
+@@ -9,10 +9,10 @@
+ #include <string.h>
+ #include <stdlib.h>
+-#include "dsi.h"
+-#include "afp.h"
+-#include "utils.h"
+-#include "afp_protocol.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
++#include "afpfs-ng/afp_protocol.h"
+ #include "dsi_protocol.h"
+ /* closedt, addicon, geticoninfo, addappl, removeappl */
+diff -Naur afpfs-ng-0.8.1/lib/proto_directory.c afpfs-ng-0.8.1.patch/lib/proto_directory.c
+--- afpfs-ng-0.8.1/lib/proto_directory.c       2008-02-19 03:39:29.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/proto_directory.c 2011-09-10 12:13:50.168125257 +0200
+@@ -9,10 +9,10 @@
+ #include <string.h>
+ #include <stdlib.h>
+-#include "dsi.h"
+-#include "afp.h"
+-#include "utils.h"
+-#include "afp_protocol.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
++#include "afpfs-ng/afp_protocol.h"
+ #include "dsi_protocol.h"
+ #include "afp_replies.h"
+diff -Naur afpfs-ng-0.8.1/lib/proto_files.c afpfs-ng-0.8.1.patch/lib/proto_files.c
+--- afpfs-ng-0.8.1/lib/proto_files.c   2008-02-18 04:46:18.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/proto_files.c     2011-09-10 12:13:50.169125270 +0200
+@@ -8,11 +8,11 @@
+ #include <stdlib.h>
+ #include <string.h>
+-#include "dsi.h"
+-#include "afp.h"
+-#include "utils.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
+ #include "dsi_protocol.h"
+-#include "afp_protocol.h"
++#include "afpfs-ng/afp_protocol.h"
+ #include "afp_internal.h"
+ /* afp_setfileparms, afp_setdirparms and afpsetfiledirparms are all remarkably
+diff -Naur afpfs-ng-0.8.1/lib/proto_fork.c afpfs-ng-0.8.1.patch/lib/proto_fork.c
+--- afpfs-ng-0.8.1/lib/proto_fork.c    2008-01-30 05:37:58.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/proto_fork.c      2011-09-10 12:13:50.169125270 +0200
+@@ -9,11 +9,11 @@
+ #include <stdlib.h>
+ #include <string.h>
+-#include "dsi.h"
+-#include "afp.h"
+-#include "utils.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
+ #include "dsi_protocol.h"
+-#include "afp_protocol.h"
++#include "afpfs-ng/afp_protocol.h"
+ int afp_setforkparms(struct afp_volume * volume,
+       unsigned short forkid, unsigned short bitmap, unsigned long len)
+diff -Naur afpfs-ng-0.8.1/lib/proto_login.c afpfs-ng-0.8.1.patch/lib/proto_login.c
+--- afpfs-ng-0.8.1/lib/proto_login.c   2008-01-30 05:37:59.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/proto_login.c     2011-09-10 12:13:50.169125270 +0200
+@@ -10,10 +10,10 @@
+ #include <stdlib.h>
+ #include <string.h>
+-#include "dsi.h"
++#include "afpfs-ng/dsi.h"
+ #include "dsi_protocol.h"
+-#include "afp.h"
+-#include "utils.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
+ #include "afp_internal.h"
+diff -Naur afpfs-ng-0.8.1/lib/proto_map.c afpfs-ng-0.8.1.patch/lib/proto_map.c
+--- afpfs-ng-0.8.1/lib/proto_map.c     2008-01-30 05:37:59.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/proto_map.c       2011-09-10 12:13:50.170125283 +0200
+@@ -9,11 +9,11 @@
+ #include <stdlib.h>
+ #include <string.h>
+-#include "dsi.h"
+-#include "afp.h"
+-#include "utils.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
+ #include "dsi_protocol.h"
+-#include "afp_protocol.h"
++#include "afpfs-ng/afp_protocol.h"
+ /* This is used to pass the return values back from afp_getuserinfo_reply() */
+ struct uidgid {
+diff -Naur afpfs-ng-0.8.1/lib/proto_replyblock.c afpfs-ng-0.8.1.patch/lib/proto_replyblock.c
+--- afpfs-ng-0.8.1/lib/proto_replyblock.c      2008-02-18 04:46:19.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/proto_replyblock.c        2011-09-10 12:13:50.170125283 +0200
+@@ -6,9 +6,9 @@
+  */
+ #include <string.h>
+-#include "dsi.h"
+-#include "afp.h"
+-#include "utils.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
+ #include "afp_internal.h"
+diff -Naur afpfs-ng-0.8.1/lib/proto_server.c afpfs-ng-0.8.1.patch/lib/proto_server.c
+--- afpfs-ng-0.8.1/lib/proto_server.c  2008-02-19 02:56:21.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/proto_server.c    2011-09-10 12:13:50.170125283 +0200
+@@ -7,12 +7,12 @@
+  */
+ #include <stdlib.h>
+ #include <string.h>
+-#include "dsi.h"
+-#include "afp.h"
+-#include "utils.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
+ #include "dsi_protocol.h"
+-#include "afp_protocol.h"
+-#include "codepage.h"
++#include "afpfs-ng/afp_protocol.h"
++#include "afpfs-ng/codepage.h"
+ #include "afp_internal.h"
+ int afp_getsrvrparms(struct afp_server *server)
+diff -Naur afpfs-ng-0.8.1/lib/proto_session.c afpfs-ng-0.8.1.patch/lib/proto_session.c
+--- afpfs-ng-0.8.1/lib/proto_session.c 2008-02-18 04:46:19.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/proto_session.c   2011-09-10 12:13:50.170125283 +0200
+@@ -8,10 +8,10 @@
+  */
+ #include <stdlib.h>
+ #include <string.h>
+-#include "dsi.h"
++#include "afpfs-ng/dsi.h"
+ #include "dsi_protocol.h"
+-#include "afp.h"
+-#include "utils.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
+ int afp_getsessiontoken(struct afp_server * server, int type, 
+       unsigned int timestamp, struct afp_token *outgoing_token, 
+diff -Naur afpfs-ng-0.8.1/lib/proto_volume.c afpfs-ng-0.8.1.patch/lib/proto_volume.c
+--- afpfs-ng-0.8.1/lib/proto_volume.c  2008-02-18 04:47:48.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/proto_volume.c    2011-09-10 12:13:50.171125296 +0200
+@@ -8,13 +8,13 @@
+ #include <string.h>
+ #include <stdlib.h>
+-#include "dsi.h"
+-#include "afp.h"
+-#include "utils.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
+ #include "dsi_protocol.h"
+-#include "afp_protocol.h"
++#include "afpfs-ng/afp_protocol.h"
+ #include "afp_internal.h"
+-#include "codepage.h"
++#include "afpfs-ng/codepage.h"
+ static int parse_volbitmap_reply(struct afp_server * server, 
+               struct afp_volume * tmpvol, 
+diff -Naur afpfs-ng-0.8.1/lib/resource.c afpfs-ng-0.8.1.patch/lib/resource.c
+--- afpfs-ng-0.8.1/lib/resource.c      2008-02-18 04:46:56.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/resource.c        2011-09-10 12:13:50.171125296 +0200
+@@ -3,11 +3,11 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <fcntl.h>
+-#include "afp.h"
++#include "afpfs-ng/afp.h"
+ #include "resource.h"
+ #include "lowlevel.h"
+ #include "did.h"
+-#include "midlevel.h"
++#include "afpfs-ng/midlevel.h"
+ #define appledouble ".AppleDouble"
+ #define finderinfo_string ".finderinfo"
+diff -Naur afpfs-ng-0.8.1/lib/server.c afpfs-ng-0.8.1.patch/lib/server.c
+--- afpfs-ng-0.8.1/lib/server.c        2008-02-19 02:56:21.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/server.c  2011-09-10 12:13:50.172125310 +0200
+@@ -8,15 +8,15 @@
+ #include <string.h>
+ #include <time.h>
+-#include "afp.h"
+-#include "dsi.h"
+-#include "utils.h"
+-#include "uams_def.h"
+-#include "codepage.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/utils.h"
++#include "afpfs-ng/uams_def.h"
++#include "afpfs-ng/codepage.h"
+ #include "users.h"
+-#include "libafpclient.h"
++#include "afpfs-ng/libafpclient.h"
+ #include "afp_internal.h"
+-#include "dsi.h"
++#include "afpfs-ng/dsi.h"
+ struct afp_server * afp_server_complete_connection(
+diff -Naur afpfs-ng-0.8.1/lib/status.c afpfs-ng-0.8.1.patch/lib/status.c
+--- afpfs-ng-0.8.1/lib/status.c        2008-03-08 17:08:38.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/status.c  2011-09-10 12:13:50.172125310 +0200
+@@ -1,8 +1,8 @@
+ #include <string.h>
+ #include <stdio.h>
+-#include "map_def.h"
+-#include "dsi.h"
+-#include "afp.h"
++#include "afpfs-ng/map_def.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
+ int afp_status_header(char * text, int * len) 
+ {
+diff -Naur afpfs-ng-0.8.1/lib/uams.c afpfs-ng-0.8.1.patch/lib/uams.c
+--- afpfs-ng-0.8.1/lib/uams.c  2008-01-04 04:52:44.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/uams.c    2011-09-10 12:13:50.173125324 +0200
+@@ -8,10 +8,10 @@
+ #include <string.h>
+ #include <stdlib.h>
+-#include "dsi.h"
+-#include "afp.h"
+-#include "utils.h"
+-#include "uams_def.h"
++#include "afpfs-ng/dsi.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
++#include "afpfs-ng/uams_def.h"
+ #include "config.h"
+ #ifdef HAVE_LIBGCRYPT
+diff -Naur afpfs-ng-0.8.1/lib/users.c afpfs-ng-0.8.1.patch/lib/users.c
+--- afpfs-ng-0.8.1/lib/users.c 2008-02-18 04:48:56.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/users.c   2011-09-10 12:13:50.174125338 +0200
+@@ -3,8 +3,8 @@
+ #include <grp.h>
+ #include <string.h>
+-#include "afp.h"
+-#include "map_def.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/map_def.h"
+ /* How mapping works
+  *
+diff -Naur afpfs-ng-0.8.1/lib/utils.c afpfs-ng-0.8.1.patch/lib/utils.c
+--- afpfs-ng-0.8.1/lib/utils.c 2008-02-18 04:53:37.000000000 +0100
++++ afpfs-ng-0.8.1.patch/lib/utils.c   2011-09-10 12:13:50.174125338 +0200
+@@ -8,10 +8,10 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
+-#include "afp.h"
+-#include "utils.h"
++#include "afpfs-ng/afp.h"
++#include "afpfs-ng/utils.h"
+ #include "afp_internal.h"
+-#include "afp_protocol.h"
++#include "afpfs-ng/afp_protocol.h"
+ struct afp_path_header_long {
+       unsigned char type;
+diff -Naur afpfs-ng-0.8.1/Makefile.am afpfs-ng-0.8.1.patch/Makefile.am
+--- afpfs-ng-0.8.1/Makefile.am 2008-02-18 04:24:14.000000000 +0100
++++ afpfs-ng-0.8.1.patch/Makefile.am   2011-09-10 12:13:50.176125365 +0200
+@@ -1,5 +1,5 @@
+ if HAVE_LIBFUSE
+-SUBDIRS = lib fuse cmdline docs
++SUBDIRS = lib fuse cmdline include docs
+ else
+-SUBDIRS = lib cmdline docs
++SUBDIRS = lib cmdline include docs
+ endif
diff --git a/tools/depends/target/alsa-lib/Makefile b/tools/depends/target/alsa-lib/Makefile
new file mode 100644 (file)
index 0000000..b03fc19
--- /dev/null
@@ -0,0 +1,64 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile removeshm-2.patch removeshm-3.patch removeshm-upstream.patch timeval.patch
+
+# lib name, version
+LIBNAME=libasound
+VERSION=1.0.23
+SOURCE=alsa-lib-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+# configuration settings
+CFLAGS += \
+       -fPIC -DPIC \
+       -finline-limit=300 -finline-functions -fno-inline-functions-called-once \
+
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          $(AUTORECONF) -vif; \
+          ./configure --prefix=$(PREFIX) \
+          --with-alsa-devdir=/dev/snd/ --with-plugindir=/system/usr/lib/alsa-lib --with-configdir=/system/usr/share/alsa \
+          --with-ctl-plugins=ext \
+          --with-pcm-plugins="copy,linear,route,mulaw,alaw,adpcm,rate,plug,multi,file,null,empty,share,meter,hooks,lfloat,ladspa,asym,iec958,softvol,extplug,ioplug,mmap_emul" \
+          --disable-resmgr --enable-aload --enable-mixer  --enable-pcm  --disable-rawmidi  --enable-hwdep  --disable-seq  --disable-alisp  --disable-old-symbols --disable-python \
+          --with-softfloat=yes --with-libdl=yes --with-pthread=yes --with-librt=no --disable-shared \
+
+LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ifeq ($(OS),android)
+       cd $(PLATFORM); patch -p1 < ../removeshm-upstream.patch
+       cd $(PLATFORM); patch -p0 < ../removeshm-2.patch
+       cd $(PLATFORM); patch -p0 < ../removeshm-3.patch
+       cd $(PLATFORM); patch -p0 < ../timeval.patch
+endif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/src
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/src install-libLTLIBRARIES
+       $(MAKE) -C $(PLATFORM)/include install
+       $(MAKE) -C $(PLATFORM)/utils install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libasound.la $(PREFIX)/lib/libasound.so $(PREFIX)/lib/libxbasound.so $(PREFIX)/lib/libasound.so.2
+       mv -f $(PREFIX)/lib/libasound.so.2.0.0 $(PREFIX)/lib/libasound.so
+       $(RPL) -e "libasound.so.2" "libasound.so\x00\x00" $(PREFIX)/lib/libasound.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libasound.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/alsa-lib/removeshm-2.patch b/tools/depends/target/alsa-lib/removeshm-2.patch
new file mode 100644 (file)
index 0000000..0bf5b18
--- /dev/null
@@ -0,0 +1,11 @@
+--- src/compat/Makefile.am     2012-05-25 00:00:09.824890740 -0400
++++ src/compat/Makefile.am     2012-05-25 14:47:53.694857153 -0400
+@@ -1,8 +1,3 @@
+ noinst_LTLIBRARIES = libcompat.la
+-EXTRA_libcompat_la_SOURCES = hsearch_r.c
+-if ALSA_HSEARCH_R
+-libcompat_la_SOURCES = empty.c hsearch_r.c
+-else
+ libcompat_la_SOURCES = empty.c
+-endif
diff --git a/tools/depends/target/alsa-lib/removeshm-3.patch b/tools/depends/target/alsa-lib/removeshm-3.patch
new file mode 100644 (file)
index 0000000..8f651fe
--- /dev/null
@@ -0,0 +1,11 @@
+--- src/Makefile.am    2011-01-12 17:02:37.000000000 -0500
++++ src/Makefile.am    2012-05-25 00:10:22.184890354 -0400
+@@ -14,7 +14,7 @@
+ endif
+ lib_LTLIBRARIES = libasound.la
+-libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c dlmisc.c socket.c shmarea.c userfile.c names.c
++libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c dlmisc.c socket.c userfile.c names.c
+ SUBDIRS=control
+ libasound_la_LIBADD = control/libcontrol.la
diff --git a/tools/depends/target/alsa-lib/removeshm-upstream.patch b/tools/depends/target/alsa-lib/removeshm-upstream.patch
new file mode 100644 (file)
index 0000000..ab899c3
--- /dev/null
@@ -0,0 +1,187 @@
+From: Sean McNeil <sean.mcneil@windriver.com>
+Date: Wed, 7 Jul 2010 02:03:47 +0000 (+0700)
+Subject: Remove shared memory access.
+X-Git-Tag: tegra-10.11.0~2
+X-Git-Url: http://nv-tegra.nvidia.com/gitweb/?p=android%2Fplatform%2Fexternal%2Falsa-lib.git;a=commitdiff_plain;h=24def9277c1bf4ed5c19b73ed3e76d761f992ddb
+
+Remove shared memory access.
+
+Somehow these changes didn't get committed.
+
+Change-Id: Ida7b706de56d95c8fb22d2708711a4d68c41ddaa
+---
+
+diff --git a/src/alisp/alisp.c b/src/alisp/alisp.c
+index f3580f9..279a24c 100644
+--- a/src/alisp/alisp.c
++++ b/src/alisp/alisp.c
+@@ -1025,6 +1025,7 @@ static const char *obj_type_str(struct alisp_object * p)
+       case ALISP_OBJ_CONS: return "cons";
+       default: assert(0);
+       }
++      return 0; /* make compiler happy */
+ }
+ static void print_obj_lists(struct alisp_instance *instance, snd_output_t *out)
+diff --git a/src/dlmisc.c b/src/dlmisc.c
+index a0d62d3..b84eaf6 100644
+--- a/src/dlmisc.c
++++ b/src/dlmisc.c
+@@ -27,6 +27,7 @@
+  *
+  */
++#define _GNU_SOURCE
+ #include "list.h"
+ #include "local.h"
+@@ -53,13 +54,13 @@ void *snd_dlopen(const char *name, int mode)
+ #else
+ #ifdef HAVE_LIBDL
+       if (name == NULL) {
+-              static const char * self = NULL;
+-              if (self == NULL) {
+-                      Dl_info dlinfo;
+-                      if (dladdr(snd_dlopen, &dlinfo) > 0)
+-                              self = dlinfo.dli_fname;
+-              }
+-              name = self;
++#ifdef ANDROID
++              return RTLD_DEFAULT;
++#else
++              Dl_info dlinfo;
++              if (dladdr(snd_dlopen, &dlinfo) > 0)
++                      name = dlinfo.dli_fname;
++#endif
+       }
+ #endif
+ #endif
+@@ -85,6 +86,10 @@ int snd_dlclose(void *handle)
+               return 0;
+ #endif
+ #ifdef HAVE_LIBDL
++#ifdef ANDROID
++      if (handle == RTLD_DEFAULT)
++              return 0;
++#endif
+       return dlclose(handle);
+ #else
+       return 0;
+diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
+index f910189..71d5e99 100644
+--- a/src/pcm/pcm.c
++++ b/src/pcm/pcm.c
+@@ -634,7 +634,6 @@ playback devices.
+ #include <stdarg.h>
+ #include <signal.h>
+ #include <sys/poll.h>
+-#include <sys/shm.h>
+ #include <sys/mman.h>
+ #include <limits.h>
+ #include "pcm_local.h"
+diff --git a/src/pcm/pcm_generic.c b/src/pcm/pcm_generic.c
+index 84ea85f..d26aead 100644
+--- a/src/pcm/pcm_generic.c
++++ b/src/pcm/pcm_generic.c
+@@ -26,7 +26,6 @@
+  *
+  */
+-#include <sys/shm.h>
+ #include <sys/ioctl.h>
+ #include <limits.h>
+ #include "pcm_local.h"
+diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
+index 9d243d5..7f88a5b 100644
+--- a/src/pcm/pcm_hw.c
++++ b/src/pcm/pcm_hw.c
+@@ -36,7 +36,6 @@
+ #include <fcntl.h>
+ #include <sys/ioctl.h>
+ #include <sys/mman.h>
+-#include <sys/shm.h>
+ #include "pcm_local.h"
+ #include "../control/control_local.h"
+ #include "../timer/timer_local.h"
+diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c
+index 4621fe6..4b7a353 100644
+--- a/src/pcm/pcm_mmap.c
++++ b/src/pcm/pcm_mmap.c
+@@ -23,7 +23,9 @@
+ #include <string.h>
+ #include <sys/poll.h>
+ #include <sys/mman.h>
++#ifndef ANDROID
+ #include <sys/shm.h>
++#endif
+ #include "pcm_local.h"
+ size_t page_size(void)
+@@ -371,6 +373,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
+                       }
+                       i->addr = ptr;
+                       break;
++#ifndef ANDROID
+               case SND_PCM_AREA_SHM:
+                       if (i->u.shm.shmid < 0) {
+                               int id;
+@@ -416,6 +419,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
+                       }
+                       i->addr = ptr;
+                       break;
++#endif
+               case SND_PCM_AREA_LOCAL:
+                       ptr = malloc(size);
+                       if (ptr == NULL) {
+@@ -496,6 +500,7 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
+                       }
+                       errno = 0;
+                       break;
++#ifndef ANDROID
+               case SND_PCM_AREA_SHM:
+                       if (i->u.shm.area) {
+                               snd_shm_area_destroy(i->u.shm.area);
+@@ -513,6 +518,7 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
+                               }
+                       }
+                       break;
++#endif
+               case SND_PCM_AREA_LOCAL:
+                       free(i->addr);
+                       break;
+diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c
+index 692254a..2f2a42f 100644
+--- a/src/pcm/pcm_null.c
++++ b/src/pcm/pcm_null.c
+@@ -28,7 +28,6 @@
+   
+ #include <byteswap.h>
+ #include <limits.h>
+-#include <sys/shm.h>
+ #include "pcm_local.h"
+ #include "pcm_plugin.h"
+diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
+index 0ef394a..a751deb 100644
+--- a/src/pcm/pcm_plugin.c
++++ b/src/pcm/pcm_plugin.c
+@@ -82,7 +82,6 @@ pcm.rate44100Hz {
+ */
+   
+-#include <sys/shm.h>
+ #include <limits.h>
+ #include "pcm_local.h"
+ #include "pcm_plugin.h"
+diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c
+index 56a8685..72084fc 100644
+--- a/src/pcm/pcm_share.c
++++ b/src/pcm/pcm_share.c
+@@ -35,7 +35,6 @@
+ #include <math.h>
+ #include <sys/socket.h>
+ #include <sys/poll.h>
+-#include <sys/shm.h>
+ #include <pthread.h>
+ #include "pcm_local.h"
diff --git a/tools/depends/target/alsa-lib/timeval.patch b/tools/depends/target/alsa-lib/timeval.patch
new file mode 100644 (file)
index 0000000..6a7c1f0
--- /dev/null
@@ -0,0 +1,11 @@
+--- include/global.h   2010-04-16 07:11:05.000000000 -0400
++++ include/global.h   2012-05-25 15:38:15.494855247 -0400
+@@ -133,7 +133,7 @@
+ int snd_user_file(const char *file, char **result);
+-#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
++#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE) $$ !defined(ANDROID)
+ struct timeval {
+       time_t          tv_sec;         /* seconds */
+       long            tv_usec;        /* microseconds */
diff --git a/tools/depends/target/android-libc-replacements/locale.h b/tools/depends/target/android-libc-replacements/locale.h
new file mode 100644 (file)
index 0000000..70a34b4
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 1991, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)locale.h    8.1 (Berkeley) 6/2/93
+ * $FreeBSD$
+ */
+
+#ifndef _LOCALE_H_
+#define _LOCALE_H_
+
+struct lconv {
+       const char      *decimal_point;
+       const char      *thousands_sep;
+       const char      *grouping;
+       const char      *int_curr_symbol;
+       const char      *currency_symbol;
+       const char      *mon_decimal_point;
+       const char      *mon_thousands_sep;
+       const char      *mon_grouping;
+       const char      *positive_sign;
+       const char      *negative_sign;
+       char    int_frac_digits;
+       char    frac_digits;
+       char    p_cs_precedes;
+       char    p_sep_by_space;
+       char    n_cs_precedes;
+       char    n_sep_by_space;
+       char    p_sign_posn;
+       char    n_sign_posn;
+       char    int_p_cs_precedes;
+       char    int_n_cs_precedes;
+       char    int_p_sep_by_space;
+       char    int_n_sep_by_space;
+       char    int_p_sign_posn;
+       char    int_n_sign_posn;
+};
+
+#define        LC_ALL          0
+#define        LC_COLLATE      1
+#define        LC_CTYPE        2
+#define        LC_MONETARY     3
+#define        LC_NUMERIC      4
+#define        LC_TIME         5
+#define        LC_MESSAGES     6
+
+#define        _LC_LAST        7               /* marks end */
+
+#include <sys/cdefs.h>
+#include <limits.h>
+__BEGIN_DECLS
+char           *setlocale(int, const char *);
+__END_DECLS
+
+static inline const struct lconv *localeconv(void)
+{
+  static const struct lconv temp =
+  {
+    ".",
+    "",
+    "",
+    "",
+    "",
+    "",
+    "",
+    "",
+    "",
+    "-",
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX,
+    CHAR_MAX
+  };
+  return &temp;
+}
+
+#endif /* _LOCALE_H_ */
diff --git a/tools/depends/target/android-sys/Makefile b/tools/depends/target/android-sys/Makefile
new file mode 100644 (file)
index 0000000..76451b9
--- /dev/null
@@ -0,0 +1,53 @@
+include ../../Makefile.include
+DEPS = ../../Makefile.include Makefile iomx.cpp
+
+LIBNAME=android-sys
+VERSION=0.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+PRIVATE_LIBDIR=$(PLATFORM)/android-libs
+PRIVATE_LIBS =$(PRIVATE_LIBDIR)/libutils.so
+PRIVATE_LIBS+=$(PRIVATE_LIBDIR)/libmedia.so
+PRIVATE_LIBS+=$(PRIVATE_LIBDIR)/libbinder.so
+PRIVATE_LIBS+=$(PRIVATE_LIBDIR)/libstagefright.so
+
+CXXFLAGS =$(PLATFORM_FLAGS) -I$(PREFIX)/include -fexceptions
+LDFLAGS += -L$(PRIVATE_LIBDIR) -lmedia -lutils -lbinder
+INCLUDES+=-I$(PLATFORM)/$(SDK_PLATFORM)/system/core/include
+INCLUDES+=-I$(PLATFORM)/$(SDK_PLATFORM)/frameworks/base/include
+INCLUDES+=-I$(PLATFORM)/$(SDK_PLATFORM)/frameworks/base/include/media/stagefright/openmax
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+
+$(PRIVATE_LIBS:.so=.symbols): $(PLATFORM)
+
+$(PRIVATE_LIBS:.so=.c): $(PRIVATE_LIBS:.so=.symbols)
+       rm -f $@
+       for s in `cat $(@:.c=.symbols)`; do echo "void $$s() {}" >> $@; done
+
+$(PRIVATE_LIBS): $(PRIVATE_LIBS:.so=.c)
+       $(CC) $(@:.so=.c) -shared -o $@
+
+$(PLATFORM)/$(SDK_PLATFORM)/libiomx.so: iomx.cpp
+       $(CXX) $(CXXFLAGS) $(INCLUDES) -shared -o $@ iomx.cpp $(LDFLAGS) -lstagefright
+
+.installed-$(PLATFORM): $(PRIVATE_LIBS) $(PLATFORM)/$(SDK_PLATFORM)/libiomx.so
+       mkdir -p $(PREFIX)/include/$(SDK_PLATFORM)
+       mkdir -p $(PREFIX)/lib/$(SDK_PLATFORM)
+       cp -f $(PLATFORM)/$(SDK_PLATFORM)/libiomx.so $(PREFIX)/lib/$(SDK_PLATFORM)/
+       cp -f $(PLATFORM)/$(SDK_PLATFORM)/frameworks/base/include/media/stagefright/openmax/* $(PREFIX)/include/$(SDK_PLATFORM)/
+       touch $@
+
+clean:
+       rm -f .installed-$(PLATFORM) $(PLATFORM)/libiomx.so $(PRIVATE_LIBS) $(PRIVATE_LIBS:.so=.c)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/android-sys/iomx.cpp b/tools/depends/target/android-sys/iomx.cpp
new file mode 100644 (file)
index 0000000..d21fae7
--- /dev/null
@@ -0,0 +1,473 @@
+/*****************************************************************************
+ * iomx.cpp: OpenMAX interface implementation based on IOMX
+ *****************************************************************************
+ * Copyright (C) 2011 VLC authors and VideoLAN
+ *
+ * Authors: Martin Storsjo <martin@martin.st>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+
+#include <media/stagefright/OMXClient.h>
+#include <media/IOMX.h>
+#include <binder/MemoryDealer.h>
+#include <OMX_Component.h>
+
+extern "C" {
+
+int android_printf(const char *format, ...)
+{
+  // For use before CLog is setup by XBMC_Run()
+  va_list args;
+  va_start(args, format);
+  int result = __android_log_vprint(ANDROID_LOG_VERBOSE, "XBMC", format, args);
+  va_end(args);
+  return result;
+}
+}
+
+//#define PREFIX(x) I ## x
+#define PREFIX(x) x
+
+using namespace android;
+
+class IOMXContext {
+public:
+    IOMXContext() {
+    }
+
+    sp<IOMX> iomx;
+    List<IOMX::ComponentInfo> components;
+};
+
+static IOMXContext *ctx;
+
+class OMXNode;
+
+class OMXCodecObserver : public BnOMXObserver {
+public:
+    OMXCodecObserver() {
+        node = NULL;
+    }
+    void setNode(OMXNode* n) {
+        node = n;
+    }
+    void onMessage(const omx_message &msg);
+    void registerBuffers(const sp<IMemoryHeap> &) {
+    }
+private:
+    OMXNode *node;
+};
+
+class OMXNode {
+public:
+    IOMX::node_id node;
+    sp<OMXCodecObserver> observer;
+    OMX_CALLBACKTYPE callbacks;
+    OMX_PTR app_data;
+    OMX_STATETYPE state;
+    List<OMX_BUFFERHEADERTYPE*> buffers;
+    OMX_HANDLETYPE handle;
+    String8 component_name;
+};
+
+class OMXBuffer {
+public:
+    sp<MemoryDealer> dealer;
+    IOMX::buffer_id id;
+};
+
+void OMXCodecObserver::onMessage(const omx_message &msg)
+{
+    if (!node)
+        return;
+    switch (msg.type) {
+    case omx_message::EVENT:
+        // TODO: Needs locking
+        if (msg.u.event_data.event == OMX_EventCmdComplete && msg.u.event_data.data1 == OMX_CommandStateSet)
+            node->state = (OMX_STATETYPE) msg.u.event_data.data2;
+        node->callbacks.EventHandler(node->handle, node->app_data, msg.u.event_data.event, msg.u.event_data.data1, msg.u.event_data.data2, NULL);
+        break;
+    case omx_message::EMPTY_BUFFER_DONE:
+        for( List<OMX_BUFFERHEADERTYPE*>::iterator it = node->buffers.begin(); it != node->buffers.end(); it++ ) {
+            OMXBuffer* info = (OMXBuffer*) (*it)->pPlatformPrivate;
+            if (msg.u.buffer_data.buffer == info->id) {
+                node->callbacks.EmptyBufferDone(node->handle, node->app_data, *it);
+                break;
+            }
+        }
+        break;
+    case omx_message::FILL_BUFFER_DONE:
+        for( List<OMX_BUFFERHEADERTYPE*>::iterator it = node->buffers.begin(); it != node->buffers.end(); it++ ) {
+            OMXBuffer* info = (OMXBuffer*) (*it)->pPlatformPrivate;
+            if (msg.u.extended_buffer_data.buffer == info->id) {
+                OMX_BUFFERHEADERTYPE *buffer = *it;
+                buffer->nOffset = msg.u.extended_buffer_data.range_offset;
+                buffer->nFilledLen = msg.u.extended_buffer_data.range_length;
+                buffer->nFlags = msg.u.extended_buffer_data.flags;
+                buffer->nTimeStamp = msg.u.extended_buffer_data.timestamp;
+                node->callbacks.FillBufferDone(node->handle, node->app_data, buffer);
+                break;
+            }
+        }
+        break;
+    default:
+        break;
+    }
+}
+
+static OMX_ERRORTYPE get_error(status_t err)
+{
+    if (err == OK)
+        return OMX_ErrorNone;
+    return OMX_ErrorUndefined;
+}
+
+static int get_param_size(OMX_INDEXTYPE param_index)
+{
+    switch (param_index) {
+    case OMX_IndexParamPortDefinition:
+        return sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
+    case OMX_IndexParamStandardComponentRole:
+        return sizeof(OMX_PARAM_COMPONENTROLETYPE);
+    case OMX_IndexParamVideoInit:
+    case OMX_IndexParamAudioInit:
+    case OMX_IndexParamImageInit:
+    case OMX_IndexParamOtherInit:
+        return sizeof(OMX_PORT_PARAM_TYPE);
+    case OMX_IndexParamNumAvailableStreams:
+        return sizeof(OMX_PARAM_U32TYPE);
+    case OMX_IndexParamAudioPcm:
+        return sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
+    case OMX_IndexParamAudioAdpcm:
+        return sizeof(OMX_AUDIO_PARAM_AMRTYPE);
+    case OMX_IndexParamAudioAmr:
+        return sizeof(OMX_AUDIO_PARAM_AMRTYPE);
+    case OMX_IndexParamAudioG723:
+        return sizeof(OMX_AUDIO_PARAM_G723TYPE);
+    case OMX_IndexParamAudioG726:
+        return sizeof(OMX_AUDIO_PARAM_G726TYPE);
+    case OMX_IndexParamAudioG729:
+        return sizeof(OMX_AUDIO_PARAM_G729TYPE);
+    case OMX_IndexParamAudioAac:
+        return sizeof(OMX_AUDIO_PARAM_AACPROFILETYPE);
+    case OMX_IndexParamAudioMp3:
+        return sizeof(OMX_AUDIO_PARAM_MP3TYPE);
+    case OMX_IndexParamAudioSbc:
+        return sizeof(OMX_AUDIO_PARAM_SBCTYPE);
+    case OMX_IndexParamAudioVorbis:
+        return sizeof(OMX_AUDIO_PARAM_VORBISTYPE);
+    case OMX_IndexParamAudioWma:
+        return sizeof(OMX_AUDIO_PARAM_WMATYPE);
+    case OMX_IndexParamAudioRa:
+        return sizeof(OMX_AUDIO_PARAM_RATYPE);
+    case OMX_IndexParamVideoPortFormat:
+        return sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE);
+    case OMX_IndexParamVideoBitrate:
+        return sizeof(OMX_VIDEO_PARAM_BITRATETYPE);
+    case OMX_IndexParamVideoH263:
+        return sizeof(OMX_VIDEO_PARAM_H263TYPE);
+    case OMX_IndexParamVideoMpeg4:
+        return sizeof(OMX_VIDEO_PARAM_MPEG4TYPE);
+    case OMX_IndexParamVideoAvc:
+        return sizeof(OMX_VIDEO_PARAM_AVCTYPE);
+    default:
+        return 0;
+    }
+}
+
+static int get_config_size(OMX_INDEXTYPE param_index)
+{
+    switch (param_index) {
+    case OMX_IndexConfigCommonOutputCrop:
+        return sizeof(OMX_CONFIG_RECTTYPE);
+    default:
+        /* Dynamically queried config indices could have any size, but
+         * are currently only used with OMX_BOOL. */
+        return sizeof(OMX_BOOL);
+    }
+}
+
+static OMX_ERRORTYPE iomx_send_command(OMX_HANDLETYPE component, OMX_COMMANDTYPE command, OMX_U32 param1, OMX_PTR)
+{
+  android_printf("iomx_send_command\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    return get_error(ctx->iomx->sendCommand(node->node, command, param1));
+}
+
+static OMX_ERRORTYPE iomx_get_parameter(OMX_HANDLETYPE component, OMX_INDEXTYPE param_index, OMX_PTR param)
+{
+  android_printf("iomx_get_parameter\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    return get_error(ctx->iomx->getParameter(node->node, param_index, param, get_param_size(param_index)));
+}
+
+static OMX_ERRORTYPE iomx_set_parameter(OMX_HANDLETYPE component, OMX_INDEXTYPE param_index, OMX_PTR param)
+{
+  android_printf("iomx_set_parameter\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    return get_error(ctx->iomx->setParameter(node->node, param_index, param, get_param_size(param_index)));
+}
+
+static OMX_ERRORTYPE iomx_get_state(OMX_HANDLETYPE component, OMX_STATETYPE *ptr)
+{
+  android_printf("iomx_get_state\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    *ptr = node->state;
+    return OMX_ErrorNone;
+}
+
+static OMX_ERRORTYPE iomx_allocate_buffer(OMX_HANDLETYPE component, OMX_BUFFERHEADERTYPE **bufferptr, OMX_U32 port_index, OMX_PTR app_private, OMX_U32 size)
+{
+  android_printf("iomx_allocate_buffer\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    OMXBuffer* info = new OMXBuffer;
+    info->dealer = new MemoryDealer(size + 4096); // Do we need to keep this around, or is it kept alive via the IMemory that references it?
+    sp<IMemory> mem = info->dealer->allocate(size);
+    int ret = ctx->iomx->allocateBufferWithBackup(node->node, port_index, mem, &info->id);
+    if (ret != OK)
+        return OMX_ErrorUndefined;
+    OMX_BUFFERHEADERTYPE *buffer = (OMX_BUFFERHEADERTYPE*) calloc(1, sizeof(OMX_BUFFERHEADERTYPE));
+    *bufferptr = buffer;
+    buffer->pPlatformPrivate = info;
+    buffer->pAppPrivate = app_private;
+    buffer->nAllocLen = size;
+    buffer->pBuffer = (OMX_U8*) mem->pointer();
+    node->buffers.push_back(buffer);
+    return OMX_ErrorNone;
+}
+
+static OMX_ERRORTYPE iomx_free_buffer(OMX_HANDLETYPE component, OMX_U32 port, OMX_BUFFERHEADERTYPE *buffer)
+{
+  android_printf("iomx_free_buffer\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    OMXBuffer* info = (OMXBuffer*) buffer->pPlatformPrivate;
+    status_t ret = ctx->iomx->freeBuffer(node->node, port, info->id);
+    for( List<OMX_BUFFERHEADERTYPE*>::iterator it = node->buffers.begin(); it != node->buffers.end(); it++ ) {
+        if (buffer == *it) {
+            node->buffers.erase(it);
+            break;
+        }
+    }
+    free(buffer);
+    delete info;
+    return get_error(ret);
+}
+
+static OMX_ERRORTYPE iomx_empty_this_buffer(OMX_HANDLETYPE component, OMX_BUFFERHEADERTYPE *buffer)
+{
+  android_printf("iomx_empty_this_buffer\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    OMXBuffer* info = (OMXBuffer*) buffer->pPlatformPrivate;
+    return get_error(ctx->iomx->emptyBuffer(node->node, info->id, buffer->nOffset, buffer->nFilledLen, buffer->nFlags, buffer->nTimeStamp));
+}
+
+static OMX_ERRORTYPE iomx_fill_this_buffer(OMX_HANDLETYPE component, OMX_BUFFERHEADERTYPE *buffer)
+{
+  android_printf("iomx_fill_this_buffer\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    OMXBuffer* info = (OMXBuffer*) buffer->pPlatformPrivate;
+    return get_error(ctx->iomx->fillBuffer(node->node, info->id));
+}
+
+static OMX_ERRORTYPE iomx_component_role_enum(OMX_HANDLETYPE component, OMX_U8 *role, OMX_U32 index)
+{
+  android_printf("iomx_component_role_enum\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    for( List<IOMX::ComponentInfo>::iterator it = ctx->components.begin(); it != ctx->components.end(); it++ ) {
+        if (node->component_name == it->mName) {
+            if (index >= it->mRoles.size())
+                return OMX_ErrorNoMore;
+            List<String8>::iterator it2 = it->mRoles.begin();
+            for( OMX_U32 i = 0; it2 != it->mRoles.end() && i < index; i++, it2++ ) ;
+            strncpy((char*)role, it2->string(), OMX_MAX_STRINGNAME_SIZE);
+            if (it2->length() >= OMX_MAX_STRINGNAME_SIZE)
+                role[OMX_MAX_STRINGNAME_SIZE - 1] = '\0';
+            return OMX_ErrorNone;
+        }
+    }
+    return OMX_ErrorInvalidComponentName;
+}
+
+static OMX_ERRORTYPE iomx_get_extension_index(OMX_HANDLETYPE component, OMX_STRING parameter, OMX_INDEXTYPE *index)
+{
+  android_printf("iomx_get_extension_index\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    return get_error(ctx->iomx->getExtensionIndex(node->node, parameter, index));
+}
+
+static OMX_ERRORTYPE iomx_set_config(OMX_HANDLETYPE component, OMX_INDEXTYPE index, OMX_PTR param)
+{
+  android_printf("iomx_set_config\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    return get_error(ctx->iomx->setConfig(node->node, index, param, get_config_size(index)));
+}
+
+static OMX_ERRORTYPE iomx_get_config(OMX_HANDLETYPE component, OMX_INDEXTYPE index, OMX_PTR param)
+{
+  android_printf("iomx_get_config\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    return get_error(ctx->iomx->getConfig(node->node, index, param, get_config_size(index)));
+}
+
+extern "C" {
+OMX_ERRORTYPE PREFIX(OMX_GetHandle)(OMX_HANDLETYPE *handle_ptr, OMX_STRING component_name, OMX_PTR app_data, OMX_CALLBACKTYPE *callbacks)
+{
+  android_printf("OMX_GetHandle\n");
+    OMXNode* node = new OMXNode();
+    node->app_data = app_data;
+    node->callbacks = *callbacks;
+    node->observer = new OMXCodecObserver();
+    node->observer->setNode(node);
+    node->state = OMX_StateLoaded;
+    node->component_name = component_name;
+
+    OMX_COMPONENTTYPE* component = (OMX_COMPONENTTYPE*) malloc(sizeof(OMX_COMPONENTTYPE));
+    memset(component, 0, sizeof(OMX_COMPONENTTYPE));
+    component->nSize = sizeof(OMX_COMPONENTTYPE);
+    component->nVersion.s.nVersionMajor = 1;
+    component->nVersion.s.nVersionMinor = 0;
+    component->nVersion.s.nRevision = 0;
+    component->nVersion.s.nStep = 0;
+    component->pComponentPrivate = node;
+    component->SendCommand = iomx_send_command;
+    component->GetParameter = iomx_get_parameter;
+    component->SetParameter = iomx_set_parameter;
+    component->FreeBuffer = iomx_free_buffer;
+    component->EmptyThisBuffer = iomx_empty_this_buffer;
+    component->FillThisBuffer = iomx_fill_this_buffer;
+    component->GetState = iomx_get_state;
+    component->AllocateBuffer = iomx_allocate_buffer;
+    component->ComponentRoleEnum = iomx_component_role_enum;
+    component->GetExtensionIndex = iomx_get_extension_index;
+    component->SetConfig = iomx_set_config;
+    component->GetConfig = iomx_get_config;
+
+    *handle_ptr = component;
+    node->handle = component;
+    status_t ret;
+    if ((ret = ctx->iomx->allocateNode( component_name, node->observer, &node->node )) != OK)
+        return OMX_ErrorUndefined;
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE PREFIX(OMX_FreeHandle)(OMX_HANDLETYPE handle)
+{
+  android_printf("OMX_FreeHandle\n");
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)handle)->pComponentPrivate;
+    ctx->iomx->freeNode( node->node );
+    node->observer->setNode(NULL);
+    delete node;
+    free(handle);
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE PREFIX(OMX_Init)(void)
+{
+  android_printf("OMX_Init\n");
+    OMXClient client;
+    if (client.connect() != OK)
+        return OMX_ErrorUndefined;
+
+    if (!ctx)
+        ctx = new IOMXContext();
+    ctx->iomx = client.interface();
+    ctx->iomx->listNodes(&ctx->components);
+
+    for (List<IOMX::ComponentInfo>::iterator it = ctx->components.begin(); it != ctx->components.end(); it++)
+    {
+      const IOMX::ComponentInfo &info = *it;
+      const char* componentName = info.mName.string();
+      for (List<String8>::const_iterator role_it = info.mRoles.begin(); role_it != info.mRoles.end(); role_it++)
+      {
+        const char* componentRole = (*role_it).string();
+        android_printf("componentName:%s,componentRole:%s\n", componentName, componentRole);
+      }
+    }
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE PREFIX(OMX_Deinit)(void)
+{
+  android_printf("OMX_Deinit\n");
+    ctx->iomx = NULL;
+    delete ctx;
+    ctx = NULL;
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE PREFIX(OMX_ComponentNameEnum)(OMX_STRING component_name, OMX_U32 name_length, OMX_U32 index)
+{
+  android_printf("OMX_ComponentNameEnum\n");
+   if (index >= ctx->components.size())
+        return OMX_ErrorNoMore;
+    List<IOMX::ComponentInfo>::iterator it = ctx->components.begin();
+    for( OMX_U32 i = 0; i < index; i++ )
+        it++;
+    strncpy(component_name, it->mName.string(), name_length);
+    component_name[name_length - 1] = '\0';
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE PREFIX(OMX_GetRolesOfComponent)(OMX_STRING component_name, OMX_U32 *num_roles, OMX_U8 **roles)
+{
+  android_printf("OMX_GetRolesOfComponent\n");
+    for( List<IOMX::ComponentInfo>::iterator it = ctx->components.begin(); it != ctx->components.end(); it++ ) {
+        if (!strcmp(component_name, it->mName.string())) {
+            if (!roles) {
+                *num_roles = it->mRoles.size();
+                return OMX_ErrorNone;
+            }
+            if (*num_roles < it->mRoles.size())
+                return OMX_ErrorInsufficientResources;
+            *num_roles = it->mRoles.size();
+            OMX_U32 i = 0;
+            for( List<String8>::iterator it2 = it->mRoles.begin(); it2 != it->mRoles.end(); i++, it2++ ) {
+                strncpy((char*)roles[i], it2->string(), OMX_MAX_STRINGNAME_SIZE);
+                roles[i][OMX_MAX_STRINGNAME_SIZE - 1] = '\0';
+            }
+            return OMX_ErrorNone;
+        }
+    }
+    return OMX_ErrorInvalidComponentName;
+}
+
+OMX_ERRORTYPE PREFIX(OMX_GetComponentsOfRole)(OMX_STRING role, OMX_U32 *num_comps, OMX_U8 **comp_names)
+{
+  android_printf("OMX_GetComponentsOfRole\n");
+    OMX_U32 i = 0;
+    for( List<IOMX::ComponentInfo>::iterator it = ctx->components.begin(); it != ctx->components.end(); it++ ) {
+        for( List<String8>::iterator it2 = it->mRoles.begin(); it2 != it->mRoles.end(); it2++ ) {
+            if (!strcmp(it2->string(), role)) {
+                if (comp_names) {
+                    if (*num_comps < i)
+                        return OMX_ErrorInsufficientResources;
+                    strncpy((char*)comp_names[i], it->mName.string(), OMX_MAX_STRINGNAME_SIZE);
+                    comp_names[i][OMX_MAX_STRINGNAME_SIZE - 1] = '\0';
+                }
+                i++;
+                break;
+            }
+        }
+    }
+    *num_comps = i;
+    return OMX_ErrorNone;
+}
+}
+
diff --git a/tools/depends/target/boost/Makefile b/tools/depends/target/boost/Makefile
new file mode 100644 (file)
index 0000000..f79a6d7
--- /dev/null
@@ -0,0 +1,36 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include add-arm-mem-barrier.patch fix-deprecated-swp.patch Makefile
+
+#Headers Only!
+LIBNAME=boost
+VERSION=1_44_0
+SOURCE=$(LIBNAME)_$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       echo 'using gcc : : $(CC) : ' > $(PLATFORM)/tools/build/v2/user-config.jam
+       echo '  <cflags>"$(CFLAGS)"' >> $(PLATFORM)/tools/build/v2/user-config.jam
+       echo '  <cxxflags>"$(CXXFLAGS)"' >> $(PLATFORM)/tools/build/v2/user-config.jam
+       echo '  ;' >> $(PLATFORM)/tools/build/v2/user-config.jam
+       cd $(PLATFORM); patch -p1 < ../add-arm-mem-barrier.patch
+       cd $(PLATFORM); patch -p1 < ../fix-deprecated-swp.patch
+       cd $(PLATFORM); ./bootstrap.sh --prefix=$(PREFIX)
+
+.installed-$(PLATFORM): $(PLATFORM)
+       cd $(PLATFORM); ./bjam --prefix=$(PREFIX) toolset=gcc --toolset-root=$(TOOLCHAIN)/$(HOST)/bin --disable-icu \
+       --without-date_time --without-filesystem --without-graph --without-graph_parallel --without-iostreams --without-math --without-mpi --without-program_options \
+--without-python --without-random --without-regex --without-serialization --without-signals --without-system --without-test --without-thread --without-wave install 
+       touch .installed-$(PLATFORM)
+
+clean:
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/boost/add-arm-mem-barrier.patch b/tools/depends/target/boost/add-arm-mem-barrier.patch
new file mode 100644 (file)
index 0000000..86f8985
--- /dev/null
@@ -0,0 +1,73 @@
+From c87ad09331d239d6566e5eb409898ae38f04799a Mon Sep 17 00:00:00 2001
+From: Peter Dimov <pdimov@boostpro.com>
+Date: Mon, 7 Nov 2011 17:50:31 +0000
+Subject: [PATCH] Add ARM memory barriers. Refs #5372.
+
+SVN-Revision: 75389
+---
+ boost/smart_ptr/detail/spinlock_gcc_arm.hpp |   23 ++++++++++++++++++++---
+ 1 file changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
+index ba6c511..f58ea44 100644
+--- a/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
++++ b/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
+@@ -2,7 +2,7 @@
+ #define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
+ //
+-//  Copyright (c) 2008 Peter Dimov
++//  Copyright (c) 2008, 2011 Peter Dimov
+ //
+ //  Distributed under the Boost Software License, Version 1.0.
+ //  See accompanying file LICENSE_1_0.txt or copy at
+@@ -11,6 +11,20 @@
+ #include <boost/smart_ptr/detail/yield_k.hpp>
++#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
++
++# define BOOST_SP_ARM_BARRIER "dmb"
++
++#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__)
++
++# define BOOST_SP_ARM_BARRIER "mcr p15, 0, r0, c7, c10, 5"
++
++#else
++
++# define BOOST_SP_ARM_BARRIER ""
++
++#endif
++
+ namespace boost
+ {
+@@ -30,7 +44,8 @@ class spinlock
+         int r;
+         __asm__ __volatile__(
+-            "swp %0, %1, [%2]":
++            "swp %0, %1, [%2]\n\t"
++                      BOOST_SP_ARM_BARRIER :
+             "=&r"( r ): // outputs
+             "r"( 1 ), "r"( &v_ ): // inputs
+             "memory", "cc" );
+@@ -48,7 +63,7 @@ class spinlock
+     void unlock()
+     {
+-        __asm__ __volatile__( "" ::: "memory" );
++        __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" );
+         *const_cast< int volatile* >( &v_ ) = 0;
+     }
+@@ -82,4 +97,6 @@ class spinlock
+ #define BOOST_DETAIL_SPINLOCK_INIT {0}
++#undef BOOST_SP_ARM_BARRIER
++
+ #endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
+-- 
+1.7.10
+
diff --git a/tools/depends/target/boost/fix-deprecated-swp.patch b/tools/depends/target/boost/fix-deprecated-swp.patch
new file mode 100644 (file)
index 0000000..de5888d
--- /dev/null
@@ -0,0 +1,58 @@
+From 8d1ba081260f98d879759433a9d7248d6bd98966 Mon Sep 17 00:00:00 2001
+From: Peter Dimov <pdimov@boostpro.com>
+Date: Mon, 12 Mar 2012 17:31:21 +0000
+Subject: [PATCH] Apply patch from #5331. Refs #5331.
+
+SVN-Revision: 77315
+---
+ boost/smart_ptr/detail/spinlock_gcc_arm.hpp |   29 +++++++++++++++++++++++++--
+ 1 file changed, 27 insertions(+), 2 deletions(-)
+
+diff --git a/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
+index f58ea44..f1bbaf6 100644
+--- a/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
++++ b/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
+@@ -43,13 +43,38 @@ class spinlock
+     {
+         int r;
++#if defined(__ARM_ARCH_6__) \
++    || defined(__ARM_ARCH_6J__) \
++    || defined(__ARM_ARCH_6K__) \
++    || defined(__ARM_ARCH_6Z__) \
++    || defined(__ARM_ARCH_6ZK__) \
++    || defined(__ARM_ARCH_6T2__) \
++    || defined(__ARM_ARCH_7__) \
++    || defined(__ARM_ARCH_7A__) \
++    || defined(__ARM_ARCH_7R__) \
++    || defined(__ARM_ARCH_7M__) \
++    || defined(__ARM_ARCH_7EM__)
++
++        __asm__ __volatile__(
++            "ldrex %0, [%2]; \n"
++            "cmp %0, %1; \n"
++            "strexne %0, %1, [%2]; \n"
++            BOOST_SP_ARM_BARRIER :
++            "=&r"( r ): // outputs
++            "r"( 1 ), "r"( &v_ ): // inputs
++            "memory", "cc" );
++
++#else
++
+         __asm__ __volatile__(
+-            "swp %0, %1, [%2]\n\t"
+-                      BOOST_SP_ARM_BARRIER :
++            "swp %0, %1, [%2];\n"
++            BOOST_SP_ARM_BARRIER :
+             "=&r"( r ): // outputs
+             "r"( 1 ), "r"( &v_ ): // inputs
+             "memory", "cc" );
++#endif
++
+         return r == 0;
+     }
+-- 
+1.7.10
+
diff --git a/tools/depends/target/bzip2/Makefile b/tools/depends/target/bzip2/Makefile
new file mode 100644 (file)
index 0000000..8085ef9
--- /dev/null
@@ -0,0 +1,40 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile Makefile.patch
+
+# lib name, version
+LIBNAME=bzip2
+VERSION=1.0.6
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --disable-shared
+
+LIBDYLIB=$(PLATFORM)/libbz2.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p1 <../Makefile.patch
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM) PREFIX=$(PREFIX) CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" AR="$(AR)"
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install PREFIX=$(PREFIX)
+       rm $(PREFIX)/bin/bzip2
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/bzip2/Makefile.patch b/tools/depends/target/bzip2/Makefile.patch
new file mode 100644 (file)
index 0000000..40dc70a
--- /dev/null
@@ -0,0 +1,34 @@
+--- Makefile   2008-02-14 14:39:18.000000000 +0200
++++ ../Makefile        2009-08-30 15:59:16.000000000 +0300
+@@ -15,16 +15,16 @@
+ SHELL=/bin/sh
+ # To assist in cross-compiling
+-CC=gcc
+-AR=ar
+-RANLIB=ranlib
+-LDFLAGS=
++#CC=gcc
++#AR=ar
++#RANLIB=ranlib
++#LDFLAGS=
+ BIGFILES=-D_FILE_OFFSET_BITS=64
+-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
++#CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
+ # Where you want it installed when you do 'make install'
+-PREFIX=/usr/local
++#PREFIX=/usr/local
+ OBJS= blocksort.o  \
+@@ -35,7 +35,7 @@
+       decompress.o \
+       bzlib.o
+-all: libbz2.a bzip2 bzip2recover test
++all: libbz2.a bzip2 bzip2recover 
+ bzip2: libbz2.a bzip2.o
+       $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2
diff --git a/tools/depends/target/config.site.in b/tools/depends/target/config.site.in
new file mode 100644 (file)
index 0000000..ad295c1
--- /dev/null
@@ -0,0 +1,161 @@
+if test "@cross_compiling@" = "yes"; then
+cross_compiling=yes
+host=@use_host@
+host_alias=@use_host@
+fi
+
+LD="@LD@"
+CC="@CC@"
+CXX="@CXX@"
+CPP="@CPP@"
+AR="@AR@"
+AS="@AS@"
+NM="@NM@"
+STRIP="@STRIP@"
+RANLIB="@RANLIB@"
+OBJDUMP="@OBJDUMP@"
+
+if test "@platform_os@" = "ios" ; then
+  export AS="@prefix@/@build_cpu@-@build_os@-native/bin/gas-preprocessor.pl @CC@"
+  export CCAS="--tag CC @prefix@/@build_cpu@-@build_os@-native/bin/gas-preprocessor.pl @CC@"
+fi
+
+CFLAGS="@platform_cflags@ @platform_includes@ -I@prefix@/@deps_dir@/include $CFLAGS"
+LDFLAGS="-L@prefix@/@deps_dir@/lib @platform_ldflags@ $LDFLAGS"
+CXXFLAGS="@platform_cxxflags@ @platform_includes@ -I@prefix@/@deps_dir@/include $CXXFLAGS"
+CPPFLAGS="@platform_cflags@ @platform_includes@ -I@prefix@/@deps_dir@/include $CPPFLAGS"
+
+export PKG_CONFIG=@prefix@/@build_cpu@-@build_os@-native/bin/pkg-config
+export PKG_CONFIG_PATH=@prefix@/@deps_dir@/lib/pkgconfig
+export YASM=@prefix@/@build_cpu@-@build_os@-native/bin/yasm
+export NASM=@prefix@/@build_cpu@-@build_os@-native/bin/yasm
+export MYSQL_CONFIG=@prefix@/@deps_dir@/bin/mysql_config
+
+PATH=@prefix@/@build_cpu@-@build_os@-native/bin:@use_toolchain@/usr/bin:@use_toolchain@/bin:$PATH
+LD_LIBRARY_PATH=@prefix@/@build_cpu@-@build_os@-native/lib:$LD_LIBRARY_PATH
+
+PYTHON_VERSION=2.6
+PYTHON_LDFLAGS="-L@prefix@/@deps_dir@/lib -lpython${PYTHON_VERSION} -lc -ldl -lm -lexpat -lffi -lintl -lutil -lssl -lcrypto"
+PYTHON_CPPFLAGS=-I@prefix@/@deps_dir@/include/python${PYTHON_VERSION}
+PYTHON_SITE_PKG=@prefix@/@deps_dir@/lib/python${PYTHON_VERSION}/site-packages
+PYTHON_NOVERSIONCHECK=no-check
+USE_TEXTUREPACKER_NATIVE_ROOT=@prefix@/@build_cpu@-@build_os@-native
+
+#afps-ng and libomxil-bellagio
+ac_cv_func_malloc_0_nonnull=yes
+
+#curl
+ac_cv_file__dev_urandom=yes
+ac_cv_lib_ssl_SSL_connect=yes
+
+#gettext and libiconv
+gl_cv_header_working_stdint_h=yes
+
+#libcec
+ac_cv_search_dlopen=-ldl
+
+#libgcrypt
+ac_cv_path_GPG_ERROR_CONFIG=@prefix@/@deps_dir@/bin/gpg-error-config
+ac_cv_sys_symbol_underscore=no
+
+#python
+ac_cv_func_gethostbyname_r=no
+ac_cv_header_sys_un_h=yes
+
+#rsxs/projectm
+jm_cv_func_gettimeofday_clobber=no
+mac_cv_pkg_ldflags=-lz
+if test "@platform_os@" = "osx"; then
+  ac_cv_func_strnlen_working=no
+fi
+
+#samba
+SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=yes
+samba_cv_CC_NEGATIVE_ENUM_VALUES=yes
+libreplace_cv_HAVE_C99_VSNPRINTF=yes
+samba_cv_HAVE_C99_VSNPRINTF=yes
+ac_cv_header_standards_h=no
+
+ac_cv_file__proc_sys_kernel_core_pattern=no
+samba_cv_SYSCONF_SC_NPROCESSORS_ONLN=no
+libreplace_cv_HAVE_GETADDRINFO=no
+
+if test "${PACKAGE_NAME}" = "Samba" -a "@platform_os@" = "ios"; then
+  # disable python support
+  export PYTHON_VER=0.0
+  # ios/osx-10.6 issue with collision of _MD5 exported from a system lib
+  export LDFLAGS="${LDFLAGS} -Wl,-unexported_symbol,_MD5* -lc"
+fi
+
+if test "${PACKAGE_NAME}" = "Samba" -a "@platform_os@" = "osx"; then
+  # disable python support
+  export PYTHON_VER=0.0
+  # ios/osx-10.6 issue with collision of _MD5 exported from a system lib
+  export LDFLAGS="${LDFLAGS} -Wl,-unexported_symbol,_MD5* -lc"
+  # uses OPT instead of CFLAGS
+  export OPT="${CFLAGS}"
+  # various configure overrides
+  ac_cv_header_libunwind_h=no
+  ac_cv_header_execinfo_h=no
+  # fixes crash on 10.6 if xbmc is built using 10.7 SDK with 10.6 min
+  ac_cv_func_vdprintf=no
+fi
+
+if test "@platform_os@" = "android"; then
+  #samba
+  SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=yes
+  libreplace_cv_READDIR_GETDIRENTRIES=no
+  libreplace_cv_READDIR_GETDENTS=no
+  samba_cv_REPLACE_READDIR=no
+  samba_cv_HAVE_WRFILE_KEYTAB=yes
+  samba_cv_HAVE_GETTIMEOFDAY_TZ=yes
+  samba_cv_USE_SETREUID=yes
+  samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes
+  samba_cv_HAVE_IFACE_IFCONF=yes
+  samba_cv_HAVE_MMAP=yes
+  samba_cv_HAVE_FCNTL_LOCK=yes
+  samba_cv_HAVE_SECURE_MKSTEMP=yes
+  samba_cv_CC_NEGATIVE_ENUM_VALUES=yes
+  samba_cv_fpie=no
+  samba_cv_have_longlong=yes
+  samba_cv_HAVE_OFF64_T=yes
+  samba_cv_HAVE_UT_UT_TYPE=no
+  ac_cv_func_srand=yes
+  ac_cv_func_rand=yes
+
+  #python: android doesn't have libutil
+  PYTHON_LDFLAGS="-L@prefix@/@deps_dir@/lib -lpython${PYTHON_VERSION} -lc -ldl -lm -lexpat -lffi -lintl -lssl -lcrypto"
+
+fi
+
+if test "@platform_os@" = "ios"; then
+  # tweaks for libffi (ios must use llvm-gcc-4.2)
+  if test "${PACKAGE_NAME}" = "libffi" ; then
+    export CC="@use_toolchain@/usr/bin/llvm-gcc-4.2"
+    export CPP="@use_toolchain@/usr/bin/llvm-gcc-4.2 -E"
+    unset AS
+    unset CCAS
+  fi
+
+  # tweaks for flac
+  if test "${ac_unique_file}" = "src/flac/main.c" ; then
+    # compiler barfs if we use -O3/O2 for flac
+    export CFLAGS=`echo ${CFLAGS} | sed 's/-O3/-Os/'`
+    export CPPFLAGS=`echo ${CPPFLAGS} | sed 's/-O3/-Os/'`
+  fi
+
+  # tweaks for libmpeg2
+  if test "${PACKAGE_NAME}" = "libmpeg2" ; then
+    export LDFLAGS="${LDFLAGS} -Wl,-read_only_relocs,suppress"
+  fi
+fi
+
+# These libs do not correctly export their symbols. Force them in case
+# -fvisibility=hidden is set.
+if test "${ac_unique_file}" = "src/flac/main.c" || \
+   test "${ac_unique_file}" = "src/framing.c" || \
+   test "${ac_unique_file}" = "src/libdvdcss.c" || \
+   test "${PACKAGE_NAME}" = "libmpeg2" || \
+   test "${PACKAGE_NAME}" = "libssh2" ; then
+     CFLAGS="$CFLAGS -fvisibility=default"
+fi
diff --git a/tools/depends/target/curl/Makefile b/tools/depends/target/curl/Makefile
new file mode 100644 (file)
index 0000000..24ad392
--- /dev/null
@@ -0,0 +1,47 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=curl
+VERSION=7.21.6
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --without-libssh2 \
+
+LIBDYLIB=$(PLATFORM)/lib/.libs/lib$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/lib
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/lib install
+       $(MAKE) -C $(PLATFORM)/include install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libcurl.la $(PREFIX)/lib/libcurl.so $(PREFIX)/lib/libcurl.so.5
+       mv -f $(PREFIX)/lib/libcurl.so.5.2.0 $(PREFIX)/lib/libcurl.so
+       $(RPL) -e "libcurl.so.5" "libcurl.so\x00\x00" $(PREFIX)/lib/libcurl.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libcurl.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/dbus/Makefile b/tools/depends/target/dbus/Makefile
new file mode 100644 (file)
index 0000000..24ba323
--- /dev/null
@@ -0,0 +1,40 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=dbus
+VERSION=1.4.6
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) \
+  --without-x --disable-xml-docs --disable-doxygen-docs
+
+LIBDYLIB=$(PLATFORM)/$(LIBNAME)/.libs/$(LIBNAME).so
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: $(LIBDYLIB) .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/dummy-libxbmc/Makefile b/tools/depends/target/dummy-libxbmc/Makefile
new file mode 100644 (file)
index 0000000..203dfa1
--- /dev/null
@@ -0,0 +1,24 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile dummy-libxbmc.c
+
+LIBDYLIB=libxbmc.so
+
+all: $(PLATFORM)/$(LIBDYLIB) .installed-$(PLATFORM)
+
+$(PLATFORM):
+       mkdir -p $(PLATFORM)
+
+$(PLATFORM)/$(LIBDYLIB): $(PLATFORM) $(DEPS)
+       $(CC) -shared -o $(PLATFORM)/libxbmc.so dummy-libxbmc.c
+
+.installed-$(PLATFORM): $(PLATFORM)/$(LIBDYLIB)
+       mkdir -p  $(PREFIX)/lib/dummy-libxbmc
+       cp $(PLATFORM)/libxbmc.so $(PREFIX)/lib/dummy-libxbmc
+       touch $@
+
+clean:
+       rm -rf $(PLATFORM)
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/dummy-libxbmc/dummy-libxbmc.c b/tools/depends/target/dummy-libxbmc/dummy-libxbmc.c
new file mode 100644 (file)
index 0000000..2d72d2b
--- /dev/null
@@ -0,0 +1,4 @@
+void xbmc_dummy_function()
+{
+  return;
+}
diff --git a/tools/depends/target/expat/Makefile b/tools/depends/target/expat/Makefile
new file mode 100644 (file)
index 0000000..de6c72e
--- /dev/null
@@ -0,0 +1,40 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=expat
+VERSION=2.0.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) ./conftools; ./configure --prefix=$(PREFIX) --disable-shared
+
+LIBDYLIB=$(PLATFORM)/.libs/lib$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/fontconfig/01-fontconfig-cross-compile-fix.patch b/tools/depends/target/fontconfig/01-fontconfig-cross-compile-fix.patch
new file mode 100644 (file)
index 0000000..334cbba
--- /dev/null
@@ -0,0 +1,80 @@
+diff -Naur fontconfig-2.6.0.orig/doc/Makefile.am fontconfig-2.6.0/doc/Makefile.am
+--- fontconfig-2.6.0.orig/doc/Makefile.am      2007-11-06 01:05:37.000000000 +0100
++++ fontconfig-2.6.0/doc/Makefile.am   2010-05-22 00:03:00.000000000 +0200
+@@ -21,9 +21,10 @@
+ # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ # PERFORMANCE OF THIS SOFTWARE.
+-CC = @CC_FOR_BUILD@
+ EXEEXT = @EXEEXT_FOR_BUILD@
+-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++COMPILE = $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
++                    $(CPPFLAGS_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD)
++LINK = $(CC_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD) -o $@
+ DOC_SRC = $(srcdir)
+ DOC_MODULE = fontconfig
+diff -Naur fontconfig-2.6.0.orig/fc-arch/Makefile.am fontconfig-2.6.0/fc-arch/Makefile.am
+--- fontconfig-2.6.0.orig/fc-arch/Makefile.am  2008-01-02 17:44:39.000000000 +0100
++++ fontconfig-2.6.0/fc-arch/Makefile.am       2010-05-21 23:59:18.000000000 +0200
+@@ -22,9 +22,10 @@
+ # PERFORMANCE OF THIS SOFTWARE.
+ #
+-CC = @CC_FOR_BUILD@
+ EXEEXT = @EXEEXT_FOR_BUILD@
+-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++COMPILE = $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
++      $(CPPFLAGS_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD)
++LINK = $(CC_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD) -o $@
+ INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
+diff -Naur fontconfig-2.6.0.orig/fc-case/Makefile.am fontconfig-2.6.0/fc-case/Makefile.am
+--- fontconfig-2.6.0.orig/fc-case/Makefile.am  2010-05-21 23:55:02.000000000 +0200
++++ fontconfig-2.6.0/fc-case/Makefile.am       2010-05-22 00:04:09.000000000 +0200
+@@ -22,9 +22,10 @@
+ # PERFORMANCE OF THIS SOFTWARE.
+ #
+-CC = @CC_FOR_BUILD@
+ EXEEXT = @EXEEXT_FOR_BUILD@
+-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++COMPILE = $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
++                    $(CPPFLAGS_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD)
++LINK = $(CC_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD) -o $@
+ INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
+diff -Naur fontconfig-2.6.0.orig/fc-glyphname/Makefile.am fontconfig-2.6.0/fc-glyphname/Makefile.am
+--- fontconfig-2.6.0.orig/fc-glyphname/Makefile.am     2008-01-02 17:44:39.000000000 +0100
++++ fontconfig-2.6.0/fc-glyphname/Makefile.am  2010-05-22 00:04:54.000000000 +0200
+@@ -22,9 +22,10 @@
+ # PERFORMANCE OF THIS SOFTWARE.
+ #
+-CC = @CC_FOR_BUILD@
+ EXEEXT = @EXEEXT_FOR_BUILD@
+-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++COMPILE = $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
++                    $(CPPFLAGS_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD)
++LINK = $(CC_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD) -o $@
+ INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
+diff -Naur fontconfig-2.6.0.orig/fc-lang/Makefile.am fontconfig-2.6.0/fc-lang/Makefile.am
+--- fontconfig-2.6.0.orig/fc-lang/Makefile.am  2008-01-02 17:44:39.000000000 +0100
++++ fontconfig-2.6.0/fc-lang/Makefile.am       2010-05-22 00:05:44.000000000 +0200
+@@ -22,9 +22,10 @@
+ # PERFORMANCE OF THIS SOFTWARE.
+ #
+-CC = @CC_FOR_BUILD@
+ EXEEXT = @EXEEXT_FOR_BUILD@
+-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++COMPILE = $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
++                    $(CPPFLAGS_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD)
++LINK = $(CC_FOR_BUILD) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD) -o $@
+ INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
diff --git a/tools/depends/target/fontconfig/Makefile b/tools/depends/target/fontconfig/Makefile
new file mode 100644 (file)
index 0000000..9dea160
--- /dev/null
@@ -0,0 +1,45 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include 01-fontconfig-cross-compile-fix.patch lconv.patch Makefile
+
+# lib name, version
+LIBNAME=fontconfig
+VERSION=2.8.0
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) \
+  --with-freetype-config=$(PREFIX)/bin/freetype-config \
+  --disable-libxml2 --disable-docs --with-arch=$(PLATFORM) --disable-shared
+
+LIBDYLIB=$(PLATFORM)/src/.libs/lib$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p1 < ../01-fontconfig-cross-compile-fix.patch
+       cd $(PLATFORM); patch -p1 < ../lconv.patch 
+       cd $(PLATFORM); $(AUTORECONF) -vif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/fontconfig/lconv.patch b/tools/depends/target/fontconfig/lconv.patch
new file mode 100644 (file)
index 0000000..c760d7f
--- /dev/null
@@ -0,0 +1,18 @@
+--- fontconfig-2.6.0.old/src/fcxml.c    2011-10-15 16:16:43.809967115 -0400
++++ fontconfig-2.6.0/src/fcxml.c        2011-10-15 16:18:39.059967042 -0400
+@@ -1139,6 +1139,7 @@
+ static double
+ FcStrtod (char *s, char **end)
+ {
++#if 0
+     struct lconv    *locale_data;
+     char           *dot;
+     double         v;
+@@ -1185,6 +1186,7 @@
+     else
+        v = strtod (s, end);
+     return v;
++#endif
+ }
+
+ static void
\ No newline at end of file
diff --git a/tools/depends/target/freetype2/Makefile b/tools/depends/target/freetype2/Makefile
new file mode 100644 (file)
index 0000000..d83b9a0
--- /dev/null
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=freetype
+VERSION=2.4.7
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+# configuration settings
+# force using internal libtool
+export LIBTOOL=builds/unix/libtool
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) builds/unix; \
+          ./configure --prefix=$(PREFIX) --disable-shared
+
+LIBDYLIB=$(PLATFORM)/objs/.libs/lib$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/fribidi/Makefile b/tools/depends/target/fribidi/Makefile
new file mode 100644 (file)
index 0000000..01049b0
--- /dev/null
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=fribidi
+VERSION=0.19.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+export CFLAGS+=-D__STDC_INT64__
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-docs --enable-malloc \
+          --disable-shared --with-glib=no
+
+LIBDYLIB=$(PLATFORM)/lib/.libs/lib$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+       touch $@
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/gettext/Makefile b/tools/depends/target/gettext/Makefile
new file mode 100644 (file)
index 0000000..85ca94d
--- /dev/null
@@ -0,0 +1,48 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=gettext
+VERSION=0.18.2
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) build-aux/; \
+    ./configure --prefix=$(PREFIX) \
+    --disable-csharp --disable-native-java --disable-java --without-emacs \
+    --disable-libasprintf --disable-openmp \
+    --with-included-gettext \
+    --with-included-glib \
+    --with-included-libcroco \
+    --with-included-libxml \
+    --without-git --without-cvs --disable-shared --disable-curses \
+
+LIBDYLIB=$(PLATFORM)/gettext-runtime/intl/.libs/libintl.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/gettext-runtime
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/gettext-runtime install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/jasper/Makefile b/tools/depends/target/jasper/Makefile
new file mode 100644 (file)
index 0000000..15d3025
--- /dev/null
@@ -0,0 +1,44 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=jasper
+VERSION=1.900.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).zip
+ARCHIVE_TOOL=unzip
+ARCHIVE_TOOL_FLAGS=
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) acaux/ ;\
+          ./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/src/lib$(LIBNAME)/.libs/lib$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       mv $(SOURCE)/* $(PLATFORM) && rm -rf $(SOURCE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/jpeg/Makefile b/tools/depends/target/jpeg/Makefile
new file mode 100644 (file)
index 0000000..5144f1d
--- /dev/null
@@ -0,0 +1,39 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=jpeg
+VERSION=8b
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(LIBNAME)src.v$(VERSION).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/.libs/lib$(LIBNAME).so
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: $(LIBDYLIB) .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libGLEW/Makefile b/tools/depends/target/libGLEW/Makefile
new file mode 100644 (file)
index 0000000..6ba67ed
--- /dev/null
@@ -0,0 +1,45 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=glew
+VERSION=1.7.0
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+SYSTEM=$(OS)
+ifeq ($(OS),osx)
+  SYSTEM=darwin
+endif
+export SYSTEM
+export GLEW_DEST=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+
+$(LIBDYLIB): $(PLATFORM)
+       sed -ie "s|CC = cc|CC = $(CC)|" "$(PLATFORM)/config/Makefile.$(SYSTEM)"
+       sed -ie "s|LD = cc|LD = $(CC)|" "$(PLATFORM)/config/Makefile.$(SYSTEM)"
+       sed -ie "s|CFLAGS.EXTRA =|CFLAGS.EXTRA = \$(CFLAGS)|" "$(PLATFORM)/config/Makefile.$(SYSTEM)"
+       sed -ie "s|LDFLAGS.EXTRA =|LDFLAGS.EXTRA = \$(LDFLAGS)|" "$(PLATFORM)/config/Makefile.$(SYSTEM)"
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libamplayer/Makefile b/tools/depends/target/libamplayer/Makefile
new file mode 100644 (file)
index 0000000..abcc81b
--- /dev/null
@@ -0,0 +1,14 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+all: .installed-$(PLATFORM)
+
+.installed-$(PLATFORM): $(DEPS)
+       mkdir -p $(PREFIX)/include/amlplayer
+       cp -rf libamplayer/include/* $(PREFIX)/include/amlplayer
+       touch $@
+
+clean:
+       rm -f .installed-$(PLATFORM)
+
+distclean:: clean
diff --git a/tools/depends/target/libamplayer/libamplayer/include/amports/aformat.h b/tools/depends/target/libamplayer/libamplayer/include/amports/aformat.h
new file mode 100644 (file)
index 0000000..25cb852
--- /dev/null
@@ -0,0 +1,89 @@
+/**
+* @file aformat.h
+* @brief  Porting from decoder driver for audio format
+* @author Tim Yao <timyao@amlogic.com>
+* @version 1.0.0
+* @date 2011-02-24
+*/
+/* Copyright (C) 2007-2011, Amlogic Inc.
+* All right reserved
+* 
+*/
+
+/*
+ * AMLOGIC Audio/Video streaming port driver.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the named License,
+ * or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Author:  Tim Yao <timyao@amlogic.com>
+ *
+ */
+
+#ifndef AFORMAT_H
+#define AFORMAT_H
+
+typedef enum {
+    AFORMAT_UNKNOWN = -1,
+    AFORMAT_MPEG   = 0,
+    AFORMAT_PCM_S16LE = 1,
+    AFORMAT_AAC   = 2,
+    AFORMAT_AC3   = 3,
+    AFORMAT_ALAW = 4,
+    AFORMAT_MULAW = 5,
+    AFORMAT_DTS = 6,
+    AFORMAT_PCM_S16BE = 7,
+    AFORMAT_FLAC = 8,
+    AFORMAT_COOK = 9,
+    AFORMAT_PCM_U8 = 10,
+    AFORMAT_ADPCM = 11,
+    AFORMAT_AMR  = 12,
+    AFORMAT_RAAC  = 13,
+    AFORMAT_WMA  = 14,
+    AFORMAT_WMAPRO   = 15,
+    AFORMAT_PCM_BLURAY  = 16,
+    AFORMAT_ALAC  = 17,
+    AFORMAT_VORBIS    = 18,
+    AFORMAT_AAC_LATM   = 19,
+    AFORMAT_APE   = 20,
+    AFORMAT_UNSUPPORT ,
+    AFORMAT_MAX    
+
+} aformat_t;
+
+#define AUDIO_EXTRA_DATA_SIZE   (4096)
+#define IS_AFMT_VALID(afmt)    ((afmt > AFORMAT_UNKNOWN) && (afmt < AFORMAT_MAX))
+    
+#define IS_AUIDO_NEED_EXT_INFO(afmt) ((afmt == AFORMAT_ADPCM) \
+                                                                ||(afmt == AFORMAT_WMA) \
+                                                                ||(afmt == AFORMAT_WMAPRO) \
+                                                                ||(afmt == AFORMAT_PCM_S16BE) \
+                                                                ||(afmt == AFORMAT_PCM_S16LE) \
+                                                                ||(afmt == AFORMAT_PCM_U8) \
+                                                                ||(afmt == AFORMAT_PCM_BLURAY) \
+                                                                ||(afmt == AFORMAT_AMR)\
+                                                                ||(afmt == AFORMAT_ALAC)\
+                                                                ||(afmt == AFORMAT_AC3) \
+                                                                ||(afmt == AFORMAT_APE) \
+                                                                ||(afmt == AFORMAT_FLAC) )
+
+
+#define IS_AUDIO_NOT_SUPPORT_EXCEED_2CH(afmt) ((afmt == AFORMAT_RAAC) \
+                                                                               ||(afmt == AFORMAT_COOK) \
+                                                                               ||(afmt == AFORMAT_FLAC))
+
+#define IS_AUIDO_NEED_PREFEED_HEADER(afmt) ((afmt == AFORMAT_VORBIS) )
+
+#endif /* AFORMAT_H */
+
diff --git a/tools/depends/target/libamplayer/libamplayer/include/amports/amstream.h b/tools/depends/target/libamplayer/libamplayer/include/amports/amstream.h
new file mode 100644 (file)
index 0000000..09f6a4a
--- /dev/null
@@ -0,0 +1,148 @@
+/**
+* @file amstream.h
+* @brief  Porting from decoder driver for codec ioctl commands
+* @author Tim Yao <timyao@amlogic.com>
+* @version 1.0.0
+* @date 2011-02-24
+*/
+/* Copyright (C) 2007-2011, Amlogic Inc.
+* All right reserved
+* 
+*/
+
+/*
+ * AMLOGIC Audio/Video streaming port driver.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the named License,
+ * or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Author:  Tim Yao <timyao@amlogic.com>
+ *
+ */
+
+#ifndef AMSTREAM_H
+#define AMSTREAM_H
+
+#define PORT_FLAG_IN_USE    0x0001
+#define PORT_FLAG_VFORMAT   0x0002
+#define PORT_FLAG_AFORMAT   0x0004
+#define PORT_FLAG_FORMAT    (PORT_FLAG_VFORMAT | PORT_FLAG_AFORMAT)
+#define PORT_FLAG_VID       0x0008
+#define PORT_FLAG_AID       0x0010
+#define PORT_FLAG_ID        (PORT_FLAG_VID | PORT_FLAG_AID)
+#define PORT_FLAG_INITED    0x100
+
+#define PORT_TYPE_VIDEO     0x01
+#define PORT_TYPE_AUDIO     0x02
+#define PORT_TYPE_MPTS      0x04
+#define PORT_TYPE_MPPS      0x08
+#define PORT_TYPE_ES        0x10
+#define PORT_TYPE_RM        0x20
+
+#define AMSTREAM_IOC_MAGIC  'S'
+
+#define AMSTREAM_IOC_VB_START   _IOW(AMSTREAM_IOC_MAGIC, 0x00, int)
+#define AMSTREAM_IOC_VB_SIZE    _IOW(AMSTREAM_IOC_MAGIC, 0x01, int)
+#define AMSTREAM_IOC_AB_START   _IOW(AMSTREAM_IOC_MAGIC, 0x02, int)
+#define AMSTREAM_IOC_AB_SIZE    _IOW(AMSTREAM_IOC_MAGIC, 0x03, int)
+#define AMSTREAM_IOC_VFORMAT    _IOW(AMSTREAM_IOC_MAGIC, 0x04, int)
+#define AMSTREAM_IOC_AFORMAT    _IOW(AMSTREAM_IOC_MAGIC, 0x05, int)
+#define AMSTREAM_IOC_VID        _IOW(AMSTREAM_IOC_MAGIC, 0x06, int)
+#define AMSTREAM_IOC_AID        _IOW(AMSTREAM_IOC_MAGIC, 0x07, int)
+#define AMSTREAM_IOC_VB_STATUS  _IOR(AMSTREAM_IOC_MAGIC, 0x08, unsigned long)
+#define AMSTREAM_IOC_AB_STATUS  _IOR(AMSTREAM_IOC_MAGIC, 0x09, unsigned long)
+#define AMSTREAM_IOC_SYSINFO    _IOW(AMSTREAM_IOC_MAGIC, 0x0a, int)
+#define AMSTREAM_IOC_ACHANNEL   _IOW(AMSTREAM_IOC_MAGIC, 0x0b, int)
+#define AMSTREAM_IOC_SAMPLERATE _IOW(AMSTREAM_IOC_MAGIC, 0x0c, int)
+#define AMSTREAM_IOC_DATAWIDTH  _IOW(AMSTREAM_IOC_MAGIC, 0x0d, int)
+#define AMSTREAM_IOC_TSTAMP     _IOW(AMSTREAM_IOC_MAGIC, 0x0e, unsigned long)
+#define AMSTREAM_IOC_VDECSTAT   _IOR(AMSTREAM_IOC_MAGIC, 0x0f, unsigned long)
+#define AMSTREAM_IOC_ADECSTAT   _IOR(AMSTREAM_IOC_MAGIC, 0x10, unsigned long)
+#define AMSTREAM_IOC_PORT_INIT  _IO(AMSTREAM_IOC_MAGIC, 0x11)
+#define AMSTREAM_IOC_TRICKMODE  _IOW(AMSTREAM_IOC_MAGIC, 0x12, unsigned long)
+#define AMSTREAM_IOC_AUDIO_INFO  _IOW(AMSTREAM_IOC_MAGIC, 0x13, unsigned long)
+#define AMSTREAM_IOC_TRICK_STAT  _IOR(AMSTREAM_IOC_MAGIC, 0x14, unsigned long)
+#define AMSTREAM_IOC_AUDIO_RESET _IO(AMSTREAM_IOC_MAGIC, 0x15)
+#define AMSTREAM_IOC_SID         _IOW(AMSTREAM_IOC_MAGIC, 0x16, int)
+#define AMSTREAM_IOC_VPAUSE      _IOW(AMSTREAM_IOC_MAGIC, 0x17, int)
+#define AMSTREAM_IOC_AVTHRESH    _IOW(AMSTREAM_IOC_MAGIC, 0x18, int)
+#define AMSTREAM_IOC_SYNCTHRESH  _IOW(AMSTREAM_IOC_MAGIC, 0x19, int)
+#define AMSTREAM_IOC_SUB_RESET   _IOW(AMSTREAM_IOC_MAGIC, 0x1a, int)
+#define AMSTREAM_IOC_SUB_LENGTH  _IOR(AMSTREAM_IOC_MAGIC, 0x1b, unsigned long)
+#define AMSTREAM_IOC_SET_DEC_RESET _IOW(AMSTREAM_IOC_MAGIC, 0x1c, int)
+#define AMSTREAM_IOC_TS_SKIPBYTE _IOW(AMSTREAM_IOC_MAGIC, 0x1d, int)
+#define AMSTREAM_IOC_SUB_TYPE    _IOW(AMSTREAM_IOC_MAGIC, 0x1e, int)
+#define AMSTREAM_IOC_APTS             _IOR(AMSTREAM_IOC_MAGIC, 0x40, unsigned long)
+#define AMSTREAM_IOC_VPTS             _IOR(AMSTREAM_IOC_MAGIC, 0x41, unsigned long)
+#define AMSTREAM_IOC_PCRSCR           _IOR(AMSTREAM_IOC_MAGIC, 0x42, unsigned long)
+#define AMSTREAM_IOC_SYNCENABLE      _IOW(AMSTREAM_IOC_MAGIC, 0x43, unsigned long)
+#define AMSTREAM_IOC_GET_SYNC_ADISCON  _IOR(AMSTREAM_IOC_MAGIC, 0x44, unsigned long)
+#define AMSTREAM_IOC_SET_SYNC_ADISCON  _IOW(AMSTREAM_IOC_MAGIC, 0x45, unsigned long)
+#define AMSTREAM_IOC_GET_SYNC_VDISCON  _IOR(AMSTREAM_IOC_MAGIC, 0x46, unsigned long)
+#define AMSTREAM_IOC_SET_SYNC_VDISCON  _IOW(AMSTREAM_IOC_MAGIC, 0x47, unsigned long)
+#define AMSTREAM_IOC_GET_VIDEO_DISABLE  _IOR(AMSTREAM_IOC_MAGIC, 0x48, unsigned long)
+#define AMSTREAM_IOC_SET_VIDEO_DISABLE  _IOW(AMSTREAM_IOC_MAGIC, 0x49, unsigned long)
+#define AMSTREAM_IOC_SET_PCRSCR       _IOW(AMSTREAM_IOC_MAGIC, 0x4a, unsigned long)
+#define AMSTREAM_IOC_GET_VIDEO_AXIS   _IOR(AMSTREAM_IOC_MAGIC, 0x4b, unsigned long)
+#define AMSTREAM_IOC_SET_VIDEO_AXIS   _IOW(AMSTREAM_IOC_MAGIC, 0x4c, unsigned long)
+#define AMSTREAM_IOC_SUB_NUM   _IOR(AMSTREAM_IOC_MAGIC, 0x50, unsigned long)
+#define AMSTREAM_IOC_SUB_INFO  _IOR(AMSTREAM_IOC_MAGIC, 0x51, unsigned long)
+
+#define AMSTREAM_IOC_SET_DEMUX  _IOW(AMSTREAM_IOC_MAGIC, 0x90, unsigned long)
+
+struct buf_status {
+    int size;
+    int data_len;
+    int free_len;
+    unsigned int read_pointer;
+    unsigned int write_pointer;
+};
+
+
+struct vdec_status {
+    unsigned int width;
+    unsigned int height;
+    unsigned int fps;
+    unsigned int error_count;
+    unsigned int status;
+};
+
+struct adec_status {
+    unsigned int channels;
+    unsigned int sample_rate;
+    unsigned int resolution;
+    unsigned int error_count;
+    unsigned int status;
+};
+
+struct am_io_param {
+    union {
+        int data;
+        int id;//get bufstatus? //or others
+    };
+
+    int len; //buffer size;
+
+    union {
+        char buf[1];
+        struct buf_status status;
+        struct vdec_status vstatus;
+        struct adec_status astatus;
+    };
+};
+void set_vdec_func(int (*vdec_func)(struct vdec_status *));
+void set_adec_func(int (*adec_func)(struct adec_status *));
+
+#endif /* AMSTREAM_H */
+
diff --git a/tools/depends/target/libamplayer/libamplayer/include/amports/vformat.h b/tools/depends/target/libamplayer/libamplayer/include/amports/vformat.h
new file mode 100644 (file)
index 0000000..6ded0d4
--- /dev/null
@@ -0,0 +1,111 @@
+/**
+* @file vformat.h
+* @brief  Porting from decoder driver for video format
+* @author Tim Yao <timyao@amlogic.com>
+* @version 1.0.0
+* @date 2011-02-24
+*/
+/* Copyright (C) 2007-2011, Amlogic Inc.
+* All right reserved
+* 
+*/
+
+/*
+ * AMLOGIC Audio/Video streaming port driver.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the named License,
+ * or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Author:  Tim Yao <timyao@amlogic.com>
+ *
+ */
+
+#ifndef VFORMAT_H
+#define VFORMAT_H
+
+typedef enum {
+    VIDEO_DEC_FORMAT_UNKNOW,
+    VIDEO_DEC_FORMAT_MPEG4_3,
+    VIDEO_DEC_FORMAT_MPEG4_4,
+    VIDEO_DEC_FORMAT_MPEG4_5,
+    VIDEO_DEC_FORMAT_H264,
+    VIDEO_DEC_FORMAT_MJPEG,
+    VIDEO_DEC_FORMAT_MP4,
+    VIDEO_DEC_FORMAT_H263,
+    VIDEO_DEC_FORMAT_REAL_8,
+    VIDEO_DEC_FORMAT_REAL_9,
+    VIDEO_DEC_FORMAT_WMV3,
+    VIDEO_DEC_FORMAT_WVC1,
+    VIDEO_DEC_FORMAT_SW,
+    VIDEO_DEC_FORMAT_MAX
+} vdec_type_t;
+
+typedef enum {
+    VFORMAT_UNKNOWN = -1,
+    VFORMAT_MPEG12 = 0,
+    VFORMAT_MPEG4,
+    VFORMAT_H264,
+    VFORMAT_MJPEG,
+    VFORMAT_REAL,
+    VFORMAT_JPEG,
+    VFORMAT_VC1,
+    VFORMAT_AVS,
+    VFORMAT_SW,
+    VFORMAT_H264MVC,
+    VFORMAT_UNSUPPORT,
+    VFORMAT_MAX
+} vformat_t;
+
+#define IS_VFMT_VALID(vfmt)    ((vfmt > VFORMAT_UNKNOWN) && (vfmt < VFORMAT_MAX))
+#define IS_NEED_VDEC_INFO(vfmt) ((vfmt == VFORMAT_MPEG4) || (vfmt == VFORMAT_REAL))
+
+#define CODEC_TAG_MJPEG     (0x47504a4d)
+#define CODEC_TAG_mjpeg     (0x47504a4c)
+#define CODEC_TAG_jpeg      (0x6765706a)
+#define CODEC_TAG_mjpa      (0x61706a6d)
+#define CODEC_TAG_XVID      (0x44495658)
+#define CODEC_TAG_xvid      (0x64697678)
+#define CODEC_TAG_XVIX      (0x58495658)
+#define CODEC_TAG_xvix      (0x78697678)
+#define CODEC_TAG_MP4       (0x8e22ada)
+#define CODEC_TAG_COL1      (0x314c4f43)
+#define CODEC_TAG_DIV3      (0x33564944)
+#define CODEC_TAG_MP43      (0x3334504d)
+#define CODEC_TAG_M4S2      (0x3253344d)
+#define CODEC_TAG_DIV4      (0x34564944)
+#define CODEC_TAG_DIVX      (0x58564944)
+#define CODEC_TAG_DIV5      (0x35564944)
+#define CODEC_TAG_DX50      (0x30355844)
+#define CODEC_TAG_DIV6      (0x36564944)
+#define CODEC_TAG_RMP4      (0x34504d52)
+#define CODEC_TAG_MP42      (0x3234504d)
+#define CODEC_TAG_MPG4      (0x3447504d)
+#define CODEC_TAG_MP4V      (0x5634504d)
+#define CODEC_TAG_mp4v      (0x7634706d)
+#define CODEC_TAG_AVC1      (0x31435641)
+#define CODEC_TAG_avc1      (0x31637661)
+#define CODEC_TAG_H264      (0x34363248)
+#define CODEC_TAG_h264      (0x34363268)
+#define CODEC_TAG_H263      (0x33363248)
+#define CODEC_TAG_h263      (0x33363268)
+#define CODEC_TAG_s263      (0x33363273)
+#define CODEC_TAG_F263      (0x33363246)
+#define CODEC_TAG_WMV1      (0x31564d57)
+#define CODEC_TAG_WMV2      (0x32564d57)
+#define CODEC_TAG_WMV3      (0x33564d57)
+#define CODEC_TAG_WVC1      (0x31435657)
+#define CODEC_TAG_WMVA      (0x41564d57)
+#define CODEC_TAG_FMP4      (0x34504d46)
+
+#endif /* VFORMAT_H */
diff --git a/tools/depends/target/libamplayer/libamplayer/include/log_print.h b/tools/depends/target/libamplayer/libamplayer/include/log_print.h
new file mode 100644 (file)
index 0000000..773727f
--- /dev/null
@@ -0,0 +1,40 @@
+
+#ifndef PLAYER_LOG_H
+#define PLAYER_LOG_H
+
+#define MAX_LOG_SIZE   (20*1024)
+
+__attribute__ ((format (printf, 2, 3)))
+void log_lprint(const int level, const char *fmt, ...);
+
+
+#define AM_LOG_PANIC   0
+#define AM_LOG_FATAL   8
+#define AM_LOG_ERROR   16
+#define AM_LOG_WARNING         24
+#define AM_LOG_INFO    32
+#define AM_LOG_VERBOSE         40
+#define AM_LOG_DEBUG   60
+#define AM_LOG_DEBUG1  70
+#define AM_LOG_DEBUG2  80
+#define AM_LOG_TRACE   90
+
+
+#define log_print(fmt...)      log_lprint(0,##fmt)
+#define log_error(fmt...)      log_lprint(AM_LOG_ERROR,##fmt)
+#define log_warning(fmt...) log_lprint(AM_LOG_WARNING,##fmt)
+#define log_info(fmt...)       log_lprint(AM_LOG_INFO,##fmt)
+/*default global_level=5,
+if the level<global_level print out
+*/
+#define log_debug(fmt...)      log_lprint(AM_LOG_DEBUG,##fmt)
+#define log_debug1(fmt...)     log_lprint(AM_LOG_DEBUG1,##fmt)
+#define log_debug2(fmt...)     log_lprint(AM_LOG_DEBUG2,##fmt)
+#define log_trace(fmt...)      log_lprint(AM_LOG_TRACE,##fmt)
+
+#define  DEBUG_PN() log_print("[%s:%d]\n", __FUNCTION__, __LINE__)
+
+void log_close(void);
+int log_open(const char *name);
+int update_loglevel_setting(void);
+#endif
diff --git a/tools/depends/target/libamplayer/libamplayer/include/message.h b/tools/depends/target/libamplayer/libamplayer/include/message.h
new file mode 100644 (file)
index 0000000..0ddedf1
--- /dev/null
@@ -0,0 +1,90 @@
+#ifndef PLAYER_MESSAGE_H
+#define PLAYER_MESSAGE_H
+
+#define MESSAGE_MAX 4
+
+#define CTRL_CMD_RESPONSE   (0xffff)
+
+typedef enum {
+    CMD_EXIT            = (1 << 0),
+    CMD_PLAY            = (1 << 1),
+    CMD_PLAY_START      = (1 << 2),
+    CMD_STOP            = (1 << 3),
+    CMD_START           = (1 << 4),
+    CMD_NEXT            = (1 << 5),
+    CMD_PREV            = (1 << 6),
+    CMD_PAUSE           = (1 << 7),
+    CMD_RESUME          = (1 << 8),
+    CMD_SEARCH          = (1 << 9),
+    CMD_FF              = (1 << 10),
+    CMD_FB              = (1 << 11),
+    CMD_SWITCH_AID      = (1 << 12),
+    CMD_SWITCH_SID      = (1 << 13),    
+    CMD_CTRL_MAX        = (1 << 31),
+} ctrl_cmd_t;
+
+typedef enum {
+    CMD_LOOP            = (1 << 0),
+    CMD_NOLOOP          = (1 << 1),
+    CMD_BLACKOUT        = (1 << 2),
+    CMD_NOBLACK         = (1 << 3),
+    CMD_NOAUDIO         = (1 << 4),
+    CMD_NOVIDEO         = (1 << 5),
+    CMD_MUTE            = (1 << 6),
+    CMD_UNMUTE          = (1 << 7),
+    CMD_SET_VOLUME      = (1 << 8),
+    CMD_SPECTRUM_SWITCH = (1 << 9),
+    CMD_SET_BALANCE     = (1 << 10),
+    CMD_SWAP_LR         = (1 << 11),
+    CMD_LEFT_MONO       = (1 << 12),
+    CMD_RIGHT_MONO      = (1 << 13),
+    CMD_SET_STEREO      = (1 << 14),   
+    CMD_EN_AUTOBUF      = (1 << 15),
+    CMD_SET_AUTOBUF_LEV = (1 << 16),
+    CMD_MODE_MAX        = (1 << 31),
+} ctrl_mode_t;
+
+typedef enum {
+    CMD_GET_VOLUME     = (1 << 0),
+    CMD_GET_VOL_RANGE  = (1 << 1),
+    CMD_GET_PLAY_STA   = (1 << 2),
+    CMD_GET_CURTIME    = (1 << 3),
+    CMD_GET_DURATION   = (1 << 4),
+    CMD_GET_MEDIA_INFO = (1 << 5),
+    CMD_LIST_PID       = (1 << 6),
+    CMD_GET_MAX        = (1 << 31),
+} get_info_t;
+
+typedef struct {
+    float min;
+    float max;
+} volume_range_t;
+
+typedef struct {
+    ctrl_cmd_t ctrl_cmd;
+    get_info_t info_cmd;
+    ctrl_mode_t set_mode;
+    int pid;
+    int cid;
+    union {
+        char *filename;
+        char *file_list;
+        int param;
+        float f_param;
+    };
+    union {
+        int param1;
+        float f_param1;
+    };
+    union {
+        int param2;
+        float f_param2;
+    };
+} player_cmd_t;
+
+int message_free(player_cmd_t * cmd);
+player_cmd_t * message_alloc(void);
+int cmd2str(player_cmd_t *cmd, char *buf);
+
+#endif
+
diff --git a/tools/depends/target/libamplayer/libamplayer/include/player.h b/tools/depends/target/libamplayer/libamplayer/include/player.h
new file mode 100644 (file)
index 0000000..b3eedc9
--- /dev/null
@@ -0,0 +1,80 @@
+#ifndef _PLAYER_H_
+#define _PLAYER_H_
+
+
+#include <codec.h>
+#include <player_type.h>
+#include <player_error.h>
+#include <message.h>
+
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+int    player_init();
+int     player_start(play_control_t *p,unsigned long  priv);
+int    player_stop(int pid);
+int    player_stop_async(int pid);
+int     player_exit(int pid);
+int    player_pause(int pid);
+int            player_resume(int pid);
+int    player_timesearch(int pid,float s_time);
+int     player_forward(int pid,int speed);
+int     player_backward(int pid,int speed);
+int     player_aid(int pid,int audio_id);
+int     player_sid(int pid,int sub_id);
+int    player_progress_exit(void);
+int     player_list_allpid(pid_info_t *pid);
+int     check_pid_valid(int pid);
+int    player_get_play_info(int pid,player_info_t *info);
+int    player_get_media_info(int pid,media_info_t *minfo);
+int    player_video_overlay_en(unsigned enable);
+int    player_start_play(int pid);
+int    player_send_message(int pid, player_cmd_t *cmd);
+player_status  player_get_state(int pid);
+unsigned int   player_get_extern_priv(int pid);
+int     player_enable_autobuffer(int pid, int enable);
+int     player_set_autobuffer_level(int pid, float min, float middle, float max);
+
+int    audio_set_mute(int pid,int mute);
+int    audio_get_volume_range(int pid,float *min,float *max);
+int    audio_set_volume(int pid,float val);
+int    audio_get_volume(int pid, float *val);
+
+int    audio_set_lrvolume(int pid,float lvol,float rvol);
+int    audio_get_lrvolume(int pid, float* lvol,float* rvol);
+
+int    audio_set_volume_balance(int pid,int balance);
+int    audio_swap_left_right(int pid);
+int    audio_left_mono(int pid);
+int    audio_right_mono(int pid);
+int    audio_stereo(int pid);
+int    audio_set_spectrum_switch(int pid,int isStart,int interval);
+int    player_register_update_callback(callback_t *cb,update_state_fun_t up_fn,int interval_s);
+char   *player_status2str(player_status status);
+int    player_cache_system_init(int enable,const char*dir,int max_size,int block_size);
+
+//control interface
+int     player_loop(int pid);
+int     player_noloop(int pid);
+
+int    check_url_type(char *filename);
+int    play_list_player(play_control_t *pctrl,unsigned long priv);
+
+//freescale
+int    enable_freescale(int cfg);
+int    disable_freescale(int cfg);
+int   disable_freescale_MBX();
+int   enable_2Xscale();
+int   enable_2XYscale();
+int   enable_freescale_MBX();
+int   disable_2X_2XYscale();
+int   GL_2X_scale(int mSwitch);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/tools/depends/target/libamplayer/libamplayer/include/player_error.h b/tools/depends/target/libamplayer/libamplayer/include/player_error.h
new file mode 100644 (file)
index 0000000..0d22211
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef _PLAYER_ERROR_H_
+#define _PLAYER_ERROR_H_
+
+#define P_PRE       (0x02000000)
+#define F_PRE       (0x03000000)
+#define X_PRE       (0x04000000)
+#define D_PRE       (0x05000000)
+
+#define PLAYER_SUCCESS          (0)
+#define PLAYER_FAILED           (-(P_PRE|0x01))
+#define PLAYER_NOMEM            (-(P_PRE|0x02))
+#define PLAYER_EMPTY_P          (-(P_PRE|0x03))
+#define PLAYER_NOT_VALID_PID    (-(P_PRE|0x04))
+#define PLAYER_CAN_NOT_CREAT_THREADS    (-(P_PRE|0x05))
+#define PLAYER_ERROR_PARAM      (-(P_PRE|0x06))
+#define PLAYER_ERROR_CALLBACK   (-(P_PRE|0x07))
+
+#define PLAYER_RD_FAILED        (-(P_PRE|0x11))
+#define PLAYER_RD_EMPTYP        (-(P_PRE|0x12))
+#define PLAYER_RD_TIMEOUT       (-(P_PRE|0x13))
+#define PLAYER_RD_AGAIN         (-(P_PRE|0x14))
+
+#define PLAYER_WR_FAILED        (-(P_PRE|0x21))
+#define PLAYER_WR_EMPTYP        (-(P_PRE|0x22))
+#define PLAYER_WR_AGAIN                        (-(P_PRE|0x23))
+#define PLAYER_WR_FINISH        (P_PRE|0x1)
+
+#define PLAYER_PTS_ERROR        (-(P_PRE|0x31))
+#define PLAYER_NO_DECODER       (-(P_PRE|0x32))
+#define DECODER_RESET_FAILED    (-(P_PRE|0x33))
+#define DECODER_INIT_FAILED     (-(P_PRE|0x34))
+#define PLAYER_UNSUPPORT        (-(P_PRE|0x35))
+#define PLAYER_UNSUPPORT_VIDEO  (-(P_PRE|0x36))
+#define PLAYER_UNSUPPORT_AUDIO  (-(P_PRE|0x37))
+#define PLAYER_SEEK_OVERSPILL   (-(P_PRE|0x38))
+#define PLAYER_CHECK_CODEC_ERROR  (-(P_PRE|0x39))
+#define PLAYER_INVALID_CMD      (-(P_PRE|0x40))
+#define PLAYER_REAL_AUDIO_FAILED (-(P_PRE|0x41))
+#define PLAYER_ADTS_NOIDX       (-(P_PRE|0x42))
+#define PLAYER_SEEK_FAILED      (-(P_PRE|0x43))
+#define PLAYER_NO_VIDEO         (-(P_PRE|0x44))
+#define PLAYER_NO_AUDIO         (-(P_PRE|0x45))
+#define PLAYER_SET_NOVIDEO      (-(P_PRE|0x46))
+#define PLAYER_SET_NOAUDIO      (-(P_PRE|0x47))
+#define PLAYER_FFFB_UNSUPPORT   (-(P_PRE|0x48))
+#define PLAYER_UNSUPPORT_VCODEC (-(P_PRE|0x49))
+#define PLAYER_UNSUPPORT_ACODEC (-(P_PRE|0x4a))
+
+#define FFMPEG_SUCCESS          (0)
+#define FFMPEG_OPEN_FAILED      (-(F_PRE|0x1))
+#define FFMPEG_PARSE_FAILED     (-(F_PRE|0x2))
+#define FFMPEG_EMP_POINTER      (-(F_PRE|0x3))
+#define FFMPEG_NO_FILE          (-(F_PRE|0x4))
+
+#define DIVX_SUCCESS            (0)
+#define DIVX_AUTHOR_ERR         (-(X_PRE|0x1))
+#define DIVX_EXPIRED            (-(X_PRE|0x2))
+
+#define DRM_NOERROR             (0)
+#define DRM_UNSUPPORT           (-(D_PRE|0x1))
+
+char * player_error_msg(int error);
+#endif
diff --git a/tools/depends/target/libamplayer/libamplayer/include/player_id.h b/tools/depends/target/libamplayer/libamplayer/include/player_id.h
new file mode 100644 (file)
index 0000000..45ae74d
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef PLAYER_ID_MGT__
+#define PLAYER_ID_MGT__
+
+int player_request_pid(void);
+int player_release_pid(int pid);
+int player_init_pid_data(int pid,void * data);
+void * player_open_pid_data(int pid);
+int player_close_pid_data(int pid);
+int player_id_pool_init(void);
+int player_list_pid(char id[],int size);
+
+#endif
+
+
diff --git a/tools/depends/target/libamplayer/libamplayer/include/player_set_sys.h b/tools/depends/target/libamplayer/libamplayer/include/player_set_sys.h
new file mode 100644 (file)
index 0000000..c47dfd2
--- /dev/null
@@ -0,0 +1,80 @@
+#ifndef _PLAYER_SET_DISP_H_
+#define _PLAYER_SET_DISP_H_
+
+#define MID_800_400_FREESCALE (0x10001) //mid 800*400
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+typedef enum
+{
+    DISP_MODE_480I  = 1,
+    DISP_MODE_480P  = 2,
+    DISP_MODE_576I  = 3,
+    DISP_MODE_576P  = 4,
+    DISP_MODE_720P  = 5,
+    DISP_MODE_1080I = 6,
+    DISP_MODE_1080P = 7
+} display_mode;
+
+typedef struct {
+    display_mode disp_mode;
+    int osd_disble_coordinate[8];
+    int osd_enable_coordinate[8];
+    int video_enablecoordinate[4];
+    int fb0_freescale_width;
+    int fb0_freescale_height;
+    int fb1_freescale_width;
+    int fb1_freescale_height;
+} freescale_setting_t;
+
+
+
+int set_sysfs_str(const char *path, const char *val);
+int  get_sysfs_str(const char *path, char *valstr, int size);
+int set_sysfs_int(const char *path, int val);
+int get_sysfs_int(const char *path);
+
+int set_black_policy(int blackout);
+int get_black_policy();
+int get_karaok_flag();
+int set_tsync_enable(int enable);
+int set_tsync_discontinue(int enable);
+int get_pts_discontinue();
+int set_fb0_blank(int blank);
+int set_fb1_blank(int blank);
+int set_subtitle_num(int num);
+int av_get_subtitle_curr();
+int set_subtitle_startpts(int pts);
+int set_subtitle_fps(int fps);
+int set_subtitle_subtype(int subtype);
+void get_display_mode(char *mode);
+int set_fb0_freescale(int freescale);
+int set_fb1_freescale(int freescale);
+int set_display_axis(int *coordinate);
+int set_video_axis(int *coordinate);
+int set_fb0_scale_width(int width);
+int set_fb0_scale_height(int height);
+int set_fb1_scale_width(int width);
+int set_fb1_scale_height(int height);
+int check_audiodsp_fatal_err(void);
+int set_stb_source_hiu(void);
+int set_stb_demux_source_hiu(void);
+int get_stb_demux_source(char *strval, int size);
+int get_stb_source(char *strval, int size);
+
+int set_subtitle_enable(int num);
+int set_subtitle_curr(int num);
+int check_file_same(char *filename2);
+
+//player sysfs API channel
+int set_amutils_enable(int isOn);
+int set_amutils_cmd(const char* cmd);
+int get_amutils_cmd(char* cmd);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/depends/target/libamplayer/libamplayer/include/player_thumbnail.h b/tools/depends/target/libamplayer/libamplayer/include/player_thumbnail.h
new file mode 100644 (file)
index 0000000..d1387e2
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef PLAYER_THUMBNAIL_H
+#define PLAYER_THUMBNAIL_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+void * thumbnail_res_alloc(void);
+int thumbnail_find_stream_info(void *handle, const char* filename);
+int thumbnail_find_stream_info_end(void *handle);
+int thumbnail_decoder_open(void *handle, const char* filename);
+int thumbnail_extract_video_frame(void * handle, int64_t time, int flag);
+int thumbnail_read_frame(void *handle, char* buffer);
+void thumbnail_get_video_size(void *handle, int* width, int* height);
+float thumbnail_get_aspect_ratio(void *handle);
+void thumbnail_get_duration(void *handle, int64_t *duration);
+int thumbnail_get_key_metadata(void* handle, char* key, const char** value);
+int thumbnail_get_key_data(void* handle, char* key, const void** data, int* data_size);
+void thumbnail_get_video_rotation(void *handle, int* rotation);
+int thumbnail_decoder_close(void *handle);
+void thumbnail_res_free(void* handle);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/depends/target/libamplayer/libamplayer/include/player_type.h b/tools/depends/target/libamplayer/libamplayer/include/player_type.h
new file mode 100644 (file)
index 0000000..2abd194
--- /dev/null
@@ -0,0 +1,271 @@
+#ifndef _PLAYER_TYPE_H_
+#define _PLAYER_TYPE_H_
+
+#include <libavformat/avformat.h>
+#include <stream_format.h>
+
+#define MSG_SIZE                    64
+#define MAX_VIDEO_STREAMS           8
+#define MAX_AUDIO_STREAMS           8
+#define MAX_SUB_INTERNAL            8
+#define MAX_SUB_EXTERNAL            24
+#define MAX_SUB_STREAMS             (MAX_SUB_INTERNAL + MAX_SUB_EXTERNAL)
+#define MAX_PLAYER_THREADS          32
+
+#define CALLBACK_INTERVAL                      (300)
+
+//#define DEBUG_VARIABLE_DUR
+
+typedef enum
+{      
+       /******************************
+       * 0x1000x: 
+       * player do parse file
+       * decoder not running
+       ******************************/
+       PLAYER_INITING          = 0x10001,
+       PLAYER_TYPE_REDY  = 0x10002,
+       PLAYER_INITOK           = 0x10003,      
+
+       /******************************
+       * 0x2000x: 
+       * playback status
+       * decoder is running
+       ******************************/
+       PLAYER_RUNNING          = 0x20001,
+       PLAYER_BUFFERING        = 0x20002,
+       PLAYER_PAUSE            = 0x20003,
+       PLAYER_SEARCHING        = 0x20004,
+       
+       PLAYER_SEARCHOK         = 0x20005,
+       PLAYER_START            = 0x20006,      
+       PLAYER_FF_END           = 0x20007,
+       PLAYER_FB_END           = 0x20008,
+
+       PLAYER_PLAY_NEXT        = 0x20009,      
+       PLAYER_BUFFER_OK        = 0x2000a,      
+       PLAYER_FOUND_SUB        = 0x2000b,
+
+       /******************************
+       * 0x3000x: 
+       * player will exit      
+       ******************************/
+       PLAYER_ERROR            = 0x30001,
+       PLAYER_PLAYEND          = 0x30002,      
+       PLAYER_STOPED           = 0x30003,  
+       PLAYER_EXIT             = 0x30004, 
+
+    /******************************
+     * 0x4000x:
+     * divx drm
+     * decoder will exit or give
+     * a message dialog
+     * ****************************/
+    PLAYER_DIVX_AUTHORERR   =   0x40001,
+    PLAYER_DIVX_RENTAL_EXPIRED  =   0x40002,
+    PLAYER_DIVX_RENTAL_VIEW =   0x40003,
+
+       
+}player_status;
+
+
+typedef struct
+{   
+       int index;
+    int id;    
+    int width;
+    int height;
+    int aspect_ratio_num;
+    int aspect_ratio_den;
+    int frame_rate_num;
+    int frame_rate_den;
+       int bit_rate;
+    vformat_t format;
+    int duartion;
+    unsigned int video_rotation_degree;
+}mvideo_info_t;
+
+typedef enum
+{
+    ACOVER_NONE   = 0,
+    ACOVER_JPG    ,
+    ACOVER_PNG    ,
+}audio_cover_type;
+
+typedef struct
+{
+    char title[512];
+    char author[512];
+    char album[512];
+    char comment[512];
+    char year[4];  
+    int track;     
+    char genre[32]; 
+    char copyright[512];
+    audio_cover_type pic; 
+}audio_tag_info;
+
+typedef struct
+{    
+    int id;
+    int channel;
+    int sample_rate;
+    int bit_rate;
+    aformat_t aformat;
+    int duration;
+       audio_tag_info *audio_tag;    
+}maudio_info_t;
+
+typedef struct
+{
+    char id;
+    char internal_external; //0:internal_sub 1:external_sub       
+    unsigned short width;
+    unsigned short height;
+       unsigned int sub_type;
+    char resolution;
+    long long subtitle_size;  
+    char *sub_language;   
+}msub_info_t;
+
+typedef struct
+{      
+    char *filename;
+    int  duration;  
+       long long  file_size;
+    pfile_type type;
+       int bitrate;
+    int has_video;
+    int has_audio;
+    int has_sub;
+    int nb_streams;
+    int total_video_num;
+    int cur_video_index;
+    int total_audio_num;
+    int cur_audio_index;
+    int total_sub_num;      
+    int cur_sub_index; 
+    int seekable;
+    int drm_check;
+}mstream_info_t;
+
+typedef struct
+{      
+       mstream_info_t stream_info;
+       mvideo_info_t *video_info[MAX_VIDEO_STREAMS];
+       maudio_info_t *audio_info[MAX_AUDIO_STREAMS];
+    msub_info_t *sub_info[MAX_SUB_STREAMS];
+}media_info_t;
+
+typedef struct player_info
+{
+       char *name;
+       player_status last_sta;
+       player_status status;              /*stop,pause */
+       int full_time;     /*Seconds    */
+    int full_time_ms;  /* mSeconds */
+       int current_time;  /*Seconds    */
+       int current_ms; /*ms*/
+       int last_time;          
+       int error_no;  
+       int start_time;
+       int first_time;
+       int pts_video;
+       //int pts_pcrscr;
+       unsigned int current_pts;
+       long curtime_old_time;    
+       unsigned int video_error_cnt;
+       unsigned int audio_error_cnt;
+       float audio_bufferlevel; // relative value
+       float video_bufferlevel; // relative value
+       int64_t bufed_pos;
+       int     bufed_time;/* Second*/
+    unsigned int drm_rental;
+}player_info_t;
+
+typedef struct pid_info
+{
+    int num;
+    int pid[MAX_PLAYER_THREADS];
+}pid_info_t;
+
+typedef struct player_file_type
+{
+       const char *fmt_string;
+       int video_tracks;
+       int audio_tracks;
+       int subtitle_tracks;
+       /**/
+}player_file_type_t;
+
+
+#define STATE_PRE(sta) (sta>>16)
+#define PLAYER_THREAD_IS_INITING(sta)  (STATE_PRE(sta)==0x1)
+#define PLAYER_THREAD_IS_RUNNING(sta)  (STATE_PRE(sta)==0x2)
+#define PLAYER_THREAD_IS_STOPPED(sta)  (STATE_PRE(sta)==0x3)
+
+typedef int (*update_state_fun_t)(int pid,player_info_t *) ;
+typedef int (*notify_callback)(int pid,int msg,unsigned long ext1,unsigned long ext2);
+typedef enum
+{      
+       PLAYER_EVENTS_PLAYER_INFO=1,                    ///<ext1=player_info*,ext2=0,same as update_statue_callback 
+       PLAYER_EVENTS_STATE_CHANGED,                    ///<ext1=new_state,ext2=0,
+       PLAYER_EVENTS_ERROR,                                    ///<ext1=error_code,ext2=message char *
+       PLAYER_EVENTS_BUFFERING,                                ///<ext1=buffered=d,d={0-100},ext2=0,
+       PLAYER_EVENTS_FILE_TYPE,                                ///<ext1=player_file_type_t*,ext2=0
+}player_events;
+
+typedef struct
+{
+    update_state_fun_t update_statue_callback;
+    int update_interval;
+    long callback_old_time;
+       notify_callback    notify_fn;
+}callback_t;
+
+typedef struct
+ {
+       char  *file_name;                                               //file url
+    char  *headers;                                                    //file name's authentication information,maybe used in network streaming
+       //List  *play_list;
+       int     video_index;                                            //video track, no assigned, please set to -1
+       int     audio_index;                                            //audio track, no assigned, please set to -1
+       int sub_index;                                                  //subtitle track, no assigned, please set to -1
+       int t_pos;                  //start postion, use second as unit
+       int     read_max_cnt;                                           //read retry maxium counts, if exceed it, return error
+       int avsync_threshold;                             //for adec av sync threshold in ms
+       union
+       {     
+               struct{
+                       unsigned int loop_mode:1;               //file loop mode 0:loop 1:not loop
+                       unsigned int nosound:1;                 //0:play with audio  1:play without audio
+                       unsigned int novideo:1;                 //0:play with video  1:play without video
+                       unsigned int hassub:1;                  //0:ignore subtitle      1:extract subtitle if have
+                       unsigned int need_start:1;/*If set need_start, we need call     player_start_play to playback*/
+                       #ifdef DEBUG_VARIABLE_DUR
+                       unsigned int is_variable:1;             //0:extrack duration from header 1:update duration during playback
+                       #endif
+                       unsigned int displast_frame : 1;//0:black out when player exit  1:keep last frame when player exit
+               };
+               int mode;                                                       //no use
+       };  
+       callback_t callback_fn;                                 //callback function
+       int byteiobufsize;                                              //byteio buffer size used in ffmpeg
+       int loopbufsize;                                                //loop buffer size used in ffmpeg
+       int enable_rw_on_pause;                                 //no use
+       /*
+       data%<min && data% <max  enter buffering;
+       data% >middle exit buffering;
+       */
+       int auto_buffing_enable;                                 //auto buffering switch
+       float buffing_min;                                               //auto buffering low limit
+       float buffing_middle;                                    //auto buffering middle limit
+       float buffing_max;                                               //auto buffering high limit
+       int is_playlist;                                                 //no use
+       int is_type_parser;                                              //is try to get file type 
+       int buffing_starttime_s;                        //for rest buffing_middle,buffering seconds data to start.
+       int buffing_force_delay_s;
+       int reserved [56];                                      //reserved  for furthur used,some one add more ,can del reserved num
+ }play_control_t; 
+
+#endif
diff --git a/tools/depends/target/libamplayer/libamplayer/include/stream_format.h b/tools/depends/target/libamplayer/libamplayer/include/stream_format.h
new file mode 100644 (file)
index 0000000..5444f52
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef _STREAM_FORMAT_H_
+#define _STREAM_FORMAT_H_
+
+#include "amports/vformat.h"
+#include "amports/aformat.h"
+
+typedef enum 
+{
+       NONE = 0,
+       ID3V1,
+       ID3V2,
+       APEV1,
+       APEV2,
+       WMATAG,
+       MPEG4TAG,
+}audio_tag_type;
+
+typedef enum 
+{
+    UNKNOWN_FILE       = 0,
+    AVI_FILE           = 1,
+    MPEG_FILE          = 2,
+    WAV_FILE           = 3,
+    MP3_FILE           = 4,
+    AAC_FILE           = 5,
+    AC3_FILE           = 6,
+    RM_FILE                    = 7,
+    DTS_FILE           = 8,        
+    MKV_FILE           = 9,    
+    MOV_FILE        = 10,
+    MP4_FILE           = 11,           
+    FLAC_FILE          = 12,
+    H264_FILE          = 13,
+    M2V_FILE        = 14,
+    FLV_FILE           = 15,
+    P2P_FILE        = 16,
+    ASF_FILE        = 17,
+    STREAM_FILE     = 18,
+    APE_FILE           = 19,        
+    FILE_MAX           = 20,        
+}pfile_type;
+
+#endif
diff --git a/tools/depends/target/libass/Makefile b/tools/depends/target/libass/Makefile
new file mode 100644 (file)
index 0000000..87e810f
--- /dev/null
@@ -0,0 +1,47 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libass
+VERSION=0.9.13
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-enca
+
+LIBDYLIB=$(PLATFORM)/$(LIBNAME)/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libass.la $(PREFIX)/lib/libass.so $(PREFIX)/lib/libass.so.4
+       mv -f $(PREFIX)/lib/libass.so.4.1.0 $(PREFIX)/lib/libass.so
+       $(RPL) -e "libass.so.4" "libass.so\x00\x00" $(PREFIX)/lib/libass.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libass.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libbluray/Makefile b/tools/depends/target/libbluray/Makefile
new file mode 100644 (file)
index 0000000..c4b9ee7
--- /dev/null
@@ -0,0 +1,48 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libbluray
+VERSION=0.2.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --exec-prefix=$(PREFIX) \
+  --disable-examples --disable-doxygen-doc
+
+LIBDYLIB=$(PLATFORM)/src/.libs/libbluray.so.1.0.0
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       # libbluray has borked Makefile.am with respect to CFLAGS, remove the offending line
+       sed -i -e "s|CFLAGS=|#CFLAGS=|" $(PLATFORM)/src/Makefile.am
+       sed -i -e "s|CFLAGS=|#CFLAGS=|" $(PLATFORM)/src/examples/Makefile.am
+       cd $(PLATFORM); ./bootstrap
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libbluray.la $(PREFIX)/lib/libbluray.so $(PREFIX)/lib/libbluray.so.1
+       mv -f $(PREFIX)/lib/libbluray.so.1.0.0 $(PREFIX)/lib/libbluray.so
+       $(RPL) -e "libbluray.so.1" "libbluray.so\x00\x00" $(PREFIX)/lib/libbluray.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libbluray.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libcdio-gplv3/Makefile b/tools/depends/target/libcdio-gplv3/Makefile
new file mode 100644 (file)
index 0000000..b90db66
--- /dev/null
@@ -0,0 +1,47 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libcdio
+VERSION=0.90
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX)  --with-cd-drive=no --with-cd-info=no --with-cd-paranoia=no \
+          --with-cdda-player=no --with-cd-read=no --with-iso-info=no --with-iso-read=no --disable-example-progs \
+          --disable-cpp-progs --disable-cxx --disable-shared
+
+LIBDYLIB=$(PLATFORM)/lib/driver/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p0 < ../osx.patch
+       cd $(PLATFORM); $(AUTORECONF) -vif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/lib
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/lib install
+       $(MAKE) -C $(PLATFORM)/include install
+       $(MAKE) -C $(PLATFORM) install-data-am
+       cp $(PLATFORM)/include/cdio/cdtext.h $(PREFIX)/include/cdio/
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libcdio-gplv3/osx.patch b/tools/depends/target/libcdio-gplv3/osx.patch
new file mode 100644 (file)
index 0000000..f705973
--- /dev/null
@@ -0,0 +1,19 @@
+--- configure.ac       2012-10-27 17:07:45.000000000 +0200
++++ configure.ac.new   2012-10-28 11:07:00.000000000 +0100
+@@ -352,14 +352,14 @@
+ esac
+ AC_SUBST(native_abs_top_srcdir)
+-case $host_os in
++case $host in
+      aix*)
+        ## Don't use AIX driver until starts to really work
+        ## cd_drivers="${cd_drivers}, AIX"
+        ## AC_DEFINE([HAVE_AIX_CDROM], [1],
+        ##     [Define 1 if you have AIX CD-ROM support])
+        ;;
+-     darwin[[6-9]].*|darwin1[[0-2]].*)
++     *86*-apple-darwin*)
+        AC_CHECK_HEADERS(IOKit/IOKitLib.h CoreFoundation/CFBase.h, 
+                         [have_iokit_h="yes"])
+        if test "x$have_iokit_h" = "xyes" ; then 
diff --git a/tools/depends/target/libcdio/Makefile b/tools/depends/target/libcdio/Makefile
new file mode 100644 (file)
index 0000000..c56e2c7
--- /dev/null
@@ -0,0 +1,48 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include configure.patch Makefile
+
+# lib name, version
+LIBNAME=libcdio
+VERSION=0.80
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX)  --with-cd-drive=no --with-cd-info=no --with-cd-paranoia=no \
+          --with-cdda-player=no --with-cd-read=no --with-iso-info=no --with-iso-read=no --disable-example-progs \
+          --disable-cpp-progs --disable-cxx --disable-shared
+
+LIBDYLIB=$(PLATFORM)/lib/driver/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p0 < ../configure.patch
+       cd $(PLATFORM); patch -p0 < ../cross.patch
+       cd $(PLATFORM); $(AUTORECONF) -vif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/lib
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/lib install
+       $(MAKE) -C $(PLATFORM)/include install
+       $(MAKE) -C $(PLATFORM) install-data-am
+       cp $(PLATFORM)/include/cdio/cdtext.h $(PREFIX)/include/cdio/
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libcdio/configure.patch b/tools/depends/target/libcdio/configure.patch
new file mode 100644 (file)
index 0000000..a4110ef
--- /dev/null
@@ -0,0 +1,11 @@
+--- configure.ac       2012-05-27 15:06:13.044747493 -0400
++++ configure.ac       2012-05-27 15:05:52.364747505 -0400
+@@ -378,7 +378,7 @@
+      ;;
+      linux*|uclinux)
+         AC_CHECK_HEADERS(linux/version.h linux/major.h)
+-        AC_CHECK_HEADERS(linux/cdrom.h, [have_linux_cdrom_h="yes"])
++        AC_CHECK_HEADERS(linux/cdrom.h, [have_linux_cdrom_h="no"])
+       if test "x$have_linux_cdrom_h" = "xyes" ; then
+          AC_TRY_COMPILE(,[
+ #include <linux/cdrom.h>
diff --git a/tools/depends/target/libcdio/cross.patch b/tools/depends/target/libcdio/cross.patch
new file mode 100644 (file)
index 0000000..d5e17ce
--- /dev/null
@@ -0,0 +1,109 @@
+--- configure.ac       2013-03-10 19:25:36.396466337 -0400
++++ configure.ac       2013-03-10 19:24:34.906466376 -0400
+@@ -269,37 +269,6 @@
+ fi
+ dnl empty_array_size
+-dnl bitfield order
+-AC_MSG_CHECKING(bitfield ordering in structs)
+-AC_TRY_RUN([
+-int
+- main() {
+-  struct { char bit_0:1, bit_12:2, bit_345:3, bit_67:2; }
+-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+-  __attribute__((packed))
+-#endif
+-  bf = { 1,1,1,1 };
+-  if (sizeof (bf) != 1) return 1;
+-  return *((unsigned char*) &bf) != 0x4b; }
+-], bf_lsbf=1, AC_TRY_RUN([ 
+-int
+-main() {
+-  struct { char bit_0:1, bit_12:2, bit_345:3, bit_67:2; }
+-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+-  __attribute__((packed))
+-#endif
+-  bf = { 1,1,1,1 };
+-  if (sizeof (bf) != 1) return 1;
+-  return *((unsigned char*) &bf) != 0xa5; }
+-], bf_lsbf=0, AC_MSG_ERROR([unsupported bitfield ordering])))
+-if test "x$bf_lsbf" = "x1"; then
+- AC_MSG_RESULT(LSBF)
+- AC_DEFINE(BITFIELD_LSBF, [], [compiler does least-significant bit first in struct bitfields])
+-else
+- AC_MSG_RESULT(MSBF)
+-fi
+-dnl
+-
+ dnl AM_PROG_LIBTOOL tests whether we have GNU ld
+ dnl this must come before checking --with-versioned-libs
+ dnl which requires GNU ld.
+@@ -466,24 +435,6 @@
+       ;;
+ esac
+-AC_MSG_CHECKING(extern long timezone variable)
+-AC_TRY_RUN([
+-#ifdef NEED_TIMEZONEVAR
+-#define timezonevar 1
+-#endif
+-
+-#include <time.h>
+-extern long timezone;
+-int main(int argc, char **argv) {
+-  long test_timezone = timezone;
+-  return 0; 
+-}
+-], [AC_MSG_RESULT(yes); 
+-   AC_DEFINE([HAVE_TIMEZONE_VAR], 1, 
+-      [Define if you have an extern long timenzone variable.])],
+-   [AC_MSG_RESULT(no)])
+-dnl
+-
+ AC_SUBST(LINUX_CDROM_TIMEOUT)
+ AC_SUBST(DARWIN_PKG_LIB_HACK)
+ AC_SUBST(HAVE_BSDI_CDROM)
+@@ -508,43 +459,6 @@
+                  ,
+                  [#include <time.h>])
+-if test $ac_cv_member_struct_tm_tm_gmtoff = yes ; then
+-  AC_MSG_CHECKING([whether time.h defines daylight and timezone variables])
+-  AC_TRY_RUN([
+-#include <time.h>
+-
+-
+-       extern char *tzname[2];
+-       extern long timezone;
+-       extern int daylight;
+-
+-int
+- main() {
+-  return (timezone != 0) + daylight;
+-}
+-  ],[AC_DEFINE(HAVE_DAYLIGHT, 1,
+-   [Define if time.h defines extern long timezone and int daylight vars.])
+-   has_daylight=yes
+-   ],[has_daylight=no])
+-  AC_MSG_RESULT($has_daylight)
+-  AC_MSG_CHECKING([whether time.h defines tzname variable])
+-  AC_TRY_RUN([
+-#include <time.h>
+-
+-
+-       extern char *tzname[2];
+-
+-int
+- main() {
+-  return (tzname != NULL);
+-}
+-  ],[AC_DEFINE(HAVE_TZNAME, 1,
+-   [Define if time.h defines extern extern char *tzname[2] variable])
+-   has_tzname=yes
+-   ],[has_tzname=no])
+-   AC_MSG_RESULT($has_tzname)
+-fi
+-
+ AC_ARG_ENABLE(joliet,
+       AS_HELP_STRING([--disable-joliet], [don't include Joliet extension support (default enabled)]),
+       [enable_joliet=$enableval],
diff --git a/tools/depends/target/libcec/Makefile b/tools/depends/target/libcec/Makefile
new file mode 100644 (file)
index 0000000..0a42317
--- /dev/null
@@ -0,0 +1,44 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libcec
+VERSION=2.1.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --disable-rpi \
+
+LIBDYLIB=$(PLATFORM)/src/lib/.libs/libcec.so.2.0.1
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(AUTORECONF) -vif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/src/lib
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/src/lib install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libcec.la $(PREFIX)/lib/libcec.so $(PREFIX)/lib/libcec.so.2
+       mv -f $(PREFIX)/lib/libcec.so.2.0.1 $(PREFIX)/lib/libcec.so
+       $(RPL) -e "libcec.so.2" "libcec.so\x00\x00" $(PREFIX)/lib/libcec.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libcec.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libcrystalhd/Makefile b/tools/depends/target/libcrystalhd/Makefile
new file mode 100644 (file)
index 0000000..ace21bf
--- /dev/null
@@ -0,0 +1,15 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include
+
+SOURCE=libcrystalhd
+
+all: .installed-$(PLATFORM)
+
+.installed-$(PLATFORM): $(SOURCE)
+       mkdir -p $(PREFIX)/include
+       cp -rf $(SOURCE) $(PREFIX)/include/
+       touch $@
+
+clean:
+distclean::
+       .installed-$(PLATFORM)
diff --git a/tools/depends/target/libcrystalhd/libcrystalhd/bc_dts_defs.h b/tools/depends/target/libcrystalhd/libcrystalhd/bc_dts_defs.h
new file mode 100644 (file)
index 0000000..2bffb80
--- /dev/null
@@ -0,0 +1,635 @@
+/********************************************************************
+ * Copyright(c) 2006-2009 Broadcom Corporation.
+ *
+ *  Name: bc_dts_defs.h
+ *
+ *  Description: Common definitions for all components. Only types
+ *              is allowed to be included from this file.
+ *
+ *  AU
+ *
+ *  HISTORY:
+ *
+ ********************************************************************
+ * This header is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License.
+ *
+ * This header is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this header.  If not, see <http://www.gnu.org/licenses/>.
+ *******************************************************************/
+
+#ifndef _BC_DTS_DEFS_H_
+#define _BC_DTS_DEFS_H_
+
+#include "bc_dts_types.h"
+
+/* BIT Mask */
+#define BC_BIT(_x)             (1 << (_x))
+
+typedef enum _BC_STATUS {
+       BC_STS_SUCCESS          = 0,
+       BC_STS_INV_ARG          = 1,
+       BC_STS_BUSY             = 2,
+       BC_STS_NOT_IMPL         = 3,
+       BC_STS_PGM_QUIT         = 4,
+       BC_STS_NO_ACCESS        = 5,
+       BC_STS_INSUFF_RES       = 6,
+       BC_STS_IO_ERROR         = 7,
+       BC_STS_NO_DATA          = 8,
+       BC_STS_VER_MISMATCH     = 9,
+       BC_STS_TIMEOUT          = 10,
+       BC_STS_FW_CMD_ERR       = 11,
+       BC_STS_DEC_NOT_OPEN     = 12,
+       BC_STS_ERR_USAGE        = 13,
+       BC_STS_IO_USER_ABORT    = 14,
+       BC_STS_IO_XFR_ERROR     = 15,
+       BC_STS_DEC_NOT_STARTED  = 16,
+       BC_STS_FWHEX_NOT_FOUND  = 17,
+       BC_STS_FMT_CHANGE       = 18,
+       BC_STS_HIF_ACCESS       = 19,
+       BC_STS_CMD_CANCELLED    = 20,
+       BC_STS_FW_AUTH_FAILED   = 21,
+       BC_STS_BOOTLOADER_FAILED = 22,
+       BC_STS_CERT_VERIFY_ERROR = 23,
+       BC_STS_DEC_EXIST_OPEN   = 24,
+       BC_STS_PENDING          = 25,
+       BC_STS_CLK_NOCHG        = 26,
+
+       /* Must be the last one.*/
+       BC_STS_ERROR            = -1
+} BC_STATUS;
+
+/*------------------------------------------------------*
+ *    Registry Key Definitions                         *
+ *------------------------------------------------------*/
+#define BC_REG_KEY_MAIN_PATH   "Software\\Broadcom\\MediaPC\\CrystalHD"
+#define BC_REG_KEY_FWPATH              "FirmwareFilePath"
+#define BC_REG_KEY_SEC_OPT             "DbgOptions"
+
+/*
+ * Options:
+ *
+ *  b[5] = Enable RSA KEY in EEPROM Support
+ *  b[6] = Enable Old PIB scheme. (0 = Use PIB with video scheme)
+ *
+ *  b[12] = Enable send message to NotifyIcon
+ *
+ */
+
+typedef enum _BC_SW_OPTIONS {
+       BC_OPT_DOSER_OUT_ENCRYPT        = BC_BIT(3),
+       BC_OPT_LINK_OUT_ENCRYPT         = BC_BIT(29),
+} BC_SW_OPTIONS;
+
+typedef struct _BC_REG_CONFIG{
+       uint32_t                DbgOptions;
+} BC_REG_CONFIG;
+
+#if defined(__KERNEL__) || defined(__LINUX_USER__)
+#else
+/* Align data structures */
+#define ALIGN(x)       __declspec(align(x))
+#endif
+
+/* mode
+ * b[0]..b[7]  = _DtsDeviceOpenMode
+ * b[8]                =  Load new FW
+ * b[9]                =  Load file play back FW
+ * b[10]       =  Disk format (0 for HD DVD and 1 for BLU ray)
+ * b[11]-b[15] =  default output resolution
+ * b[16]       =  Skip TX CPB Buffer Check
+ * b[17]       =  Adaptive Output Encrypt/Scramble Scheme
+ * b[18]-b[31] =  reserved for future use
+ */
+
+/* To allow multiple apps to open the device. */
+enum _DtsDeviceOpenMode {
+       DTS_PLAYBACK_MODE = 0,
+       DTS_DIAG_MODE,
+       DTS_MONITOR_MODE,
+       DTS_HWINIT_MODE
+};
+
+/* To enable the filter to selectively enable/disable fixes or erratas */
+enum _DtsDeviceFixMode {
+       DTS_LOAD_NEW_FW         = BC_BIT(8),
+       DTS_LOAD_FILE_PLAY_FW   = BC_BIT(9),
+       DTS_DISK_FMT_BD         = BC_BIT(10),
+       /* b[11]-b[15] : Default output resolution */
+       DTS_SKIP_TX_CHK_CPB     = BC_BIT(16),
+       DTS_ADAPTIVE_OUTPUT_PER = BC_BIT(17),
+       DTS_INTELLIMAP          = BC_BIT(18),
+       /* b[19]-b[21] : select clock frequency */
+       DTS_PLAYBACK_DROP_RPT_MODE = BC_BIT(22),
+       DTS_DIAG_TEST_MODE = BC_BIT(23),
+       DTS_SINGLE_THREADED_MODE = BC_BIT(24),
+       DTS_FILTER_MODE = BC_BIT(25),
+       DTS_MFT_MODE = BC_BIT(26)
+};
+
+#define DTS_DFLT_RESOLUTION(x) (x<<11)
+
+#define DTS_DFLT_CLOCK(x) (x<<19)
+
+/* F/W File Version corresponding to S/W Releases */
+enum _FW_FILE_VER {
+       /* S/W release: 02.04.02        F/W release 2.12.2.0 */
+       BC_FW_VER_020402 = ((12<<16) | (2<<8) | (0))
+};
+
+/*------------------------------------------------------*
+ *    Stream Types for DtsOpenDecoder()                        *
+ *------------------------------------------------------*/
+enum _DtsOpenDecStreamTypes {
+       BC_STREAM_TYPE_ES               = 0,
+       BC_STREAM_TYPE_PES              = 1,
+       BC_STREAM_TYPE_TS               = 2,
+       BC_STREAM_TYPE_ES_TSTAMP        = 6,
+};
+
+/*------------------------------------------------------*
+ *    Video Algorithms for DtsSetVideoParams()         *
+ *------------------------------------------------------*/
+enum _DtsSetVideoParamsAlgo {
+       BC_VID_ALGO_H264                = 0,
+       BC_VID_ALGO_MPEG2               = 1,
+       BC_VID_ALGO_VC1                 = 4,
+       BC_VID_ALGO_DIVX                = 6,
+       BC_VID_ALGO_VC1MP               = 7,
+};
+
+/*------------------------------------------------------*
+ *    MPEG Extension to the PPB                                *
+ *------------------------------------------------------*/
+#define BC_MPEG_VALID_PANSCAN          (1)
+
+typedef struct _BC_PIB_EXT_MPEG {
+       uint32_t        valid;
+       /* Always valid,  defaults to picture size if no
+        * sequence display extension in the stream. */
+       uint32_t        display_horizontal_size;
+       uint32_t        display_vertical_size;
+
+       /* MPEG_VALID_PANSCAN
+        * Offsets are a copy values from the MPEG stream. */
+       uint32_t        offset_count;
+       int32_t         horizontal_offset[3];
+       int32_t         vertical_offset[3];
+
+} BC_PIB_EXT_MPEG;
+
+/*------------------------------------------------------*
+ *    H.264 Extension to the PPB                       *
+ *------------------------------------------------------*/
+/* Bit definitions for 'other.h264.valid' field */
+#define H264_VALID_PANSCAN             (1)
+#define H264_VALID_SPS_CROP            (2)
+#define H264_VALID_VUI                 (4)
+
+typedef struct _BC_PIB_EXT_H264 {
+       /* 'valid' specifies which fields (or sets of
+        * fields) below are valid.  If the corresponding
+        * bit in 'valid' is NOT set then that field(s)
+        * is (are) not initialized. */
+       uint32_t        valid;
+
+       /* H264_VALID_PANSCAN */
+       uint32_t        pan_scan_count;
+       int32_t         pan_scan_left[3];
+       int32_t         pan_scan_right[3];
+       int32_t         pan_scan_top[3];
+       int32_t         pan_scan_bottom[3];
+
+       /* H264_VALID_SPS_CROP */
+       int32_t         sps_crop_left;
+       int32_t         sps_crop_right;
+       int32_t         sps_crop_top;
+       int32_t         sps_crop_bottom;
+
+       /* H264_VALID_VUI */
+       uint32_t        chroma_top;
+       uint32_t        chroma_bottom;
+
+} BC_PIB_EXT_H264;
+
+/*------------------------------------------------------*
+ *    VC1 Extension to the PPB                         *
+ *------------------------------------------------------*/
+#define VC1_VALID_PANSCAN              (1)
+
+typedef struct _BC_PIB_EXT_VC1 {
+       uint32_t        valid;
+
+       /* Always valid, defaults to picture size if no
+        * sequence display extension in the stream. */
+       uint32_t        display_horizontal_size;
+       uint32_t        display_vertical_size;
+
+       /* VC1 pan scan windows */
+       uint32_t        num_panscan_windows;
+       int32_t         ps_horiz_offset[4];
+       int32_t         ps_vert_offset[4];
+       int32_t         ps_width[4];
+       int32_t         ps_height[4];
+
+} BC_PIB_EXT_VC1;
+
+
+/*------------------------------------------------------*
+ *    Picture Information Block                                *
+ *------------------------------------------------------*/
+#if defined(__LINUX_USER__)
+/* Values for 'pulldown' field.  '0' means no pulldown information
+ * was present for this picture. */
+enum {
+       vdecNoPulldownInfo      = 0,
+       vdecTop                 = 1,
+       vdecBottom              = 2,
+       vdecTopBottom           = 3,
+       vdecBottomTop           = 4,
+       vdecTopBottomTop        = 5,
+       vdecBottomTopBottom     = 6,
+       vdecFrame_X2            = 7,
+       vdecFrame_X3            = 8,
+       vdecFrame_X1            = 9,
+       vdecFrame_X4            = 10,
+};
+
+/* Values for the 'frame_rate' field. */
+enum {
+       vdecFrameRateUnknown = 0,
+       vdecFrameRate23_97,
+       vdecFrameRate24,
+       vdecFrameRate25,
+       vdecFrameRate29_97,
+       vdecFrameRate30,
+       vdecFrameRate50,
+       vdecFrameRate59_94,
+       vdecFrameRate60,
+       vdecFrameRate14_985,
+       vdecFrameRate7_496,
+};
+
+/* Values for the 'aspect_ratio' field. */
+enum {
+       vdecAspectRatioUnknown = 0,
+       vdecAspectRatioSquare,
+       vdecAspectRatio12_11,
+       vdecAspectRatio10_11,
+       vdecAspectRatio16_11,
+       vdecAspectRatio40_33,
+       vdecAspectRatio24_11,
+       vdecAspectRatio20_11,
+       vdecAspectRatio32_11,
+       vdecAspectRatio80_33,
+       vdecAspectRatio18_11,
+       vdecAspectRatio15_11,
+       vdecAspectRatio64_33,
+       vdecAspectRatio160_99,
+       vdecAspectRatio4_3,
+       vdecAspectRatio16_9,
+       vdecAspectRatio221_1,
+       vdecAspectRatioOther = 255,
+};
+
+/* Values for the 'colour_primaries' field. */
+enum {
+       vdecColourPrimariesUnknown = 0,
+       vdecColourPrimariesBT709,
+       vdecColourPrimariesUnspecified,
+       vdecColourPrimariesReserved,
+       vdecColourPrimariesBT470_2M = 4,
+       vdecColourPrimariesBT470_2BG,
+       vdecColourPrimariesSMPTE170M,
+       vdecColourPrimariesSMPTE240M,
+       vdecColourPrimariesGenericFilm,
+};
+
+enum {
+       vdecRESOLUTION_CUSTOM   = 0x00000000, /* custom */
+       vdecRESOLUTION_480i     = 0x00000001, /* 480i */
+       vdecRESOLUTION_1080i    = 0x00000002, /* 1080i (1920x1080, 60i) */
+       vdecRESOLUTION_NTSC     = 0x00000003, /* NTSC (720x483, 60i) */
+       vdecRESOLUTION_480p     = 0x00000004, /* 480p (720x480, 60p) */
+       vdecRESOLUTION_720p     = 0x00000005, /* 720p (1280x720, 60p) */
+       vdecRESOLUTION_PAL1     = 0x00000006, /* PAL_1 (720x576, 50i) */
+       vdecRESOLUTION_1080i25  = 0x00000007, /* 1080i25 (1920x1080, 50i) */
+       vdecRESOLUTION_720p50   = 0x00000008, /* 720p50 (1280x720, 50p) */
+       vdecRESOLUTION_576p     = 0x00000009, /* 576p (720x576, 50p) */
+       vdecRESOLUTION_1080i29_97 = 0x0000000A, /* 1080i (1920x1080, 59.94i) */
+       vdecRESOLUTION_720p59_94  = 0x0000000B, /* 720p (1280x720, 59.94p) */
+       vdecRESOLUTION_SD_DVD   = 0x0000000C, /* SD DVD (720x483, 60i) */
+       vdecRESOLUTION_480p656  = 0x0000000D, /* 480p (720x480, 60p), output bus width 8 bit, clock 74.25MHz */
+       vdecRESOLUTION_1080p23_976 = 0x0000000E, /* 1080p23_976 (1920x1080, 23.976p) */
+       vdecRESOLUTION_720p23_976  = 0x0000000F, /* 720p23_976 (1280x720p, 23.976p) */
+       vdecRESOLUTION_240p29_97   = 0x00000010, /* 240p (1440x240, 29.97p ) */
+       vdecRESOLUTION_240p30   = 0x00000011, /* 240p (1440x240, 30p) */
+       vdecRESOLUTION_288p25   = 0x00000012, /* 288p (1440x288p, 25p) */
+       vdecRESOLUTION_1080p29_97 = 0x00000013, /* 1080p29_97 (1920x1080, 29.97p) */
+       vdecRESOLUTION_1080p30  = 0x00000014, /* 1080p30 (1920x1080, 30p) */
+       vdecRESOLUTION_1080p24  = 0x00000015, /* 1080p24 (1920x1080, 24p) */
+       vdecRESOLUTION_1080p25  = 0x00000016, /* 1080p25 (1920x1080, 25p) */
+       vdecRESOLUTION_720p24   = 0x00000017, /* 720p24 (1280x720, 25p) */
+       vdecRESOLUTION_720p29_97  = 0x00000018, /* 720p29.97 (1280x720, 29.97p) */
+       vdecRESOLUTION_480p23_976 = 0x00000019, /* 480p23.976 (720*480, 23.976) */
+       vdecRESOLUTION_480p29_97  = 0x0000001A, /* 480p29.976 (720*480, 29.97p) */
+       vdecRESOLUTION_576p25   = 0x0000001B, /* 576p25 (720*576, 25p) */
+       /* For Zero Frame Rate */
+       vdecRESOLUTION_480p0    = 0x0000001C, /* 480p (720x480, 0p) */
+       vdecRESOLUTION_480i0    = 0x0000001D, /* 480i (720x480, 0i) */
+       vdecRESOLUTION_576p0    = 0x0000001E, /* 576p (720x576, 0p) */
+       vdecRESOLUTION_720p0    = 0x0000001F, /* 720p (1280x720, 0p) */
+       vdecRESOLUTION_1080p0   = 0x00000020, /* 1080p (1920x1080, 0p) */
+       vdecRESOLUTION_1080i0   = 0x00000021, /* 1080i (1920x1080, 0i) */
+};
+
+/* Bit definitions for 'flags' field */
+#define VDEC_FLAG_EOS                          (0x0004)
+
+#define VDEC_FLAG_FRAME                                (0x0000)
+#define VDEC_FLAG_FIELDPAIR                    (0x0008)
+#define VDEC_FLAG_TOPFIELD                     (0x0010)
+#define VDEC_FLAG_BOTTOMFIELD                  (0x0018)
+
+#define VDEC_FLAG_PROGRESSIVE_SRC              (0x0000)
+#define VDEC_FLAG_INTERLACED_SRC               (0x0020)
+#define VDEC_FLAG_UNKNOWN_SRC                  (0x0040)
+
+#define VDEC_FLAG_BOTTOM_FIRST                 (0x0080)
+#define VDEC_FLAG_LAST_PICTURE                 (0x0100)
+
+#define VDEC_FLAG_PICTURE_META_DATA_PRESENT    (0x40000)
+
+#endif /* __LINUX_USER__ */
+
+typedef struct _BC_PIC_INFO_BLOCK {
+       /* Common fields. */
+       uint64_t        timeStamp;      /* Timestamp */
+       uint32_t        picture_number; /* Ordinal display number  */
+       uint32_t        width;          /* pixels           */
+       uint32_t        height;         /* pixels           */
+       uint32_t        chroma_format;  /* 0x420, 0x422 or 0x444 */
+       uint32_t        pulldown;
+       uint32_t        flags;
+       uint32_t        frame_rate;
+       uint32_t        aspect_ratio;
+       uint32_t        colour_primaries;
+       uint32_t        picture_meta_payload;
+       uint32_t        sess_num;
+       uint32_t        ycom;
+       uint32_t        custom_aspect_ratio_width_height;
+       uint32_t        n_drop; /* number of non-reference frames remaining to be dropped */
+
+       /* Protocol-specific extensions. */
+       union {
+               BC_PIB_EXT_H264 h264;
+               BC_PIB_EXT_MPEG mpeg;
+               BC_PIB_EXT_VC1   vc1;
+       } other;
+
+} BC_PIC_INFO_BLOCK, *PBC_PIC_INFO_BLOCK;
+
+/*------------------------------------------------------*
+ *    ProcOut Info                                     *
+ *------------------------------------------------------*/
+/* Optional flags for ProcOut Interface.*/
+enum _POUT_OPTIONAL_IN_FLAGS_{
+       /* Flags from App to Device */
+       BC_POUT_FLAGS_YV12        = 0x01,       /* Copy Data in YV12 format */
+       BC_POUT_FLAGS_STRIDE      = 0x02,       /* Stride size is valid. */
+       BC_POUT_FLAGS_SIZE        = 0x04,       /* Take size information from Application */
+       BC_POUT_FLAGS_INTERLACED  = 0x08,       /* copy only half the bytes */
+       BC_POUT_FLAGS_INTERLEAVED = 0x10,       /* interleaved frame */
+       BC_POUT_FLAGS_STRIDE_UV   = 0x20,       /* Stride size is valid (for UV buffers). */
+       BC_POUT_FLAGS_MODE        = 0x40,       /* Take output mode from Application, overrides YV12 flag if on */
+
+       /* Flags from Device to APP */
+       BC_POUT_FLAGS_FMT_CHANGE  = 0x10000,    /* Data is not VALID when this flag is set */
+       BC_POUT_FLAGS_PIB_VALID   = 0x20000,    /* PIB Information valid */
+       BC_POUT_FLAGS_ENCRYPTED   = 0x40000,    /* Data is encrypted. */
+       BC_POUT_FLAGS_FLD_BOT     = 0x80000,    /* Bottom Field data */
+};
+
+//Decoder Capability
+enum DECODER_CAP_FLAGS
+{
+       BC_DEC_FLAGS_H264               = 0x01,
+       BC_DEC_FLAGS_MPEG2              = 0x02,
+       BC_DEC_FLAGS_VC1                = 0x04,
+       BC_DEC_FLAGS_M4P2               = 0x08, //MPEG-4 Part 2: Divx, Xvid etc.
+};
+
+#if defined(__KERNEL__) || defined(__LINUX_USER__)
+typedef BC_STATUS(*dts_pout_callback)(void  *shnd, uint32_t width, uint32_t height, uint32_t stride, void *pOut);
+#else
+typedef BC_STATUS(*dts_pout_callback)(void  *shnd, uint32_t width, uint32_t height, uint32_t stride, struct _BC_DTS_PROC_OUT *pOut);
+#endif
+
+/* Line 21 Closed Caption */
+/* User Data */
+#define MAX_UD_SIZE            1792    /* 1920 - 128 */
+
+typedef struct _BC_DTS_PROC_OUT {
+       uint8_t         *Ybuff;                 /* Caller Supplied buffer for Y data */
+       uint32_t        YbuffSz;                /* Caller Supplied Y buffer size */
+       uint32_t        YBuffDoneSz;            /* Transferred Y datasize */
+
+       uint8_t         *UVbuff;                /* Caller Supplied buffer for UV data */
+       uint32_t        UVbuffSz;               /* Caller Supplied UV buffer size */
+       uint32_t        UVBuffDoneSz;           /* Transferred UV data size */
+
+       uint32_t        StrideSz;               /* Caller supplied Stride Size */
+       uint32_t        PoutFlags;              /* Call IN Flags */
+
+       uint32_t        discCnt;                /* Picture discontinuity count */
+
+       BC_PIC_INFO_BLOCK PicInfo;              /* Picture Information Block Data */
+
+       /* Line 21 Closed Caption */
+       /* User Data */
+       uint32_t        UserDataSz;
+       uint8_t         UserData[MAX_UD_SIZE];
+
+       void            *hnd;
+       dts_pout_callback AppCallBack;
+       uint8_t         DropFrames;
+       uint8_t         b422Mode;               /* Picture output Mode */
+       uint8_t         bPibEnc;                /* PIB encrypted */
+       uint8_t         bRevertScramble;
+       uint32_t        StrideSzUV;             /* Caller supplied Stride Size */
+
+} BC_DTS_PROC_OUT;
+
+typedef struct _BC_DTS_STATUS {
+       uint8_t         ReadyListCount; /* Number of frames in ready list (reported by driver) */
+       uint8_t         FreeListCount;  /* Number of frame buffers free.  (reported by driver) */
+       uint8_t         PowerStateChange; /* Number of active state power transitions (reported by driver) */
+       uint8_t         reserved_[1];
+
+       uint32_t        FramesDropped;  /* Number of frames dropped.  (reported by DIL) */
+       uint32_t        FramesCaptured; /* Number of frames captured. (reported by DIL) */
+       uint32_t        FramesRepeated; /* Number of frames repeated. (reported by DIL) */
+
+       uint32_t        InputCount;     /* Times compressed video has been sent to the HW.
+                                        * i.e. Successful DtsProcInput() calls (reported by DIL) */
+       uint64_t        InputTotalSize; /* Amount of compressed video that has been sent to the HW.
+                                        * (reported by DIL) */
+       uint32_t        InputBusyCount; /* Times compressed video has attempted to be sent to the HW
+                                        * but the input FIFO was full. (reported by DIL) */
+
+       uint32_t        PIBMissCount;   /* Amount of times a PIB is invalid. (reported by DIL) */
+
+       uint32_t        cpbEmptySize;   /* supported only for H.264, specifically changed for
+                                        * SingleThreadedAppMode. Report size of CPB buffer available.
+                                        * Reported by DIL */
+       uint64_t        NextTimeStamp;  /* TimeStamp of the next picture that will be returned
+                                        * by a call to ProcOutput. Added for SingleThreadedAppMode.
+                                        * Reported back from the driver */
+       uint8_t         TxBufData;
+
+       uint8_t         reserved__[3];
+
+       uint32_t        picNumFlags; /* Picture number and flags of the next picture to be delivered from the driver */
+
+       uint8_t         reserved___[8];
+
+} BC_DTS_STATUS;
+
+#define BC_SWAP32(_v)                  \
+       ((((_v) & 0xFF000000)>>24)|     \
+         (((_v) & 0x00FF0000)>>8)|     \
+         (((_v) & 0x0000FF00)<<8)|     \
+         (((_v) & 0x000000FF)<<24))
+
+#define WM_AGENT_TRAYICON_DECODER_OPEN 10001
+#define WM_AGENT_TRAYICON_DECODER_CLOSE        10002
+#define WM_AGENT_TRAYICON_DECODER_START        10003
+#define WM_AGENT_TRAYICON_DECODER_STOP 10004
+#define WM_AGENT_TRAYICON_DECODER_RUN  10005
+#define WM_AGENT_TRAYICON_DECODER_PAUSE        10006
+
+#define MAX_COLOR_SPACES       3
+
+typedef enum _BC_OUTPUT_FORMAT {
+       MODE420                 = 0x0,
+       MODE422_YUY2            = 0x1,
+       MODE422_UYVY            = 0x2,
+       OUTPUT_MODE420          = 0x0,
+       OUTPUT_MODE422_YUY2     = 0x1,
+       OUTPUT_MODE422_UYVY     = 0x2,
+       OUTPUT_MODE420_NV12     = 0x0,
+       OUTPUT_MODE_INVALID     = 0xFF,
+} BC_OUTPUT_FORMAT;
+
+typedef struct _BC_COLOR_SPACES_ {
+       BC_OUTPUT_FORMAT        OutFmt[MAX_COLOR_SPACES];
+       uint16_t                Count;
+} BC_COLOR_SPACES;
+
+
+typedef enum _BC_CAPS_FLAGS_ {
+       PES_CONV_SUPPORT        = 1,    /*Support PES Conversion*/
+       MULTIPLE_DECODE_SUPPORT = 2     /*Support multiple stream decode*/
+} BC_CAPS_FLAGS;
+
+typedef struct _BC_HW_CAPABILITY_ {
+       BC_CAPS_FLAGS           flags;
+       BC_COLOR_SPACES         ColorCaps;
+       void*                   Reserved1;      /* Expansion Of API */
+
+       //Decoder Capability
+       uint32_t                DecCaps;        //DECODER_CAP_FLAGS
+} BC_HW_CAPS, *PBC_HW_CAPS;
+
+typedef struct _BC_SCALING_PARAMS_ {
+       uint32_t        sWidth;
+       uint32_t        sHeight;
+       uint32_t        DNR;
+       uint32_t        Reserved1;      /*Expansion Of API*/
+       uint8_t         *Reserved2;     /*Expansion OF API*/
+       uint32_t        Reserved3;      /*Expansion Of API*/
+       uint8_t         *Reserved4;     /*Expansion Of API*/
+
+} BC_SCALING_PARAMS, *PBC_SCALING_PARAMS;
+
+typedef enum _BC_MEDIA_SUBTYPE_ {
+       BC_MSUBTYPE_INVALID = 0,
+       BC_MSUBTYPE_MPEG1VIDEO,
+       BC_MSUBTYPE_MPEG2VIDEO,
+       BC_MSUBTYPE_H264,
+       BC_MSUBTYPE_WVC1,
+       BC_MSUBTYPE_WMV3,
+       BC_MSUBTYPE_AVC1,
+       BC_MSUBTYPE_WMVA,
+       BC_MSUBTYPE_VC1,
+       BC_MSUBTYPE_DIVX,
+       BC_MSUBTYPE_DIVX311,
+       BC_MSUBTYPE_OTHERS      /*Types to facilitate PES conversion*/
+} BC_MEDIA_SUBTYPE;
+
+typedef struct _BC_INPUT_FORMAT_ {
+       BOOL        FGTEnable;      /*Enable processing of FGT SEI*/
+       BOOL        MetaDataEnable; /*Enable retrieval of picture metadata to be sent to video pipeline.*/
+       BOOL        Progressive;    /*Instruct decoder to always try to send back progressive
+                                    frames. If input content is 1080p, the decoder will
+                                    ignore pull-down flags and always give 1080p output.
+                                    If 1080i content is processed, the decoder will return
+                                    1080i data. When this flag is not set, the decoder will
+                                    use pull-down information in the input stream to decide
+                                    the decoded data format.*/
+       uint32_t    OptFlags;       /*In this field bits 0:3 are used pass default frame rate, bits 4:5 are for operation mode
+                                    (used to indicate Blu-ray mode to the decoder) and bit 6 is for the flag mpcOutPutMaxFRate
+                                    which when set tells the FW to output at the max rate for the resolution and ignore the
+                                    frame rate determined from the stream. Bit 7 is set to indicate that this is single threaded
+                                    mode and the driver will be peeked to get timestamps ahead of time*/
+       BC_MEDIA_SUBTYPE mSubtype;  /* Video Media Type*/
+       uint32_t    width;
+       uint32_t    height;
+       uint32_t    startCodeSz;    /*Start code size for H264 clips*/
+       uint8_t     *pMetaData;     /*Metadata buffer that is used to pass sequence header*/
+       uint32_t    metaDataSz;     /*Metadata size*/
+       uint8_t     bEnableScaling;
+       BC_SCALING_PARAMS ScalingParams;
+} BC_INPUT_FORMAT;
+
+typedef struct _BC_INFO_CRYSTAL_ {
+       uint8_t device;
+       union {
+               struct {
+                       uint32_t dilRelease:8;
+                       uint32_t dilMajor:8;
+                       uint32_t dilMinor:16;
+               };
+               uint32_t version;
+       } dilVersion;
+
+       union {
+               struct {
+                       uint32_t drvRelease:4;
+                       uint32_t drvMajor:8;
+                       uint32_t drvMinor:12;
+                       uint32_t drvBuild:8;
+               };
+               uint32_t version;
+       } drvVersion;
+
+       union {
+               struct {
+                       uint32_t fwRelease:4;
+                       uint32_t fwMajor:8;
+                       uint32_t fwMinor:12;
+                       uint32_t fwBuild:8;
+               };
+               uint32_t version;
+       } fwVersion;
+
+       uint32_t Reserved1; // For future expansion
+       uint32_t Reserved2; // For future expansion
+} BC_INFO_CRYSTAL, *PBC_INFO_CRYSTAL;
+
+#endif /* _BC_DTS_DEFS_H_ */
diff --git a/tools/depends/target/libcrystalhd/libcrystalhd/bc_dts_types.h b/tools/depends/target/libcrystalhd/libcrystalhd/bc_dts_types.h
new file mode 100644 (file)
index 0000000..a0b9ca5
--- /dev/null
@@ -0,0 +1,68 @@
+/********************************************************************
+ * Copyright(c) 2006-2009 Broadcom Corporation.
+ *
+ *  Name: bc_dts_types.h
+ *
+ *  Description: Data types
+ *
+ *  AU
+ *
+ *  HISTORY:
+ *
+ ********************************************************************
+ * This header is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License.
+ *
+ * This header is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this header.  If not, see <http://www.gnu.org/licenses/>.
+ *******************************************************************/
+
+#ifndef _BC_DTS_TYPES_H_
+#define _BC_DTS_TYPES_H_
+
+#ifdef __LINUX_USER__  /* Don't include these for KERNEL.. */
+#include <stdint.h>
+#endif
+
+#ifndef PVOID
+typedef void   *PVOID;
+#endif
+
+#ifndef BOOL
+typedef int    BOOL;
+#endif
+
+#ifdef __LINUX_USER__  /* Don't include these for KERNEL */
+typedef uint32_t       ULONG;
+typedef int32_t                LONG;
+typedef void           *HANDLE;
+#ifndef VOID
+typedef void           VOID;
+#endif
+typedef void           *LPVOID;
+typedef uint32_t       DWORD;
+typedef uint32_t       UINT32;
+typedef uint32_t       *LPDWORD;
+typedef unsigned char  *PUCHAR;
+
+#ifndef TRUE
+       #define TRUE            1
+#endif
+
+#ifndef FALSE
+       #define FALSE           0
+#endif
+
+#else /* !__LINUX_USER__ */
+
+/* For Kernel usage.. */
+typedef bool   bc_bool_t;
+#endif /* __LINUX_USER__ */
+
+#endif
+
diff --git a/tools/depends/target/libcrystalhd/libcrystalhd/libcrystalhd_if.h b/tools/depends/target/libcrystalhd/libcrystalhd/libcrystalhd_if.h
new file mode 100644 (file)
index 0000000..45fa7a6
--- /dev/null
@@ -0,0 +1,1515 @@
+/*****************************************************************************
+ * Copyright(c) 2006-2009 Broadcom Corporation.
+ *
+ *  Name: libcrystalhd_if.h
+ *
+ *  Description: Device Interface Library API.
+ *
+ *  AU
+ *
+ *  HISTORY:
+ *
+ *****************************************************************************
+ *
+ * This file is part of libcrystalhd.
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ ****************************************************************************/
+
+#ifndef _BCM_LDIL_IF_H_
+#define _BCM_LDIL_IF_H_
+
+#include "bc_dts_defs.h"
+
+#define FLEA_MAX_TRICK_MODE_SPEED      6
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*****************************************************************************
+******************************************************************************
+
+                            Theory of operation
+
+
+    The Device Interface Library (DIL) allows application level code, such
+as a DirectShow filter, to access the Broadcom CrystalHD decoder driver to 
+provide hardware decoding for MPEG-2, H.264 (AVC) and VC-1 streams.
+
+    In the Microsoft DirectShow system, the overall system graph would look 
+like the following:
+
++--------+  +---------------+  +---------------+  +--------------------+
+| Source |->| Demultiplexer |->| Audio decoder |->| DirectSound Device |
++--------+  +---------------+  +---------------+  +--------------------+
+                    |
+                    |  +-------------------------+  +----------------+
+                    +->| Broadcom decoder filter |->| Video Renderer |
+                       +-------------------------+  +----------------+
+                                  |    |  
+                            +----------------+
+                            |  Broadcom DIL  |
+                            +----------------+
+                                  |    |
+                            +-----------------+
+                            | Broadcom Driver |
+                            +-----------------+
+
+    From the view of the caller, the DIL will accept compressed video streams
+and will output decoded video frames or fields to seperate Y and UV buffers.
+The DIL is responsible solely for decoding video and has no responsibilities
+for audio nor for rendering, as shown in the above diagram.  Audio/video
+sychronization is assisted by feeding the DIL with timestamps so that it
+may pass those timestamps along with the decoded video.  The timestamped
+output video will then be presented at the appropriate time by the renderer.
+
+A minimal implementation would be:
+
+    HANDLE              hBRCMhandle;
+    uint8_t             input_buffer[INPUT_SIZE];
+    uint8_t             y_output_buffer[WIDTH*HEIGHT];
+    uint8_t             uv_output_buffer[WIDTH*HEIGHT];
+    BC_DTS_PROC_OUT     sProcOutData = { fill in your values here };
+    BC_PIC_INFO_BLOCK   sPIB = { fill in your values here };
+
+    // Acquire handle for device.
+    DtsDeviceOpen(&hBRCMhandle, 0);
+     
+    // Elemental stream.
+    DtsOpenDecoder(hBRCMhandle, 0);
+    
+    // H.264, Enable FGT SEI, do not parse metadata, no forced progressive out
+    DtsSetVideoParams(hBRCMhandle,0,1,0,0,0);
+
+    // Tell decoder to wait for input from host. (PC)
+    DtsStartDecoder(hBRCMhandle);       
+
+    // Input buffer address, input buffer size, no timestamp, Unencrypted
+    DtsProcInput(hBRCMhandle,input_buffer,sizeof(input_buffer),0,0);
+
+    // Tell PC to wait for data from decoder.
+    DtsStartCapture(hBRCMhandle);       
+
+    // 16ms timeout, pass pointer to PIB then get the decoded picture.
+    DtsProcOutput(hBRCMhandle,16,&sPIB);
+
+    // Stop the decoder.
+    DtsStopDecoder(hBRCMhandle);
+
+    // Close the decoder
+    DtsCloseDecoder(hBRCMhandle);
+
+    // Release handle for device.
+    DtsDeviceClose(hBRCMhandle);
+
+******************************************************************************
+*****************************************************************************/
+
+#define DRVIFLIB_API
+
+/*****************************************************************************
+Function name:
+
+    DtsDeviceOpen
+
+Description:
+
+    Opens a handle to the decoder device that will be used to address that
+    unique instance of the decoder for all subsequent operations.
+
+    Must be called once when the application opens the decoder for use.
+
+Parameters:
+
+    *hDevice    Pointer to device handle that will be filled in after the
+                device is successfully opened. [OUTPUT]
+
+    mode        Controls the mode in which the device is opened.
+                Currently only mode 0 (normal playback) is supported.
+                All other values will return BC_STS_INV_ARG.
+
+Return:
+
+    Returns BC_STS_SUCCESS or error codes as appropriate.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsDeviceOpen(
+    HANDLE   *hDevice,
+    uint32_t mode
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsDeviceClose
+
+Description:
+
+    Close the handle to the decoder device.
+
+    Must be called once when the application closes the decoder after use.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen
+
+Return:
+
+    Returns BC_STS_SUCCESS or error codes as appropriate.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsDeviceClose(
+    HANDLE hDevice
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsGetVersion
+
+Description:
+
+    Get version information from the driver as well as API library.
+    Version numbers are maintained in <Major>.<Minor>.<Revision> format.
+    Example ?01.23.4567
+
+    The device must have been previously opened for this call to succeed.
+    The individual components of the revision number are available as follows:
+
+    o Major     (8 Bits) : Bit 31 ?24
+    o Minor     (8 Bits) : Bit 23 ?16
+    o Revision (16 Bits) : Bits 15 ?Bit 0.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen
+    DrVer       Device driver version
+    DilVer      Driver interface library version
+
+Return:
+    The revision numbers from the currently loaded driver as well as the
+    driver interface API library.
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsGetVersion(
+    HANDLE   hDevice,
+    uint32_t *DrVer,
+    uint32_t *DilVer
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsGetFWVersionFromFile
+
+Description:
+
+    Get version information from the Firmware Bin file when FW is not running
+    Version numbers in FW are maintained in <Major>.<Minor>.<Spl Revision> format.
+    the return value will be of the format:
+    (Major << 16) | (Minor<<8) | Spl_rev ?012345
+
+    The individual components of the revision number are available as follows:
+
+    o Major     (8 Bits) : Bit 24 ?16
+    o Minor     (8 Bits) : Bit 16 ?8
+    o Revision (16 Bits) : Bits 8 ?0.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen
+    StreamVer   Stream FW version
+    DecVer      VDEC FW version
+    Rsvd        Reserved for future use
+
+Return:
+    The Stream FW Version umbers from the FW bin file in the install directory
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsGetFWVersionFromFile(
+    HANDLE   hDevice,
+    uint32_t *StreamVer,
+    uint32_t *DecVer,
+    char     *fname
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsGetFWVersion
+
+Description:
+
+    Get version information from the Firmware. The version information is obtained
+    from Bin file when the flag is not set. When the flag is set, a FW command is
+    issued to get the version numbers.
+    Version numbers in FW are maintained in <Major>.<Minor>.<Spl Revision> format.
+    Version number will be returned in the following format
+    (Major << 16) | (Minor<<8) | Spl_rev ?012345
+
+    The individual components of the revision number are available as follows:
+
+    o Major     (8 Bits) : Bit 24 ?16
+    o Minor     (8 Bits) : Bit 16 ?8
+    o Revision (16 Bits) : Bits 8 ?Bit 0.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen
+    StreamVer   Stream FW version
+    DecVer      VDEC FW version
+    HwVer       Hardware version
+    Rsvd        Reserved for future use
+    flag        Reseved for future use
+
+Return:
+    The Stream FW Version number, VDEC FW version and Hwrev
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsGetFWVersion(
+    HANDLE   hDevice,
+    uint32_t *StreamVer,
+    uint32_t *DecVer,
+    uint32_t *HwVer,
+    char     *fname,
+    uint32_t flag
+    );
+
+
+/*****************************************************************************
+
+Function name:
+
+    DtsOpenDecoder
+
+Description:
+
+    Open the decoder for playback operations and sets appropriate parameters
+    for decode of input video data.
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+    StreamType  Currently supported streams are:
+                        Elementary Streams with no timestamp management (0)
+                        Transport Streams (2)
+                        Elementary Streams with timestamp management (6)
+                All other values will return BC_STS_INV_ARG.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsOpenDecoder(
+    HANDLE   hDevice,
+    uint32_t StreamType
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsCloseDecoder
+
+Description:
+
+    Close the decoder. No further pictures will be produced and all input
+    will be ignored.
+
+    The device must have been previously opened for this call to succeed.
+    This function closes the decoder and cleans up the state of the driver
+    and the library. All pending pictures will be dropped and all outstanding
+    transfers to and from the decoder will be aborted.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsCloseDecoder(
+    HANDLE hDevice
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsStartDecoder
+
+Description:
+
+    Start the actual processing of input data. Before this command the
+    decoder will ignore all of the presented input data.
+
+    DtsOpenDecoder must always be followed by a DtsStartDecoder for the
+    decoder to start processing input data. The device must have been
+    previously opened for this call to succeed. In addition the video
+    parameters for codec must have been set via a call to DtsSetVideoParams.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsStartDecoder(
+    HANDLE hDevice
+    );
+
+
+/*****************************************************************************
+
+Function name:
+
+    DtsSetVideoParams
+
+Description:
+
+    Sets various codec parameters that would be used by a subsequent call
+    to DtsStartDecoder.
+
+    DtsSetVideoParams must always be called before DtsStartDecoder for the
+    decoder to start processing input data. The device must have been
+    previously opened for this call to succeed.
+
+Parameters:
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+    videoAlg        Video Codec to be enabled to decode stream.
+                    H.264 (0), VC-1 (4) and MPEG-2 (1) currently supported.
+                    All other values will return BC_STS_INV_ARG
+    FGTEnable       Enable processing of FGT SEI.
+    MetaDataEnable  Enable retrieval of picture metadata to be sent to video
+                    pipeline.
+    Progressive     Instruct decoder to always try to send back progressive
+                    frames. If input content is 1080p, the decoder will
+                    ignore pull-down flags and always give 1080p output.
+                    If 1080i content is processed, the decoder will return
+                    1080i data. When this flag is not set, the decoder will
+                    use pull-down information in the input stream to decide
+                    the decoded data format.
+    OptFlags        In this field bits 0:3 are used pass default frame rate,
+                    bits 4:5 are for operation mode (used to indicate Blu-ray
+                    mode to the decoder) and bit 6 is for the flag mpcOutPutMaxFRate
+                    which when set tells the FW to output at the max rate for the
+                    resolution and ignore the frame rate determined from the
+                    stream. Bit 7 is set to indicate that this is single threaded mode
+                    and the driver will be peeked to get timestamps ahead of time.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsSetVideoParams(
+    HANDLE   hDevice,
+    uint32_t videoAlg,
+    BOOL     FGTEnable,
+    BOOL     MetaDataEnable,
+    BOOL     Progressive,
+    uint32_t OptFlags
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsSetInputFormat
+    
+Description:
+
+    Sets input video's various parameters that would be used by a subsequent call
+    to DtsStartDecoder.
+
+    DtsSetInputFormat must always be called before DtsStartDecoder for the
+    decoder to start processing input data. The device must have been
+    previously opened for this call to succeed.
+
+Parameters:
+    hDevice         Handle to device. This is obtained via a prior call to DtsDeviceOpen.
+    pInputFormat Pointer to the BC_INPUT_FORMAT data.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS 
+DtsSetInputFormat(
+    HANDLE                     hDevice,
+    BC_INPUT_FORMAT   *pInputFormat
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsGetVideoParams
+
+Description:
+
+    Returns various codec parameters that would be used by a subsequent call
+    to DtsStartDecoder. These parameters are either default values or were
+    set via a prior call to DtsSetVideoParams
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+    *videoAlg       See DtsSetVideoParams. [OUTPUT]
+    *FGTEnable      See DtsSetVideoParams. [OUTPUT]
+    *MetaDataEnable See DtsSetVideoParams. [OUTPUT]
+    *Progressive    See DtsSetVideoParams. [OUTPUT]
+    Reserved        This field is reserved for possible future expansion.
+                    Set to 0.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsGetVideoParams(
+    HANDLE   hDevice,
+    uint32_t *videoAlg,
+    BOOL     *FGTEnable,
+    BOOL     *MetaDataEnable,
+    BOOL     *Progressive,
+    uint32_t Reserved
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsFormatChange
+
+Description:
+
+    Changes codec type and parameters.
+
+    The device must have been previously opened for this call to succeed.
+    This function should be used only for mid-stream format changes.
+    DtsStartDecoder must have been called before for this function to succeed.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+    videoAlg    Video Codec to be enabled to decode stream.
+                H.264 (0), VC-1 (4) and MPEG-2 (1) currently supported. All
+                other values will return BC_STS_INV_ARG
+    FGTEnable   Enable processing of FGT SEI.
+    Progressive Instruct decoder to always try to send back progressive
+                frames. If input content is 1080p, the decoder will ignore
+                pull-down flags and always give 1080p output. If 1080i
+                content is processed, the decoder will return 1080i data.
+                When this flag is not set, the decoder will use pull-down
+                information in the input stream to decide the decoded data
+                format.
+    Reserved    This field is reserved for possible future expansion.
+                Set to 0.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsFormatChange(
+    HANDLE   hDevice,
+    uint32_t videoAlg,
+    BOOL     FGTEnable,
+    BOOL     MetaDataEnable,
+    BOOL     Progressive,
+    uint32_t Reserved
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsStopDecoder
+
+Description:
+
+    Stop the decoder.
+
+    The device must have been previously opened for this call to succeed.
+    This function will clean up any pending operations and stop the decoder.
+    Internal state is still maintained and the decoder can be restarted.
+    Any pending pictures will be dropped.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsStopDecoder(
+    HANDLE hDevice
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsPauseDecoder
+
+Description:
+
+    Pause the decoder. The paused picture will be repeated by decoder.
+
+    The device must have been previously opened for this call to succeed.
+    In addition the decoder must have been started as well. If the decoder
+    is open but not started, this function will return BC_STS_DEC_NOT_STARTED.
+    If the decoder has not been opened this function will return
+    BC_STS_DEC_NOT_OPEN.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsPauseDecoder(
+    HANDLE hDevice
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsResumeDecoder
+
+Description:
+
+    Unpause the decoder from a previous paused condition.
+
+    The device must have been previously opened for this call to succeed.
+    If the decoder was not paused previously, this function will return
+    without affecting the decoder with a BC_STS_SUCCESS status. If the
+    decoder is open but not started, this function will return
+    BC_STS_DEC_NOT_STARTED.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsResumeDecoder(
+    HANDLE  hDevice
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsSetVideoPID
+    
+Description:
+
+    Sets the video PID in the input Transport Stream that the decoder
+    needs to process.
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice Handle to device. This is obtained via a prior call to
+            DtsDeviceOpen.
+    PID     PID value that decoder needs to process.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS 
+DtsSetVideoPID(
+    HANDLE    hDevice,
+    uint32_t  pid
+    );
+
+
+/*****************************************************************************
+
+Function name:
+
+    StartCaptureImmidiate
+    
+Description:
+
+    Instruct the driver to start capturing decoded frames for output.
+
+    The device must have been previously opened for this call to succeed.
+    This function must be called before the first call to DtsProcInput.
+    This function instructs the receive path in the driver to start waiting
+    for valid data to be presented from the decoder.
+
+Parameters:
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS 
+DtsStartCaptureImmidiate(
+    HANDLE    hDevice,
+    uint32_t  Reserved
+    );
+
+
+/*****************************************************************************
+
+Function name:
+
+    StartCapture
+
+Description:
+
+    Instruct the driver to start capturing decoded frames for output.
+
+    The device must have been previously opened for this call to succeed.
+    This function must be called before the first call to DtsProcInput.
+    This function instructs the receive path in the driver to start waiting
+    for valid data to be presented from the decoder.
+
+Parameters:
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsStartCapture(
+    HANDLE hDevice
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    FlushRxCapture
+
+Description:
+
+    ***This function is deprecated and is for temporary use only.***
+
+    Flush the driverís queue of pictures and stops the capture process. These
+    functions will be replaced with automatic Stop (End of Sequence) detection.
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsFlushRxCapture(
+    HANDLE hDevice,
+    BOOL   bDiscardOnly
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsProcOutput
+
+Description:
+
+    Returns one decoded picture to the caller.
+
+    The device must have been previously opened for this call to succeed.
+
+    == NOTE ====
+        For PIB AND 100% output encryption/scrambling on Bcm LINK hardware
+    use ProcOutputNoCopy() Interace. This interface will not support
+    PIB encryption.
+
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+    milliSecWait    Timeout parameter. DtsProcOutput will fail is no picture
+                    is received in this time.
+    *pOut           This is a pointer to the BC_DTS_PROC_OUT structure that is
+                    allocated by the caller. The decoded picture is returned
+                    in this structure. This structure is described in the
+                    data structures section. The actual data buffer to be
+                    filled with the decoded data is allocated by the caller.
+                    Data is copied from the decoder to the buffers before this
+                    function returns. [INPUT/OUTPUT]
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsProcOutput(
+    HANDLE   hDevice,
+    uint32_t milliSecWait,
+    BC_DTS_PROC_OUT *pOut
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsProcOutputNoCopy
+
+Description:
+
+    Returns one decoded picture to the caller. Functionality of this API()
+    is very similar to ProcOutPut() API. This API will not copy the video data
+    to caller's buffers but provides the source buffer pointers in pOut structure.
+
+    This is more secure and preferred method for BCM's Link hardware. The actual
+    format conversion/copy routines are provided as part of the Filter/Security
+    layer source code. Using this method, all the clear data handling will be
+    done by bcmDFilter or bcmSec layers which are expected to be in Player's
+    tamper resistant area.
+
+    == NOTE ====
+     1) DtsReleaseOutputBuffs() interface must be called to release the buffers
+        back to DIL if return Status is BC_STS_SUCCESS.
+
+     2) Only this interface supports PIB and full 100% output encryption/Scrambling.
+
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+    milliSecWait    Timeout parameter. DtsProcOoutput will fail is no picture
+                    is received in this time.
+    *pOut           This is a pointer to the BC_DTS_PROC_OUT structure that is
+                    allocated by the caller. The decoded picture is returned
+                    in this structure.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsProcOutputNoCopy(
+    HANDLE   hDevice,
+    uint32_t milliSecWait,
+    BC_DTS_PROC_OUT *pOut
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsReleaseOutputBuffs
+
+Description:
+
+    Release Buffers acquired during ProcOutputNoCopy() interface.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+    Reserved        Reserved. Set to NULL.
+
+    fChange         FALSE.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsReleaseOutputBuffs(
+    HANDLE hDevice,
+    PVOID  Reserved,
+    BOOL   fChange
+    );
+
+
+/*****************************************************************************
+
+Function name:
+
+    DtsProcInput
+
+Description:
+
+    Sends compressed (coded) data to the decoder for processing.
+
+    The device must have been previously opened for this call to succeed.
+    In addition, suitable keys must have been exchanged for decryption and
+    decode to be successful.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+    pUserData   Pointer to data buffer that holds the data to be transferred.
+                [INPUT]
+    sizeInBytes Size in Bytes of data available to be sent to the decoder for
+                processing.
+    Timestamp   Optional timestamp information attached to the media sample
+                that is available in the buffer. If timestamp is present
+                (i.e. non-zero), then this will be reflected in the output
+                sample (picture) produced from the contents of this buffer.
+                               Timestamp should be in units of 100 ns.
+    Encrypted   Flag to indicate that the data transfer is not in the clear
+                and that the decoder needs to decrypt before it can decode
+                the data.  Note that due to complexity, it is preferred that
+                the application writer uses the higher level
+                dts_pre_proc_input() call if encypted content will be sent.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsProcInput(
+    HANDLE   hDevice,
+    uint8_t  *pUserData,
+    uint32_t ulSizeInBytes,
+    uint64_t timeStamp,
+    BOOL     encrypted
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsGetColorPrimaries
+
+Description:
+
+    Returns color primaries information from the stream being processed.
+
+    The device must have been previously opened for this call to succeed.
+    In addition at least one picture must have been successfully decoded and
+    returned back from the decoder.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+    colorPrimaries  Pointer to U32 to receive the color primaries information.
+                    The values returned are described in the previous section
+                    regarding the picture metadata. [OUTPUT]
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsGetColorPrimaries(
+    HANDLE    hDevice,
+    uint32_t  *colorPrimaries
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsFlushInput
+
+Description:
+
+    Flushes the current channel and causes the decoder to stop accessing input
+    data.  Based on the flush mode parameter, the channel will be flushed from
+    the current point in the input data or from the current processing point.
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+    Mode            0   Flush at the current input point. use to drain the
+                        input FIFO . All the data that has been received will
+                        be decoded.
+                    1   Flush at the current processing point. All the decoded
+                        frames will be presented but no more data from the
+                        input will be decoded.
+                    2   Flushes all the decoder buffers, input, decoded and
+                        to be decoded.
+                    3   Cancels the pending TX Request from the DIL/driver
+                                       4       Flushes all the decoder buffers, input, decoded and
+                                               to be decoded data. Also flushes the drivers buffers
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsFlushInput(
+    HANDLE   hDevice,
+    uint32_t Mode
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsSetRateChange
+
+Description:
+
+    Sets the decoder playback speed and direction of playback.
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+    rate            Inverse of speed x 10000.
+                    Examples:
+                        1/2x playback speed = 20000
+                        1x   playback speed = 10000
+                        2x   playback speed = 5000
+
+    direction       Playback direction.
+                    0   Forward direction.
+                    1   Reverse direction.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsSetRateChange(
+    HANDLE   hDevice,
+    uint32_t rate,
+    uint8_t  direction
+    );
+
+
+//Set FF Rate for Catching Up
+/*****************************************************************************
+
+Function name:
+
+    DtsSetFFRate
+
+Description:
+
+    Sets the decoder playback FF speed
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+    rate            Inverse of speed x 10000.
+                    Examples:
+                        1/2x playback speed = 20000
+                        1x   playback speed = 10000
+                        2x   playback speed = 5000
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsSetFFRate(
+    HANDLE   hDevice,
+    uint32_t rate
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsSetSkipPictureMode
+
+Description:
+
+    This command sets the decoder to only decode selected picture types.
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+
+    SkipMode        0   IPB, All pictures are decoded.
+
+                    1   IP decoding, This mode skips all non reference pictures.
+
+                    2   I decoding, This mode skips all P/B pictures and only decodes
+                        I pictures.
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsSetSkipPictureMode(
+    HANDLE   hDevice,
+    uint32_t SkipMode
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsSetIFrameTrickMode
+
+Description:
+
+    This command sets the decoder to decode only I Frames for FF and FR.
+
+    Use this API for I Frame only trick mode play back in either direction. The
+    application/Up stream filter  determines the speed of the playback by
+    means of Skip on the input compressed data.
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsSetIFrameTrickMode(
+    HANDLE hDevice
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsStepDecoder
+
+Description:
+
+    This function forwards one frame.
+
+    The device must have been opened must be in paused
+    state previously for this call to succeed.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsStepDecoder(
+    HANDLE hDevice
+    );
+
+
+/*****************************************************************************
+
+Function name:
+
+    DtsIs422Supported
+
+Description:
+
+    This function returns whether 422 YUV mode is supported or not.
+
+    The device must have been opened previously for this call to succeed.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+    bSupported  1 - 422 is supported
+                0 - 422 is not supported.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsIs422Supported(
+    HANDLE  hDevice,
+    uint8_t *bSupported
+    );
+
+/*****************************************************************************
+
+Function name:
+
+     DtsSetColorSpace    
+    
+Description:
+
+    This function sets the output sample's color space.
+
+    The device must have been opened previously and must support 422 mode for
+    this call to succeed.
+
+    Use "DtsIs422Supported" to find whether 422 mode is supported.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+    422Mode     Mode is defined by BC_OUTPUT_FORMAT as follows -
+                               OUTPUT_MODE420          = 0x0,
+                               OUTPUT_MODE422_YUY2     = 0x1,
+                               OUTPUT_MODE422_UYVY     = 0x2,
+                               OUTPUT_MODE_INVALID     = 0xFF
+                               Valid values for this API are OUTPUT_MODE422_YUY2 and OUTPUT_MODE422_UYVY
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS 
+DtsSetColorSpace(
+    HANDLE  hDevice,
+    BC_OUTPUT_FORMAT      Mode422
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsSet422Mode
+
+Description:
+
+    This function sets the 422 mode to either YUY2 or UYVY.
+
+    The device must have been opened previously and must support 422 mode for
+    this call to succeed.
+
+    Use "DtsIs422Supported" to find whether 422 mode is supported.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+    422Mode     0 - set the YUV mode to YUY2
+                1 - set the YUV mode to UYVY
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsSet422Mode(
+    HANDLE  hDevice,
+    uint8_t Mode422
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsGetDILPath
+
+Description:
+
+    This is a helper function to return DIL's Path.
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                DtsDeviceOpen.
+
+    DilPath     Buffer to hold DIL path info upto 256 bytes.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+
+DRVIFLIB_API BC_STATUS
+DtsGetDILPath(
+    HANDLE   hDevice,
+    char   *DilPath,
+    uint32_t size
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsDropPictures
+
+Description:
+
+    This command sets the decoder to skip one or more non-reference (B) pictures
+    in the input data stream.  This is used for when the audio is ahead of
+    video and the application needs to cause video to move ahead to catch up.
+    Reference pictures are not skipped.
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+
+    Pictures        The number of non-reference pictures to drop.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsDropPictures(
+    HANDLE   hDevice,
+    uint32_t Pictures
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsGetDriverStatus
+
+Description:
+
+    This command returns various statistics related to the driver and DIL.
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.
+
+    *pStatus        Pointer to BC_DTS_STATUS to receive driver status.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS
+DtsGetDriverStatus(
+    HANDLE          hDevice,
+       BC_DTS_STATUS   *pStatus
+    );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsGetCapabilities
+
+Description:
+
+    This command returns output format support and hardware capabilities.
+
+    The device must have been previously opened for this call to succeed.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.   
+
+    pCapsBuffer   Pointer to BC_HW_CAPS to receive HW Output capabilities.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS 
+DtsGetCapabilities (
+       HANDLE  hDevice,
+       PBC_HW_CAPS     pCapsBuffer
+       );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsSetScaleParams
+
+Description:
+
+    This command sets hardware scaling parameters.
+
+Parameters:
+
+    hDevice         Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.   
+
+    pScaleParams   Pointer to BC_SCALING_PARAMS to set hardware scaling parameters.
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS 
+DtsSetScaleParams (
+       HANDLE  hDevice,
+       PBC_SCALING_PARAMS pScaleParams
+       );
+
+/*****************************************************************************
+
+Function name:
+
+    DtsIsEndOfStream
+
+Description:
+
+    This command returns whether the end of stream(EOS) is reaching.
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.   
+
+    bEOS   Pointer to uint8_t to indicate if EOS of not
+
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS 
+DtsIsEndOfStream(
+    HANDLE  hDevice,
+    uint8_t*   bEOS
+);
+
+/*****************************************************************************
+
+Function name:
+
+    DtsCrystalHDVersion
+
+Description:
+
+    This API returns hw and sw version information for Crystal HD solutions
+Parameters:
+
+    hDevice     Handle to device. This is obtained via a prior call to
+                    DtsDeviceOpen.   
+
+    bCrystalInfo   Pointer to structure to fill in with information
+
+       device = 0 for BCM70012, 1 for BCM70015
+       
+Return:
+
+    BC_STS_SUCCESS will be returned on successful completion.
+
+*****************************************************************************/
+DRVIFLIB_API BC_STATUS 
+DtsCrystalHDVersion(
+    HANDLE  hDevice,
+    PBC_INFO_CRYSTAL bCrystalInfo
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/depends/target/libcrystalhd/libcrystalhd/libcrystalhd_version.h b/tools/depends/target/libcrystalhd/libcrystalhd/libcrystalhd_version.h
new file mode 100644 (file)
index 0000000..b640dac
--- /dev/null
@@ -0,0 +1,80 @@
+/********************************************************************
+ * Copyright(c) 2006-2009 Broadcom Corporation.
+ *
+ *  Name: libcrystalhd_version.h
+ *
+ *  Description: Version numbering for the driver use.
+ *
+ *  AU
+ *
+ *  HISTORY:
+ *
+ ********************************************************************
+ * This header is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License.
+ *
+ * This header is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this header.  If not, see <http://www.gnu.org/licenses/>.
+ *******************************************************************/
+
+#ifndef _BC_DTS_VERSION_LNX_
+#define _BC_DTS_VERSION_LNX_
+//
+// The version format that we are adopting is
+// MajorVersion.MinorVersion.Revision
+// This will be the same for all the components.
+//
+//
+#define STRINGIFY_VERSION(MAJ,MIN,REV) STRINGIFIED_VERSION(MAJ,MIN,REV)
+#define STRINGIFIED_VERSION(MAJ,MIN,REV) #MAJ "." #MIN "." #REV
+
+#define STRINGIFY_VERSION_W(MAJ,MIN,REV) STRINGIFIED_VERSION_W(MAJ,MIN,REV)
+#define STRINGIFIED_VERSION_W(MAJ,MIN,REV) #MAJ "." #MIN "." #REV
+
+//
+//  Product Version number is:
+//  x.y.z.a
+//
+//  x = Major release.      1 = Dozer, 2 = Dozer + Link
+//  y = Minor release.      Should increase +1 per "real" release.
+//  z = Branch release.     0 for main branch.  This is +1 per branch release.
+//  a = Build number   +1 per candidate release.  Reset to 0 every "real" release.
+//
+//
+// Enabling Check-In rules enforcement 08092007
+//
+#define INVALID_VERSION                0xFFFF
+
+/*========================== Common For All Components =================================*/
+#define BRCM_MAJOR_VERSION     3
+
+#define DRIVER_MAJOR_VERSION        BRCM_MAJOR_VERSION
+#define DRIVER_MINOR_VERSION        6
+#define DRIVER_REVISION             0
+
+#define RC_FILE_VERSION             STRINGIFY_VERSION(DRIVER_MAJOR_VERSION,DRIVER_MINOR_VERSION,DRIVER_REVISION) ".0"
+
+/*======================= Device Interface Library ========================*/
+#define DIL_MAJOR_VERSION      BRCM_MAJOR_VERSION
+#define DIL_MINOR_VERSION      6
+#define DIL_REVISION           0
+
+#define DIL_RC_FILE_VERSION    STRINGIFY_VERSION(DIL_MAJOR_VERSION,DIL_MINOR_VERSION,DIL_REVISION)
+
+/*========================== deconf utility ==============================*/
+#define DECONF_MAJOR_VERSION   BRCM_MAJOR_VERSION
+#define DECONF_MINOR_VERSION   9
+#define DECONF_REVISION                18
+#define DECONF_RC_FILE_VERSION  STRINGIFY_VERSION(DIL_MAJOR_VERSION,DIL_MINOR_VERSION,DIL_REVISION)
+
+/*========================== Firmware ==============================*/
+#define FW_MAJOR_VERSION        BRCM_MAJOR_VERSION
+#define FW_MINOR_VERSION        60
+#define FW_REVISION            39
+
+#endif
diff --git a/tools/depends/target/libffi/Makefile b/tools/depends/target/libffi/Makefile
new file mode 100644 (file)
index 0000000..e30f72c
--- /dev/null
@@ -0,0 +1,40 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libffi
+VERSION=3.0.11
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE= ./configure --prefix=$(PREFIX) --disable-shared --disable-builddir
+
+LIBDYLIB=$(PLATFORM)/.libs/$(LIBNAME).a
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -j 1 -C $(PLATFORM)
+       touch $@
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       mkdir -p $(PREFIX)/include/ffi
+       cp $(PREFIX)/lib/$(SOURCE)/include/* $(PREFIX)/include/ffi/
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libflac/Makefile b/tools/depends/target/libflac/Makefile
new file mode 100644 (file)
index 0000000..c1f7add
--- /dev/null
@@ -0,0 +1,51 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile nasm.patch
+
+# lib name, version
+LIBNAME=flac
+VERSION=1.2.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+export NASM=
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-xmms-plugin --disable-cpplibs --disable-asm-optimizations
+
+LIBDYLIB=$(PLATFORM)/src/libFLAC/.libs/libFLAC.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p1 < ../autoreconf.patch
+       cd $(PLATFORM); patch -p0 < ../nasm.patch
+       cd $(PLATFORM); $(AUTORECONF) -vif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libFLAC.la $(PREFIX)/lib/libFLAC.so $(PREFIX)/lib/libFLAC.so.8
+       mv -f $(PREFIX)/lib/libFLAC.so.8.2.0 $(PREFIX)/lib/libxbFLAC.so
+       ln -sf $(PREFIX)/lib/libxbFLAC.so $(PREFIX)/lib/libFLAC.so
+       $(RPL) -e "libFLAC.so.8" "libxbFLAC.so" $(PREFIX)/lib/libxbFLAC.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libxbFLAC.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libflac/autoreconf.patch b/tools/depends/target/libflac/autoreconf.patch
new file mode 100644 (file)
index 0000000..3a04931
--- /dev/null
@@ -0,0 +1,38 @@
+From: Erik de Castro Lopo <erikd@mega-nerd.com>
+Date: Mon, 13 Feb 2012 08:55:46 +0000 (+1100)
+Subject: Fix for autoreconf failures.
+X-Git-Url: https://git.xiph.org/?p=flac.git;a=commitdiff_plain;h=e38026a52c34008bcf9126f61ee63b58168facf9
+
+Fix for autoreconf failures.
+
+Fixes "undefined macro: AM_PATH_XMMS" and similar errors which cause
+autoreconf to fail.
+
+From Sebastian Andrzej Siewior <bigeasy@linutronix.de> via Debian.
+---
+
+diff --git a/Makefile.am b/Makefile.am
+index d106d9f..0a65206 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -30,6 +30,8 @@
+ AUTOMAKE_OPTIONS = foreign 1.7
++ACLOCAL_AMFLAGS = -I m4
++
+ SUBDIRS = doc include m4 man src examples test build obj
+ DISTCLEANFILES = libtool-disable-static
+diff --git a/configure.in b/configure.in
+index 63a0984..f56c188 100644
+--- a/configure.in
++++ b/configure.in
+@@ -33,6 +33,7 @@ sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-stat
+ chmod +x libtool-disable-static
+ AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
++AC_CONFIG_MACRO_DIR([m4])
+ AM_PROG_AS
+ AC_PROG_CXX
diff --git a/tools/depends/target/libflac/nasm.patch b/tools/depends/target/libflac/nasm.patch
new file mode 100644 (file)
index 0000000..0371cb9
--- /dev/null
@@ -0,0 +1,14 @@
+diff -ruN configure.in configure.in
+--- configure.in       2007-09-13 11:48:42.000000000 -0400
++++ configure.in       2012-06-10 20:13:50.543973093 -0400
+@@ -269,10 +269,6 @@
+ # only matters for x86
+ AC_CHECK_PROGS(NASM, nasm)
+ AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
+-if test -n "$NASM" ; then
+-AC_DEFINE(FLAC__HAS_NASM)
+-AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
+-fi
+ # only matters for PowerPC
+ AC_CHECK_PROGS(AS, as, as)
diff --git a/tools/depends/target/libgcrypt/01-static-mpi_mpi-internal.patch b/tools/depends/target/libgcrypt/01-static-mpi_mpi-internal.patch
new file mode 100644 (file)
index 0000000..5a1f60f
--- /dev/null
@@ -0,0 +1,53 @@
+*** mpi/mpi-internal.h Sun May  6 17:39:56 2012
+--- mpi/mpi-internal_new.h     Sun May  6 17:45:59 2012
+*************** void _gcry_mpi_lshift_limbs( gcry_mpi_t 
+*** 183,206 ****
+  
+  
+  /*-- mpih-add.c --*/
+! mpi_limb_t _gcry_mpih_add_1(mpi_ptr_t res_ptr,  mpi_ptr_t s1_ptr,
+!                       mpi_size_t s1_size, mpi_limb_t s2_limb );
+  mpi_limb_t _gcry_mpih_add_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
+!                        mpi_ptr_t s2_ptr,  mpi_size_t size);
+! mpi_limb_t _gcry_mpih_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
+!                     mpi_ptr_t s2_ptr, mpi_size_t s2_size);
+! 
+  /*-- mpih-sub.c --*/
+! mpi_limb_t _gcry_mpih_sub_1( mpi_ptr_t res_ptr,  mpi_ptr_t s1_ptr,
+!                        mpi_size_t s1_size, mpi_limb_t s2_limb );
+  mpi_limb_t _gcry_mpih_sub_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
+!                        mpi_ptr_t s2_ptr, mpi_size_t size);
+! mpi_limb_t _gcry_mpih_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
+!                     mpi_ptr_t s2_ptr, mpi_size_t s2_size);
+! 
+  /*-- mpih-cmp.c --*/
+! int _gcry_mpih_cmp( mpi_ptr_t op1_ptr, mpi_ptr_t op2_ptr, mpi_size_t size );
+! 
+  /*-- mpih-mul.c --*/
+  
+  struct karatsuba_ctx {
+--- 183,206 ----
+  
+  
+  /*-- mpih-add.c --*/
+! static mpi_limb_t _gcry_mpih_add_1(mpi_ptr_t res_ptr,  mpi_ptr_t s1_ptr,
+!                         mpi_size_t s1_size, mpi_limb_t s2_limb );
+  mpi_limb_t _gcry_mpih_add_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
+!                          mpi_ptr_t s2_ptr,  mpi_size_t size);
+! static mpi_limb_t _gcry_mpih_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
+!                       mpi_ptr_t s2_ptr, mpi_size_t s2_size);
+!  
+  /*-- mpih-sub.c --*/
+! static mpi_limb_t _gcry_mpih_sub_1( mpi_ptr_t res_ptr,  mpi_ptr_t s1_ptr,
+!                          mpi_size_t s1_size, mpi_limb_t s2_limb );
+  mpi_limb_t _gcry_mpih_sub_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
+!                          mpi_ptr_t s2_ptr, mpi_size_t size);
+! static mpi_limb_t _gcry_mpih_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
+!                       mpi_ptr_t s2_ptr, mpi_size_t s2_size);
+!  
+  /*-- mpih-cmp.c --*/
+! static int _gcry_mpih_cmp( mpi_ptr_t op1_ptr, mpi_ptr_t op2_ptr, mpi_size_t size );
+!  
+  /*-- mpih-mul.c --*/
+  
+  struct karatsuba_ctx {
diff --git a/tools/depends/target/libgcrypt/02-armasm.patch b/tools/depends/target/libgcrypt/02-armasm.patch
new file mode 100644 (file)
index 0000000..cb0f6b9
--- /dev/null
@@ -0,0 +1,30 @@
+--- mpi/longlong.h     2005-07-29 09:31:17.000000000 -0400
++++ mpi/longlong.h     2013-01-20 15:18:22.000000000 -0500
+@@ -223,15 +223,24 @@
+          : "r" ((USItype)(a)),                                        \
+            "r" ((USItype)(b))                                         \
+          : "r0", "r1", "r2")
+-#else
++#elif defined(__APPLE__)
+ #define umul_ppmm(xh, xl, a, b)                                         \
+-  __asm__ ("%@ Inlined umul_ppmm\n"                                     \
+-         "umull %r1, %r0, %r2, %r3"                                   \
++  __asm__ ("@ Inlined umul_ppmm\n"                                      \
++         "umull %1, %0, %2, %3"                                       \
+                  : "=&r" ((USItype)(xh)),                             \
+                    "=r" ((USItype)(xl))                               \
+                  : "r" ((USItype)(a)),                                \
+                    "r" ((USItype)(b))                                 \
+                  : "r0", "r1")
++#else
++#define umul_ppmm(xh, xl, a, b)                                         \
++  __asm__ ("%@ Inlined umul_ppmm\n"                                     \
++          "umull %r1, %r0, %r2, %r3"                                    \
++                   : "=&r" ((USItype)(xh)),                             \
++                     "=r" ((USItype)(xl))                               \
++                   : "r" ((USItype)(a)),                                \
++                     "r" ((USItype)(b))                                 \
++                 : "r0", "r1")
+ #endif
+ #define UMUL_TIME 20
+ #define UDIV_TIME 100
diff --git a/tools/depends/target/libgcrypt/03-gcrypt-android-select.patch b/tools/depends/target/libgcrypt/03-gcrypt-android-select.patch
new file mode 100644 (file)
index 0000000..5965496
--- /dev/null
@@ -0,0 +1,13 @@
+--- src/gcrypt.h.in    2007-12-03 03:48:19.000000000 -0500
++++ src/gcrypt.h.in    2013-01-21 00:31:48.772740461 -0500
+@@ -41,6 +41,10 @@
+ #include <sys/time.h>
++#if defined(ANDROID)
++#include <sys/select.h>
++#endif
++
+ /* This is required for error code compatibility. */
+ #define _GCRY_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GCRYPT
diff --git a/tools/depends/target/libgcrypt/Makefile b/tools/depends/target/libgcrypt/Makefile
new file mode 100644 (file)
index 0000000..6d86b59
--- /dev/null
@@ -0,0 +1,47 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include 03-gcrypt-android-select.patch Makefile
+
+# lib name, version
+LIBNAME=libgcrypt
+VERSION=1.4.5
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-shared \
+
+ifeq ($(OS),osx)
+CONFIGURE+=--disable-asm
+endif
+
+LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p0 < ../01-static-mpi_mpi-internal.patch 
+       cd $(PLATFORM); patch -p0 < ../02-armasm.patch
+       cd $(PLATFORM); patch -p0 < ../03-gcrypt-android-select.patch
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libgpg-error/Makefile b/tools/depends/target/libgpg-error/Makefile
new file mode 100644 (file)
index 0000000..f402cc4
--- /dev/null
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libgpg-error
+VERSION=1.10
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) \
+  --disable-languages \
+  --disable-nls --disable-shared
+
+LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libiconv/Makefile b/tools/depends/target/libiconv/Makefile
new file mode 100644 (file)
index 0000000..d171d9e
--- /dev/null
@@ -0,0 +1,42 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libiconv
+VERSION=1.13.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) build-aux/; \
+          cp -f $(CONFIG_SUB) $(CONFIG_GUESS) libcharset/build-aux/; \
+          ./configure --prefix=$(PREFIX) --disable-shared
+
+LIBDYLIB=$(PLATFORM)/lib/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libjpeg-turbo/Makefile b/tools/depends/target/libjpeg-turbo/Makefile
new file mode 100644 (file)
index 0000000..6e767a4
--- /dev/null
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libjpeg-turbo
+VERSION=1.2.0
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --with-jpeg8 --disable-shared
+
+export CFLAGS=-O3
+
+LIBDYLIB=$(PLATFORM)/.libs/libjpeg.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -j 1 -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/liblzo2/Makefile b/tools/depends/target/liblzo2/Makefile
new file mode 100644 (file)
index 0000000..9a670ed
--- /dev/null
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=lzo
+VERSION=2.06
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) autoconf/; \
+          ./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/src/.libs/lib$(LIBNAME)2.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libmad/01-libmad-pkgconfig.patch b/tools/depends/target/libmad/01-libmad-pkgconfig.patch
new file mode 100644 (file)
index 0000000..fcfd341
--- /dev/null
@@ -0,0 +1,118 @@
+diff -ruN libmad-0.15.1b.orig/Makefile.am libmad-0.15.1b/Makefile.am
+--- libmad-0.15.1b.orig/Makefile.am    2004-02-17 02:02:03.000000000 +0000
++++ libmad-0.15.1b/Makefile.am 2005-08-25 12:08:04.000000000 +0000
+@@ -33,9 +33,12 @@
+ minimad_INCLUDES =    
+ minimad_LDADD =               libmad.la
+-EXTRA_DIST =          mad.h.sed  \
++EXTRA_DIST =          mad.h.sed mad.pc.in \
+                       CHANGES COPYRIGHT CREDITS README TODO VERSION
++pkgconfigdir = $(libdir)/pkgconfig
++pkgconfig_DATA= mad.pc
++
+ exported_headers =    version.h fixed.h bit.h timer.h stream.h frame.h  \
+                       synth.h decoder.h
+diff -ruN libmad-0.15.1b.orig/Makefile.in libmad-0.15.1b/Makefile.in
+--- libmad-0.15.1b.orig/Makefile.in    2004-02-17 02:33:23.000000000 +0000
++++ libmad-0.15.1b/Makefile.in 2005-08-25 12:09:34.000000000 +0000
+@@ -14,6 +14,8 @@
+ @SET_MAKE@
++pkgconfigdir = $(libdir)/pkgconfig
++pkgconfig_DATA = mad.pc
+ SOURCES = $(libmad_la_SOURCES) $(EXTRA_libmad_la_SOURCES) $(minimad_SOURCES)
+@@ -43,7 +45,7 @@
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(srcdir)/config.h.in $(srcdir)/libmad.list.in \
+       $(top_srcdir)/configure COPYING INSTALL TODO config.guess \
+-      config.sub depcomp install-sh ltmain.sh missing mkinstalldirs
++      config.sub depcomp install-sh ltmain.sh missing mkinstalldirs mad.pc.in
+ subdir = .
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+@@ -53,7 +55,7 @@
+  configure.lineno configure.status.lineno
+ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+ CONFIG_HEADER = config.h
+-CONFIG_CLEAN_FILES = libmad.list
++CONFIG_CLEAN_FILES = libmad.list mad.pc
+ am__installdirs = $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
+ libLTLIBRARIES_INSTALL = $(INSTALL)
+ LTLIBRARIES = $(lib_LTLIBRARIES)
+@@ -218,7 +220,7 @@
+ minimad_SOURCES = minimad.c
+ minimad_INCLUDES = 
+ minimad_LDADD = libmad.la
+-EXTRA_DIST = mad.h.sed  \
++EXTRA_DIST = mad.h.sed  mad.pc.in \
+                       CHANGES COPYRIGHT CREDITS README TODO VERSION
+ exported_headers = version.h fixed.h bit.h timer.h stream.h frame.h  \
+@@ -298,6 +300,28 @@
+       rm -f stamp-h1
+       touch $@
++mad.pc: $(top_builddir)/config.status mad.pc.in
++      cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
++
++install-pkgconfigDATA: $(pkgconfig_DATA)
++      @$(NORMAL_INSTALL)
++      $(mkinstalldirs) $(DESTDIR)$(pkgconfigdir)
++      @list='$(pkgconfig_DATA)'; for p in $$list; do \
++        if test -f $(srcdir)/$$p; then \
++          echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p"; \
++          $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p; \
++        else if test -f $$p; then \
++          echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p"; \
++          $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p; \
++        fi; fi; \
++      done
++
++uninstall-pkgconfigDATA:
++      @$(NORMAL_UNINSTALL)
++      list='$(pkgconfig_DATA)'; for p in $$list; do \
++        rm -f $(DESTDIR)$(pkgconfigdir)/$$p; \
++      done
++
+ distclean-hdr:
+       -rm -f config.h stamp-h1
+ libmad.list: $(top_builddir)/config.status $(srcdir)/libmad.list.in
+@@ -726,7 +750,7 @@
+ info-am:
+-install-data-am: install-includeHEADERS
++install-data-am: install-includeHEADERS install-pkgconfigDATA
+ install-exec-am: install-libLTLIBRARIES
+@@ -757,7 +781,7 @@
+ ps-am:
+ uninstall-am: uninstall-includeHEADERS uninstall-info-am \
+-      uninstall-libLTLIBRARIES
++      uninstall-libLTLIBRARIES install-pkgconfigDATA
+ uninstall-info: uninstall-info-recursive
+diff -ruN libmad-0.15.1b.orig/mad.pc.in libmad-0.15.1b/mad.pc.in
+--- libmad-0.15.1b.orig/mad.pc.in      1970-01-01 00:00:00.000000000 +0000
++++ libmad-0.15.1b/mad.pc.in   2005-08-25 12:08:04.000000000 +0000
+@@ -0,0 +1,10 @@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
++
++Name: MAD
++Description: libmad - MPEG audio decoder library
++Version: @VERSION@
++Libs: -L${libdir} -lmad
++Cflags:
+
diff --git a/tools/depends/target/libmad/02-libmad-thumb-fix.patch b/tools/depends/target/libmad/02-libmad-thumb-fix.patch
new file mode 100644 (file)
index 0000000..398dbec
--- /dev/null
@@ -0,0 +1,17 @@
+diff -ruN libmad-0.15.1b.orig/imdct_l_arm.S libmad-0.15.1b/imdct_l_arm.S
+--- libmad-0.15.1b.orig/imdct_l_arm.S.orig     2010-10-28 18:57:51.000000000 -0400
++++ libmad-0.15.1b/imdct_l_arm.S       2010-10-28 18:58:41.000000000 -0400
+@@ -468,8 +468,11 @@
+     @----
+-    add     r2, pc, #(imdct36_long_karray-.-8)  @ r2 = base address of Knn array (PIC safe ?)
+-
++#ifdef __thumb__
++    adr     r2, imdct36_long_karray
++#else
++     add     r2, pc, #(imdct36_long_karray-.-8)  @ r2 = base address of Knn array (PIC safe ?)
++#endif
+ loop:
+     ldr     r12, [r0, #X0]
diff --git a/tools/depends/target/libmad/Makefile b/tools/depends/target/libmad/Makefile
new file mode 100644 (file)
index 0000000..7f10ec6
--- /dev/null
@@ -0,0 +1,51 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include 01-libmad-pkgconfig.patch Makefile
+
+# lib name, version
+LIBNAME=libmad
+VERSION=0.15.1b
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=rm config.sub config.guess; $(AUTOMAKE) -ac; ./configure --prefix=$(PREFIX) --enable-fpm=default
+
+LIBDYLIB=$(PLATFORM)/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); touch NEWS AUTHORS ChangeLog
+       cd $(PLATFORM); patch -p1 < ../01-libmad-pkgconfig.patch
+       cd $(PLATFORM); patch -p1 < ../02-libmad-thumb-fix.patch
+       sed -ie "s|libmad.list|libmad.list mad.pc|g" "$(PLATFORM)/configure.ac"
+       cd $(PLATFORM); $(AUTORECONF) -vif
+       cd $(PLATFORM); sed -i '/-fforce-mem/d' configure; $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libmad.la $(PREFIX)/lib/libmad.so $(PREFIX)/lib/libmad.so.0
+       mv -f $(PREFIX)/lib/libmad.so.0.2.1 $(PREFIX)/lib/libmad.so
+       $(RPL) -e "libmad.so.0" "libmad.so\x00\x00" $(PREFIX)/lib/libmad.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libmad.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libmicrohttpd/Makefile b/tools/depends/target/libmicrohttpd/Makefile
new file mode 100644 (file)
index 0000000..06b62c3
--- /dev/null
@@ -0,0 +1,44 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include fix-android-include.patch Makefile
+
+# lib name, version
+LIBNAME=libmicrohttpd
+VERSION=0.4.6
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-shared
+
+LIBDYLIB=$(PLATFORM)/src/daemon/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p0 < ../fix-android-include.patch
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/src/daemon
+       $(MAKE) -C $(PLATFORM)/src/include install
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       rm -f $(PREFIX)/lib/libmicrohttpd.so $(PREFIX)/lib/libmicrohttpd.so.5 $(PREFIX)/lib/libmicrohttpd.so.5.2.1
+       $(MAKE) -C $(PLATFORM)/src/daemon install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libmicrohttpd/fix-android-include.patch b/tools/depends/target/libmicrohttpd/fix-android-include.patch
new file mode 100644 (file)
index 0000000..10eaa25
--- /dev/null
@@ -0,0 +1,35 @@
+diff -ruN src/daemon/daemon.c src/daemon/daemon.c
+--- src/daemon/daemon.c        2012-05-07 17:21:43.695832026 -0400
++++ src/daemon/daemon.c        2012-05-07 17:20:20.365832079 -0400
+@@ -244,7 +244,9 @@
+   MHD_ip_count_lock (daemon);
+   /* Search for the IP address */
++#if !defined(ANDROID)
+   node = (void*)TSEARCH (key, &daemon->per_ip_connection_count, MHD_ip_addr_compare);
++#endif
+   if (!node)
+     {
+ #if HAVE_MESSAGES
+@@ -296,7 +298,9 @@
+   MHD_ip_count_lock (daemon);
+   /* Search for the IP address */
++#if !defined(ANDROID)
+   node = (void*)TFIND (&search_key, &daemon->per_ip_connection_count, MHD_ip_addr_compare);
++#endif
+   /* Something's wrong if we couldn't find an IP address
+    * that was previously added */
+diff -ruN src/include/platform.h src/include/platform.h
+--- src/include/platform.h     2012-05-07 17:34:57.345831526 -0400
++++ src/include/platform.h     2012-05-07 17:20:20.375832079 -0400
+@@ -53,7 +53,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <signal.h>
+-#if !defined(MINGW) && !defined(__SYMBIAN32__)
++#if !defined(MINGW) && !defined(__SYMBIAN32__) && !defined(ANDROID)
+ #include <search.h>
+ #endif
+ #include <stddef.h>
diff --git a/tools/depends/target/libmodplug/Makefile b/tools/depends/target/libmodplug/Makefile
new file mode 100644 (file)
index 0000000..7aaa0de
--- /dev/null
@@ -0,0 +1,48 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libmodplug
+VERSION=0.8.7
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).so
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(AUTORECONF) -vif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libmodplug.la $(PREFIX)/lib/libmodplug.so $(PREFIX)/lib/libmodplug.so.0
+       mv -f $(PREFIX)/lib/libmodplug.so.0.0.0 $(PREFIX)/lib/libmodplug.so
+       $(RPL) -e "libmodplug.so.0" "libmodplug.so\x00\x00" $(PREFIX)/lib/libmodplug.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libmodplug.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libmp3lame/Makefile b/tools/depends/target/libmp3lame/Makefile
new file mode 100644 (file)
index 0000000..bdcd98d
--- /dev/null
@@ -0,0 +1,47 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=lame
+VERSION=3.99.5
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-gtktest --disable-frontend --disable-decoder
+
+LIBDYLIB=$(PLATFORM)/libmp3lame/.libs/libmp3lame.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/libmp3lame
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/include install
+       $(MAKE) -C $(PLATFORM)/libmp3lame install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libmp3lame.la $(PREFIX)/lib/libmp3lame.so $(PREFIX)/lib/libmp3lame.so.0
+       mv -f $(PREFIX)/lib/libmp3lame.so.0.0.0 $(PREFIX)/lib/libmp3lame.so
+       $(RPL) -e "libmp3lame.so.0" "libmp3lame.so\x00\x00" $(PREFIX)/lib/libmp3lame.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libmp3lame.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libmpeg2/01-libmpeg2-add-asm-leading-underscores.patch b/tools/depends/target/libmpeg2/01-libmpeg2-add-asm-leading-underscores.patch
new file mode 100644 (file)
index 0000000..f8bf8d3
--- /dev/null
@@ -0,0 +1,62 @@
+--- libmpeg2-0.5.1.org/libmpeg2/motion_comp_arm_s.S    2008-07-09 15:16:05.000000000 -0400
++++ libmpeg2-0.5.1/libmpeg2/motion_comp_arm_s.S        2013-01-18 01:53:04.692900836 -0500
+@@ -23,8 +23,13 @@
+ @ ----------------------------------------------------------------
+       .align
+-      .global MC_put_o_16_arm
++#if defined(__APPLE__) && defined(__arm__)
++      .global _MC_put_o_16_arm
++_MC_put_o_16_arm:
++#else
++        .global MC_put_o_16_arm
+ MC_put_o_16_arm:
++#endif
+       @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+       pld [r1]
+         stmfd sp!, {r4-r11, lr} @ R14 is also called LR
+@@ -83,8 +88,13 @@
+ @ ----------------------------------------------------------------
+       .align
+-      .global MC_put_o_8_arm
++#if defined(__APPLE__) && defined(__arm__)
++      .global _MC_put_o_8_arm
++_MC_put_o_8_arm:
++#else
++        .global MC_put_o_8_arm
+ MC_put_o_8_arm:
++#endif
+       @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+       pld [r1]
+         stmfd sp!, {r4-r10, lr} @ R14 is also called LR
+@@ -152,8 +162,13 @@
+ .endm
+       .align
+-      .global MC_put_x_16_arm
++#if defined(__APPLE__) && defined(__arm__)
++      .global _MC_put_x_16_arm
++_MC_put_x_16_arm:
++#else
++        .global MC_put_x_16_arm
+ MC_put_x_16_arm:
++#endif
+       @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+       pld [r1]
+         stmfd sp!, {r4-r11,lr} @ R14 is also called LR
+@@ -244,8 +259,13 @@
+ @ ----------------------------------------------------------------
+       .align
+-      .global MC_put_x_8_arm
++#if defined(__APPLE__) && defined(__arm__)
++      .global _MC_put_x_8_arm
++_MC_put_x_8_arm:
++#else
++        .global MC_put_x_8_arm
+ MC_put_x_8_arm:
++#endif
+       @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+       pld [r1]
+         stmfd sp!, {r4-r11,lr} @ R14 is also called LR
diff --git a/tools/depends/target/libmpeg2/02-neon.patch b/tools/depends/target/libmpeg2/02-neon.patch
new file mode 100644 (file)
index 0000000..329551b
--- /dev/null
@@ -0,0 +1,385 @@
+Index: include/mpeg2.h
+===================================================================
+--- include/mpeg2.h    (révision 1193)
++++ include/mpeg2.h    (copie de travail)
+@@ -164,6 +164,7 @@
+ #define MPEG2_ACCEL_SPARC_VIS 1
+ #define MPEG2_ACCEL_SPARC_VIS2 2
+ #define MPEG2_ACCEL_ARM 1
++#define MPEG2_ACCEL_ARM_NEON 2
+ #define MPEG2_ACCEL_DETECT 0x80000000
+ uint32_t mpeg2_accel (uint32_t accel);
+Index: libmpeg2/motion_comp_neon.c
+===================================================================
+--- libmpeg2/motion_comp_neon.c        (révision 0)
++++ libmpeg2/motion_comp_neon.c        (révision 0)
+@@ -0,0 +1,302 @@
++/*
++ * motion_comp_neon.c
++ * Copyright (C) 2009 Rémi Denis-Courmont
++ *
++ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
++ * See http://libmpeg2.sourceforge.net/ for updates.
++ *
++ * mpeg2dec is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * mpeg2dec is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License along
++ * with mpeg2dec; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++ */
++
++#include "config.h"
++
++#if defined(ARCH_ARM)
++
++#include <stdint.h>
++#include <string.h>
++
++#include "mpeg2.h"
++#include "attributes.h"
++#include "mpeg2_internal.h"
++
++/* dest = ref */
++static void MC_put_o_16_neon (uint8_t * dest, const uint8_t * ref,
++                            const int stride, int height)
++{
++    do {
++      memcpy (dest, ref, 16);
++      ref += stride;
++      dest += stride;
++    } while (--height);
++}
++
++static void MC_put_o_8_neon (uint8_t * dest, const uint8_t * ref,
++                           const int stride, int height)
++{
++    do {
++      memcpy (dest, ref, 8);
++      ref += stride;
++      dest += stride;
++    } while (--height);
++}
++
++/* dest = (src1 + src2 + 1) / 2 */
++static void MC_avg_1_16_neon (uint8_t * dest, const uint8_t * src1,
++                            const uint8_t * src2,
++                            const int stride, unsigned height)
++{
++    do {
++      asm volatile (
++          "vld1.u8 {q0}, [%[src1]]\n"
++          "vld1.u8 {q1}, [%[src2]]\n"
++          "vrhadd.u8 q0, q0, q1\n"
++          /* XXX: three cycles stall */
++          "vst1.u8 {q0}, [%[dest]]\n"
++          :
++          : [dest]"r"(dest), [src1]"r"(src1), [src2]"r"(src2)
++          : "memory", "q0", "q1");
++      src1 += stride;
++      src2 += stride;
++      dest += stride;
++    } while (--height);
++}
++
++static void MC_avg_1_8_neon (uint8_t * dest, const uint8_t * src1,
++                           const uint8_t * src2,
++                           const int stride, unsigned height)
++{
++    do {
++      asm volatile (
++          "vld1.u8 {d0}, [%[src1]]\n"
++          "vld1.u8 {d1}, [%[src2]]\n"
++          "vrhadd.u8 d0, d0, d1\n"
++          "vst1.u8 {d0}, [%[dest]]\n"
++          :
++          : [dest]"r"(dest), [src1]"r"(src1), [src2]"r"(src2)
++          : "memory", "q0");
++      
++      src1 += stride;
++      src2 += stride;
++      dest += stride;
++    } while (--height);
++}
++
++/* dest = (dest + ((src1 + src2 + 1) / 2) + 1) / 2 */
++static void MC_avg_2_16_neon (uint8_t * dest, const uint8_t * src1,
++                            const uint8_t * src2,
++                            const int stride, unsigned height)
++{
++    do {
++      asm volatile (
++          "vld1.u8 {q0}, [%[src1]]\n"
++          "vld1.u8 {q1}, [%[src2]]\n"
++          "vrhadd.u8 q0, q0, q1\n"
++          "vld1.u8 {q2}, [%[dest]]\n"
++          /* XXX: one cycle stall */
++          "vrhadd.u8 q0, q0, q2\n"
++          /* XXX: three cycles stall */
++          "vst1.u8 {q0}, [%[dest]]\n"
++          :
++          : [dest]"r"(dest), [src1]"r"(src1), [src2]"r"(src2)
++          : "memory", "q0", "q1", "q2");
++      src1 += stride;
++      src2 += stride;
++      dest += stride;
++    } while (--height);
++}
++
++static void MC_avg_2_8_neon (uint8_t * dest, const uint8_t * src1,
++                           const uint8_t * src2,
++                           const int stride, unsigned height)
++{
++    do {
++      asm volatile (
++          "vld1.u8 {d0}, [%[src1]]\n"
++          "vld1.u8 {d1}, [%[src2]]\n"
++          "vrhadd.u8 d0, d0, d1\n"
++          "vld1.u8 {d2}, [%[dest]]\n"
++          "vrhadd.u8 d0, d0, d2\n"
++          "vst1.u8 {d0}, [%[dest]]\n"
++          :
++          : [dest]"r"(dest), [src1]"r"(src1), [src2]"r"(src2)
++          : "memory", "q0", "d2");
++      src1 += stride;
++      src2 += stride;
++      dest += stride;
++    } while (--height);
++}
++
++static void MC_avg_o_16_neon (uint8_t * dest, const uint8_t * ref,
++                            const int stride, int height)
++{
++    MC_avg_1_16_neon (dest, dest, ref, stride, height);
++}
++
++static void MC_avg_o_8_neon (uint8_t * dest, const uint8_t * ref,
++                           const int stride, int height)
++{
++    MC_avg_1_8_neon (dest, dest, ref, stride, height);
++}
++
++static void MC_put_x_16_neon (uint8_t * dest, const uint8_t * ref,
++                            const int stride, int height)
++{
++    MC_avg_1_16_neon (dest, ref, ref + 1, stride, height);
++}
++
++static void MC_put_x_8_neon (uint8_t * dest, const uint8_t * ref,
++                           const int stride, int height)
++{
++    MC_avg_1_8_neon (dest, ref, ref + 1, stride, height);
++}
++
++static void MC_avg_x_16_neon (uint8_t * dest, const uint8_t * ref,
++                            const int stride, int height)
++{
++    MC_avg_2_16_neon (dest, ref, ref + 1, stride, height);
++}
++
++static void MC_avg_x_8_neon (uint8_t * dest, const uint8_t * ref,
++                           const int stride, int height)
++{
++    MC_avg_2_8_neon (dest, ref, ref + 1, stride, height);
++}
++
++static void MC_put_y_16_neon (uint8_t * dest, const uint8_t * ref,
++                            const int stride, int height)
++{
++    MC_avg_1_16_neon (dest, ref, ref + stride, stride, height);
++}
++static void MC_put_y_8_neon (uint8_t * dest, const uint8_t * ref,
++                           const int stride, int height)
++{
++    MC_avg_1_8_neon (dest, ref, ref + stride, stride, height);
++}
++
++static void MC_avg_y_16_neon (uint8_t * dest, const uint8_t * ref,
++                            const int stride, int height)
++{
++    MC_avg_2_16_neon (dest, ref, ref + stride, stride, height);
++}
++
++static void MC_avg_y_8_neon (uint8_t * dest, const uint8_t * ref,
++                           const int stride, int height)
++{
++    MC_avg_2_8_neon (dest, ref, ref + stride, stride, height);
++}
++
++static void MC_put_xy_16_neon (uint8_t * dest, const uint8_t * ref,
++                             const int stride, int height)
++{
++    do {
++      asm volatile (
++          "vld1.u8 {q0}, [%[ref]]\n"
++          "vld1.u8 {q1}, [%[refx]]\n"
++          "vrhadd.u8 q0, q0, q1\n"
++          "vld1.u8 {q2}, [%[refy]]\n"
++          "vld1.u8 {q3}, [%[refxy]]\n"
++          "vrhadd.u8 q2, q2, q3\n"
++          /* XXX: three cycles stall */
++          "vrhadd.u8 q0, q0, q2\n"
++          /* XXX: three cycles stall */
++          "vst1.u8 {q0}, [%[dest]]\n"
++          :
++          : [dest]"r"(dest), [ref]"r"(ref), [refx]"r"(ref + 1),
++                     [refy]"r"(ref + stride), [refxy]"r"(ref + stride + 1)
++          : "memory", "q0", "q1", "q2", "q3");
++      ref += stride;
++      dest += stride;
++    } while (--height);
++}
++
++static void MC_put_xy_8_neon (uint8_t * dest, const uint8_t * ref,
++                            const int stride, int height)
++{
++    do {
++      asm volatile (
++          "vld1.u8 {d0}, [%[ref]]\n"
++          "vld1.u8 {d1}, [%[refx]]\n"
++          "vrhadd.u8 d0, d0, d1\n"
++          "vld1.u8 {d2}, [%[refy]]\n"
++          "vld1.u8 {d3}, [%[refxy]]\n"
++          "vrhadd.u8 d2, d2, d3\n"
++          /* XXX: three cycles stall */
++          "vrhadd.u8 d0, d0, d2\n"
++          /* XXX: three cycles stall */
++          "vst1.u8 {d0}, [%[dest]]\n"
++          :
++          : [dest]"r"(dest), [ref]"r"(ref), [refx]"r"(ref + 1),
++                     [refy]"r"(ref + stride), [refxy]"r"(ref + stride + 1)
++          : "memory", "q0", "q1");
++      ref += stride;
++      dest += stride;
++    } while (--height);
++}
++
++static void MC_avg_xy_16_neon (uint8_t * dest, const uint8_t * ref,
++                             const int stride, int height)
++{
++    do {
++      asm volatile (
++          "vld1.u8 {q0}, [%[ref]]\n"
++          "vld1.u8 {q1}, [%[refx]]\n"
++          "vrhadd.u8 q0, q0, q1\n"
++          "vld1.u8 {q2}, [%[refy]]\n"
++          "vld1.u8 {q3}, [%[refxy]]\n"
++          "vrhadd.u8 q2, q2, q3\n"
++          "vld1.u8 {q4}, [%[dest]]\n"
++          /* XXX: one cycle stall */
++          "vrhadd.u8 q0, q0, q2\n"
++          /* XXX: three cycles stall */
++          "vrhadd.u8 q0, q4, q0\n"
++          "vst1.u8 {q0}, [%[dest]]\n"
++          :
++          : [dest]"r"(dest), [ref]"r"(ref), [refx]"r"(ref + 1),
++                     [refy]"r"(ref + stride), [refxy]"r"(ref + stride + 1)
++          : "memory", "q0", "q1", "q2", "q3", "q4");
++      ref += stride;
++      dest += stride;
++    } while (--height);
++}
++
++static void MC_avg_xy_8_neon (uint8_t * dest, const uint8_t * ref,
++                            const int stride, int height)
++{
++    do {
++      asm volatile (
++          "vld1.u8 {d0}, [%[ref]]\n"
++          "vld1.u8 {d1}, [%[refx]]\n"
++          "vrhadd.u8 d0, d0, d1\n"
++          "vld1.u8 {d2}, [%[refy]]\n"
++          "vld1.u8 {d3}, [%[refxy]]\n"
++          "vrhadd.u8 d2, d2, d3\n"
++          "vld1.u8 {d4}, [%[dest]]\n"
++          /* XXX: one cycle stall */
++          "vrhadd.u8 d0, d0, d2\n"
++          /* XXX: three cycles stall */
++          "vrhadd.u8 d0, d4, d0\n"
++          "vst1.u8 {d0}, [%[dest]]\n"
++          :
++          : [dest]"r"(dest), [ref]"r"(ref), [refx]"r"(ref + 1),
++                     [refy]"r"(ref + stride), [refxy]"r"(ref + stride + 1)
++          : "memory", "q0", "q1", "d4");
++      ref += stride;
++      dest += stride;
++    } while (--height);
++}
++
++MPEG2_MC_EXTERN (neon)
++
++#endif /* ARCH_ARM */
+
+Modification de propriétés sur libmpeg2/motion_comp_neon.c
+___________________________________________________________________
+Ajouté : svn:eol-style
+   + native
+
+Index: libmpeg2/mpeg2_internal.h
+===================================================================
+--- libmpeg2/mpeg2_internal.h  (révision 1193)
++++ libmpeg2/mpeg2_internal.h  (copie de travail)
+@@ -313,5 +313,6 @@
+ extern mpeg2_mc_t mpeg2_mc_alpha;
+ extern mpeg2_mc_t mpeg2_mc_vis;
+ extern mpeg2_mc_t mpeg2_mc_arm;
++extern mpeg2_mc_t mpeg2_mc_neon;
+ #endif /* LIBMPEG2_MPEG2_INTERNAL_H */
+Index: libmpeg2/motion_comp.c
+===================================================================
+--- libmpeg2/motion_comp.c     (révision 1193)
++++ libmpeg2/motion_comp.c     (copie de travail)
+@@ -58,6 +58,11 @@
+     else
+ #endif
+ #ifdef ARCH_ARM
++#ifdef ARCH_ARM
++    if (accel & MPEG2_ACCEL_ARM)
++        mpeg2_mc = mpeg2_mc_neon;
++    else
++#endif
+     if (accel & MPEG2_ACCEL_ARM) {
+       mpeg2_mc = mpeg2_mc_arm;
+     } else
+Index: libmpeg2/Makefile.am
+===================================================================
+--- libmpeg2/Makefile.am       (révision 1193)
++++ libmpeg2/Makefile.am       (copie de travail)
+@@ -14,7 +14,7 @@
+                         motion_comp_vis.c motion_comp_arm.c \
+                         cpu_accel.c cpu_state.c
+ if ARCH_ARM
+-libmpeg2arch_la_SOURCES += motion_comp_arm_s.S
++libmpeg2arch_la_SOURCES += motion_comp_arm_s.S motion_comp_neon.c
+ endif
+ libmpeg2arch_la_CFLAGS = $(OPT_CFLAGS) $(ARCH_OPT_CFLAGS) $(LIBMPEG2_CFLAGS)
+Index: configure.ac
+===================================================================
+--- configure.ac       (révision 1193)
++++ configure.ac       (copie de travail)
+@@ -103,7 +103,14 @@
+       AC_DEFINE([ARCH_ALPHA],,[alpha architecture]);;
+     arm*)
+       arm_conditional=:
+-      AC_DEFINE([ARCH_ARM],,[ARM architecture]);;
++      AC_DEFINE([ARCH_ARM],,[ARM architecture])
++        AC_MSG_CHECKING([if inline ARM Advanced SIMD assembly is supported])
++        AC_TRY_COMPILE([],
++           [asm ("vqmovun.s64 d0, q1":::"d0");],
++           [AC_DEFINE([ARCH_ARM_NEON],, [ARM Advanced SIMD assembly])
++            AC_MSG_RESULT(yes)],
++           [AC_MSG_RESULT(no)])
++        ;;
+     esac
+ elif test x"$CC" = x"tendracc"; then
+     dnl TenDRA portability checking compiler
diff --git a/tools/depends/target/libmpeg2/03-config-fix.patch b/tools/depends/target/libmpeg2/03-config-fix.patch
new file mode 100644 (file)
index 0000000..98f766e
--- /dev/null
@@ -0,0 +1,208 @@
+--- a/libmpeg2/Makefile.in     2011-01-29 10:17:27.000000000 +0100
++++ b/libmpeg2/Makefile.in     2011-01-29 10:28:26.000000000 +0100
+@@ -1,8 +1,8 @@
+-# Makefile.in generated by automake 1.10.1 from Makefile.am.
++# Makefile.in generated by automake 1.10 from Makefile.am.
+ # @configure_input@
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
++# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+ # This Makefile.in is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+ # with or without modifications, as long as this notice is preserved.
+@@ -33,14 +33,17 @@
+ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
+-@ARCH_ARM_TRUE@am__append_1 = motion_comp_arm_s.S
++@ARCH_ARM_TRUE@am__append_1 = motion_comp_arm_s.S motion_comp_neon.c
+ subdir = libmpeg2
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(srcdir)/libmpeg2.pc.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/m4/cflags.m4 \
+       $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/keywords.m4 \
+-      $(top_srcdir)/m4/nonpic.m4 $(top_srcdir)/configure.ac
++      $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
++      $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
++      $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nonpic.m4 \
++      $(top_srcdir)/configure.ac
+ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+ mkinstalldirs = $(install_sh) -d
+@@ -66,8 +69,9 @@
+ am__libmpeg2arch_la_SOURCES_DIST = motion_comp_mmx.c idct_mmx.c \
+       motion_comp_altivec.c idct_altivec.c motion_comp_alpha.c \
+       idct_alpha.c motion_comp_vis.c motion_comp_arm.c cpu_accel.c \
+-      cpu_state.c motion_comp_arm_s.S
+-@ARCH_ARM_TRUE@am__objects_1 = motion_comp_arm_s.lo
++      cpu_state.c motion_comp_arm_s.S motion_comp_neon.c
++@ARCH_ARM_TRUE@am__objects_1 = motion_comp_arm_s.lo \
++@ARCH_ARM_TRUE@       libmpeg2arch_la-motion_comp_neon.lo
+ am_libmpeg2arch_la_OBJECTS = libmpeg2arch_la-motion_comp_mmx.lo \
+       libmpeg2arch_la-idct_mmx.lo \
+       libmpeg2arch_la-motion_comp_altivec.lo \
+@@ -82,7 +86,7 @@
+ libmpeg2arch_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libmpeg2arch_la_CFLAGS) \
+       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
++DEFAULT_INCLUDES = -I. -I$(top_builddir)/include@am__isrc@
+ depcomp = $(SHELL) $(top_srcdir)/.auto/depcomp
+ am__depfiles_maybe = depfiles
+ CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+@@ -135,29 +139,25 @@
+ CFLAGS = @CFLAGS@
+ CPP = @CPP@
+ CPPFLAGS = @CPPFLAGS@
+-CXX = @CXX@
+-CXXCPP = @CXXCPP@
+-CXXDEPMODE = @CXXDEPMODE@
+-CXXFLAGS = @CXXFLAGS@
+ CYGPATH_W = @CYGPATH_W@
+ DEFS = @DEFS@
+ DEPDIR = @DEPDIR@
+ DLLTOOL = @DLLTOOL@
+ DSYMUTIL = @DSYMUTIL@
+-ECHO = @ECHO@
++DUMPBIN = @DUMPBIN@
+ ECHO_C = @ECHO_C@
+ ECHO_N = @ECHO_N@
+ ECHO_T = @ECHO_T@
+ EGREP = @EGREP@
+ EXEEXT = @EXEEXT@
+-F77 = @F77@
+-FFLAGS = @FFLAGS@
++FGREP = @FGREP@
+ GREP = @GREP@
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
++LD = @LD@
+ LDFLAGS = @LDFLAGS@
+ LIBMPEG2_CFLAGS = @LIBMPEG2_CFLAGS@
+ LIBOBJS = @LIBOBJS@
+@@ -165,16 +165,20 @@
+ LIBTOOL = @LIBTOOL@
+ LIBVO_CFLAGS = @LIBVO_CFLAGS@
+ LIBVO_LIBS = @LIBVO_LIBS@
++LIPO = @LIPO@
+ LN_S = @LN_S@
+ LTLIBOBJS = @LTLIBOBJS@
+ MAINT = @MAINT@
+ MAKEINFO = @MAKEINFO@
+ MKDIR_P = @MKDIR_P@
+ MPEG2DEC_CFLAGS = @MPEG2DEC_CFLAGS@
++NM = @NM@
+ NMEDIT = @NMEDIT@
+ OBJDUMP = @OBJDUMP@
+ OBJEXT = @OBJEXT@
+ OPT_CFLAGS = @OPT_CFLAGS@
++OTOOL = @OTOOL@
++OTOOL64 = @OTOOL64@
+ PACKAGE = @PACKAGE@
+ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+ PACKAGE_NAME = @PACKAGE_NAME@
+@@ -199,8 +203,7 @@
+ abs_top_builddir = @abs_top_builddir@
+ abs_top_srcdir = @abs_top_srcdir@
+ ac_ct_CC = @ac_ct_CC@
+-ac_ct_CXX = @ac_ct_CXX@
+-ac_ct_F77 = @ac_ct_F77@
++ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ am__include = @am__include@
+ am__leading_dot = @am__leading_dot@
+ am__quote = @am__quote@
+@@ -231,6 +234,7 @@
+ libexecdir = @libexecdir@
+ localedir = @localedir@
+ localstatedir = @localstatedir@
++lt_ECHO = @lt_ECHO@
+ mandir = @mandir@
+ mkdir_p = @mkdir_p@
+ oldincludedir = @oldincludedir@
+@@ -301,8 +305,8 @@
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+-          echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+-          $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
++          echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
++          $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+         else :; fi; \
+       done
+@@ -310,8 +314,8 @@
+       @$(NORMAL_UNINSTALL)
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+-        echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+-        $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
++        echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
++        $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+       done
+ clean-libLTLIBRARIES:
+@@ -355,6 +359,7 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmpeg2arch_la-motion_comp_altivec.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmpeg2arch_la-motion_comp_arm.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmpeg2arch_la-motion_comp_mmx.Plo@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmpeg2arch_la-motion_comp_neon.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmpeg2arch_la-motion_comp_vis.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motion_comp.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motion_comp_arm_s.Plo@am__quote@
+@@ -472,6 +477,13 @@
+ @AMDEP_TRUE@@am__fastdepCC_FALSE@     DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmpeg2arch_la_CFLAGS) $(CFLAGS) -c -o libmpeg2arch_la-cpu_state.lo `test -f 'cpu_state.c' || echo '$(srcdir)/'`cpu_state.c
++libmpeg2arch_la-motion_comp_neon.lo: motion_comp_neon.c
++@am__fastdepCC_TRUE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmpeg2arch_la_CFLAGS) $(CFLAGS) -MT libmpeg2arch_la-motion_comp_neon.lo -MD -MP -MF $(DEPDIR)/libmpeg2arch_la-motion_comp_neon.Tpo -c -o libmpeg2arch_la-motion_comp_neon.lo `test -f 'motion_comp_neon.c' || echo '$(srcdir)/'`motion_comp_neon.c
++@am__fastdepCC_TRUE@  mv -f $(DEPDIR)/libmpeg2arch_la-motion_comp_neon.Tpo $(DEPDIR)/libmpeg2arch_la-motion_comp_neon.Plo
++@AMDEP_TRUE@@am__fastdepCC_FALSE@     source='motion_comp_neon.c' object='libmpeg2arch_la-motion_comp_neon.lo' libtool=yes @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@     DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmpeg2arch_la_CFLAGS) $(CFLAGS) -c -o libmpeg2arch_la-motion_comp_neon.lo `test -f 'motion_comp_neon.c' || echo '$(srcdir)/'`motion_comp_neon.c
++
+ mostlyclean-libtool:
+       -rm -f *.lo
+@@ -570,8 +582,8 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+-            END { if (nonempty) { for (i in files) print i; }; }'`; \
++        $(AWK) '    { files[$$0] = 1; } \
++             END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+ tags: TAGS
+@@ -596,8 +608,8 @@
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+-            END { if (nonempty) { for (i in files) print i; }; }'`; \
++        $(AWK) '    { files[$$0] = 1; } \
++             END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+@@ -607,12 +619,13 @@
+ CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
++      here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+-        $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+-            END { if (nonempty) { for (i in files) print i; }; }'`; \
++        $(AWK) '    { files[$$0] = 1; } \
++             END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
diff --git a/tools/depends/target/libmpeg2/Makefile b/tools/depends/target/libmpeg2/Makefile
new file mode 100644 (file)
index 0000000..800d647
--- /dev/null
@@ -0,0 +1,60 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libmpeg2
+VERSION=0.5.1
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .auto/ ; \
+          ./configure --prefix=$(PREFIX) --disable-sdl
+
+LIBDYLIB=$(PLATFORM)/$(LIBNAME)/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ifeq ($(OS),ios)
+       cd $(PLATFORM); patch -p1 < ../01-libmpeg2-add-asm-leading-underscores.patch
+       cd $(PLATFORM); patch -p0 < ../02-neon.patch
+       cd $(PLATFORM); patch -p1 < ../03-config-fix.patch
+endif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libmpeg2.la $(PREFIX)/lib/libmpeg2.so $(PREFIX)/lib/libmpeg2.so.0
+       mv -f $(PREFIX)/lib/libmpeg2.so.0.1.0 $(PREFIX)/lib/libxbmpeg2.so
+       ln -sf $(PREFIX)/lib/libxbmpeg2.so $(PREFIX)/lib/libmpeg2.so
+       $(RPL) -e "libmpeg2.so.0" "libxbmpeg2.so" $(PREFIX)/lib/libxbmpeg2.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libxbmpeg2.so | grep ibrary
+       #
+       rm -f $(PREFIX)/lib/libmpeg2convert.la $(PREFIX)/lib/libmpeg2convert.so $(PREFIX)/lib/libmpeg2convert.so.0
+       mv -f $(PREFIX)/lib/libmpeg2convert.so.0.0.0 $(PREFIX)/lib/libxbmpeg2convert.so
+       ln -sf $(PREFIX)/lib/libxbmpeg2convert.so $(PREFIX)/lib/libmpeg2convert.so
+       $(RPL) -e "libmpeg2convert.so.0" "libxbmpeg2convert.so" $(PREFIX)/lib/libxbmpeg2convert.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libxbmpeg2convert.so | grep ibrary
+       #
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libnfs/Makefile b/tools/depends/target/libnfs/Makefile
new file mode 100644 (file)
index 0000000..f8394a1
--- /dev/null
@@ -0,0 +1,47 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libnfs
+VERSION=1.5.0
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/lib/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       -rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); ./bootstrap
+       cd $(PLATFORM); patch -p0 < ../timeval.patch
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libnfs.la $(PREFIX)/lib/libnfs.so $(PREFIX)/lib/libnfs.so.1
+       mv -f $(PREFIX)/lib/libnfs.so.1.0.5 $(PREFIX)/lib/libnfs.so
+       $(RPL) -e "libnfs.so.1" "libnfs.so\x00\x00" $(PREFIX)/lib/libnfs.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libnfs.so | grep ibrary
+endif
+       touch $@
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -r .installed-$(PLATFORM)
+       rm -rf $(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libnfs/timeval.patch b/tools/depends/target/libnfs/timeval.patch
new file mode 100644 (file)
index 0000000..521e57c
--- /dev/null
@@ -0,0 +1,12 @@
+--- include/nfsc/libnfs.h      2012-12-03 09:38:18.000000000 -0500
++++ include/nfsc/libnfs.h      2013-01-17 23:04:35.000000000 -0500
+@@ -18,9 +18,7 @@
+  * This is the highlevel interface to access NFS resources using a posix-like interface
+  */
+ #include <stdint.h>
+-#if defined(ANDROID)
+ #include <sys/time.h>
+-#endif
+ struct nfs_context;
+ struct rpc_context;
diff --git a/tools/depends/target/libogg/Makefile b/tools/depends/target/libogg/Makefile
new file mode 100644 (file)
index 0000000..e7d8867
--- /dev/null
@@ -0,0 +1,48 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libogg
+VERSION=1.1.4
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX)
+
+LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libogg.la $(PREFIX)/lib/libogg.so $(PREFIX)/lib/libogg.so.0
+       mv -f $(PREFIX)/lib/libogg.so.0.6.0 $(PREFIX)/lib/libxbogg.so
+       ln -sf $(PREFIX)/lib/libxbogg.so $(PREFIX)/lib/libogg.so
+       $(RPL) -e "libogg.so.0" "libxbogg.so" $(PREFIX)/lib/libxbogg.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libxbogg.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libomxil-bellagio/Makefile b/tools/depends/target/libomxil-bellagio/Makefile
new file mode 100644 (file)
index 0000000..7c64058
--- /dev/null
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include android-fix-build.patch Makefile oscl/*
+
+# lib name, version
+LIBNAME=libomxil-bellagio
+VERSION=0.9.3
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
+# configuration settings
+CFLAGS+=-I$(CURDIR)/oscl
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-shared \
+           --enable-android
+
+LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) "$(BASE_URL)/$(ARCHIVE)"
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p1 < ../android-fix-build.patch
+       cd $(PLATFORM); autoreconf -vif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -j 1 -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libomxil-bellagio/android-fix-build.patch b/tools/depends/target/libomxil-bellagio/android-fix-build.patch
new file mode 100644 (file)
index 0000000..a6e61db
--- /dev/null
@@ -0,0 +1,33 @@
+diff -ruN armeabi-v7a/configure.ac armeabi-v7a-good/configure.ac
+--- armeabi-v7a/configure.ac   2011-05-20 01:44:18.000000000 -0400
++++ armeabi-v7a-good/configure.ac      2012-06-19 01:58:45.483524179 -0400
+@@ -5,7 +5,7 @@
+ AC_PREREQ([2.59])
+ AC_CONFIG_HEADERS([config.h])
+-CFLAGS="${CFLAGS} -Wall -Werror"
++CFLAGS="${CFLAGS} -Wall"
+ ################################################################################
+ # Set the shared versioning info, according to section 6.3 of the libtool info #
+@@ -149,8 +149,6 @@
+ # Check for libraries                                                          #
+ ################################################################################
+-AC_CHECK_LIB([pthread], [pthread_create])
+-
+ # Check for libdl
+ AC_SEARCH_LIBS([dlopen], [dl], [], [AC_MSG_ERROR([libdl is required])])
+diff -ruN armeabi-v7a/src/Makefile.am armeabi-v7a-good/src/Makefile.am
+--- armeabi-v7a/src/Makefile.am        2011-05-20 01:28:17.000000000 -0400
++++ armeabi-v7a-good/src/Makefile.am   2012-06-19 01:59:23.603524155 -0400
+@@ -27,7 +27,7 @@
+ libomxil_bellagio_la_CFLAGS = -I$(top_srcdir)/include -I$(srcdir)/base -I$(srcdir)/core_extensions \
+                               -DINSTALL_PATH_STR=\"$(plugindir)\" -DOMX_LOADERS_DIRNAME=\"$(libdir)/omxloaders\/\"
+-libomxil_bellagio_la_LIBADD = base/libomxbase.la core_extensions/libomxcoreext.la -lpthread
++libomxil_bellagio_la_LIBADD = base/libomxbase.la core_extensions/libomxcoreext.la
+ libomxil_bellagio_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
+ include_extradir = $(includedir)/bellagio
diff --git a/tools/depends/target/libomxil-bellagio/oscl/oscl_base_macros.h b/tools/depends/target/libomxil-bellagio/oscl/oscl_base_macros.h
new file mode 100644 (file)
index 0000000..30fc868
--- /dev/null
@@ -0,0 +1,159 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//               O S C L B A S E _ M A C R O S
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+/*! \addtogroup osclbase OSCL Base
+ *
+ * @{
+ */
+
+
+/*! \file oscl_base_macros.h
+    \brief This file defines common macros and constants for basic compilation support.
+*/
+
+#ifndef OSCL_BASE_MACROS_H_INCLUDED
+#define OSCL_BASE_MACROS_H_INCLUDED
+
+// Pick up any platform-specific definitions for the common
+// macros.
+#include "osclconfig.h"
+
+// Define default values for the common macros
+#ifndef OSCL_EXPORT_REF
+#define OSCL_EXPORT_REF
+#endif
+
+#ifndef OSCL_IMPORT_REF
+#define OSCL_IMPORT_REF
+#endif
+
+//! The NULL_TERM_CHAR is used to terminate c-style strings.
+//static const char NULL_TERM_CHAR = '\0';
+#ifndef NULL_TERM_CHAR
+#define NULL_TERM_CHAR '\0'
+#endif
+
+//! if the NULL macro isn't already defined, then define it as zero.
+#ifndef NULL
+#define NULL (0)
+#endif
+
+#if (OSCL_DISABLE_INLINES)
+#define OSCL_INLINE
+#define OSCL_COND_EXPORT_REF OSCL_EXPORT_REF
+#define OSCL_COND_IMPORT_REF OSCL_IMPORT_REF
+#else
+#define OSCL_INLINE inline
+#define OSCL_COND_EXPORT_REF
+#define OSCL_COND_IMPORT_REF
+#endif
+
+//this macro may not be defined in all configurations
+//so a default is defined here.
+
+//! Type casting macros
+/*!
+  \param type   Destination type of cast
+  \param exp    Expression to cast
+*/
+
+#define OSCL_CONST_CAST(type,exp)           ((type)(exp))
+#define OSCL_STATIC_CAST(type,exp)          ((type)(exp))
+#define OSCL_REINTERPRET_CAST(type,exp)     ((type)(exp))
+#define OSCL_DYNAMIC_CAST(type, exp)        ((type)(exp))
+#define OSCL_VIRTUAL_BASE(type)               type
+
+
+/**
+ * The following two macros are used to avoid compiler warnings.
+ *
+ * OSCL_UNUSED_ARG(vbl) is used to "reference" an otherwise unused
+ *   parameter or variable, often one which is used only in an
+ *   OSCL_ASSERT and thus unreferenced in release mode
+ * OSCL_UNUSED_RETURN(val) provides a "return" of a value, in places
+ *   which will not actually be executed, such as after an
+ *   OSCL_LEAVE or Thread::exit or abort.  The value needs to
+ *   be of an appropriate type for the current function, though
+ *   zero will usually suffice.  Note that OSCL_UNUSED_RETURN
+ *   will not be necessary for 'void' functions, as there is no
+ *   requirement for a value-return operation.
+ */
+#define OSCL_UNUSED_ARG(vbl) (void)(vbl)
+#define OSCL_UNUSED_RETURN(value) return value
+
+/* The __TFS__ macro is used to optionally expand to "<>" depending on the
+ * compiler.  Some compilers require it to indicate that the friend function
+ * is a template function as specified in the standard, but others don't
+ * like it so it will handled with a macro expansion that depends on the
+ * compiler.
+ */
+#ifndef __TFS__
+#define __TFS__
+#endif
+
+#define OSCL_MIN(a,b) ((a) < (b) ? (a) : (b))
+#define OSCL_MAX(a,b) ((a) > (b) ? (a) : (b))
+#define OSCL_ABS(a) ((a) > (0) ? (a) : -(a))
+
+// the syntax for explicitly calling the destructor varies on some platforms
+// below is the default syntax as defined in the C++ standard
+#ifndef OSCL_TEMPLATED_DESTRUCTOR_CALL
+#define OSCL_TEMPLATED_DESTRUCTOR_CALL(type,simple_type) type :: ~simple_type ()
+#endif
+
+
+/*
+ * The OSCL_UNSIGNED_CONST macro is used to optionally add a suffix to the
+ * end of integer constants to identify them as unsigned constants.  It is
+ * usually only necessary to do that for very large constants that are too
+ * big to fit within the range of a signed integer. Some compilers will issue
+ * warnings for that.  The default behavior will be to add no suffix.
+ */
+
+#ifndef OSCL_UNSIGNED_CONST
+#define OSCL_UNSIGNED_CONST(x) x
+#endif
+
+/*
+ * These macros are used by MTP to avoid byte aligning structures.
+ */
+#ifndef OSCL_PACKED_VAR
+#define OSCL_PACKED_VAR     "error"
+#endif
+
+
+/* The following macros enumerate the possible values of the build flag PV_COMPILER */
+
+#define EPV_ARM_GNUC  1 /* for GNU compiler */
+#define EPV_ARM_RVCT  2 /* for RVCT compiler from ARM */
+#define EPV_ARM_MSEVC 3 /* for MS Embedded VC compiler */
+
+/* PV_COMPILER value must be set to build command.
+   In addition, PV_CPU_ARCH_VERSION must be defined to take on an integer value that specifies the version of target
+   ARM architecture. */
+
+
+/*! @} */
+
+#endif  // OSCL_BASE_MACROS_H_INCLUDED
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig.h
new file mode 100644 (file)
index 0000000..e664e19
--- /dev/null
@@ -0,0 +1,105 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//     O S C L C O N F I G   ( P L A T F O R M   C O N F I G   I N F O )
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig.h
+ *  \brief This file contains configuration information for the linux platform
+ *
+ */
+
+#ifndef OSCLCONFIG_H_INCLUDED
+#define OSCLCONFIG_H_INCLUDED
+
+// system includes for dynamic registry
+#include <dirent.h>
+#include <dlfcn.h>
+
+#define OSCL_HAS_ANDROID_SUPPORT 1
+#define OSCL_HAS_ANDROID_FILE_IO_SUPPORT 1
+
+#define OSCL_EXPORT_REF __attribute__ ((visibility("default")))
+#define OSCL_IMPORT_REF __attribute__ ((visibility("default")))
+
+// include common include for determining sizes from limits.h
+#include "osclconfig_limits_typedefs.h"
+
+//This switch turns off some profiling and debug settings
+#ifndef OSCL_RELEASE_BUILD
+#ifdef NDEBUG
+#define OSCL_RELEASE_BUILD 1
+#else
+#define OSCL_RELEASE_BUILD 0
+#endif
+#endif
+
+#ifndef PVLOGGER_INST_LEVEL
+#if (OSCL_RELEASE_BUILD)
+//Release mode logging - should be kept minimum
+#define PVLOGGER_INST_LEVEL 2
+#else
+//full logging
+#define PVLOGGER_INST_LEVEL 5
+#endif
+#endif
+
+// include common unix definitions
+#include "osclconfig_unix_android.h"
+
+// define the suffix for unsigned constants
+#define OSCL_UNSIGNED_CONST(x) x##u
+
+// override the common definition for
+#undef OSCL_NATIVE_UINT64_TYPE
+#define OSCL_NATIVE_UINT64_TYPE    u_int64_t
+
+// include the definitions for the processor
+#include "osclconfig_ix86.h"
+
+// the syntax for explicitly calling the destructor varies on some platforms
+// below is the default syntax as defined by another ARM project
+#define OSCL_TEMPLATED_DESTRUCTOR_CALL(type,simple_type) ~type ()
+
+
+/* The __TFS__ macro is used to optionally expand to "<>" depending on the
+ * compiler.  Some compilers require it to indicate that the friend function
+ * is a template function as specified in the standard, but others don't
+ * like it so it will handled with a macro expansion that depends on the
+ * compiler.
+ */
+#define __TFS__ <>
+
+#define OSCL_HAS_PRAGMA_PACK 0
+#define OSCL_HAS_PACKED_STRUCT 1
+#define OSCL_PACKED_VAR(x)  x __attribute__((packed))
+#define OSCL_PACKED_STRUCT_BEGIN
+#define OSCL_PACKED_STRUCT_END  __attribute__((packed))
+
+//set this to 1 to enable OSCL_ASSERT in release builds.
+#define OSCL_ASSERT_ALWAYS 0
+
+
+// check all osclconfig required macros are defined
+#include "osclconfig_check.h"
+
+#endif
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_ansi_memory.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_ansi_memory.h
new file mode 100644 (file)
index 0000000..fb53ea1
--- /dev/null
@@ -0,0 +1,42 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//     O S C L C O N F I G _ A N S I _ M E M O R Y
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_ansi_memory.h
+ *  \brief This file contains common typedefs based on the ANSI C limits.h header
+ *
+ *  This header file should work for any ANSI C compiler to determine the
+ *  proper native C types to use for OSCL integer types.
+ */
+
+
+#ifndef OSCLCONFIG_ANSI_MEMORY_H_INCLUDED
+#define OSCLCONFIG_ANSI_MEMORY_H_INCLUDED
+
+#include <memory.h>
+typedef size_t oscl_memsize_t;
+#define OSCL_HAS_ANSI_MEMORY_FUNCS 1
+
+
+#endif
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_check.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_check.h
new file mode 100644 (file)
index 0000000..19d0b63
--- /dev/null
@@ -0,0 +1,423 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OSCLCONFIG_CHECK_H_INCLUDED
+#define OSCLCONFIG_CHECK_H_INCLUDED
+
+/*! \addtogroup osclconfig OSCL config
+ *
+ * @{
+ */
+
+/**
+\def Make sure the basic types are defined,
+either in osclconfig_limits_typedefs.h or elsewhere.
+*/
+typedef int8 __int8__check__;
+typedef uint8 __uint8__check__;
+typedef int16 __int16__check__;
+typedef uint16 __uint16__check__;
+typedef int32 __int32__check__;
+typedef uint32 __uint32__check__;
+
+/**
+\def OSCL_ASSERT_ALWAYS macro should be set to 0 or 1.
+When set to 1, OSCL_ASSERT will be compiled in release mode as well
+as debug mode.
+*/
+#ifndef OSCL_ASSERT_ALWAYS
+#error "ERROR: OSCL_ASSERT_ALWAYS has to be defined to either 1 or 0."
+#endif
+
+
+/**
+\def OSCL_DISABLE_INLINES macro should be set to 1 if
+the target compiler supports 'inline' function definitions.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_DISABLE_INLINES
+#error "ERROR: OSCL_DISABLE_INLINES has to be defined to either 1 or 0."
+#endif
+
+/**
+\def OSCL_HAS_ANSI_STDLIB_SUPPORT macro should be set to 1 if
+the target compiler supports ANSI C standard lib functions.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_ANSI_STDLIB_SUPPORT
+#error "ERROR: OSCL_HAS_ANSI_STDLIB_SUPPORT has to be defined to either 1 or 0."
+#endif
+
+/**
+\def OSCL_HAS_ANSI_STDIO_SUPPORT macro should be set to 1 if
+the target compiler supports ANSI C standard I/O functions.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_ANSI_STDIO_SUPPORT
+#error "ERROR: OSCL_HAS_ANSI_STDIO_SUPPORT has to be defined to either 1 or 0."
+#endif
+
+/**
+\def OSCL_HAS_ANSI_STRING_SUPPORT macro should be set to 1 if
+the target compiler supports ANSI C standard string functions.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_ANSI_STRING_SUPPORT
+#error "ERROR: OSCL_HAS_ANSI_STRING_SUPPORT has to be defined to either 1 or 0."
+#endif
+
+/**
+\def OSCL_HAS_UNICODE_SUPPORT macro should be set to 1 if
+the target platform has a native 16-bit (wide) character type.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_UNICODE_SUPPORT
+#error "ERROR: OSCL_HAS_UNICODE_SUPPORT has to be defined to either 1 or 0."
+#endif
+
+/**
+\def _STRLIT macro should be set to an expression to convert
+a constant character string into a string literal type
+appropriate for the platform.
+Otherwise it should be set to 0.
+*/
+#ifndef _STRLIT
+#error "ERROR: _STRLIT has to be defined."
+#endif
+
+/**
+\def _STRLIT_CHAR macro should be set to an expression to convert
+a constant character string into a char string literal type
+appropriate for the platform.
+Otherwise it should be set to 0.
+*/
+#ifndef _STRLIT_CHAR
+#error "ERROR: _STRLIT_CHAR has to be defined."
+#endif
+
+/**
+When OSCL_HAS_UNICODE_SUPPORT==1,
+\def _STRLIT_WCHAR macro should be set to an expression to convert
+a constant character string into a wchar string literal type
+appropriate for the platform.
+Otherwise it should be set to 0.
+*/
+#if (OSCL_HAS_UNICODE_SUPPORT) && !defined(_STRLIT_WCHAR)
+#error "ERROR: _STRLIT_WCHAR has to be defined"
+#endif
+
+/**
+When OSCL_HAS_UNICODE_SUPPORT==1,
+\def OSCL_NATIVE_WCHAR_TYPE macro should be set to
+the native wide character type for the platform.
+Otherwise it should be set to 0.
+*/
+#if (OSCL_HAS_UNICODE_SUPPORT) && !defined(OSCL_NATIVE_WCHAR_TYPE)
+#error "ERROR: OSCL_NATIVE_WCHAR_TYPE has to be defined."
+#endif
+
+/**
+\def OSCL_HAS_MSWIN_SUPPORT macro should be set to 1 if
+the target platform supports the Win32 API.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_MSWIN_SUPPORT
+#error "ERROR: OSCL_HAS_MSWIN_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+\def OSCL_HAS_MSWIN_PARTIAL_SUPPORT macro should be set to 1 if
+the target platform supports the WinMobile API.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_MSWIN_PARTIAL_SUPPORT
+#error "ERROR: OSCL_HAS_MSWIN_PARTIAL_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+\def OSCL_HAS_UNIX_SUPPORT macro should be set to 1 if
+the target platform supports the Unix API.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_UNIX_SUPPORT
+#error "ERROR: OSCL_HAS_UNIX_SUPPORT has to be defined to either 1 or 0."
+#endif
+
+/**
+\def OSCL_HAS_SYMBIAN_SUPPORT macro should be set to 1 if
+the target platform supports the Symbian API.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SYMBIAN_SUPPORT
+#error "ERROR: OSCL_HAS_SYMBIAN_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+\def OSCL_HAS_ANDROID_SUPPORT macro should be set to 1 if
+the target platform supports the Android API.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_ANDROID_SUPPORT
+#error "ERROR: OSCL_HAS_ANDROID_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+\def OSCL_HAS_IPHONE_SUPPORT macro should be set to 1 if
+the target platform supports the iPhone API.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_IPHONE_SUPPORT
+#error "ERROR: OSCL_HAS_IPHONE_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+\def OSCL_INTEGERS_WORD_ALIGNED macro should be set to 1 if
+the target platform requires integers to be word-aligned in memory.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_INTEGERS_WORD_ALIGNED
+#error "ERROR: OSCL_INTEGERS_WORD_ALIGNED has to be defined to either 1 or 0."
+#endif
+
+/**
+\def OSCL_BYTE_ORDER_BIG_ENDIAN macro should be set to 1 if
+the target platform uses big-endian byte order in memory.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_BYTE_ORDER_BIG_ENDIAN
+#error "ERROR: OSCL_BYTE_ORDER_BIG_ENDIAN has to be defined to either 1 or 0."
+#endif
+
+/**
+\def OSCL_BYTE_ORDER_LITTLE_ENDIAN macro should be set to 1 if
+the target platform uses little-endian byte order in memory.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_BYTE_ORDER_LITTLE_ENDIAN
+#error "ERROR: OSCL_BYTE_ORDER_LITTLE_ENDIAN has to be defined to either 1 or 0."
+#endif
+
+/**
+\def Either OSCL_BYTE_ORDER_BIG_ENDIAN must be set to 1
+or else OSCL_BYTE_ORDER_LITTLE_ENDIAN must be set to 1.
+*/
+#if !(OSCL_BYTE_ORDER_BIG_ENDIAN) && !(OSCL_BYTE_ORDER_LITTLE_ENDIAN)
+#error "ERROR: either OSCL_BYTE_ORDER_LITTLE_ENDIAN or else OSCL_BYTE_ORDER_BIG_ENDIAN must be 1."
+#endif
+#if (OSCL_BYTE_ORDER_BIG_ENDIAN) && (OSCL_BYTE_ORDER_LITTLE_ENDIAN)
+#error "ERROR: either OSCL_BYTE_ORDER_LITTLE_ENDIAN or else OSCL_BYTE_ORDER_BIG_ENDIAN must be 1."
+#endif
+
+/**
+\def OSCL_HAS_GLOBAL_VARIABLE_SUPPORT macro should be set to 1 if
+the target platform allows global variable definitions.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_GLOBAL_VARIABLE_SUPPORT
+#error "ERROR: OSCL_HAS_GLOBAL_VARIABLE_SUPPORT has to be defined to either 1 or 0."
+#endif
+
+/**
+Note: only one byte order mode can be defined per platform.
+*/
+#if (OSCL_BYTE_ORDER_LITTLE_ENDIAN) && (OSCL_BYTE_ORDER_BIG_ENDIAN)
+#error "ERROR: Multiple selection for OSCL_BYTE_ORDER."
+#endif
+
+/**
+\def OSCL_HAS_ANSI_STRING_SUPPORT macro should be set to 1 if
+the target platform supports C standard string functions (string.h).
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_ANSI_STRING_SUPPORT
+#error "ERROR: OSCL_HAS_ANSI_STRING_SUPPORT has to be defined to either 1 or 0."
+#endif
+
+/**
+\def OSCL_NATIVE_INT64_TYPE has to be defined to the native
+signed 64-bit integer type.
+*/
+#ifndef OSCL_NATIVE_INT64_TYPE
+#error "ERROR: OSCL_NATIVE_INT64_TYPE has to be defined."
+#endif
+
+/**
+\def OSCL_NATIVE_UINT64_TYPE has to be defined to the native
+unsigned 64-bit integer type.
+*/
+#ifndef OSCL_NATIVE_UINT64_TYPE
+#error "ERROR: OSCL_NATIVE_UINT64_TYPE has to be defined."
+#endif
+
+/**
+\def INT64(x) has to be defined to the expression for a signed
+64-bit literal.
+*/
+#ifndef INT64
+#error "ERROR: INT64(x) has to be defined."
+#endif
+
+/**
+\def UINT64(x) has to be defined to the expression for an unsigned
+64-bit literal.
+*/
+#ifndef UINT64
+#error "ERROR: UINT64(x) has to be defined."
+#endif
+
+/**
+\def INT64_HILO(high,low) has to be defined to an expression
+to create a signed 64-bit integer from 2 32-bit integers.
+*/
+#ifndef INT64_HILO
+#error "ERROR: INT64_HILO(high,low) has to be defined."
+#endif
+
+/**
+\def UINT64_HILO(high,low) has to be defined to an expression
+to create an unsigned 64-bit integer from 2 32-bit integers.
+*/
+#ifndef UINT64_HILO
+#error "ERROR: UINT64_HILO(high,low) has to be defined."
+#endif
+
+/**
+\def OSCL_MEMFRAG_PTR_BEFORE_LEN macro should be set to 1 if
+memory fragements data structures, such as used by sendmsg
+(i.e., the iovec data structures), should use ptr before length.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_MEMFRAG_PTR_BEFORE_LEN
+#error "ERROR: OSCL_MEMFRAG_PTR_BEFORE_LEN has to be defined to either 0 or 1"
+#endif
+
+/**
+\def OSCL_HAS_TLS_SUPPORT macro should be set to 1 if
+the target platform has thread-local storage functions.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_TLS_SUPPORT
+#error "ERROR: OSCL_HAS_TLS_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+\def OSCL_TLS_IS_KEYED macro should be set to 1 if
+the target platform's thread local storage function requires an
+input key value to uniquely identify the TLS.
+If the thread local storage function does not require any key,
+or thread local storage is not supported, it should be set to 0.
+*/
+#ifndef OSCL_TLS_IS_KEYED
+#error "ERROR: OSCL_TLS_IS_KEYED has to be defined to either 1 or 0"
+#endif
+
+
+/**
+When OSCL_TLS_IS_KEYED==1,
+\def OSCL_TLS_STORE_FUNC macro must be set to an expression that will
+set the TLS value and evalutes to true on success, false on failure.
+The macro takes 2 input parameters (key, ptr).
+*/
+#if (OSCL_TLS_IS_KEYED) && !defined(OSCL_TLS_STORE_FUNC)
+#error "ERROR: OSCL_TLS_STORE_FUNC has to be defined"
+#endif
+
+/**
+When OSCL_TLS_IS_KEYED==1,
+\def OSCL_TLS_GET_FUNC macro should be set to an expression that
+returns the TLS value.
+The macro takes 1 input parameter (key).
+*/
+#if (OSCL_TLS_IS_KEYED) && !defined(OSCL_TLS_GET_FUNC)
+#error "ERROR: OSCL_TLS_GET_FUNC has to be defined"
+#endif
+
+/**
+When OSCL_TLS_IS_KEYED==1,
+\def OSCL_TLS_GET_FUNC macro should be set to an expression that
+creates a TLS entry and evalutes to true on success, false on failure.
+The macro takes 1 input parameter (key).
+*/
+#if (OSCL_TLS_IS_KEYED) && !defined(OSCL_TLS_KEY_CREATE_FUNC)
+#error "ERROR: OSCL_TLS_KEY_CREATE_FUNC has to be defined"
+#endif
+
+/**
+When OSCL_TLS_IS_KEYED==1,
+\def OSCL_TLS_GET_FUNC macro should be set to an expression that
+deletes a TLS entry.
+The macro takes 1 input parameter (key).
+*/
+#if (OSCL_TLS_IS_KEYED) && !defined(OSCL_TLS_KEY_DELETE_FUNC)
+#error "ERROR: OSCL_TLS_KEY_DELETE_FUNC has to be defined"
+#endif
+
+
+/**
+When OSCL_TLS_IS_KEYED==0,
+\def OSCL_TLS_STORE_FUNC macro must be set to an expression that will
+set the TLS value and evalutes to true on success, false on failure.
+The macro takes 1 input parameter (ptr).
+*/
+#if (OSCL_HAS_TLS_SUPPORT) && !(OSCL_TLS_IS_KEYED) && !defined(OSCL_TLS_STORE_FUNC)
+#error "ERROR: OSCL_TLS_STORE_FUNC has to be defined"
+#endif
+
+/**
+When OSCL_TLS_IS_KEYED==0,
+\def OSCL_TLS_GET_FUNC macro should be set to an expression that
+returns the TLS value.
+*/
+#if (OSCL_HAS_TLS_SUPPORT) && !(OSCL_TLS_IS_KEYED) && !defined(OSCL_TLS_GET_FUNC)
+#error "ERROR: OSCL_TLS_GET_FUNC has to be defined"
+#endif
+
+/**
+OSCL_HAS_BASIC_LOCK should be set to 1 if the platform has basic lock support.
+*/
+#if !defined(OSCL_HAS_BASIC_LOCK )
+#error "ERROR: OSCL_HAS_BASIC_LOCK must be defined to 0 or 1"
+#endif
+
+
+/**
+When OSCL_HAS_BASIC_LOCK is 1,
+type TOsclBasicLockObject should be defined as the type used as
+a mutex object or handle on the target platform.  It can
+be either typedef'd as a C-compilable type or can be #defined.
+Examples:
+typedef pthread_mutex_t TOsclBasicLockObject;
+#define TOsclBasicLockObject RMutex
+*/
+#if (OSCL_HAS_BASIC_LOCK) && !defined(TOsclBasicLockObject)
+typedef TOsclBasicLockObject __verify__TOsclBasicLockObject__defined__;
+#endif
+
+/**
+\def OSCL_HAS_PRAGMA_PACK macro should be set to 1 if the compiler supports
+pragma pack, 0 if it does not.
+*/
+#ifndef OSCL_HAS_PRAGMA_PACK
+#error "ERROR: OSCL_HAS_PRAGMA_PACK must be defined to 0 or 1"
+#endif
+
+/*! @} */
+
+#endif // OSCLCONFIG_CHECK_H_INCLUDED
+
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_compiler_warnings.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_compiler_warnings.h
new file mode 100644 (file)
index 0000000..28d7418
--- /dev/null
@@ -0,0 +1,44 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//       O S C L C O N F I G _ C O M P I L E R  _ W A R N I N G S
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_compiler_warnings.h
+ *  \brief This file contains the ability to turn off/on compiler warnings
+ *
+ */
+
+// This macro enables the "#pragma GCC system_header" found in any header file that
+// includes this config file.
+// "#pragma GCC system_header" suppresses compiler warnings in the rest of that header
+// file by treating the header as a system header file.
+// For instance, foo.h has 30 lines, "#pragma GCC system_header" is inserted at line 10,
+// from line 11 to the end of file, all compiler warnings are disabled.
+// However, this does not affect any files that include foo.h.
+//
+#ifdef __GNUC__
+#define OSCL_DISABLE_GCC_WARNING_SYSTEM_HEADER
+#endif
+
+#define OSCL_FUNCTION_PTR(x) (&x)
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_error.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_error.h
new file mode 100644 (file)
index 0000000..6cdf86c
--- /dev/null
@@ -0,0 +1,53 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//                O S C L C O N F I G _ E R R O R
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_error.h
+ *  \brief This file contains the common typedefs and header files needed to compile osclerror
+ *
+ */
+
+
+#ifndef OSCLCONFIG_ERROR_H_INCLUDED
+#define OSCLCONFIG_ERROR_H_INCLUDED
+
+#ifndef OSCLCONFIG_H_INCLUDED
+#include "osclconfig.h"
+#endif
+
+#define OSCL_HAS_EXCEPTIONS                     1
+#define OSCL_HAS_ERRNO_H                        1
+#define OSCL_HAS_SYMBIAN_ERRORTRAP      0
+#define OSCL_HAS_SETJMP_H 1
+
+// system header files
+#include <setjmp.h>
+#include <errno.h>
+
+
+// confirm that all definitions have been defined
+#include "osclconfig_error_check.h"
+
+#endif // OSCLCONFIG_ERROR_H_INCLUDED
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_error_check.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_error_check.h
new file mode 100644 (file)
index 0000000..301181e
--- /dev/null
@@ -0,0 +1,63 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OSCLCONFIG_ERROR_CHECK_H_INCLUDED
+#define OSCLCONFIG_ERROR_CHECK_H_INCLUDED
+
+
+/**
+OSCL_HAS_EXCEPTIONS macro should be set to 1 if
+the target platform supports C++ exceptions (throw, catch).
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_EXCEPTIONS
+#error "ERROR: OSCL_HAS_EXCEPTIONS has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_EXCEPTIONS macro should be set to 1 if
+the target platform supports the POSIX-compliant errno.h header file.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_ERRNO_H
+#error "ERROR: OSCL_HAS_ERRNO_H has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_SYMBIAN_ERRORTRAP macro should be set to 1 if
+the target platform has Symbian leave, trap, and cleanup stack support.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SYMBIAN_ERRORTRAP
+#error "ERROR: OSCL_HAS_SYMBIAN_ERRORTRAP has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_SETJMP_H macro should be set to 1 if
+the target platform supports the setjmp.h header file including
+the setjmp and longjmp functions.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SETJMP_H
+#error "ERROR: OSCL_HAS_SETJMP_H has to be defined to either 1 or 0"
+#endif
+
+
+#endif //OSCLCONFIG_ERROR_CHECK_H_INCLUDED
+
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_global_new_delete.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_global_new_delete.h
new file mode 100644 (file)
index 0000000..d3d0112
--- /dev/null
@@ -0,0 +1,30 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+#ifndef OSCLCONFIG_GLOBAL_NEW_DELETE_H_INCLUDED
+#define OSCLCONFIG_GLOBAL_NEW_DELETE_H_INCLUDED
+
+//This file contains overloads for the global new/delete operators
+//for use in configurations without a native new/delete operator,
+//or where it is desirable to overload the existing global new/delete
+//operators.  The implementation of the operators is in oscl_mem.cpp.
+
+void* operator new(size_t);
+void operator delete(void*);
+
+
+#endif
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_global_placement_new.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_global_placement_new.h
new file mode 100644 (file)
index 0000000..4ab19e7
--- /dev/null
@@ -0,0 +1,31 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+#ifndef OSCLCONFIG_GLOBAL_PLACEMENT_NEW_H_INCLUDED
+#define OSCLCONFIG_GLOBAL_PLACEMENT_NEW_H_INCLUDED
+
+//This file contains a definition of placement new operator
+//for use in configurations without a native placement new
+//operator definition.
+
+inline void* operator new(size_t, void* ptr)
+{
+    return ptr;
+}
+
+
+#endif
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_io.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_io.h
new file mode 100644 (file)
index 0000000..bca1245
--- /dev/null
@@ -0,0 +1,309 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//     O S C L C O N F I G _ I O
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_io.h
+ *  \brief This file contains common typedefs based on the ANSI C limits.h header
+ *
+ *  This header file should work for any ANSI C compiler to determine the
+ *  proper native C types to use for OSCL integer types.
+ */
+
+
+#ifndef OSCLCONFIG_IO_H_INCLUDED
+#define OSCLCONFIG_IO_H_INCLUDED
+
+#ifndef OSCLCONFIG_H_INCLUDED
+#include "osclconfig.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <netdb.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <errno.h>
+#include <sys/vfs.h>
+#include <dirent.h>
+//#include <glob.h>
+#if (OSCL_HAS_ANSI_STDLIB_SUPPORT)
+#if (OSCL_HAS_UNIX_SUPPORT)
+#include <sys/stat.h>
+#endif
+#endif
+
+//For File I/O
+#define OSCL_HAS_GLOB 0
+#define OSCL_HAS_ANSI_FILE_IO_SUPPORT 1
+#define OSCL_HAS_ANSI_64BIT_FILE_IO_SUPPORT 0
+#define OSCL_HAS_MSWIN_FILE_IO_SUPPORT 0
+#define OSCL_HAS_SYMBIAN_COMPATIBLE_IO_FUNCTION 0
+#define OSCL_HAS_NATIVE_FILE_CACHE_ENABLE 1
+#define OSCL_FILE_BUFFER_MAX_SIZE   32768
+#define OSCL_HAS_PV_FILE_CACHE  0
+#define OSCL_HAS_LARGE_FILE_SUPPORT 1
+
+//For Sockets
+#define OSCL_HAS_SYMBIAN_SOCKET_SERVER 0
+#define OSCL_HAS_SYMBIAN_DNS_SERVER 0
+#define OSCL_HAS_BERKELEY_SOCKETS 1
+#define OSCL_HAS_SOCKET_SUPPORT 1
+
+//basic socket types
+typedef int TOsclSocket;
+typedef struct sockaddr_in TOsclSockAddr;
+typedef socklen_t TOsclSockAddrLen;
+typedef struct ip_mreq TIpMReq;
+
+//Init addr macro, inet_addr returns an uint32
+#define OsclValidInetAddr(addr) (inet_addr(addr)!=INADDR_NONE)
+
+//address conversion macro-- from string to network address.
+#define OsclMakeSockAddr(sockaddr,port,addrstr,ok)\
+    sockaddr.sin_family=OSCL_AF_INET;\
+    sockaddr.sin_port=htons(port);\
+    int32 result=inet_aton((const char*)addrstr,&sockaddr.sin_addr);\
+    ok=(result!=0);
+
+//address conversion macro-- from network address to string
+#define OsclUnMakeSockAddr(sockaddr,addrstr)\
+    addrstr=inet_ntoa(sockaddr.sin_addr);
+//address conversion macro-- from string to inaddr
+#define OsclMakeInAddr(in_addr,addrstr,ok)\
+    int32 result = inet_aton((const char*)addrstr, &in_addr);\
+    ok=(result!=0);
+
+//address conversion macro-- from inaddr to string
+#define OsclUnMakeInAddr(in_addr,addrstr)\
+    addrstr=inet_ntoa(in_addr);
+
+//wrappers for berkeley socket calls
+#define OsclSetRecvBufferSize(s,val,ok,err) \
+        ok=(setsockopt(s,SOL_SOCKET,SO_RCVBUF,(char*)&val, sizeof(int)) !=-1);\
+        if (!ok)err=errno
+
+#define OsclBind(s,addr,ok,err)\
+    TOsclSockAddr* tmpadr = &addr;\
+    sockaddr* sadr = OSCL_STATIC_CAST(sockaddr*, tmpadr);\
+    ok=(bind(s,sadr,sizeof(addr))!=(-1));\
+    if (!ok)err=errno
+
+#define OsclSetSockOpt(s,optLevel,optName,optVal,optLen,ok,err)\
+    ok=(setsockopt(s,optLevel,optName,OSCL_STATIC_CAST(const char*,optVal),optLen) != (-1));\
+    if (!ok)err=errno
+#define OsclJoin(s,addr,ok,err)\
+{\
+        struct ip_mreq mreq; \
+            void* p = &addr; \
+        ok=(bind(s,(sockaddr*)p,sizeof(addr))!=(-1));\
+        mreq.imr_multiaddr.s_addr = addr.sin_addr.s_addr ; \
+        mreq.imr_interface.s_addr = htonl(INADDR_ANY); \
+        ok=(setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(struct ip_mreq))!=(-1)); \
+        if (!ok)err=errno;\
+}
+
+
+#define OsclListen(s,size,ok,err)\
+    ok=(listen(iSocket,qSize)!=(-1));\
+    if (!ok)err=errno
+
+#define OsclAccept(s,accept_s,ok,err,wouldblock)\
+    accept_s=accept(s,NULL,NULL);\
+    ok=(accept_s!=(-1));\
+    if (!ok){err=errno;wouldblock=(err==EAGAIN||err==EWOULDBLOCK);}
+
+#define OsclSetNonBlocking(s,ok,err)\
+    ok=(fcntl(s,F_SETFL,O_NONBLOCK)!=(-1));\
+    if (!ok)err=errno
+
+#define OsclShutdown(s,how,ok,err)\
+    ok=(shutdown(iSocket,how)!=(-1));\
+    if (!ok)err=errno
+
+#define OsclSocket(s,fam,type,prot,ok,err)\
+    s=socket(fam,type,prot);\
+    ok=(s!=(-1));\
+    if (!ok)err=errno
+
+#define OsclSendTo(s,buf,len,addr,ok,err,nbytes,wouldblock)\
+    TOsclSockAddr* tmpadr = &addr;\
+    sockaddr* sadr = OSCL_STATIC_CAST(sockaddr*, tmpadr);\
+    nbytes=sendto(s,(const void*)(buf),(size_t)(len),0,sadr,(socklen_t)sizeof(addr));\
+    ok=(nbytes!=(-1));\
+    if (!ok){err=errno;wouldblock=(err==EAGAIN||err==EWOULDBLOCK);}
+
+#define OsclSend(s,buf,len,ok,err,nbytes,wouldblock)\
+    nbytes=send(s,(const void*)(buf),(size_t)(len),0);\
+    ok=(nbytes!=(-1));\
+    if (!ok){err=errno;wouldblock=(err==EAGAIN||err==EWOULDBLOCK);}
+
+#define OsclCloseSocket(s,ok,err)\
+    ok=(close(s)!=(-1));\
+    if (!ok)err=errno
+
+#define OsclConnect(s,addr,ok,err,wouldblock)\
+    TOsclSockAddr* tmpadr = &addr;\
+    sockaddr* sadr = OSCL_STATIC_CAST(sockaddr*, tmpadr);\
+    ok=(connect(s,sadr,sizeof(addr))!=(-1));\
+    if (!ok){err=errno;wouldblock=(err==EINPROGRESS);}
+#define OsclGetPeerName(s,name,namelen,ok,err)\
+    ok=(getpeername(s,(sockaddr*)&name,(socklen_t*)&namelen) != (-1) );\
+    if (!ok)err=errno
+
+#define OsclGetAsyncSockErr(s,ok,err)\
+    int opterr;socklen_t optlen=sizeof(opterr);\
+    ok=(getsockopt(s,SOL_SOCKET,SO_ERROR,(void *)&opterr,&optlen)!=(-1));\
+    if(ok)err=opterr;else err=errno;
+
+#define OsclPipe(x)         pipe(x)
+#define OsclReadFD(fd,buf,cnt)  read(fd,buf,cnt)
+#define OsclWriteFD(fd,buf,cnt) write(fd,buf,cnt)
+
+//unix reports connect completion in write set in the getsockopt
+//error.
+#define OsclConnectComplete(s,wset,eset,success,fail,ok,err)\
+    success=fail=false;\
+    if (FD_ISSET(s,&eset))\
+    {fail=true;OsclGetAsyncSockErr(s,ok,err);}\
+    else if (FD_ISSET(s,&wset))\
+    {OsclGetAsyncSockErr(s,ok,err);if (ok && err==0)success=true;else fail=true;}
+
+#define OsclRecv(s,buf,len,ok,err,nbytes,wouldblock)\
+    nbytes=recv(s,(void *)(buf),(size_t)(len),0);\
+    ok=(nbytes!=(-1));\
+    if (!ok){err=errno;wouldblock=(err==EAGAIN);}
+
+#define OsclRecvFrom(s,buf,len,paddr,paddrlen,ok,err,nbytes,wouldblock)\
+{\
+void* p=paddr;\
+nbytes=recvfrom(s,(void*)(buf),(size_t)(len),0,(struct sockaddr*)p,paddrlen);\
+    ok=(nbytes!=(-1));\
+    if (!ok){err=errno;wouldblock=(err==EAGAIN);}\
+}
+
+
+#define OsclSocketSelect(nfds,rd,wr,ex,timeout,ok,err,nhandles)\
+    nhandles=select(nfds,&rd,&wr,&ex,&timeout);\
+    ok=(nhandles!=(-1));\
+    if (!ok)err=errno
+
+//there's not really any socket startup needed on unix, but
+//you need to define a signal handler for SIGPIPE to avoid
+//broken pipe crashes.
+#define OsclSocketStartup(ok)\
+    signal(SIGPIPE,SIG_IGN);\
+    ok=true
+
+#define OsclSocketCleanup(ok)\
+    signal(SIGPIPE,SIG_DFL);\
+    ok=true
+
+//hostent type
+typedef struct hostent TOsclHostent;
+
+//wrapper for gethostbyname
+#define OsclGethostbyname(name,hostent,ok,err)\
+    hostent=gethostbyname((const char*)name);\
+    ok=(hostent!=NULL);\
+    if (!ok)err=errno;
+
+//extract dotted address from a hostent
+#define OsclGetDottedAddr(hostent,dottedaddr,ok)\
+    long *_hostaddr=(long*)hostent->h_addr_list[0];\
+    struct in_addr _inaddr;\
+    _inaddr.s_addr=*_hostaddr;\
+    dottedaddr=inet_ntoa(_inaddr);\
+    ok=(dottedaddr!=NULL);
+
+//extract dotted address from a hostent into the vector of OsclNetworkAddress
+#define OsclGetDottedAddrVector(hostent,dottedaddr,dottedaddrvect,ok)\
+    if(dottedaddrvect)\
+    {\
+    long **_addrlist=(long**)hostent->h_addr_list;\
+    for(int i = 0; _addrlist[i] != NULL; i++){\
+        struct in_addr _inaddr;\
+        _inaddr.s_addr=*_addrlist[i];\
+        OsclNetworkAddress addr(inet_ntoa(_inaddr), 0);\
+        dottedaddrvect->push_back(addr);\
+    }\
+    if (!dottedaddrvect->empty())\
+        {dottedaddr->port = dottedaddrvect->front().port; dottedaddr->ipAddr.Set(dottedaddrvect->front().ipAddr.Str());}\
+    ok=(!dottedaddrvect->empty() && (((*dottedaddrvect)[0]).ipAddr.Str() != NULL));\
+    }\
+    else\
+    {\
+        char *add;\
+        OsclGetDottedAddr(hostent,add,ok);\
+        if(ok) dottedaddr->ipAddr.Set(add);\
+    }
+
+//socket shutdown codes
+#define OSCL_SD_RECEIVE SHUT_RD
+#define OSCL_SD_SEND SHUT_WR
+#define OSCL_SD_BOTH SHUT_RDWR
+
+//address family codes
+#define OSCL_AF_INET AF_INET
+
+//socket type codes
+#define OSCL_SOCK_STREAM SOCK_STREAM
+#define OSCL_SOCK_DATAGRAM SOCK_DGRAM
+
+//IP protocol codes
+#define OSCL_IPPROTO_IP  IPPROTO_IP
+#define OSCL_IPPROTO_TCP IPPROTO_TCP
+#define OSCL_IPPROTO_UDP IPPROTO_UDP
+
+//Socket option Levels
+#define OSCL_SOL_SOCKET SOL_SOCKET
+#define OSCL_SOL_IP     IPPROTO_IP
+#define OSCL_SOL_TCP    IPPROTO_TCP
+#define OSCL_SOL_UDP    IPPROTO_UDP
+
+//Socket Option Values (level = IP)
+#define OSCL_SOCKOPT_IP_MULTICAST_TTL   IP_MULTICAST_TTL
+#define OSCL_SOCKOPT_IP_ADDMEMBERSHIP   IP_ADD_MEMBERSHIP
+#define OSCL_SOCKOPT_IP_TOS             IP_TOS
+
+//Socket Option Values (level = Socket)
+#define OSCL_SOCKOPT_SOL_REUSEADDR      SO_REUSEADDR
+//End sockets
+
+// file IO support
+#if (OSCL_HAS_LARGE_FILE_SUPPORT)
+typedef off64_t TOsclFileOffset;
+#else
+typedef int32 TOsclFileOffset;
+#endif
+
+#include "osclconfig_io_check.h"
+
+#endif
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_io_check.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_io_check.h
new file mode 100644 (file)
index 0000000..22ddebb
--- /dev/null
@@ -0,0 +1,605 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+#ifndef OSCLCONFIG_IO_CHECK_H_INCLUDED
+#define OSCLCONFIG_IO_CHECK_H_INCLUDED
+
+/**
+OSCL_HAS_ANSI_FILE_IO_SUPPORT macro should be set to 1 if
+the target platform supports the ANSI C file I/O functions (fopen, fread, etc).
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_ANSI_FILE_IO_SUPPORT
+#error "ERROR: OSCL_HAS_ANSI_FILE_IO_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_ANSI_64BIT_FILE_IO_SUPPORT macro should be set to 1 if
+the target platform supports the 64-bit ANSI C file I/O functions (fopen, fread, etc).
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_ANSI_64BIT_FILE_IO_SUPPORT
+#error "ERROR: OSCL_HAS_ANSI_64BIT_FILE_IO_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_MSWIN_FILE_IO_SUPPORT macro should be set to 1 if
+the target platform supports the ANSI C file I/O functions (fopen, fread, etc).
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_MSWIN_FILE_IO_SUPPORT
+#error "ERROR: OSCL_HAS_MSWIN_FILE_IO_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_SYMBIAN_COMPATIBLE_IO_FUNCTION macro should be set to 1 if
+the target platform supports the Symbian file I/O functions (RFile, RFs).
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SYMBIAN_COMPATIBLE_IO_FUNCTION
+#error "ERROR: OSCL_HAS_SYMBIAN_COMPATIBLE_IO_FUNCTION has to be defined to either 1 or 0"
+#endif
+
+/**
+On Symbian platforms only:
+OSCL_HAS_NATIVE_DUPLICATE_FILE_HANDLE  macro should be set to 1 if
+the target platform supports the Symbian file I/O function RFile::Duplicate.
+Otherwise it should be set to 0.
+*/
+#if (OSCL_HAS_SYMBIAN_COMPATIBLE_IO_FUNCTION)
+#ifndef OSCL_HAS_NATIVE_DUPLICATE_FILE_HANDLE
+#error "ERROR: OSCL_HAS_NATIVE_DUPLICATE_FILE_HANDLE has to be defined to either 1 or 0"
+#endif
+#endif
+
+
+/**
+OSCL_HAS_NATIVE_FILE_CACHE_ENABLE macro should be set to 1 if
+the target platform includes native file cache capability.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_NATIVE_FILE_CACHE_ENABLE
+#error "ERROR: OSCL_HAS_NATIVE_FILE_CACHE_ENABLE has to be defined to either 1 or 0"
+#endif
+
+
+/**
+OSCL_HAS_PV_FILE_CACHE macro should be set to 1 if
+the target platform includes PV file cache capability.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_PV_FILE_CACHE
+#error "ERROR: OSCL_HAS_PV_FILE_CACHE has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_LARGE_FILE_SUPPORT macro should be set to 1 if
+the target platform supports more than 32bit file I/O capability.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_LARGE_FILE_SUPPORT
+#error "ERROR: OSCL_HAS_LARGE_FILE_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+type TOsclFileOffset should be defined as the type used for file size
+and offsets on the target platform.
+Example:
+typedef size_t TOsclFileOffset;
+*/
+typedef TOsclFileOffset __verify__TOsclFileOffset__defined__;
+
+
+/**
+OSCL_FILE_BUFFER_MAX_SIZE macro should be set to
+the desired size of the file I/O cache in bytes.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_FILE_BUFFER_MAX_SIZE
+#error "ERROR: OSCL_FILE_BUFFER_MAX_SIZE has to be defined to a numeric value"
+#endif
+
+/**
+OSCL_HAS_SOCKET_SUPPORT macro should be set to 1 if
+the target platform supports sockets of any type.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SOCKET_SUPPORT
+#error "ERROR: OSCL_HAS_SOCKET_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_SYMBIAN_SOCKET_SERVER macro should be set to
+1 if the platform supports Symbian socket API (RSocket, RSocketServ).
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SYMBIAN_SOCKET_SERVER
+#error "ERROR: OSCL_HAS_SYMBIAN_SOCKET_SERVER has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_SYMBIAN_DNS_SERVER macro should be set to
+1 if the platform supports Symbian Host Resolver API (RHostResolver).
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SYMBIAN_DNS_SERVER
+#error "ERROR: OSCL_HAS_SYMBIAN_DNS_SERVER has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_BERKELEY_SOCKETS macro should be set to
+1 if the platform supports Berkeley style socket API, including
+non-blocking I/O and a 'select' call.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_BERKELEY_SOCKETS
+#error "ERROR: OSCL_HAS_BERKELEY_SOCKETS has to be defined to either 1 or 0"
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+TOsclSocket typedef should be set to platform native socket type.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+typedef TOsclSocket __TOsclSocketCheck___;
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+TOsclSockAddr typedef should be set to platform native socket address type.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+typedef TOsclSockAddr __TOsclSockAddrCheck___;
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+TOsclSockAddrLen typedef should be set to platform native socket address
+length type.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+typedef TOsclSockAddrLen __TOsclSockAddrLenCheck___;
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclBind(s,addr,ok,err) must be defined to
+an expression that does a bind call.
+'s' and 'addr' are the socket and address parameters
+to the bind command.
+On success, 'ok' must be set to true.
+On failure, 'ok' must be set to false and 'err' must be set
+to the bind error.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclBind
+#error "ERROR: OsclBind(s,addr,ok,err) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclListen(s,size,ok,err) must be defined to
+an expression that does a listen call and sets 'ok' and 'err'
+to indicate the result.
+'s' and 'size' are the socket and queue size args to the listen
+call.
+On success, 'ok' must be set to true.
+On failure, 'ok' must be set to false and 'err' must be set
+to the listen error.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclListen
+#error "ERROR: OsclListen(s,size,ok,err) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclAccept(s,accept_s,ok,err,wouldblock) must be defined to
+an expression that does an accept call and sets 'ok', 'err',
+and 'wouldblock' to indicate the result.
+'s' and 'accept_s' are the socket and accept socket args to the
+accept call.
+On success, 'ok' must be set to true.
+On failure, 'ok' must be set to false and 'err' must be set
+to the accept error.  Additionally 'wouldblock' must be set to true
+if the error code indicates that the socket is non-blocking and
+would block, or to false otherwise.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclAccept
+#error "ERROR: OsclAccept(s,accept_s,ok,err,wouldblock) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclSetNonBlocking(s,ok,err) must be defined to
+an expression that sets socket 's' to non-blocking I/O mode
+and sets 'ok' and 'err' to indicate the result.
+On success, 'ok' must be set to true.
+On failure, 'ok' must be set to false and 'err' must be set
+to the error.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclSetNonBlocking
+#error "ERROR: OsclSetNonBlocking(s,ok,err) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclShutdown(s,how,ok,err) must be defined to
+an expression that does a shutdown call and sets 'ok' and 'err'
+to indicate the result.
+'s' and 'how' are the socket and shutdown type args to the
+shutdown call.
+On success, 'ok' must be set to true.
+On failure, 'ok' must be set to false and 'err' must be set
+to the shutdown error.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclShutdown
+#error "ERROR: OsclShutdown(s,how,ok,err) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclSocket(s,fam,type,prot,ok,err) must be defined to
+an expression that does a socket creation call and sets 'ok'
+and 'err' to indicate the result.
+'s', 'fam', 'type', and 'prot' are the socket, family, type, and
+protocol args to the socket call.
+On success, 'ok' must be set to true.
+On failure, 'ok' must be set to false and 'err' must be set
+to the socket error.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclSocket
+#error "ERROR: OsclSocket(s,fam,type,prot,ok,err) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclSendTo(s,buf,len,addr,ok,err,nbytes,wouldblock) must be defined
+to an expression that does a sendto call and sets 'ok, 'err', 'nbytes',
+and 'wouldblock' to indicate the result.
+'s', 'buf', 'len', 'flags' and 'addr' are the arguments to the sendto
+call.
+On success, 'ok' must be set to true, and 'nbytes' must be set to
+the number of bytes sent.
+On failure, 'ok' must be set to false 'err' must be set
+to the socket error.  Additionally 'wouldblock' must be set to true
+if the error code indicates that the socket is non-blocking and
+would block, or to false otherwise.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclSendTo
+#error "ERROR: OsclSendTo(s,buf,len,flags,addr,ok,err,nbytes,wouldblock) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclSend(s,buf,len,ok,err,nbytes,wouldblock) must be defined to
+an expression that does a send operation and sets 'ok, 'err', 'nbytes',
+and 'wouldblock' to indicate the result.
+'s', 'buf', and 'len' are the args to the send call.
+On success, 'ok' must be set to true, and 'nbytes' must be set to
+the number of bytes sent.
+On failure, 'ok' must be set to false 'err' must be set
+to the socket error.  Additionally 'wouldblock' must be set to true
+if the error code indicates that the socket is non-blocking and
+would block, or to false otherwise.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclSend
+#error "ERROR: OsclSend(s,buf,len,ok,err,nbytes,wouldblock) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclCloseSocket(s,ok,err) must be defined to
+an expression that closes socket 's' and sets 'ok and 'err'
+to indicate the result.
+On success, 'ok' must be set to true.
+On failure, 'ok' must be set to false and 'err' must be set
+to the close error.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclCloseSocket
+#error "ERROR: OsclCloseSocket(s,ok,err) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclConnect(s,addr,ok,err,wouldblock) must be defined to
+an expression that does a connect call and sets 'ok', 'err',
+and 'wouldblock' to indicate the result.
+'s' and 'addr' are the socket and address args to the connect call.
+On success, 'ok' must be set to true.
+On failure, 'ok' must be set to false 'err' must be set
+to the socket error.  Additionally 'wouldblock' must be set to true
+if the error code indicates that the socket is non-blocking and
+would block, or to false otherwise.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclConnect
+#error "ERROR: OsclConnect(s,addr,ok,err,wouldblock) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclConnectComplete(s,wset,eset,success,fail,ok,err) must be set
+to an expression that checks for completion of a connect operation
+on a non-blocking socket and sets 'success', 'fail', 'ok', and 'err'
+to indicate the result.
+'s' is the socket, 'wset' is the write set from the select call,
+'eset' is the exception set from the select call.
+If connect is not yet complete, 'success' and 'fail' must be
+set false.
+On connect success, 'success' must be set true.
+On conneect failure, 'success' must be set false, 'fail' must be
+set true. Additionally, the call attempts to retrieve the connect error.
+If the connect error is obtained, 'ok' is set true and 'err' contains
+the error.  If the connect error is not obtained, 'ok' is set false
+and 'err' is the error code from the attempt.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclConnectComplete
+#error "ERROR: OsclConnectComplete(s,wset,eset,success,fail,ok,err) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclRecv(s,buf,len,ok,err,nbytes,wouldblock) must be defined to
+an expression that does a recv call and sets 'ok', 'err', 'nbytes',
+and 'wouldblock' to indicate the result.
+'s', 'buf', and 'len' are the arguments to the recv call.
+On success, 'ok' must be set to true, and 'nbytes' must be set to
+the number of bytes received.
+On failure, 'ok' must be set to false 'err' must be set
+to the socket error.  Additionally 'wouldblock' must be set to true
+if the error code indicates that the socket is non-blocking and
+would block, or to false otherwise.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclRecv
+#error "ERROR: OsclRecv(s,buf,len,ok,err,nbytes,wouldblock) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclRecvFrom(s,buf,len,addr,addrlen,ok,err,nbytes,wouldblock) must be defined to
+an expression that does a recvfrom call and sets 'ok', 'err', 'nbytes',
+and 'wouldblock' to indicate the result.
+'s', 'buf', 'len', 'paddr', and 'paddrlen' are the arguments to the recvfrom call.
+On success, 'ok' must be set to true, 'nbytes' must be set to
+the number of bytes received, and 'paddr' must be set to the source address.
+On failure, 'ok' must be set to false 'err' must be set
+to the socket error.  Additionally 'wouldblock' must be set to true
+if the error code indicates that the socket is non-blocking and
+would block, or to false otherwise.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclRecvFrom
+#error "ERROR: OsclRecvFrom(s,buf,len,paddr,paddrlen,ok,err,nbytes,wouldblock) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclSocketSelect(nfds,rd,wr,ex,timeout,ok,err,nhandles) must be defined to
+an expression that does a select call and sets 'ok', 'err', and
+'nhandles' to indicate the result.
+'nfds', 'rd', 'wr', 'ex', and 'timeout' are the arguments to the
+select call.
+On success, 'ok' must be set to true, and 'nhandles' must be set to
+the number of socket handles with activitiy detected.
+On failure, 'ok' must be set to false 'err' must be set
+to the select error.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclSocketSelect
+#error "ERROR: OsclSocketSelect(nfds,rd,wr,ex,timeout,ok,err,nhandles) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclSocketStartup(ok) must be defined to
+an expression that does any necessary startup of the socket system
+and sets 'ok' to indicate the result.
+On success, 'ok' must be set to true.
+On failure, 'ok' must be set to false.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclSocketStartup
+#error "ERROR: OsclSocketStartup(ok) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclSocketCleanup(ok) must be defined to
+an expression that does any necessary cleanup of the socket system
+and sets 'ok' to indicate the result.
+On success, 'ok' must be set to true.
+On failure, 'ok' must be set to false.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclSocketCleanup
+#error "ERROR: OsclSocketCleanup(ok) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclGetAsyncSockErr(s,ok,err) must be defined to
+an expression that does a getsockopt call to retrieve a socket error
+and sets 'ok' and 'err' to indicate the result.
+'s' is the socket argument to the getsockopt call.
+On success, 'ok' must be set true and 'err' must be set to the
+error retrieved.
+On failure, 'ok' must be set false and 'err' must be set to the
+error from the getsockopt call.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclGetAsyncSockErr
+#error "ERROR: OsclGetAsyncSockErr(s,ok,err) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+TOsclHostent typedef should be set to platform native hostent type.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+typedef TOsclHostent __TOsclHostentCheck___;
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclGethostbyname(name,hostent,ok,err) must be defined to
+an expression that does a gethostbyname call on host 'name'
+and sets 'hostent', 'ok' and 'err' to indicate the result.
+'name' is the name argument to the gethostbyname call.
+On success, 'ok' must be set true and 'hostent' must be set to
+the TOsclHostent* retrieved.
+On failure, 'ok' must be set false and 'err' must be set to the
+error from the gethostbyname call.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclGethostbyname
+#error "ERROR: OsclGethostbyname(name,hostent,ok,err) has to be defined"
+#endif
+#endif
+
+/**
+For platforms with Berkeley type sockets,
+OsclGetDottedAddr(hostent,dottedaddr,ok) must be defined to
+an expression that does extracts an address in dotted decimal
+notation from a hostent structure.
+'hostent' is the TOsclHostent*,
+'dottedaddr' is a char* output containing the dotted address,
+and 'ok' is a bool that should be set true on success, false on failure.
+*/
+#if OSCL_HAS_BERKELEY_SOCKETS
+#ifndef OsclGetDottedAddr
+#error "ERROR: OsclGetDottedAddr(hostent,dottedaddr,ok) has to be defined"
+#endif
+#endif
+
+
+/**
+For platforms in which file descriptors created with a pipe() command can be
+used with the select() system call the following 3 macros must be defined
+*/
+
+#if OSCL_HAS_SELECTABLE_PIPES
+#ifndef OsclPipe
+#error "ERROR: OsclPipe(pipearray) has to be defined"
+#endif
+#endif
+
+#if OSCL_HAS_SELECTABLE_PIPES
+#ifndef OsclReadFD
+#error "ERROR: OsclReadFD(fd,buffer,cnt) has to be defined"
+#endif
+#endif
+
+#if OSCL_HAS_SELECTABLE_PIPES
+#ifndef OsclWriteFD
+#error "ERROR: OsclWriteFD(fd,buffer,cnt) has to be defined"
+#endif
+#endif
+
+#if OSCL_HAS_SOCKET_SUPPORT
+/**
+OsclValidInetAddr must be defined to a boolean expression to
+evaluate whether an address is proper IP4 format.
+'addr' is a char* containing the address string.
+*/
+#ifndef OsclValidInetAddr
+#error "ERROR: OsclValidInetAddr(addr) must be defined"
+#endif
+#endif
+
+#if OSCL_HAS_SOCKET_SUPPORT
+/**
+OSCL_SD_RECEIVE, OSCL_SD_SEND, and OSCL_SD_BOTH must be defined to
+the platform-specific socket shutdown codes.
+*/
+#ifndef OSCL_SD_RECEIVE
+#error "ERROR: OSCL_SD_RECEIVE has to be defined"
+#endif
+#ifndef OSCL_SD_SEND
+#error "ERROR: OSCL_SD_SEND has to be defined"
+#endif
+#ifndef OSCL_SD_BOTH
+#error "ERROR: OSCL_SD_BOTH has to be defined"
+#endif
+#endif
+
+#if OSCL_HAS_SOCKET_SUPPORT
+/**
+OSCL_AF_INET must be defined to the platform-specific
+network address family codes for INET.
+*/
+#ifndef OSCL_AF_INET
+#error "ERROR: OSCL_AF_INET has to be defined"
+#endif
+#endif
+
+#if OSCL_HAS_SOCKET_SUPPORT
+/**
+OSCL_SOCK_STREAM and OSCL_SOCK_DATAGRAM must be defined to
+the platform-specific socket type codes.
+*/
+#ifndef OSCL_SOCK_STREAM
+#error "ERROR: OSCL_SOCK_STREAM has to be defined"
+#endif
+#ifndef OSCL_SOCK_DATAGRAM
+#error "ERROR: OSCL_SOCK_DATAGRAM has to be defined"
+#endif
+#endif
+
+#if OSCL_HAS_SOCKET_SUPPORT
+/**
+OSCL_IPPROTO_TCP and OSCL_IPPROTO_UDP must be defined to
+the platform-specific IP protocol codes.
+*/
+#ifndef OSCL_IPPROTO_TCP
+#error "ERROR: OSCL_IPPROTO_TCP has to be defined"
+#endif
+#ifndef OSCL_IPPROTO_UDP
+#error "ERROR: OSCL_IPPROTO_UDP has to be defined"
+#endif
+#endif
+
+
+#endif // OSCLCONFIG_IO_CHECK_H_INCLUDED
+
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_ix86.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_ix86.h
new file mode 100644 (file)
index 0000000..87d7afb
--- /dev/null
@@ -0,0 +1,41 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//     O S C L C O N F I G   ( P L A T F O R M   C O N F I G   I N F O )
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_ix86.h
+ *  \brief This file contains configuration information for the ix86 processor family
+ *
+ */
+
+#ifndef OSCLCONFIG_IX86_H_INCLUDED
+#define OSCLCONFIG_IX86_H_INCLUDED
+
+
+// Define macros for integer alignment and little endian byte order.
+#define OSCL_INTEGERS_WORD_ALIGNED               1
+#define OSCL_BYTE_ORDER_BIG_ENDIAN               0
+#define OSCL_BYTE_ORDER_LITTLE_ENDIAN            1
+
+
+#endif
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_lib.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_lib.h
new file mode 100644 (file)
index 0000000..ee71a6a
--- /dev/null
@@ -0,0 +1,63 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//     O S C L C O N F I G _ L I B  ( P L A T F O R M   C O N F I G   I N F O )
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_lib.h
+    \brief This file contains configuration information for the ANSI build.
+
+*/
+
+#ifndef OSCLCONFIG_LIB_H_INCLUDED
+#define OSCLCONFIG_LIB_H_INCLUDED
+
+
+
+//Set this to 1 to indicate this platform has oscllib support
+#define OSCL_HAS_RUNTIME_LIB_LOADING_SUPPORT    1
+#define PV_RUNTIME_LIB_FILENAME_EXTENSION "so"
+
+//Set this to 1 to enable looking for debug versions of libraries.
+//Use #ifndef to allow the compiler setting to override this definition
+#ifndef OSCL_LIB_READ_DEBUG_LIBS
+#if (OSCL_RELEASE_BUILD)
+#define OSCL_LIB_READ_DEBUG_LIBS 0
+#else
+#define OSCL_LIB_READ_DEBUG_LIBS 1
+#endif
+#endif
+
+// The path recursively from which the config files are picked up
+#ifndef PV_DYNAMIC_LOADING_CONFIG_FILE_PATH
+#ifdef ANDROID
+#define PV_DYNAMIC_LOADING_CONFIG_FILE_PATH "/system/etc"
+#else
+#define PV_DYNAMIC_LOADING_CONFIG_FILE_PATH "./"
+#endif
+#endif
+
+// check all osclconfig required macros are defined
+#include "osclconfig_lib_check.h"
+
+#endif // OSCLCONFIG_LIB_H_INCLUDED
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_lib_check.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_lib_check.h
new file mode 100644 (file)
index 0000000..e4f7479
--- /dev/null
@@ -0,0 +1,67 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OSCLCONFIG_LIB_CHECK_H_INCLUDED
+#define OSCLCONFIG_LIB_CHECK_H_INCLUDED
+
+/*! \addtogroup osclconfig OSCL config
+ *
+ * @{
+ */
+
+
+
+/**
+OSCL_HAS_RUNTIME_LIB_LOADING_SUPPORT should be set to 1 if the platform has basic explicit runtime DLL loading support.
+*/
+#if !defined(OSCL_HAS_RUNTIME_LIB_LOADING_SUPPORT )
+#error "ERROR: OSCL_HAS_RUNTIME_LIB_LOADING_SUPPORT must be defined to 0 or 1"
+#endif
+
+#if(OSCL_HAS_RUNTIME_LIB_LOADING_SUPPORT)
+/**
+** When OSCL_HAS_RUNTIME_LIB_LOADING_SUPPORT is 1,
+** OSCL_LIB_READ_DEBUG_LIBS should be set to 0 or 1.  Set to 1 to enable loading
+** debug versions of libs.
+*/
+#if !defined(OSCL_LIB_READ_DEBUG_LIBS)
+#error "ERROR: OSCL_LIB_READ_DEBUG_LIBS must be defined to 0 or 1"
+#endif
+
+/*
+** When OSCL_HAS_RUNTIME_LIB_LOADING_SUPPORT is 1,
+** PV_DYNAMIC_LOADING_CONFIG_FILE_PATH should be set.
+*/
+#if !defined(PV_DYNAMIC_LOADING_CONFIG_FILE_PATH)
+#error "ERROR: PV_DYNAMIC_LOADING_CONFIG_FILE_PATH must be set to a path where the config files are expected to be present"
+#endif
+
+/*
+** When OSCL_HAS_RUNTIME_LIB_LOADING_SUPPORT is 1,
+** PV_RUNTIME_LIB_FILENAME_EXTENSION should be set.
+*/
+#if !defined(PV_RUNTIME_LIB_FILENAME_EXTENSION)
+#error "ERROR: PV_RUNTIME_LIB_FILENAME_EXTENSION must be specified for use as the dynamic library file extension"
+#endif
+#endif // OSCL_HAS_RUNTIME_LIB_LOADING_SUPPORT
+
+/*! @} */
+
+#endif // OSCLCONFIG_LIB_CHECK_H_INCLUDED
+
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_limits_typedefs.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_limits_typedefs.h
new file mode 100644 (file)
index 0000000..4ce355d
--- /dev/null
@@ -0,0 +1,88 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//     O S C L C O N F I G_ L I M I T S _ T Y P E D E F S
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_limits_typedefs.h
+ *  \brief This file contains common typedefs based on the ANSI C limits.h header
+ *
+ *  This header file should work for any ANSI C compiler to determine the
+ *  proper native C types to use for OSCL integer types.
+ */
+
+
+#ifndef OSCLCONFIG_LIMITS_TYPEDEFS_H_INCLUDED
+#define OSCLCONFIG_LIMITS_TYPEDEFS_H_INCLUDED
+
+
+#include <limits.h>
+
+// determine if char is signed or unsigned
+#if ( CHAR_MIN == 0 )
+#define OSCL_CHAR_IS_UNSIGNED 1
+#define OSCL_CHAR_IS_SIGNED   0
+#elif ( CHAR_MIN == SCHAR_MIN )
+#define OSCL_CHAR_IS_UNSIGNED 0
+#define OSCL_CHAR_IS_SIGNED   1
+#else
+#error "Cannot determine if char is signed or unsigned"
+#endif
+
+
+#if ( (CHAR_MAX == 255) || (CHAR_MAX == 127) )
+typedef signed char int8;
+typedef unsigned char uint8;
+#else
+#error "Cannot determine an 8-bit interger type"
+#endif
+
+
+#if ( SHRT_MAX == 32767 )
+typedef short int16;
+typedef unsigned short uint16;
+
+#elif ( INT_MAX == 32767 )
+typedef int int16;
+typedef unsigned int uint16;
+
+#else
+#error "Cannot determine 16-bit integer type"
+#endif
+
+
+
+#if ( INT_MAX == 2147483647 )
+typedef int int32;
+typedef unsigned int uint32;
+
+#elif ( LONG_MAX == 2147483647 )
+typedef long int32;
+typedef unsigned long uint32;
+
+#else
+#error "Cannot determine 32-bit integer type"
+#endif
+
+
+
+#endif
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_memory.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_memory.h
new file mode 100644 (file)
index 0000000..b5c69d0
--- /dev/null
@@ -0,0 +1,91 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//             O S C L C O N F I G _ M E M O R Y
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+
+
+#ifndef OSCLCONFIG_MEMORY_H_INCLUDED
+#define OSCLCONFIG_MEMORY_H_INCLUDED
+
+
+#ifndef OSCLCONFIG_H_INCLUDED
+#include "osclconfig.h"
+#endif
+
+#ifndef OSCLCONFIG_ANSI_MEMORY_H_INCLUDED
+#include "osclconfig_ansi_memory.h"
+#endif
+
+/* OSCL_HAS_GLOBAL_NEW_DELETE - Enables or disables the definition of overloaded
+ * global memory operators in oscl_mem.h
+ *
+ * Release Mode: OSCL_HAS_GLOBAL_NEW_DELETE 0
+ * Debug Mode: OSCL_HAS_GLOBAL_NEW_DELETE 1
+ */
+
+
+#if (OSCL_RELEASE_BUILD)
+#define OSCL_BYPASS_MEMMGT 1
+#define OSCL_HAS_GLOBAL_NEW_DELETE 0
+#else
+#define OSCL_BYPASS_MEMMGT 1  //Temporarily disabling
+#define OSCL_HAS_GLOBAL_NEW_DELETE 1
+#endif
+
+/* PVMEM_INST_LEVEL - Memory leak instrumentation level enables the compilation
+ * of detailed memory leak info (filename + line number).
+ * PVMEM_INST_LEVEL 0: Release mode.
+ * PVMEM_INST_LEVEL 1: Debug mode.
+ */
+
+#if(OSCL_RELEASE_BUILD)
+#define PVMEM_INST_LEVEL 0
+#else
+#define PVMEM_INST_LEVEL 1
+#endif
+
+#if(OSCL_HAS_GLOBAL_NEW_DELETE)
+//Detect if <new> or <new.h> is included anyplace to avoid a compile error.
+#if defined(_INC_NEW)
+#error Duplicate New Definition!
+#endif //_INC_NEW
+#if defined(_NEW_)
+#error Duplicate New Definition!
+#endif //_NEW_
+#endif //OSCL_HAS_GLOBAL_NEW_DELETE
+
+#ifdef __cplusplus
+#include <new> //for placement new
+#endif //__cplusplus
+
+//OSCL_HAS_HEAP_BASE_SUPPORT - Enables or disables overloaded memory operators in HeapBase class
+#define OSCL_HAS_HEAP_BASE_SUPPORT 1
+
+#define OSCL_HAS_SYMBIAN_MEMORY_FUNCS 0
+
+
+#include "osclconfig_memory_check.h"
+
+
+#endif
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_memory_check.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_memory_check.h
new file mode 100644 (file)
index 0000000..8903111
--- /dev/null
@@ -0,0 +1,72 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OSCLCONFIG_MEMORY_CHECK_H_INCLUDED
+#define OSCLCONFIG_MEMORY_CHECK_H_INCLUDED
+
+
+/**
+OSCL_BYPASS_MEMMGT macro should be set to 1 if
+it is desirable to bypass the PV memory management system and just
+use the native memory management.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_BYPASS_MEMMGT
+#error "ERROR: OSCL_BYPASS_MEMMGT has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_ANSI_MEMORY_FUNCS macro should be set to 1 if
+the target platform supports ANSI C memory functions (malloc, free, etc).
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_ANSI_MEMORY_FUNCS
+#error "ERROR: OSCL_HAS_ANSI_MEMORY_FUNCS has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_SYMBIAN_MEMORY_FUNCS macro should be set to 1 if
+the target platform supports Symbian memory functions User::Alloc, User::Free, etc.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SYMBIAN_MEMORY_FUNCS
+#error "ERROR: OSCL_HAS_SYMBIAN_MEMORY_FUNCS has to be defined to either 1 or 0"
+#endif
+
+/*
+ * OSCL_HAS_HEAP_BASE_SUPPORT macro should be set to 1 for the
+ * platforms that allows inheritance from HeapBase class for
+ * overloading of new/delete operators.
+ */
+
+#ifndef OSCL_HAS_HEAP_BASE_SUPPORT
+#error "ERROR: OSCL_HAS_HEAP_BASE_SUPPORT has to be defined to either 1 or 0."
+#endif
+
+/*
+ * OSCL_HAS_GLOBAL_NEW_DELETE macro should be set to 1 for the
+ * platforms that allows overloading of new/delete operators.
+ */
+
+#ifndef OSCL_HAS_GLOBAL_NEW_DELETE
+#error "ERROR: OSCL_HAS_GLOBAL_NEW_DELETE has to be defined to either 1 or 0."
+#endif
+
+#endif // OSCLCONFIG_MEMORY_CHECK_H_INCLUDED
+
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_no_os.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_no_os.h
new file mode 100644 (file)
index 0000000..c1a06e3
--- /dev/null
@@ -0,0 +1,71 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OSCLCONFIG_NO_OS_H_INCLUDED
+#define OSCLCONFIG_NO_OS_H_INCLUDED
+
+/*! \addtogroup osclconfig OSCL config
+ *
+ * @{
+ */
+
+//a file to turn off ALL os-specific switches.
+
+//osclconfig
+#define OSCL_HAS_UNIX_SUPPORT               0
+#define OSCL_HAS_MSWIN_SUPPORT              0
+#define OSCL_HAS_MSWIN_PARTIAL_SUPPORT      0
+#define OSCL_HAS_SYMBIAN_SUPPORT            0
+#define OSCL_HAS_SAVAJE_SUPPORT             0
+#define OSCL_HAS_PV_C_OS_SUPPORT            0
+#define OSCL_HAS_ANDROID_SUPPORT            0
+#define OSCL_HAS_IPHONE_SUPPORT             0
+
+//osclconfig_error
+#define OSCL_HAS_SYMBIAN_ERRORTRAP 0
+
+//osclconfig_memory
+#define OSCL_HAS_SYMBIAN_MEMORY_FUNCS 0
+#define OSCL_HAS_PV_C_OS_API_MEMORY_FUNCS 0
+
+//osclconfig_time
+#define OSCL_HAS_PV_C_OS_TIME_FUNCS 0
+#define OSCL_HAS_UNIX_TIME_FUNCS    0
+
+//osclconfig_util
+#define OSCL_HAS_SYMBIAN_TIMERS 0
+#define OSCL_HAS_SYMBIAN_MATH   0
+
+//osclconfig_proc
+#define OSCL_HAS_SYMBIAN_SCHEDULER 0
+#define OSCL_HAS_SEM_TIMEDWAIT_SUPPORT 0
+#define OSCL_HAS_PTHREAD_SUPPORT 0
+
+//osclconfig_io
+#define OSCL_HAS_SYMBIAN_COMPATIBLE_IO_FUNCTION 0
+#define OSCL_HAS_SAVAJE_IO_SUPPORT 0
+#define OSCL_HAS_SYMBIAN_SOCKET_SERVER 0
+#define OSCL_HAS_SYMBIAN_DNS_SERVER 0
+#define OSCL_HAS_BERKELEY_SOCKETS 0
+
+
+/*! @} */
+
+#endif // OSCLCONFIG_CHECK_H_INCLUDED
+
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc.h
new file mode 100644 (file)
index 0000000..9f43965
--- /dev/null
@@ -0,0 +1,43 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//     O S C L C O N F I G _ P R O C  ( P L A T F O R M   C O N F I G   I N F O )
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_proc.h
+ *  \brief This file contains configuration information for the linux platform
+ *
+ */
+
+#ifndef OSCLCONFIG_PROC_H_INCLUDED
+#define OSCLCONFIG_PROC_H_INCLUDED
+
+#ifndef OSCLCONFIG_H_INCLUDED
+#include "osclconfig.h"
+#endif
+
+#include "osclconfig_proc_unix_android.h"
+
+#include "osclconfig_proc_check.h"
+
+
+#endif
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc_check.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc_check.h
new file mode 100644 (file)
index 0000000..0cba8f2
--- /dev/null
@@ -0,0 +1,157 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+#ifndef OSCLCONFIG_PROC_CHECK_H_INCLUDED
+#define OSCLCONFIG_PROC_CHECK_H_INCLUDED
+
+/**
+OSCL_HAS_THREAD_SUPPORT macro should be set to 1 if
+the target platform supports threads.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_THREAD_SUPPORT
+#error "ERROR: OSCL_HAS_THREAD_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_NON_PREEMPTIVE_THREAD_SUPPORT macro should be set to 1 if
+the target platform supports non-pre-emptive threads.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_NON_PREEMPTIVE_THREAD_SUPPORT
+#error "ERROR: OSCL_HAS_NON_PREEMPTIVE_THREAD_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_SYMBIAN_SCHEDULER macro should be set to 1 if
+the target platform supports Symbian active object scheduler.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SYMBIAN_SCHEDULER
+#error "ERROR: OSCL_HAS_SYMBIAN_SCHEDULER has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_SEM_TIMEDWAIT_SUPPORT macro should be set to 1 if
+the target platform supports POSIX-compliant semaphores (semaphore.h)
+with advanced realtime features including sem_timedwait.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SEM_TIMEDWAIT_SUPPORT
+#error "ERROR: OSCL_HAS_SEM_TIMEDWAIT_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_PTHREAD_SUPPORT macro should be set to 1 if
+the target platform supports POSIX-compliand pthreads (pthread.h).
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_PTHREAD_SUPPORT
+#error "ERROR: OSCL_HAS_PTHREAD_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+type TOsclThreadId should be defined as the type used as
+a thread ID
+on the target platform.
+Example:
+typedef DWORD TOsclThreadId;
+*/
+typedef TOsclThreadId __verify__TOsclThreadId__defined__;
+
+/**
+type TOsclThreadFuncRet should be defined as the type used as
+a thread function return value
+on the target platform.
+Example:
+typedef DWORD TOsclThreadFuncRet;
+*/
+typedef TOsclThreadFuncRet __verify__TOsclThreadFuncRet__defined__;
+
+/**
+type TOsclThreadFuncArg should be defined as the type used as
+a thread function argument
+on the target platform.
+Example:
+typedef LPVOID TOsclThreadFuncArg;
+*/
+typedef TOsclThreadFuncArg __verify__TOsclThreadFuncArg__defined__;
+
+/**
+OSCL_THREAD_DECL macro should be defined to the
+necessary function declaration modifiers for thread routines,
+or a null macro if no modifiers are needed.
+Example:
+#define OSCL_THREAD_DECL WINAPI
+*/
+#ifndef OSCL_THREAD_DECL
+#error "ERROR: OSCL_THREAD_DECL has to be defined."
+#endif
+
+/**
+Example of a declaration of a thread routine called MyThreadMain using
+the Oscl definitions:
+
+static TOsclThreadFuncRet OSCL_THREAD_DECL MyThreadMain(TOsclThreadFuncArg arg);
+*/
+
+/**
+type TOsclThreadObject should be defined as the type used as
+a thread object or handle
+on the target platform.
+Example:
+typedef pthread_t TOsclThreadObject;
+*/
+typedef TOsclThreadObject __verify__TOsclThreadObject__defined__;
+
+/**
+type TOsclMutexObject should be defined as the type used as
+a mutex object or handle
+on the target platform.
+Example:
+typedef pthread_mutex_t TOsclMutexObject;
+*/
+typedef TOsclMutexObject __verify__TOsclMutexObject__defined__;
+
+/**
+type TOsclSemaphoreObject should be defined as the type used as
+a mutex object or handle
+on the target platform.
+Example:
+typedef sem_t TOsclSemaphoreObject;
+*/
+typedef TOsclSemaphoreObject __verify__TOsclSemaphoreObject__defined__;
+
+/**
+type TOsclConditionObject should be defined as the type used as
+a condition variable
+on the target platform.
+Example:
+typedef pthread_cond_t TOsclConditionObject;
+
+Note: Condition variables are only used with certain semaphore implementations.
+If the semaphore implementation does not require a condition variable,
+then this type can be defined as 'int' as follows:
+typedef int TOsclConditionObject; //not used
+*/
+typedef TOsclConditionObject __verify__TOsclConditionObject__defined__;
+
+
+#endif //OSCLCONFIG_PROC_CHECK_H_INCLUDED
+
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc_unix_android.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc_unix_android.h
new file mode 100644 (file)
index 0000000..c5d05eb
--- /dev/null
@@ -0,0 +1,60 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//     O S C L C O N F I G _ P R O C  ( P L A T F O R M   C O N F I G   I N F O )
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_proc.h
+ *  \brief This file contains configuration information for the linux platform
+ *
+ */
+
+#ifndef OSCLCONFIG_PROC_UNIX_ANDROID_H_INCLUDED
+#define OSCLCONFIG_PROC_UNIX_ANDROID_H_INCLUDED
+
+#define OSCL_HAS_SYMBIAN_SCHEDULER 0
+
+#define OSCL_HAS_THREAD_SUPPORT 1
+#define OSCL_HAS_NON_PREEMPTIVE_THREAD_SUPPORT 0
+
+//semaphore with advanced realtime features incl. timed wait.
+#define OSCL_HAS_SEM_TIMEDWAIT_SUPPORT 0
+//#include <time.h>
+//#include <semaphore.h>
+
+//pthreads
+#define OSCL_HAS_PTHREAD_SUPPORT 1
+#include <pthread.h>
+#include <errno.h>
+#include <signal.h>
+
+// threads, mutex, semaphores
+typedef pthread_t TOsclThreadId;
+typedef void* TOsclThreadFuncArg;
+typedef void* TOsclThreadFuncRet;
+#define OSCL_THREAD_DECL
+typedef pthread_t TOsclThreadObject;
+typedef pthread_mutex_t TOsclMutexObject;
+typedef int TOsclSemaphoreObject;
+typedef pthread_cond_t TOsclConditionObject;
+
+#endif
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc_unix_common.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_proc_unix_common.h
new file mode 100644 (file)
index 0000000..104a2cc
--- /dev/null
@@ -0,0 +1,59 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//     O S C L C O N F I G _ P R O C  ( P L A T F O R M   C O N F I G   I N F O )
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_proc.h
+ *  \brief This file contains configuration information for the linux platform
+ *
+ */
+
+#ifndef OSCLCONFIG_PROC_UNIX_COMMON_H_INCLUDED
+#define OSCLCONFIG_PROC_UNIX_COMMON_H_INCLUDED
+
+#define OSCL_HAS_SYMBIAN_SCHEDULER 0
+
+#define OSCL_HAS_THREAD_SUPPORT 1
+#define OSCL_HAS_NON_PREEMPTIVE_THREAD_SUPPORT 0
+
+//semaphore with advanced realtime features incl. timed wait.
+#define OSCL_HAS_SEM_TIMEDWAIT_SUPPORT 1
+#include <time.h>
+#include <semaphore.h>
+
+//pthreads
+#define OSCL_HAS_PTHREAD_SUPPORT 1
+#include <pthread.h>
+#include <errno.h>
+
+// threads, mutex, semaphores
+typedef pthread_t TOsclThreadId;
+typedef void* TOsclThreadFuncArg;
+typedef void* TOsclThreadFuncRet;
+#define OSCL_THREAD_DECL
+typedef pthread_t TOsclThreadObject;
+typedef pthread_mutex_t TOsclMutexObject;
+typedef sem_t TOsclSemaphoreObject;
+typedef pthread_cond_t TOsclConditionObject;
+
+#endif
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_time.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_time.h
new file mode 100644 (file)
index 0000000..cb53659
--- /dev/null
@@ -0,0 +1,50 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//   O S C L C O N F I G _ T I M E   ( T I M E - D E F I N I T I O N S )
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+
+
+#ifndef OSCLCONFIG_TIME_H_INCLUDED
+#define OSCLCONFIG_TIME_H_INCLUDED
+
+
+#ifndef OSCLCONFIG_H_INCLUDED
+#include "osclconfig.h"
+#endif
+
+// system header files
+#include <time.h> // timeval
+#include <sys/time.h> // timercmp
+#include <unistd.h>
+
+
+
+#define OSCL_HAS_UNIX_TIME_FUNCS        1
+
+typedef struct timeval OsclBasicTimeStruct;
+typedef tm      OsclBasicDateTimeStruct;
+
+#include "osclconfig_time_check.h"
+
+#endif
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_time_check.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_time_check.h
new file mode 100644 (file)
index 0000000..0243d5c
--- /dev/null
@@ -0,0 +1,47 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+
+//osclconfig: this build configuration file is for win32
+#ifndef OSCLCONFIG_TIME_CHECK_H_INCLUDED
+#define OSCLCONFIG_TIME_CHECK_H_INCLUDED
+
+
+/**
+OSCL_HAS_UNIX_TIME_FUNCS macro should be set to 1 if
+the target platform supports unix time of day functions.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_UNIX_TIME_FUNCS
+#error "ERROR: OSCL_HAS_UNIX_TIME_FUNCS has to be defined to either 1 or 0"
+#endif
+
+/**
+OsclBasicTimeStruct type should be defined to the platform-specific
+time of day type.
+*/
+typedef OsclBasicTimeStruct __Validate__BasicTimeStruct__;
+
+/**
+OsclBasicDateTimeStruct type should be defined to the platform-specific
+date + time type.
+*/
+typedef OsclBasicDateTimeStruct __Validate__BasicTimeDateStruct__;
+
+#endif //OSCLCONFIG_TIME_CHECK_H_INCLUDED
+
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_unix_android.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_unix_android.h
new file mode 100644 (file)
index 0000000..f4508ac
--- /dev/null
@@ -0,0 +1,105 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//         O S C L C O N F I G _ U N I X _ C O M M O N
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_limits_typedefs.h
+ *  \brief This file contains common typedefs based on the ANSI C limits.h header
+ *
+ *  This header file should work for any ANSI C compiler to determine the
+ *  proper native C types to use for OSCL integer types.
+ */
+
+
+#ifndef OSCLCONFIG_UNIX_ANDROID_H_INCLUDED
+#define OSCLCONFIG_UNIX_ANDROID_H_INCLUDED
+
+
+// system header files
+#include <stdlib.h> // abort
+#include <stdarg.h> // va_list
+#include <sys/types.h>
+#include <stdio.h>
+//#include <wchar.h>
+#include <string.h>
+#include <unistd.h> //for sleep
+#include <pthread.h>
+#include <ctype.h> // for tolower and toupper
+#ifdef __cplusplus
+#include <new> //for placement new
+#endif
+#include <math.h>
+
+#define OSCL_DISABLE_INLINES                0
+
+#define OSCL_HAS_ANSI_STDLIB_SUPPORT        1
+#define OSCL_HAS_ANSI_MATH_SUPPORT          1
+#define OSCL_HAS_GLOBAL_VARIABLE_SUPPORT    1
+#define OSCL_HAS_ANSI_STRING_SUPPORT        1
+#define OSCL_HAS_ANSI_WIDE_STRING_SUPPORT   0
+#define OSCL_HAS_ANSI_STDIO_SUPPORT         1
+
+#define OSCL_MEMFRAG_PTR_BEFORE_LEN         1
+
+#define OSCL_HAS_UNIX_SUPPORT               1
+#define OSCL_HAS_MSWIN_SUPPORT              0
+#define OSCL_HAS_MSWIN_PARTIAL_SUPPORT    0
+#define OSCL_HAS_SYMBIAN_SUPPORT            0
+#define OSCL_HAS_IPHONE_SUPPORT        0
+
+
+// 64-bit int
+#define OSCL_NATIVE_INT64_TYPE     int64_t
+#define OSCL_NATIVE_UINT64_TYPE    uint64_t
+#define INT64(x) x##LL
+#define UINT64(x) x##ULL
+#define INT64_HILO(high,low) ((((high##LL))<<32)|low)
+#define UINT64_HILO(high,low) ((((high##ULL))<<32)|low)
+
+// character set.
+#define OSCL_HAS_UNICODE_SUPPORT            1
+#define OSCL_NATIVE_WCHAR_TYPE wchar_t
+#if (OSCL_HAS_UNICODE_SUPPORT)
+#define _STRLIT(x) L ## x
+#else
+#define _STRLIT(x) x
+#endif
+#define _STRLIT_CHAR(x) x
+#define _STRLIT_WCHAR(x) L ## x
+
+// Thread-local storage.  Unix has keyed TLS.
+#define OSCL_HAS_TLS_SUPPORT    1
+#define OSCL_TLS_IS_KEYED 1
+typedef pthread_key_t TOsclTlsKey ;
+#define OSCL_TLS_KEY_CREATE_FUNC(key) (pthread_key_create(&key,NULL)==0)
+#define OSCL_TLS_KEY_DELETE_FUNC(key) pthread_key_delete(key)
+#define OSCL_TLS_STORE_FUNC(key,ptr) (pthread_setspecific(key,(const void*)ptr)==0)
+#define OSCL_TLS_GET_FUNC(key) pthread_getspecific(key)
+
+//Basic lock
+#define OSCL_HAS_BASIC_LOCK 1
+#include <pthread.h>
+typedef pthread_mutex_t TOsclBasicLockObject;
+
+#endif // OSCLCONFIG_UNIX_COMMON_H_INCLUDED
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_unix_common.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_unix_common.h
new file mode 100644 (file)
index 0000000..d795c49
--- /dev/null
@@ -0,0 +1,103 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2010 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+// -*- c++ -*-
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+//         O S C L C O N F I G _ U N I X _ C O M M O N
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+
+
+/*! \file osclconfig_limits_typedefs.h
+ *  \brief This file contains common typedefs based on the ANSI C limits.h header
+ *
+ *  This header file should work for any ANSI C compiler to determine the
+ *  proper native C types to use for OSCL integer types.
+ */
+
+
+#ifndef OSCLCONFIG_UNIX_COMMON_H_INCLUDED
+#define OSCLCONFIG_UNIX_COMMON_H_INCLUDED
+
+
+// system header files
+#include <stdlib.h> // abort
+#include <stdarg.h> // va_list
+#include <sys/types.h>
+#include <stdio.h>
+#include <wchar.h>
+#include <string.h>
+#include <unistd.h> //for sleep
+#include <pthread.h>
+#include <ctype.h> // for tolower and toupper
+#ifdef __cplusplus
+#include <new> //for placement new
+#endif
+#include <math.h>
+
+#define OSCL_DISABLE_INLINES                0
+
+#define OSCL_HAS_ANSI_STDLIB_SUPPORT        1
+#define OSCL_HAS_ANSI_MATH_SUPPORT          1
+#define OSCL_HAS_GLOBAL_VARIABLE_SUPPORT    1
+#define OSCL_HAS_ANSI_STRING_SUPPORT        1
+#define OSCL_HAS_ANSI_WIDE_STRING_SUPPORT   1
+#define OSCL_HAS_ANSI_STDIO_SUPPORT         1
+
+#define OSCL_MEMFRAG_PTR_BEFORE_LEN         1
+
+#define OSCL_HAS_UNIX_SUPPORT               1
+#define OSCL_HAS_MSWIN_SUPPORT              0
+#define OSCL_HAS_MSWIN_PARTIAL_SUPPORT    0
+#define OSCL_HAS_SYMBIAN_SUPPORT            0
+
+// 64-bit int
+#define OSCL_NATIVE_INT64_TYPE     int64_t
+#define OSCL_NATIVE_UINT64_TYPE    uint64_t
+#define INT64(x) x##LL
+#define UINT64(x) x##ULL
+#define INT64_HILO(high,low) ((((high##LL))<<32)|low)
+#define UINT64_HILO(high,low) ((((high##ULL))<<32)|low)
+
+// character set.
+#define OSCL_HAS_UNICODE_SUPPORT            1
+#define OSCL_NATIVE_WCHAR_TYPE wchar_t
+#if (OSCL_HAS_UNICODE_SUPPORT)
+#define _STRLIT(x) L ## x
+#else
+#define _STRLIT(x) x
+#endif
+#define _STRLIT_CHAR(x) x
+#define _STRLIT_WCHAR(x) L ## x
+
+// Thread-local storage.  Unix has keyed TLS.
+#define OSCL_HAS_TLS_SUPPORT    1
+#define OSCL_TLS_IS_KEYED 1
+typedef pthread_key_t TOsclTlsKey ;
+#define OSCL_TLS_KEY_CREATE_FUNC(key) (pthread_key_create(&key,NULL)==0)
+#define OSCL_TLS_KEY_DELETE_FUNC(key) pthread_key_delete(key)
+#define OSCL_TLS_STORE_FUNC(key,ptr) (pthread_setspecific(key,(const void*)ptr)==0)
+#define OSCL_TLS_GET_FUNC(key) pthread_getspecific(key)
+
+//Basic lock
+#define OSCL_HAS_BASIC_LOCK 1
+#include <pthread.h>
+typedef pthread_mutex_t TOsclBasicLockObject;
+
+#endif // OSCLCONFIG_UNIX_COMMON_H_INCLUDED
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_util.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_util.h
new file mode 100644 (file)
index 0000000..a169848
--- /dev/null
@@ -0,0 +1,43 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+#ifndef OSCLCONFIG_UTIL_H_INCLUDED
+#define OSCLCONFIG_UTIL_H_INCLUDED
+
+#ifndef OSCLCONFIG_H_INCLUDED
+#include "osclconfig.h"
+#endif
+
+#include <stdio.h> //sprintf
+#include <time.h>     // OSCL clock
+#include <sys/time.h> // timeval
+
+#define OSCL_CLOCK_HAS_DRIFT_CORRECTION 0
+#define OSCL_HAS_SYMBIAN_TIMERS 0
+#define OSCL_HAS_SYMBIAN_MATH   0
+
+#define OSCL_RAND_MAX           RAND_MAX
+
+//Define system sleep call for the tick count test here.
+#include <unistd.h>
+#define SLEEP_ONE_SEC sleep(1)
+
+
+#include "osclconfig_util_check.h"
+
+#endif
+
diff --git a/tools/depends/target/libomxil-bellagio/oscl/osclconfig_util_check.h b/tools/depends/target/libomxil-bellagio/oscl/osclconfig_util_check.h
new file mode 100644 (file)
index 0000000..f615c4a
--- /dev/null
@@ -0,0 +1,58 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+#ifndef OSCLCONFIG_UTIL_CHECK_H_INCLUDED
+#define OSCLCONFIG_UTIL_CHECK_H_INCLUDED
+
+/**
+OSCL_HAS_SYMBIAN_TIMERS macro should be set to 1 if
+the target platform supports Symbian timers (RTimer).
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SYMBIAN_TIMERS
+#error "ERROR: OSCL_HAS_SYMBIAN_TIMERS has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_SYMBIAN_MATH macro should be set to 1 if
+the target platform supports Symbian <e32math.h> features.
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_SYMBIAN_MATH
+#error "ERROR: OSCL_HAS_SYMBIAN_MATH has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_HAS_ANSI_MATH_SUPPORT macro should be set to 1 if
+the target platform supports the ANSI C math functions (math.h)
+Otherwise it should be set to 0.
+*/
+#ifndef OSCL_HAS_ANSI_MATH_SUPPORT
+#error "ERROR: OSCL_HAS_ANSI_MATH_SUPPORT has to be defined to either 1 or 0"
+#endif
+
+/**
+OSCL_CLOCK_HAS_DRIFT_CORRECTION macro should be set to 1 if the target platform
+has drift correction Otherwise it should be set to 0.
+*/
+#ifndef OSCL_CLOCK_HAS_DRIFT_CORRECTION
+#error "ERROR: OSCL_CLOCK_HAS_DRIFT_CORRECTION has to be defined to either 1 or 0"
+#endif
+
+#endif // OSCLCONFIG_UTIL_CHECK_H_INCLUDED
+
+
diff --git a/tools/depends/target/libplist/0001-dontbuildswig.patch b/tools/depends/target/libplist/0001-dontbuildswig.patch
new file mode 100644 (file)
index 0000000..7ff491d
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt   2011-08-18 21:45:33.000000000 +0200
++++ b/CMakeLists.txt   2011-08-18 21:45:16.000000000 +0200
+@@ -36,7 +36,7 @@
+ ADD_SUBDIRECTORY( test )
+ IF ( SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND )
+-      ADD_SUBDIRECTORY( swig )
++#     ADD_SUBDIRECTORY( swig )
+ ENDIF ( SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND )
+ # add uninstall target
diff --git a/tools/depends/target/libplist/Makefile b/tools/depends/target/libplist/Makefile
new file mode 100644 (file)
index 0000000..2d0d322
--- /dev/null
@@ -0,0 +1,51 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include 0001-dontbuildswig.patch Makefile
+
+# lib name, version
+LIBNAME=libplist
+VERSION=1.6
+SOURCE=$(LIBNAME)-$(VERSION)
+FILENAME=v$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+LIBDYLIB=$(PLATFORM)/build/src/libplist++.so
+ICONV=$(shell echo $(LINK_ICONV) | sed -e 's/\-l//')
+CFLAGS+=-fvisibility=default
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       echo $(ICONV)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p1 < ../0001-dontbuildswig.patch
+       cd $(PLATFORM); sed -ie 's/TARGET_LINK_LIBRARIES( plist /TARGET_LINK_LIBRARIES( plist m z $(ICONV) /' src/CMakeLists.txt
+       cd $(PLATFORM); rm -rf build; mkdir -p build
+       cd $(PLATFORM)/build; $(CMAKE) VERBOSE=1 -DCMAKE_C_FLAGS="$(CFLAGS)" ..
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -j 1 -C $(PLATFORM)/build VERBOSE=1
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/build install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libplist.la $(PREFIX)/lib/libplist.so $(PREFIX)/lib/libplist.so.1
+       mv -f $(PREFIX)/lib/libplist.so.1.1.6 $(PREFIX)/lib/libplist.so
+       $(RPL) -e "libplist.so.1" "libplist.so\x00\x00" $(PREFIX)/lib/libplist.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libplist.so | grep ibrary
+
+       rm -f $(PREFIX)/lib/libplist++.la $(PREFIX)/lib/libplist++.so $(PREFIX)/lib/libplist++.so.1
+       mv -f $(PREFIX)/lib/libplist++.so.1.1.6 $(PREFIX)/lib/libplist++.so
+       $(RPL) -e "libplist++.so.1" "libplist++.so\x00\x00" $(PREFIX)/lib/libplist++.so
+       $(RPL) -e "libplist.so.1" "libplist.so\x00\x00" $(PREFIX)/lib/libplist++.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libplist++.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libpng/Makefile b/tools/depends/target/libpng/Makefile
new file mode 100644 (file)
index 0000000..b5ab12a
--- /dev/null
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libpng
+#VERSION=1.4.4
+VERSION=1.5.13
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-shared
+
+LIBDYLIB=$(PLATFORM)/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/librtmp/Makefile b/tools/depends/target/librtmp/Makefile
new file mode 100644 (file)
index 0000000..36c2f39
--- /dev/null
@@ -0,0 +1,54 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile prefix.patch
+
+# lib name, version
+LIBNAME=rtmpdump
+VERSION=e0056c51cc1710c9a44d2a2c4e2f344fa9cabcf4
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+# configuration settings
+LIBDYLIB=$(PLATFORM)/librtmp/librtmp.a
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+SYS=posix
+ifeq ($(OS),ios)
+  SYS=darwin
+endif
+ifeq ($(OS),osx)
+  SYS=darwin
+endif
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p0 < ../prefix.patch
+       cd $(PLATFORM); patch -p1 < ../librtmp-60-second-fix.patch
+       sed -i -e 's|CC=|#CC=|' $(PLATFORM)/librtmp/Makefile
+       sed -i -e 's|LD=|#LD=|' $(PLATFORM)/librtmp/Makefile
+       sed -i -e 's|AR=|#AR=|' $(PLATFORM)/librtmp/Makefile
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE)  PREFIX=$(PREFIX) SYS=$(SYS) CC="$(CC)" LD="$(LD)" AR="$(AR)" XCFLAGS="$(CFLAGS)" XLDFLAGS="$(LDFLAGS)" -C $(PLATFORM)/librtmp
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) SYS=$(SYS) prefix=$(PREFIX) -C $(PLATFORM)/librtmp install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/librtmp.la $(PREFIX)/lib/librtmp.so
+       mv -f $(PREFIX)/lib/librtmp.so.0 $(PREFIX)/lib/librtmp.so
+       $(RPL) -e "librtmp.so.0" "librtmp.so\x00\x00" $(PREFIX)/lib/librtmp.so
+       -$(READELF) --dynamic $(PREFIX)/lib/librtmp.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/librtmp/librtmp-60-second-fix.patch b/tools/depends/target/librtmp/librtmp-60-second-fix.patch
new file mode 100644 (file)
index 0000000..2914fc1
--- /dev/null
@@ -0,0 +1,1913 @@
+diff --git a/librtmp/amf.c b/librtmp/amf.c
+index ce84f81..a25bc04 100644
+--- a/librtmp/amf.c
++++ b/librtmp/amf.c
+@@ -610,6 +610,9 @@ AMFProp_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
+       return -1;
+     }
++  if (*pBuffer == AMF_NULL)
++    bDecodeName = 0;
++
+   if (bDecodeName && nSize < 4)
+     {                         /* at least name (length + at least 1 byte) and 1 byte of data */
+       RTMP_Log(RTMP_LOGDEBUG,
+@@ -801,8 +804,8 @@ AMFProp_Dump(AMFObjectProperty *prop)
+     }
+   else
+     {
+-      name.av_val = "no-name.";
+-      name.av_len = sizeof("no-name.") - 1;
++      name.av_val = "no-name";
++      name.av_len = sizeof("no-name") - 1;
+     }
+   if (name.av_len > 18)
+     name.av_len = 18;
+diff --git a/librtmp/dh.h b/librtmp/dh.h
+index 9959532..e29587b 100644
+--- a/librtmp/dh.h
++++ b/librtmp/dh.h
+@@ -61,7 +61,7 @@ static int MDH_generate_key(MDH *dh)
+   MP_set(&dh->ctx.P, dh->p);
+   MP_set(&dh->ctx.G, dh->g);
+   dh->ctx.len = 128;
+-  dhm_make_public(&dh->ctx, 1024, out, 1, havege_rand, &RTMP_TLS_ctx->hs);
++  dhm_make_public(&dh->ctx, 1024, out, 1, havege_random, &RTMP_TLS_ctx->hs);
+   MP_new(dh->pub_key);
+   MP_new(dh->priv_key);
+   MP_set(dh->pub_key, &dh->ctx.GX);
+diff --git a/librtmp/handshake.h b/librtmp/handshake.h
+index 0438486..102ba82 100644
+--- a/librtmp/handshake.h
++++ b/librtmp/handshake.h
+@@ -965,8 +965,18 @@ HandShake(RTMP * r, int FP9HandShake)
+     __FUNCTION__);
+   RTMP_LogHex(RTMP_LOGDEBUG, reply, RTMP_SIG_SIZE);
+ #endif
+-  if (!WriteN(r, (char *)reply, RTMP_SIG_SIZE))
+-    return FALSE;
++  if (r->Link.CombineConnectPacket)
++    {
++      char *HandshakeResponse = malloc(RTMP_SIG_SIZE);
++      memcpy(HandshakeResponse, (char *) reply, RTMP_SIG_SIZE);
++      r->Link.HandshakeResponse.av_val = HandshakeResponse;
++      r->Link.HandshakeResponse.av_len = RTMP_SIG_SIZE;
++    }
++  else
++    {
++      if (!WriteN(r, (char *) reply, RTMP_SIG_SIZE))
++        return FALSE;
++    }
+   /* 2nd part of handshake */
+   if (ReadN(r, (char *)serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
+diff --git a/librtmp/hashswf.c b/librtmp/hashswf.c
+index 9f4e2c0..eeed34c 100644
+--- a/librtmp/hashswf.c
++++ b/librtmp/hashswf.c
+@@ -70,7 +70,7 @@ extern TLS_CTX RTMP_TLS_ctx;
+ #endif /* CRYPTO */
+-#define       AGENT   "Mozilla/5.0"
++#define       AGENT   "Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20100101 Firefox/8.0"
+ HTTPResult
+ HTTP_get(struct HTTP_ctx *http, const char *url, HTTP_read_callback *cb)
+@@ -528,7 +528,7 @@ RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash,
+         if (strncmp(buf, "url: ", 5))
+           continue;
+-        if (strncmp(buf + 5, url, hlen))
++        if (strncmp(buf + 5, url, strlen(buf + 5) - 1))
+           continue;
+         r1 = strrchr(buf, '/');
+         i = strlen(r1);
+diff --git a/librtmp/log.c b/librtmp/log.c
+index 0012985..856e3e4 100644
+--- a/librtmp/log.c
++++ b/librtmp/log.c
+@@ -52,8 +52,8 @@ static void rtmp_log_default(int level, const char *format, va_list vl)
+       vsnprintf(str, MAX_PRINT_LEN-1, format, vl);
+       /* Filter out 'no-name' */
+-      if ( RTMP_debuglevel<RTMP_LOGALL && strstr(str, "no-name" ) != NULL )
+-              return;
++      if (RTMP_debuglevel < RTMP_LOGDEBUG && strstr(str, "no-name") != NULL)
++        return;
+       if ( !fmsg ) fmsg = stderr;
+diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
+index 52d0254..bef37aa 100644
+--- a/librtmp/rtmp.c
++++ b/librtmp/rtmp.c
+@@ -27,6 +27,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <assert.h>
++#include <math.h>
+ #include "rtmp_sys.h"
+ #include "log.h"
+@@ -45,6 +46,7 @@ TLS_CTX RTMP_TLS_ctx;
+ #define RTMP_SIG_SIZE 1536
+ #define RTMP_LARGE_HEADER_SIZE 12
++#define HEX2BIN(a) (((a)&0x40)?((a)&0xf)+9:((a)&0xf))
+ static const int packetSize[] = { 12, 8, 4, 1 };
+@@ -97,6 +99,9 @@ static int SendFCSubscribe(RTMP *r, AVal *subscribepath);
+ static int SendPlay(RTMP *r);
+ static int SendBytesReceived(RTMP *r);
+ static int SendUsherToken(RTMP *r, AVal *usherToken);
++static int SendInvoke(RTMP *r, AVal *Command, int queue);
++static int SendGetStreamLength(RTMP *r);
++static int strsplit(char *src, int srclen, char delim, char ***params);
+ #if 0                         /* unused */
+ static int SendBGHasStream(RTMP *r, double dId, AVal *playpath);
+@@ -259,6 +264,8 @@ RTMP_Init(RTMP *r)
+   r->m_fVideoCodecs = 252.0;
+   r->Link.timeout = 30;
+   r->Link.swfAge = 30;
++  r->Link.CombineConnectPacket = TRUE;
++  r->Link.ConnectPacket = FALSE;
+ }
+ void
+@@ -337,6 +344,7 @@ RTMP_SetupStream(RTMP *r,
+                AVal *flashVer,
+                AVal *subscribepath,
+                AVal *usherToken,
++               AVal *WeebToken,
+                int dStart,
+                int dStop, int bLiveStream, long int timeout)
+ {
+@@ -359,6 +367,8 @@ RTMP_SetupStream(RTMP *r,
+     RTMP_Log(RTMP_LOGDEBUG, "subscribepath : %s", subscribepath->av_val);
+   if (usherToken && usherToken->av_val)
+     RTMP_Log(RTMP_LOGDEBUG, "NetStream.Authenticate.UsherToken : %s", usherToken->av_val);
++  if (WeebToken && WeebToken->av_val)
++    RTMP_Log(RTMP_LOGDEBUG, "WeebToken: %s", WeebToken->av_val);
+   if (flashVer && flashVer->av_val)
+     RTMP_Log(RTMP_LOGDEBUG, "flashVer : %s", flashVer->av_val);
+   if (dStart > 0)
+@@ -426,6 +436,8 @@ RTMP_SetupStream(RTMP *r,
+     r->Link.subscribepath = *subscribepath;
+   if (usherToken && usherToken->av_len)
+     r->Link.usherToken = *usherToken;
++  if (WeebToken && WeebToken->av_len)
++    r->Link.WeebToken = *WeebToken;
+   r->Link.seekTime = dStart;
+   r->Link.stopTime = dStop;
+   if (bLiveStream)
+@@ -483,14 +495,22 @@ static struct urlopt {
+       "Stream is live, no seeking possible" },
+   { AVC("subscribe"), OFF(Link.subscribepath), OPT_STR, 0,
+       "Stream to subscribe to" },
+-  { AVC("jtv"), OFF(Link.usherToken),          OPT_STR, 0,
+-      "Justin.tv authentication token" },
+-  { AVC("token"),     OFF(Link.token),               OPT_STR, 0,
++  { AVC("jtv"),       OFF(Link.usherToken),    OPT_STR, 0,
++        "Justin.tv authentication token"},
++  { AVC("weeb"),      OFF(Link.WeebToken),     OPT_STR, 0,
++        "Weeb.tv authentication token"},
++  { AVC("token"),     OFF(Link.token),         OPT_STR, 0,
+       "Key for SecureToken response" },
+   { AVC("swfVfy"),    OFF(Link.lFlags),        OPT_BOOL, RTMP_LF_SWFV,
+       "Perform SWF Verification" },
+   { AVC("swfAge"),    OFF(Link.swfAge),        OPT_INT, 0,
+       "Number of days to use cached SWF hash" },
++#ifdef CRYPTO
++  { AVC("swfsize"),   OFF(Link.swfSize),       OPT_INT, 0,
++        "Size of the decompressed SWF file"},
++  { AVC("swfhash"),   OFF(Link.swfHash),       OPT_STR, 0,
++        "SHA256 hash of the decompressed SWF file"},
++#endif
+   { AVC("start"),     OFF(Link.seekTime),      OPT_INT, 0,
+       "Stream start position in milliseconds" },
+   { AVC("stop"),      OFF(Link.stopTime),      OPT_INT, 0,
+@@ -751,9 +771,16 @@ int RTMP_SetupURL(RTMP *r, char *url)
+     }
+ #ifdef CRYPTO
+-  if ((r->Link.lFlags & RTMP_LF_SWFV) && r->Link.swfUrl.av_len)
+-    RTMP_HashSWF(r->Link.swfUrl.av_val, &r->Link.SWFSize,
+-        (unsigned char *)r->Link.SWFHash, r->Link.swfAge);
++  RTMP_Log(RTMP_LOGDEBUG, "Khalsa: %d %d %s\n", r->Link.swfSize, r->Link.swfHash.av_len, r->Link.swfHash.av_val);
++  if (r->Link.swfSize && r->Link.swfHash.av_len)
++    {
++      int i, j = 0;
++      for (i = 0; i < r->Link.swfHash.av_len; i += 2)
++        r->Link.SWFHash[j++] = (HEX2BIN(r->Link.swfHash.av_val[i]) << 4) | HEX2BIN(r->Link.swfHash.av_val[i + 1]);
++      r->Link.SWFSize = (uint32_t) r->Link.swfSize;
++    }
++  else if ((r->Link.lFlags & RTMP_LF_SWFV) && r->Link.swfUrl.av_len)
++    RTMP_HashSWF(r->Link.swfUrl.av_val, &r->Link.SWFSize, (unsigned char *) r->Link.SWFHash, r->Link.swfAge);
+ #endif
+   if (r->Link.port == 0)
+@@ -854,6 +881,8 @@ RTMP_Connect0(RTMP *r, struct sockaddr * service)
+   }
+   setsockopt(r->m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof(on));
++  if (r->Link.protocol & RTMP_FEATURE_HTTP)
++    setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_KEEPALIVE, (char *) &on, sizeof (on));
+   return TRUE;
+ }
+@@ -1308,8 +1337,24 @@ ReadN(RTMP *r, char *buffer, int n)
+                 return 0;
+               }
+           }
+-        if (r->m_resplen && !r->m_sb.sb_size)
+-          RTMPSockBuf_Fill(&r->m_sb);
++
++          // Try to fill the whole buffer. previous buffer needs to be consumed
++          // completely before receiving new data.
++          if (r->m_resplen && (r->m_sb.sb_size <= 0))
++            {
++              do
++                {
++                  nBytes = RTMPSockBuf_Fill(&r->m_sb);
++                  if (nBytes == -1)
++                    {
++                      if (!r->m_sb.sb_timedout)
++                        RTMP_Close(r);
++                      return 0;
++                    }
++                }
++              while (r->m_resplen && (r->m_sb.sb_size < r->m_resplen) && (nBytes > 0));
++            }
++
+           avail = r->m_sb.sb_size;
+         if (avail > r->m_resplen)
+           avail = r->m_resplen;
+@@ -1336,10 +1381,9 @@ ReadN(RTMP *r, char *buffer, int n)
+         r->m_sb.sb_size -= nRead;
+         nBytes = nRead;
+         r->m_nBytesIn += nRead;
+-        if (r->m_bSendCounter
+-            && r->m_nBytesIn > ( r->m_nBytesInSent + r->m_nClientBW / 10))
+-          if (!SendBytesReceived(r))
+-              return FALSE;
++          if (r->m_bSendCounter && r->m_nBytesIn > (r->m_nBytesInSent + r->m_nClientBW / 10))
++            if (!SendBytesReceived(r))
++              return FALSE;
+       }
+       /*RTMP_Log(RTMP_LOGDEBUG, "%s: %d bytes\n", __FUNCTION__, nBytes); */
+ #ifdef _DEBUG
+@@ -1390,6 +1434,16 @@ WriteN(RTMP *r, const char *buffer, int n)
+     }
+ #endif
++  if (r->Link.ConnectPacket)
++    {
++      char *ConnectPacket = malloc(r->Link.HandshakeResponse.av_len + n);
++      memcpy(ConnectPacket, r->Link.HandshakeResponse.av_val, r->Link.HandshakeResponse.av_len);
++      memcpy(ConnectPacket + r->Link.HandshakeResponse.av_len, ptr, n);
++      ptr = ConnectPacket;
++      n += r->Link.HandshakeResponse.av_len;
++      r->Link.ConnectPacket = FALSE;
++    }
++
+   while (n > 0)
+     {
+       int nBytes;
+@@ -1455,6 +1509,9 @@ SendConnectPacket(RTMP *r, RTMPPacket *cp)
+   char pbuf[4096], *pend = pbuf + sizeof(pbuf);
+   char *enc;
++  if (r->Link.CombineConnectPacket)
++    r->Link.ConnectPacket = TRUE;
++
+   if (cp)
+     return RTMP_SendPacket(r, cp, TRUE);
+@@ -1667,7 +1724,7 @@ SendUsherToken(RTMP *r, AVal *usherToken)
+   packet.m_hasAbsTimestamp = 0;
+   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
+-  RTMP_Log(RTMP_LOGDEBUG, "UsherToken: %s", usherToken->av_val);
++  RTMP_Log(RTMP_LOGDEBUG, "UsherToken: %.*s", usherToken->av_len, usherToken->av_val);
+   enc = packet.m_body;
+   enc = AMF_EncodeString(enc, pend, &av_NetStream_Authenticate_UsherToken);
+   enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
+@@ -2096,10 +2153,8 @@ SendPlay(RTMP *r)
+     enc = AMF_EncodeNumber(enc, pend, -1000.0);
+   else
+     {
+-      if (r->Link.seekTime > 0.0)
+-      enc = AMF_EncodeNumber(enc, pend, r->Link.seekTime);    /* resume from here */
+-      else
+-      enc = AMF_EncodeNumber(enc, pend, 0.0); /*-2000.0);*/ /* recorded as default, -2000.0 is not reliable since that freezes the player if the stream is not found */
++      if (r->Link.seekTime > 0.0 || r->Link.stopTime)
++        enc = AMF_EncodeNumber(enc, pend, r->Link.seekTime); /* resume from here */
+     }
+   if (!enc)
+     return FALSE;
+@@ -2215,7 +2270,7 @@ RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, unsigned int nTime)
+   int nSize;
+   char *buf;
+-  RTMP_Log(RTMP_LOGDEBUG, "sending ctrl. type: 0x%04x", (unsigned short)nType);
++  RTMP_Log(RTMP_LOGDEBUG, "sending ctrl, type: 0x%04x", (unsigned short)nType);
+   packet.m_nChannel = 0x02;   /* control channel (ping) */
+   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
+@@ -2247,8 +2302,8 @@ RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, unsigned int nTime)
+     }
+   else if (nType == 0x1A)
+     {
+-        *buf = nObject & 0xff;
+-      }
++      *buf = nObject & 0xff;
++    }
+   else
+     {
+       if (nSize > 2)
+@@ -2305,6 +2360,7 @@ AV_clear(RTMP_METHOD *vals, int num)
+   free(vals);
+ }
++SAVC(onBWCheck);
+ SAVC(onBWDone);
+ SAVC(onFCSubscribe);
+ SAVC(onFCUnsubscribe);
+@@ -2314,24 +2370,26 @@ SAVC(_error);
+ SAVC(close);
+ SAVC(code);
+ SAVC(level);
++SAVC(description);
+ SAVC(onStatus);
+ SAVC(playlist_ready);
+ static const AVal av_NetStream_Failed = AVC("NetStream.Failed");
+ static const AVal av_NetStream_Play_Failed = AVC("NetStream.Play.Failed");
+-static const AVal av_NetStream_Play_StreamNotFound =
+-AVC("NetStream.Play.StreamNotFound");
+-static const AVal av_NetConnection_Connect_InvalidApp =
+-AVC("NetConnection.Connect.InvalidApp");
++static const AVal av_NetStream_Play_StreamNotFound = AVC("NetStream.Play.StreamNotFound");
++static const AVal av_NetConnection_Connect_InvalidApp = AVC("NetConnection.Connect.InvalidApp");
+ static const AVal av_NetStream_Play_Start = AVC("NetStream.Play.Start");
+ static const AVal av_NetStream_Play_Complete = AVC("NetStream.Play.Complete");
+ static const AVal av_NetStream_Play_Stop = AVC("NetStream.Play.Stop");
+ static const AVal av_NetStream_Seek_Notify = AVC("NetStream.Seek.Notify");
+ static const AVal av_NetStream_Pause_Notify = AVC("NetStream.Pause.Notify");
+-static const AVal av_NetStream_Play_PublishNotify =
+-AVC("NetStream.Play.PublishNotify");
+-static const AVal av_NetStream_Play_UnpublishNotify =
+-AVC("NetStream.Play.UnpublishNotify");
++static const AVal av_NetStream_Play_PublishNotify = AVC("NetStream.Play.PublishNotify");
++static const AVal av_NetStream_Play_UnpublishNotify = AVC("NetStream.Play.UnpublishNotify");
+ static const AVal av_NetStream_Publish_Start = AVC("NetStream.Publish.Start");
++static const AVal av_NetConnection_confStream = AVC("NetConnection.confStream");
++static const AVal av_verifyClient = AVC("verifyClient");
++static const AVal av_sendStatus = AVC("sendStatus");
++static const AVal av_getStreamLength = AVC("getStreamLength");
++static const AVal av_ReceiveCheckPublicStatus = AVC("ReceiveCheckPublicStatus");
+ /* Returns 0 for OK/Failed/error, 1 for 'Stop or Complete' */
+ static int
+@@ -2341,6 +2399,11 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
+   AVal method;
+   double txn;
+   int ret = 0, nRes;
++  char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc, **params = NULL;
++  char *host = r->Link.hostname.av_len ? r->Link.hostname.av_val : "";
++  char *pageUrl = r->Link.pageUrl.av_len ? r->Link.pageUrl.av_val : "";
++  int param_count;
++  AVal av_Command, av_Response;
+   if (body[0] != 0x02)                /* make sure it is a string method name we start with */
+     {
+       RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
+@@ -2402,23 +2465,137 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
+             RTMP_SendServerBW(r);
+             RTMP_SendCtrl(r, 3, 0, 300);
+           }
+-        RTMP_SendCreateStream(r);
+-
+-        if (!(r->Link.protocol & RTMP_FEATURE_WRITE))
+-          {
+-            /* Authenticate on Justin.tv legacy servers before sending FCSubscribe */
+-            if (r->Link.usherToken.av_len)
+-              SendUsherToken(r, &r->Link.usherToken);
+-            /* Send the FCSubscribe if live stream or if subscribepath is set */
+-            if (r->Link.subscribepath.av_len)
+-              SendFCSubscribe(r, &r->Link.subscribepath);
+-            else if (r->Link.lFlags & RTMP_LF_LIVE)
+-              SendFCSubscribe(r, &r->Link.playpath);
+-          }
+-      }
++          if (strstr(host, "tv-stream.to") || strstr(pageUrl, "tv-stream.to"))
++            {
++              static char auth[] = {'h', 0xC2, 0xA7, '4', 'j', 'h', 'H', '4', '3', 'd'};
++              AVal av_auth;
++              SAVC(requestAccess);
++              av_auth.av_val = auth;
++              av_auth.av_len = sizeof (auth);
++
++              enc = pbuf;
++              enc = AMF_EncodeString(enc, pend, &av_requestAccess);
++              enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
++              *enc++ = AMF_NULL;
++              enc = AMF_EncodeString(enc, pend, &av_auth);
++              av_Command.av_val = pbuf;
++              av_Command.av_len = enc - pbuf;
++              SendInvoke(r, &av_Command, FALSE);
++
++              SAVC(getConnectionCount);
++              enc = pbuf;
++              enc = AMF_EncodeString(enc, pend, &av_getConnectionCount);
++              enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
++              *enc++ = AMF_NULL;
++              av_Command.av_val = pbuf;
++              av_Command.av_len = enc - pbuf;
++              SendInvoke(r, &av_Command, FALSE);
++
++              SendGetStreamLength(r);
++            }
++          else if (strstr(host, "jampo.com.ua") || strstr(pageUrl, "jampo.com.ua"))
++            {
++              SendGetStreamLength(r);
++            }
++          else if (strstr(host, "streamscene.cc") || strstr(pageUrl, "streamscene.cc")
++                   || strstr(host, "tsboard.tv") || strstr(pageUrl, "teamstream.in"))
++            {
++              SAVC(r);
++              enc = pbuf;
++              enc = AMF_EncodeString(enc, pend, &av_r);
++              enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
++              *enc++ = AMF_NULL;
++              av_Command.av_val = pbuf;
++              av_Command.av_len = enc - pbuf;
++              SendInvoke(r, &av_Command, FALSE);
++
++              SendGetStreamLength(r);
++            }
++          else if (strstr(host, "chaturbate.com") || strstr(pageUrl, "chaturbate.com"))
++            {
++              AVal av_ModelName;
++              SAVC(CheckPublicStatus);
++
++              if (strlen(pageUrl) > 7)
++                {
++                  strsplit(pageUrl + 7, FALSE, '/', &params);
++                  av_ModelName.av_val = params[1];
++                  av_ModelName.av_len = strlen(params[1]);
++
++                  enc = pbuf;
++                  enc = AMF_EncodeString(enc, pend, &av_CheckPublicStatus);
++                  enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
++                  *enc++ = AMF_NULL;
++                  enc = AMF_EncodeString(enc, pend, &av_ModelName);
++                  av_Command.av_val = pbuf;
++                  av_Command.av_len = enc - pbuf;
++
++                  SendInvoke(r, &av_Command, FALSE);
++                }
++              else
++                {
++                  RTMP_Log(RTMP_LOGERROR, "you must specify the pageUrl");
++                  RTMP_Close(r);
++                }
++            }
++          /* Weeb.tv specific authentication */
++          else if (r->Link.WeebToken.av_len)
++            {
++              AVal av_Token, av_Username, av_Password;
++              SAVC(determineAccess);
++
++              param_count = strsplit(r->Link.WeebToken.av_val, FALSE, ';', &params);
++              if (param_count >= 1)
++                {
++                  av_Token.av_val = params[0];
++                  av_Token.av_len = strlen(params[0]);
++                }
++              if (param_count >= 2)
++                {
++                  av_Username.av_val = params[1];
++                  av_Username.av_len = strlen(params[1]);
++                }
++              if (param_count >= 3)
++                {
++                  av_Password.av_val = params[2];
++                  av_Password.av_len = strlen(params[2]);
++                }
++
++              enc = pbuf;
++              enc = AMF_EncodeString(enc, pend, &av_determineAccess);
++              enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
++              *enc++ = AMF_NULL;
++              enc = AMF_EncodeString(enc, pend, &av_Token);
++              enc = AMF_EncodeString(enc, pend, &av_Username);
++              enc = AMF_EncodeString(enc, pend, &av_Password);
++              av_Command.av_val = pbuf;
++              av_Command.av_len = enc - pbuf;
++
++              RTMP_Log(RTMP_LOGDEBUG, "WeebToken: %s", r->Link.WeebToken.av_val);
++              SendInvoke(r, &av_Command, FALSE);
++            }
++          else
++            RTMP_SendCreateStream(r);
++        }
++      else if (AVMATCH(&methodInvoked, &av_getStreamLength))
++        {
++          RTMP_SendCreateStream(r);
++        }
+       else if (AVMATCH(&methodInvoked, &av_createStream))
+-      {
+-        r->m_stream_id = (int)AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3));
++        {
++          r->m_stream_id = (int) AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3));
++
++          if (!(r->Link.protocol & RTMP_FEATURE_WRITE))
++            {
++              /* Authenticate on Justin.tv legacy servers before sending FCSubscribe */
++              if (r->Link.usherToken.av_len)
++                SendUsherToken(r, &r->Link.usherToken);
++              /* Send the FCSubscribe if live stream or if subscribepath is set */
++              if (r->Link.subscribepath.av_len)
++                SendFCSubscribe(r, &r->Link.subscribepath);
++              else if ((r->Link.lFlags & RTMP_LF_LIVE) && (!r->Link.WeebToken.av_len))
++                SendFCSubscribe(r, &r->Link.playpath);
++            }
+         if (r->Link.protocol & RTMP_FEATURE_WRITE)
+           {
+@@ -2441,7 +2618,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
+     }
+   else if (AVMATCH(&method, &av_onBWDone))
+     {
+-        if (!r->m_nBWCheckCounter)
++      if (!r->m_nBWCheckCounter)
+         SendCheckBW(r);
+     }
+   else if (AVMATCH(&method, &av_onFCSubscribe))
+@@ -2457,7 +2634,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
+     {
+       SendPong(r, txn);
+     }
+-  else if (AVMATCH(&method, &av__onbwcheck))
++  else if (AVMATCH(&method, &av__onbwcheck) || AVMATCH(&method, &av_onBWCheck))
+     {
+       SendCheckBWResult(r, txn);
+     }
+@@ -2473,20 +2650,63 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
+     }
+   else if (AVMATCH(&method, &av__error))
+     {
+-      RTMP_Log(RTMP_LOGERROR, "rtmp server sent error");
++      double code = 0;
++      unsigned int parsedPort;
++      AMFObject obj2;
++      AMFObjectProperty p;
++      AVal redirect;
++      SAVC(ex);
++      SAVC(redirect);
++
++      AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2);
++      if (RTMP_FindFirstMatchingProperty(&obj2, &av_ex, &p))
++        {
++          AMFProp_GetObject(&p, &obj2);
++          if (RTMP_FindFirstMatchingProperty(&obj2, &av_code, &p))
++            code = AMFProp_GetNumber(&p);
++          if (code == 302 && RTMP_FindFirstMatchingProperty(&obj2, &av_redirect, &p))
++            {
++              AMFProp_GetString(&p, &redirect);
++              r->Link.redirected = TRUE;
++
++              char *url = malloc(redirect.av_len + sizeof ("/playpath"));
++              strncpy(url, redirect.av_val, redirect.av_len);
++              url[redirect.av_len] = '\0';
++              r->Link.tcUrl.av_val = url;
++              r->Link.tcUrl.av_len = redirect.av_len;
++              strcat(url, "/playpath");
++              RTMP_ParseURL(url, &r->Link.protocol, &r->Link.hostname, &parsedPort, &r->Link.playpath0, &r->Link.app);
++              r->Link.port = parsedPort;
++            }
++        }
++      if (r->Link.redirected)
++        RTMP_Log(RTMP_LOGINFO, "rtmp server sent redirect");
++      else
++        RTMP_Log(RTMP_LOGERROR, "rtmp server sent error");
+     }
+   else if (AVMATCH(&method, &av_close))
+     {
+-      RTMP_Log(RTMP_LOGERROR, "rtmp server requested close");
+-      RTMP_Close(r);
++      if (r->Link.redirected)
++        {
++          RTMP_Log(RTMP_LOGINFO, "trying to connect with redirected url");
++          RTMP_Close(r);
++          r->Link.redirected = FALSE;
++          RTMP_Connect(r, NULL);
++        }
++      else
++        {
++          RTMP_Log(RTMP_LOGERROR, "rtmp server requested close");
++          RTMP_Close(r);
++        }
+     }
+   else if (AVMATCH(&method, &av_onStatus))
+     {
+       AMFObject obj2;
+-      AVal code, level;
++      AVal code, level, description;
+       AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2);
+       AMFProp_GetString(AMF_GetProp(&obj2, &av_code, -1), &code);
+       AMFProp_GetString(AMF_GetProp(&obj2, &av_level, -1), &level);
++      AMFProp_GetString(AMF_GetProp(&obj2, &av_description, -1), &description);
+       RTMP_Log(RTMP_LOGDEBUG, "%s, onStatus: %s", __FUNCTION__, code.av_val);
+       if (AVMATCH(&code, &av_NetStream_Failed)
+@@ -2550,6 +2770,45 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
+           r->m_pausing = 3;
+         }
+       }
++
++      else if (AVMATCH(&code, &av_NetConnection_confStream))
++        {
++#ifdef CRYPTO
++          static const char hexdig[] = "0123456789abcdef";
++          SAVC(cf_stream);
++          int i;
++          char hash_hex[33] = {0};
++          unsigned char hash[16];
++          AVal auth;
++          param_count = strsplit(description.av_val, description.av_len, ':', &params);
++          if (param_count >= 3)
++            {
++              char *buf = malloc(strlen(params[0]) + r->Link.playpath.av_len + 1);
++              strcpy(buf, params[0]);
++              strncat(buf, r->Link.playpath.av_val, r->Link.playpath.av_len);
++              md5_hash((unsigned char *) buf, strlen(buf), hash);
++              for (i = 0; i < 16; i++)
++                {
++                  hash_hex[i * 2] = hexdig[0x0f & (hash[i] >> 4)];
++                  hash_hex[i * 2 + 1] = hexdig[0x0f & (hash[i])];
++                }
++              auth.av_val = &hash_hex[atoi(params[1]) - 1];
++              auth.av_len = atoi(params[2]);
++              RTMP_Log(RTMP_LOGDEBUG, "Khalsa: %.*s", auth.av_len, auth.av_val);
++
++              enc = pbuf;
++              enc = AMF_EncodeString(enc, pend, &av_cf_stream);
++              enc = AMF_EncodeNumber(enc, pend, txn);
++              *enc++ = AMF_NULL;
++              enc = AMF_EncodeString(enc, pend, &auth);
++              av_Command.av_val = pbuf;
++              av_Command.av_len = enc - pbuf;
++
++              SendInvoke(r, &av_Command, FALSE);
++              free(buf);
++            }
++#endif
++        }
+     }
+   else if (AVMATCH(&method, &av_playlist_ready))
+     {
+@@ -2563,6 +2822,74 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
+           }
+         }
+     }
++  else if (AVMATCH(&method, &av_verifyClient))
++    {
++      double VerificationNumber = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3));
++      RTMP_Log(RTMP_LOGDEBUG, "VerificationNumber: %.2f", VerificationNumber);
++
++      enc = pbuf;
++      enc = AMF_EncodeString(enc, pend, &av__result);
++      enc = AMF_EncodeNumber(enc, pend, txn);
++      *enc++ = AMF_NULL;
++      enc = AMF_EncodeNumber(enc, pend, exp(atan(sqrt(VerificationNumber))) + 1);
++      av_Response.av_val = pbuf;
++      av_Response.av_len = enc - pbuf;
++
++      AMF_Decode(&obj, av_Response.av_val, av_Response.av_len, FALSE);
++      AMF_Dump(&obj);
++      SendInvoke(r, &av_Response, FALSE);
++    }
++  else if (AVMATCH(&method, &av_sendStatus))
++    {
++      if (r->Link.WeebToken.av_len)
++        {
++          AVal av_Authorized = AVC("User.hasAccess");
++          AVal av_TransferLimit = AVC("User.noPremium.limited");
++          AVal av_UserLimit = AVC("User.noPremium.tooManyUsers");
++          AVal av_TimeLeft = AVC("timeLeft");
++          AVal av_Status, av_ReconnectionTime;
++
++          AMFObject Status;
++          AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &Status);
++          AMFProp_GetString(AMF_GetProp(&Status, &av_code, -1), &av_Status);
++          RTMP_Log(RTMP_LOGINFO, "%.*s", av_Status.av_len, av_Status.av_val);
++          if (AVMATCH(&av_Status, &av_Authorized))
++            {
++              RTMP_Log(RTMP_LOGINFO, "Weeb.tv authentication successful");
++              RTMP_SendCreateStream(r);
++            }
++          else if (AVMATCH(&av_Status, &av_UserLimit))
++            {
++              RTMP_Log(RTMP_LOGINFO, "No free slots available");
++              RTMP_Close(r);
++            }
++          else if (AVMATCH(&av_Status, &av_TransferLimit))
++            {
++              AMFProp_GetString(AMF_GetProp(&Status, &av_TimeLeft, -1), &av_ReconnectionTime);
++              RTMP_Log(RTMP_LOGINFO, "Viewing limit exceeded. try again in %.*s minutes.", av_ReconnectionTime.av_len, av_ReconnectionTime.av_val);
++              RTMP_Close(r);
++            }
++        }
++    }
++  else if (AVMATCH(&method, &av_ReceiveCheckPublicStatus))
++    {
++      AVal Status;
++      AMFProp_GetString(AMF_GetProp(&obj, NULL, 3), &Status);
++      strsplit(Status.av_val, Status.av_len, ',', &params);
++      if (strcmp(params[0], "0") == 0)
++        {
++          RTMP_Log(RTMP_LOGINFO, "Model status is %s", params[1]);
++          RTMP_Close(r);
++        }
++      else
++        {
++          AVal Playpath;
++          Playpath.av_val = params[1];
++          Playpath.av_len = strlen(params[1]);
++          RTMP_ParsePlaypath(&Playpath, &r->Link.playpath);
++          RTMP_SendCreateStream(r);
++        }
++    }
+   else
+     {
+@@ -2748,7 +3075,7 @@ HandleCtrl(RTMP *r, const RTMPPacket *packet)
+   unsigned int tmp;
+   if (packet->m_body && packet->m_nBodySize >= 2)
+     nType = AMF_DecodeInt16(packet->m_body);
+-  RTMP_Log(RTMP_LOGDEBUG, "%s, received ctrl. type: %d, len: %d", __FUNCTION__, nType,
++  RTMP_Log(RTMP_LOGDEBUG, "%s, received ctrl, type: %d, len: %d", __FUNCTION__, nType,
+       packet->m_nBodySize);
+   /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */
+@@ -2856,15 +3183,15 @@ HandleCtrl(RTMP *r, const RTMPPacket *packet)
+       RTMP_Log(RTMP_LOGDEBUG, "%s, SWFVerification ping received: ", __FUNCTION__);
+       if (packet->m_nBodySize > 2 && packet->m_body[2] > 0x01)
+       {
+-        RTMP_Log(RTMP_LOGERROR,
+-            "%s: SWFVerification Type %d request not supported! Patches welcome...",
+-          __FUNCTION__, packet->m_body[2]);
++          RTMP_Log(RTMP_LOGERROR,
++                   "%s: SWFVerification Type %d request not supported, attempting to use SWFVerification Type 1! Patches welcome...",
++                   __FUNCTION__, packet->m_body[2]);
+       }
+ #ifdef CRYPTO
+       /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */
+       /* respond with HMAC SHA256 of decompressed SWF, key is the 30byte player key, also the last 30 bytes of the server handshake are applied */
+-      else if (r->Link.SWFSize)
++      if (r->Link.SWFSize)
+       {
+         RTMP_SendCtrl(r, 0x1B, 0, 0);
+       }
+@@ -3142,8 +3469,18 @@ HandShake(RTMP *r, int FP9HandShake)
+       serversig[4], serversig[5], serversig[6], serversig[7]);
+   /* 2nd part of handshake */
+-  if (!WriteN(r, serversig, RTMP_SIG_SIZE))
+-    return FALSE;
++  if (r->Link.CombineConnectPacket)
++    {
++      char *HandshakeResponse = malloc(RTMP_SIG_SIZE);
++      memcpy(HandshakeResponse, (char *) serversig, RTMP_SIG_SIZE);
++      r->Link.HandshakeResponse.av_val = HandshakeResponse;
++      r->Link.HandshakeResponse.av_len = RTMP_SIG_SIZE;
++    }
++  else
++    {
++      if (!WriteN(r, (char *) serversig, RTMP_SIG_SIZE))
++        return FALSE;
++    }
+   if (ReadN(r, serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
+     return FALSE;
+@@ -3709,12 +4046,11 @@ HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len)
+   char hbuf[512];
+   int hlen = snprintf(hbuf, sizeof(hbuf), "POST /%s%s/%d HTTP/1.1\r\n"
+     "Host: %.*s:%d\r\n"
+-    "Accept: */*\r\n"
+-    "User-Agent: Shockwave Flash\n"
+-    "Connection: Keep-Alive\n"
++    "User-Agent: Shockwave Flash\r\n"
++    "Connection: Keep-Alive\r\n"
+     "Cache-Control: no-cache\r\n"
+-    "Content-type: application/x-fcs\r\n"
+-    "Content-length: %d\r\n\r\n", RTMPT_cmds[cmd],
++    "Content-Type: application/x-fcs\r\n"
++    "Content-Length: %d\r\n\r\n", RTMPT_cmds[cmd],
+     r->m_clientID.av_val ? r->m_clientID.av_val : "",
+     r->m_msgCounter, r->Link.hostname.av_len, r->Link.hostname.av_val,
+     r->Link.port, len);
+@@ -3749,6 +4085,14 @@ HTTP_read(RTMP *r, int fill)
+   if (!ptr)
+     return -1;
+   ptr += 4;
++  int resplen = r->m_sb.sb_size - (ptr - r->m_sb.sb_start);
++  if (hlen < 4096)
++    while (resplen < hlen)
++      {
++        if (RTMPSockBuf_Fill(&r->m_sb) == -1)
++          return -1;
++        resplen = r->m_sb.sb_size - (ptr - r->m_sb.sb_start);
++      }
+   r->m_sb.sb_size -= ptr - r->m_sb.sb_start;
+   r->m_sb.sb_start = ptr;
+   r->m_unackd--;
+@@ -4301,13 +4645,21 @@ fail:
+                 r->m_read.status = nRead;
+                 goto fail;
+               }
+-            /* buffer overflow, fix buffer and give up */
+-            if (r->m_read.buf < mybuf || r->m_read.buf > end) {
+-              mybuf = realloc(mybuf, cnt + nRead);
+-              memcpy(mybuf+cnt, r->m_read.buf, nRead);
+-              r->m_read.buf = mybuf+cnt+nRead;
+-              break;
+-            }
++              /* buffer overflow, fix buffer and give up */
++              if (r->m_read.buf < mybuf || r->m_read.buf > end)
++                {
++                  if (!cnt)
++                    {
++                      mybuf = realloc(mybuf, sizeof (flvHeader) + cnt + nRead);
++                      memcpy(mybuf, flvHeader, sizeof (flvHeader));
++                      cnt += sizeof (flvHeader);
++                    }
++                  else
++                    mybuf = realloc(mybuf, cnt + nRead);
++                  memcpy(mybuf + cnt, r->m_read.buf, nRead);
++                  r->m_read.buf = mybuf + cnt + nRead;
++                  break;
++                }
+             cnt += nRead;
+             r->m_read.buf += nRead;
+             r->m_read.buflen -= nRead;
+@@ -4458,3 +4810,90 @@ RTMP_Write(RTMP *r, const char *buf, int size)
+     }
+   return size+s2;
+ }
++
++static int
++SendInvoke(RTMP *r, AVal *Command, int queue)
++{
++  RTMPPacket packet;
++  char pbuf[512], *enc;
++
++  packet.m_nChannel = 0x03; /* control channel (invoke) */
++  packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
++  packet.m_packetType = RTMP_PACKET_TYPE_INVOKE;
++  packet.m_nTimeStamp = 0;
++  packet.m_nInfoField2 = 0;
++  packet.m_hasAbsTimestamp = 0;
++  packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
++
++  enc = packet.m_body;
++  if (Command->av_len)
++    {
++      memcpy(enc, Command->av_val, Command->av_len);
++      enc += Command->av_len;
++    }
++  else
++    return FALSE;
++  packet.m_nBodySize = enc - packet.m_body;
++
++  return RTMP_SendPacket(r, &packet, queue);
++}
++
++static int
++strsplit(char *src, int srclen, char delim, char ***params)
++{
++  char *sptr, *srcbeg, *srcend, *dstr;
++  int count = 1, i = 0, len = 0;
++
++  if (src == NULL)
++    return 0;
++  if (!srclen)
++    srclen = strlen(src);
++  srcbeg = src;
++  srcend = srcbeg + srclen;
++  sptr = srcbeg;
++
++  /* count the delimiters */
++  while (sptr < srcend)
++    {
++      if (*sptr++ == delim)
++        count++;
++    }
++  sptr = srcbeg;
++  *params = calloc(count, sizeof (size_t));
++  char **param = *params;
++
++  for (i = 0; i < (count - 1); i++)
++    {
++      dstr = strchr(sptr, delim);
++      len = dstr - sptr;
++      param[i] = calloc(len + 1, sizeof (char));
++      strncpy(param[i], sptr, len);
++      sptr += len + 1;
++    }
++
++  /* copy the last string */
++  if (sptr <= srcend)
++    {
++      len = srclen - (sptr - srcbeg);
++      param[i] = calloc(len + 1, sizeof (char));
++      strncpy(param[i], sptr, len);
++    }
++  return count;
++}
++
++static int
++SendGetStreamLength(RTMP *r)
++{
++  char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc;
++  AVal av_Command;
++
++  enc = pbuf;
++  enc = AMF_EncodeString(enc, pend, &av_getStreamLength);
++  enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
++  *enc++ = AMF_NULL;
++  enc = AMF_EncodeString(enc, pend, &r->Link.playpath);
++  av_Command.av_val = pbuf;
++  av_Command.av_len = enc - pbuf;
++
++  return SendInvoke(r, &av_Command, TRUE);
++}
+diff --git a/librtmp/rtmp.h b/librtmp/rtmp.h
+index 6b2ae5b..411b488 100644
+--- a/librtmp/rtmp.h
++++ b/librtmp/rtmp.h
+@@ -150,12 +150,14 @@ extern "C"
+     AVal playpath;    /* passed in explicitly */
+     AVal tcUrl;
+     AVal swfUrl;
++    AVal swfHash;
+     AVal pageUrl;
+     AVal app;
+     AVal auth;
+     AVal flashVer;
+     AVal subscribepath;
+     AVal usherToken;
++    AVal WeebToken;
+     AVal token;
+     AMFObject extras;
+     int edepth;
+@@ -172,9 +174,15 @@ extern "C"
+     int lFlags;
+     int swfAge;
++    int swfSize;
+     int protocol;
++    int ConnectPacket;
++    int CombineConnectPacket;
++    int redirected;
+     int timeout;              /* connection timeout in seconds */
++    AVal Extras;
++    AVal HandshakeResponse;
+     unsigned short socksport;
+     unsigned short port;
+@@ -299,6 +307,7 @@ extern "C"
+                       AVal *flashVer,
+                       AVal *subscribepath,
+                       AVal *usherToken,
++                      AVal *WeebToken,
+                       int dStart,
+                       int dStop, int bLiveStream, long int timeout);
+diff --git a/librtmp/rtmp_sys.h b/librtmp/rtmp_sys.h
+index c3fd4a6..1bfb562 100644
+--- a/librtmp/rtmp_sys.h
++++ b/librtmp/rtmp_sys.h
+@@ -64,6 +64,7 @@
+ #include <polarssl/net.h>
+ #include <polarssl/ssl.h>
+ #include <polarssl/havege.h>
++#include <polarssl/md5.h>
+ typedef struct tls_ctx {
+       havege_state hs;
+       ssl_session ssn;
+@@ -71,7 +72,7 @@ typedef struct tls_ctx {
+ #define TLS_CTX tls_ctx *
+ #define TLS_client(ctx,s)     s = malloc(sizeof(ssl_context)); ssl_init(s);\
+       ssl_set_endpoint(s, SSL_IS_CLIENT); ssl_set_authmode(s, SSL_VERIFY_NONE);\
+-      ssl_set_rng(s, havege_rand, &ctx->hs);\
++      ssl_set_rng(s, havege_random, &ctx->hs);\
+       ssl_set_ciphersuites(s, ssl_default_ciphersuites);\
+       ssl_set_session(s, 1, 600, &ctx->ssn)
+ #define TLS_setfd(s,fd)       ssl_set_bio(s, net_recv, &fd, net_send, &fd)
+@@ -80,6 +81,7 @@ typedef struct tls_ctx {
+ #define TLS_write(s,b,l)      ssl_write(s,(unsigned char *)b,l)
+ #define TLS_shutdown(s)       ssl_close_notify(s)
+ #define TLS_close(s)  ssl_free(s); free(s)
++#define md5_hash(i, ilen, o) md5(i, ilen, o)
+ #elif defined(USE_GNUTLS)
+ #include <gnutls/gnutls.h>
+@@ -95,6 +97,8 @@ typedef struct tls_ctx {
+ #define TLS_write(s,b,l)      gnutls_record_send(s,b,l)
+ #define TLS_shutdown(s)       gnutls_bye(s, GNUTLS_SHUT_RDWR)
+ #define TLS_close(s)  gnutls_deinit(s)
++#define md5_hash(i, ilen, o) gnutls_digest_algorithm_t algorithm = GNUTLS_DIG_MD5;\
++                             gnutls_hash_fast(algorithm, i, ilen, o);
+ #else /* USE_OPENSSL */
+ #define TLS_CTX       SSL_CTX *
+@@ -105,6 +109,7 @@ typedef struct tls_ctx {
+ #define TLS_write(s,b,l)      SSL_write(s,b,l)
+ #define TLS_shutdown(s)       SSL_shutdown(s)
+ #define TLS_close(s)  SSL_free(s)
++#define md5_hash(i, ilen, o) MD5(i, ilen, o)
+ #endif
+ #endif
+diff --git a/rtmpdump.c b/rtmpdump.c
+index e52f7d4..7bb0890 100644
+--- a/rtmpdump.c
++++ b/rtmpdump.c
+@@ -701,6 +701,8 @@ void usage(char *prog)
+         RTMP_LogPrintf
+           ("--jtv|-j JSON           Authentication token for Justin.tv legacy servers\n");
+         RTMP_LogPrintf
++          ("--weeb|-J string        Authentication token for weeb.tv servers\n");
++        RTMP_LogPrintf
+           ("--hashes|-#             Display progress with hashes, not with the byte counter\n");
+         RTMP_LogPrintf
+           ("--buffer|-b             Buffer time in milliseconds (default: %u)\n",
+@@ -747,7 +749,8 @@ main(int argc, char **argv)
+   AVal hostname = { 0, 0 };
+   AVal playpath = { 0, 0 };
+   AVal subscribepath = { 0, 0 };
+-  AVal usherToken = { 0, 0 }; //Justin.tv auth token
++  AVal usherToken = { 0, 0 }; // Justin.tv auth token
++  AVal WeebToken = { 0, 0 };  // Weeb.tv auth token
+   int port = -1;
+   int protocol = RTMP_PROTOCOL_UNDEFINED;
+   int retries = 0;
+@@ -852,12 +855,13 @@ main(int argc, char **argv)
+     {"quiet", 0, NULL, 'q'},
+     {"verbose", 0, NULL, 'V'},
+     {"jtv", 1, NULL, 'j'},
++    {"weeb", 1, NULL, 'J'},
+     {0, 0, 0, 0}
+   };
+   while ((opt =
+         getopt_long(argc, argv,
+-                    "hVveqzRr:s:t:p:a:b:f:o:u:C:n:c:l:y:Ym:k:d:A:B:T:w:x:W:X:S:#j:",
++                    "hVveqzr:s:t:p:a:b:f:o:u:C:n:c:l:y:Ym:k:d:A:B:T:w:x:W:X:S:#j:J:",
+                     longopts, NULL)) != -1)
+     {
+       switch (opt)
+@@ -1070,6 +1074,9 @@ main(int argc, char **argv)
+       case 'j':
+         STR2AVAL(usherToken, optarg);
+         break;
++      case 'J':
++        STR2AVAL(WeebToken, optarg);
++        break;
+       default:
+         RTMP_LogPrintf("unknown option: %c\n", opt);
+         usage(argv[0]);
+@@ -1161,14 +1168,14 @@ main(int argc, char **argv)
+   if (tcUrl.av_len == 0)
+     {
+-        tcUrl.av_len = strlen(RTMPProtocolStringsLower[protocol]) +
+-              hostname.av_len + app.av_len + sizeof("://:65535/");
++      tcUrl.av_len = strlen(RTMPProtocolStringsLower[protocol]) +
++              hostname.av_len + app.av_len + sizeof ("://:65535/");
+       tcUrl.av_val = (char *) malloc(tcUrl.av_len);
+-        if (!tcUrl.av_val)
+-          return RD_FAILED;
++      if (!tcUrl.av_val)
++        return RD_FAILED;
+       tcUrl.av_len = snprintf(tcUrl.av_val, tcUrl.av_len, "%s://%.*s:%d/%.*s",
+-                 RTMPProtocolStringsLower[protocol], hostname.av_len,
+-                 hostname.av_val, port, app.av_len, app.av_val);
++                              RTMPProtocolStringsLower[protocol], hostname.av_len,
++                              hostname.av_val, port, app.av_len, app.av_val);
+     }
+   int first = 1;
+@@ -1187,7 +1194,7 @@ main(int argc, char **argv)
+   RTMP_SetupStream(&rtmp, protocol, &hostname, port, &sockshost, &playpath,
+                  &tcUrl, &swfUrl, &pageUrl, &app, &auth, &swfHash, swfSize,
+-                 &flashVer, &subscribepath, &usherToken, dSeek, dStopOffset, bLiveStream, timeout);
++                 &flashVer, &subscribepath, &usherToken, &WeebToken, dSeek, dStopOffset, bLiveStream, timeout);
+   /* Try to keep the stream moving if it pauses on us */
+   if (!bLiveStream && !bRealtimeStream && !(protocol & RTMP_FEATURE_HTTP))
+diff --git a/rtmpgw.c b/rtmpgw.c
+index 0cf56bb..cd4396d 100644
+--- a/rtmpgw.c
++++ b/rtmpgw.c
+@@ -95,7 +95,8 @@ typedef struct
+   AVal flashVer;
+   AVal token;
+   AVal subscribepath;
+-  AVal usherToken; //Justin.tv auth token
++  AVal usherToken; // Justin.tv auth token
++  AVal WeebToken;  // Weeb.tv auth token
+   AVal sockshost;
+   AMFObject extras;
+   int edepth;
+@@ -553,7 +554,7 @@ void processTCPrequest(STREAMING_SERVER * server,  // server socket and state (ou
+   RTMP_Init(&rtmp);
+   RTMP_SetBufferMS(&rtmp, req.bufferTime);
+   RTMP_SetupStream(&rtmp, req.protocol, &req.hostname, req.rtmpport, &req.sockshost,
+-                 &req.playpath, &req.tcUrl, &req.swfUrl, &req.pageUrl, &req.app, &req.auth, &req.swfHash, req.swfSize, &req.flashVer, &req.subscribepath, &req.usherToken, dSeek, req.dStopOffset,
++                 &req.playpath, &req.tcUrl, &req.swfUrl, &req.pageUrl, &req.app, &req.auth, &req.swfHash, req.swfSize, &req.flashVer, &req.subscribepath, &req.usherToken, &req.WeebToken, dSeek, req.dStopOffset,
+                  req.bLiveStream, req.timeout);
+   /* backward compatibility, we always sent this as true before */
+   if (req.auth.av_len)
+@@ -957,6 +958,9 @@ ParseOption(char opt, char *arg, RTMP_REQUEST * req)
+     case 'j':
+       STR2AVAL(req->usherToken, arg);
+       break;
++    case 'J':
++      STR2AVAL(req->WeebToken, arg);
++      break;
+     default:
+       RTMP_LogPrintf("unknown option: %c, arg: %s\n", opt, arg);
+       return FALSE;
+@@ -1028,6 +1032,7 @@ main(int argc, char **argv)
+     {"quiet", 0, NULL, 'q'},
+     {"verbose", 0, NULL, 'V'},
+     {"jtv", 1, NULL, 'j'},
++    {"weeb", 1, NULL, 'J'},
+     {0, 0, 0, 0}
+   };
+@@ -1040,7 +1045,7 @@ main(int argc, char **argv)
+   while ((opt =
+         getopt_long(argc, argv,
+-                    "hvqVzr:s:t:p:a:f:u:n:c:l:y:m:d:D:A:B:T:g:w:x:W:X:S:j:", longopts,
++                    "hvqVzr:s:t:p:a:f:u:n:c:l:y:m:d:D:A:B:T:g:w:x:W:X:S:j:J:", longopts,
+                     NULL)) != -1)
+     {
+       switch (opt)
+@@ -1103,6 +1108,8 @@ main(int argc, char **argv)
+         RTMP_LogPrintf
+           ("--jtv|-j JSON           Authentication token for Justin.tv legacy servers\n");
+         RTMP_LogPrintf
++          ("--weeb|-J string        Authentication token for weeb.tv servers\n");
++        RTMP_LogPrintf
+           ("--buffer|-b             Buffer time in milliseconds (default: %u)\n\n",
+            defaultRTMPRequest.bufferTime);
+diff --git a/rtmpsrv.c b/rtmpsrv.c
+index 9aa62f3..9ec8f23 100644
+--- a/rtmpsrv.c
++++ b/rtmpsrv.c
+@@ -96,9 +96,20 @@ STREAMING_SERVER *rtmpServer = 0;   // server structure pointer
+ STREAMING_SERVER *startStreaming(const char *address, int port);
+ void stopStreaming(STREAMING_SERVER * server);
+ void AVreplace(AVal *src, const AVal *orig, const AVal *repl);
++char *strreplace(char *srcstr, int srclen, char *orig, char *repl);
++int file_exists(const char *fname);
++int SendCheckBWResponse(RTMP *r, int oldMethodType, int onBWDoneInit);
++AVal AVcopy(AVal src);
++AVal StripParams(AVal *src);
+ static const AVal av_dquote = AVC("\"");
+ static const AVal av_escdquote = AVC("\\\"");
++#ifdef WIN32
++static const AVal av_caret = AVC("^");
++static const AVal av_esccaret = AVC("^^");
++static const AVal av_pipe = AVC("|");
++static const AVal av_escpipe = AVC("^|");
++#endif
+ typedef struct
+ {
+@@ -167,6 +178,10 @@ SAVC(level);
+ SAVC(code);
+ SAVC(description);
+ SAVC(secureToken);
++SAVC(_checkbw);
++SAVC(_onbwdone);
++SAVC(checkBandwidth);
++SAVC(onBWDone);
+ static int
+ SendConnectResult(RTMP *r, double txn)
+@@ -190,7 +205,7 @@ SendConnectResult(RTMP *r, double txn)
+   enc = AMF_EncodeNumber(enc, pend, txn);
+   *enc++ = AMF_OBJECT;
+-  STR2AVAL(av, "FMS/3,5,1,525");
++  STR2AVAL(av, "FMS/3,5,7,7009");
+   enc = AMF_EncodeNamedString(enc, pend, &av_fmsVer, &av);
+   enc = AMF_EncodeNamedNumber(enc, pend, &av_capabilities, 31.0);
+   enc = AMF_EncodeNamedNumber(enc, pend, &av_mode, 1.0);
+@@ -212,7 +227,7 @@ SendConnectResult(RTMP *r, double txn)
+   enc = AMF_EncodeNamedString(enc, pend, &av_secureToken, &av);
+ #endif
+   STR2AVAL(p.p_name, "version");
+-  STR2AVAL(p.p_vu.p_aval, "3,5,1,525");
++  STR2AVAL(p.p_vu.p_aval, "3,5,7,7009");
+   p.p_type = AMF_STRING;
+   obj.o_num = 1;
+   obj.o_props = &p;
+@@ -268,7 +283,7 @@ static int
+ SendPlayStart(RTMP *r)
+ {
+   RTMPPacket packet;
+-  char pbuf[512], *pend = pbuf+sizeof(pbuf);
++  char pbuf[1024], *pend = pbuf + sizeof (pbuf);
+   packet.m_nChannel = 0x03;     // control channel (invoke)
+   packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */
+@@ -300,7 +315,7 @@ static int
+ SendPlayStop(RTMP *r)
+ {
+   RTMPPacket packet;
+-  char pbuf[512], *pend = pbuf+sizeof(pbuf);
++  char pbuf[1024], *pend = pbuf + sizeof (pbuf);
+   packet.m_nChannel = 0x03;     // control channel (invoke)
+   packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */
+@@ -328,6 +343,49 @@ SendPlayStop(RTMP *r)
+   return RTMP_SendPacket(r, &packet, FALSE);
+ }
++int
++SendCheckBWResponse(RTMP *r, int oldMethodType, int onBWDoneInit)
++{
++  RTMPPacket packet;
++  char pbuf[256], *pend = pbuf + sizeof (pbuf);
++  char *enc;
++
++  packet.m_nChannel = 0x03; /* control channel (invoke) */
++  packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
++  packet.m_packetType = RTMP_PACKET_TYPE_INVOKE;
++  packet.m_nTimeStamp = 0;
++  packet.m_nInfoField2 = 0;
++  packet.m_hasAbsTimestamp = 0;
++  packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
++
++  enc = packet.m_body;
++  if (oldMethodType)
++    {
++      enc = AMF_EncodeString(enc, pend, &av__onbwdone);
++      enc = AMF_EncodeNumber(enc, pend, 0);
++      *enc++ = AMF_NULL;
++      enc = AMF_EncodeNumber(enc, pend, 10240);
++      enc = AMF_EncodeNumber(enc, pend, 10240);
++    }
++  else
++    {
++      enc = AMF_EncodeString(enc, pend, &av_onBWDone);
++      enc = AMF_EncodeNumber(enc, pend, 0);
++      *enc++ = AMF_NULL;
++      if (!onBWDoneInit)
++        {
++          enc = AMF_EncodeNumber(enc, pend, 10240);
++          enc = AMF_EncodeNumber(enc, pend, 10240);
++          enc = AMF_EncodeNumber(enc, pend, 0);
++          enc = AMF_EncodeNumber(enc, pend, 0);
++        }
++    }
++
++  packet.m_nBodySize = enc - packet.m_body;
++
++  return RTMP_SendPacket(r, &packet, FALSE);
++}
++
+ static void
+ spawn_dumper(int argc, AVal *av, char *cmd)
+ {
+@@ -568,6 +626,7 @@ ServeInvoke(STREAMING_SERVER *server, RTMP * r, RTMPPacket *packet, unsigned int
+         server->arglen += countAMF(&r->Link.extras, &server->argc);
+       }
+       SendConnectResult(r, txn);
++      SendCheckBWResponse(r, FALSE, TRUE);
+     }
+   else if (AVMATCH(&method, &av_createStream))
+     {
+@@ -582,10 +641,22 @@ ServeInvoke(STREAMING_SERVER *server, RTMP * r, RTMPPacket *packet, unsigned int
+       AVal usherToken;
+       AMFProp_GetString(AMF_GetProp(&obj, NULL, 3), &usherToken);
+       AVreplace(&usherToken, &av_dquote, &av_escdquote);
++#ifdef WIN32
++      AVreplace(&usherToken, &av_caret, &av_esccaret);
++      AVreplace(&usherToken, &av_pipe, &av_escpipe);
++#endif
+       server->arglen += 6 + usherToken.av_len;
+       server->argc += 2;
+       r->Link.usherToken = usherToken;
+     }
++  else if (AVMATCH(&method, &av__checkbw))
++    {
++      SendCheckBWResponse(r, TRUE, FALSE);
++    }
++  else if (AVMATCH(&method, &av_checkBandwidth))
++    {
++      SendCheckBWResponse(r, FALSE, FALSE);
++    }
+   else if (AVMATCH(&method, &av_play))
+     {
+       char *file, *p, *q, *cmd, *ptr;
+@@ -599,6 +670,17 @@ ServeInvoke(STREAMING_SERVER *server, RTMP * r, RTMPPacket *packet, unsigned int
+       if (obj.o_num > 5)
+       r->Link.length = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 5));
+       */
++      double StartFlag = 0;
++      AMFObjectProperty *Start = AMF_GetProp(&obj, NULL, 4);
++      if (!(Start->p_type == AMF_INVALID))
++        StartFlag = AMFProp_GetNumber(Start);
++      r->Link.app = AVcopy(r->Link.app);
++      if (StartFlag == -1000 || strstr(r->Link.app.av_val, "live"))
++        {
++          StartFlag = -1000;
++          server->arglen += 7;
++          server->argc += 1;
++        }
+       if (r->Link.tcUrl.av_len)
+       {
+         len = server->arglen + r->Link.playpath.av_len + 4 +
+@@ -616,6 +698,7 @@ ServeInvoke(STREAMING_SERVER *server, RTMP * r, RTMPPacket *packet, unsigned int
+         argv[argc].av_val = ptr + 1;
+         argv[argc++].av_len = 2;
+         argv[argc].av_val = ptr + 5;
++        r->Link.tcUrl = StripParams(&r->Link.tcUrl);
+         ptr += sprintf(ptr," -r \"%s\"", r->Link.tcUrl.av_val);
+         argv[argc++].av_len = r->Link.tcUrl.av_len;
+@@ -640,6 +723,7 @@ ServeInvoke(STREAMING_SERVER *server, RTMP * r, RTMPPacket *packet, unsigned int
+             argv[argc].av_val = ptr + 1;
+             argv[argc++].av_len = 2;
+             argv[argc].av_val = ptr + 5;
++            r->Link.swfUrl = StripParams(&r->Link.swfUrl);
+             ptr += sprintf(ptr, " -W \"%s\"", r->Link.swfUrl.av_val);
+             argv[argc++].av_len = r->Link.swfUrl.av_len;
+           }
+@@ -662,10 +746,17 @@ ServeInvoke(STREAMING_SERVER *server, RTMP * r, RTMPPacket *packet, unsigned int
+             r->Link.usherToken.av_val = NULL;
+             r->Link.usherToken.av_len = 0;
+           }
+-        if (r->Link.extras.o_num) {
+-          ptr = dumpAMF(&r->Link.extras, ptr, argv, &argc);
+-          AMF_Reset(&r->Link.extras);
+-        }
++          if (StartFlag == -1000)
++            {
++              argv[argc].av_val = ptr + 1;
++              argv[argc++].av_len = 6;
++              ptr += sprintf(ptr, " --live");
++            }
++          if (r->Link.extras.o_num)
++            {
++              ptr = dumpAMF(&r->Link.extras, ptr, argv, &argc);
++              AMF_Reset(&r->Link.extras);
++            }
+         argv[argc].av_val = ptr + 1;
+         argv[argc++].av_len = 2;
+         argv[argc].av_val = ptr + 5;
+@@ -673,7 +764,13 @@ ServeInvoke(STREAMING_SERVER *server, RTMP * r, RTMPPacket *packet, unsigned int
+           r->Link.playpath.av_len, r->Link.playpath.av_val);
+         argv[argc++].av_len = r->Link.playpath.av_len;
+-        av = r->Link.playpath;
++          if (r->Link.playpath.av_len)
++            av = r->Link.playpath;
++          else
++            {
++              av.av_val = "file";
++              av.av_len = 4;
++            }
+         /* strip trailing URL parameters */
+         q = memchr(av.av_val, '?', av.av_len);
+         if (q)
+@@ -725,7 +822,30 @@ ServeInvoke(STREAMING_SERVER *server, RTMP * r, RTMPPacket *packet, unsigned int
+         argv[argc++].av_len = 2;
+         argv[argc].av_val = file;
+         argv[argc].av_len = av.av_len;
+-        ptr += sprintf(ptr, " -o %s", file);
++#ifdef VLC
++          char *vlc;
++          int didAlloc = FALSE;
++
++          if (getenv("VLC"))
++            vlc = getenv("VLC");
++          else if (getenv("ProgramFiles"))
++            {
++              vlc = malloc(512 * sizeof (char));
++              didAlloc = TRUE;
++              char *ProgramFiles = getenv("ProgramFiles");
++              sprintf(vlc, "%s%s", ProgramFiles, " (x86)\\VideoLAN\\VLC\\vlc.exe");
++              if (!file_exists(vlc))
++                sprintf(vlc, "%s%s", ProgramFiles, "\\VideoLAN\\VLC\\vlc.exe");
++            }
++          else
++            vlc = "C:\\Program Files\\VideoLAN\\VLC\\vlc.exe";
++
++          ptr += sprintf(ptr, " | %s -", vlc);
++          if (didAlloc)
++            free(vlc);
++#else
++          ptr += sprintf(ptr, " -o %s", file);
++#endif
+         now = RTMP_GetTime();
+         if (now - server->filetime < DUPTIME && AVMATCH(&argv[argc], &server->filename))
+           {
+@@ -739,7 +859,23 @@ ServeInvoke(STREAMING_SERVER *server, RTMP * r, RTMPPacket *packet, unsigned int
+             server->filetime = now;
+             free(server->filename.av_val);
+             server->filename = argv[argc++];
+-            spawn_dumper(argc, argv, cmd);
++#ifdef VLC
++              FILE *vlc_cmdfile = fopen("VLC.bat", "w");
++              char *vlc_batchcmd = strreplace(cmd, 0, "%", "%%");
++              fprintf(vlc_cmdfile, "%s\n", vlc_batchcmd);
++              fclose(vlc_cmdfile);
++              free(vlc_batchcmd);
++              spawn_dumper(argc, argv, "VLC.bat");
++#else
++              spawn_dumper(argc, argv, cmd);
++#endif
++
++#ifdef WIN32
++              // Dump command to batch file
++              FILE *cmdfile = fopen("Command.bat", "a");
++              fprintf(cmdfile, "%s\n", cmd);
++              fclose(cmdfile);
++#endif
+           }
+         free(cmd);
+@@ -1178,3 +1314,115 @@ AVreplace(AVal *src, const AVal *orig, const AVal *repl)
+   src->av_val = dest;
+   src->av_len = dptr - dest;
+ }
++
++char *
++strreplace(char *srcstr, int srclen, char *orig, char *repl)
++{
++  char *ptr = NULL, *sptr = srcstr;
++  int origlen = strlen(orig);
++  int repllen = strlen(repl);
++  if (!srclen)
++    srclen = strlen(srcstr);
++  char *srcend = srcstr + srclen;
++  int dstbuffer = srclen / origlen * repllen;
++  if (dstbuffer < srclen)
++    dstbuffer = srclen;
++  char *dststr = calloc(dstbuffer + 1, sizeof (char));
++  char *dptr = dststr;
++
++  if ((ptr = strstr(srcstr, orig)))
++    {
++      while (ptr < srcend && (ptr = strstr(sptr, orig)))
++        {
++          int len = ptr - sptr;
++          memcpy(dptr, sptr, len);
++          sptr += len + origlen;
++          dptr += len;
++          memcpy(dptr, repl, repllen);
++          dptr += repllen;
++        }
++      memcpy(dptr, sptr, srcend - sptr);
++      return dststr;
++    }
++
++  memcpy(dststr, srcstr, srclen);
++  return dststr;
++}
++
++AVal
++StripParams(AVal *src)
++{
++  AVal str;
++  if (src->av_val)
++    {
++      str.av_val = calloc(src->av_len + 1, sizeof (char));
++      strncpy(str.av_val, src->av_val, src->av_len);
++      str.av_len = src->av_len;
++      char *start = str.av_val;
++      char *end = start + str.av_len;
++      char *ptr = start;
++
++      while (ptr < end)
++        {
++          if (*ptr == '?')
++            {
++              str.av_len = ptr - start;
++              break;
++            }
++          ptr++;
++        }
++      memset(start + str.av_len, 0, 1);
++
++      char *dynamic = strstr(start, "[[DYNAMIC]]");
++      if (dynamic)
++        {
++          dynamic -= 1;
++          memset(dynamic, 0, 1);
++          str.av_len = dynamic - start;
++          end = start + str.av_len;
++        }
++
++      char *import = strstr(start, "[[IMPORT]]");
++      if (import)
++        {
++          str.av_val = import + 11;
++          strcpy(start, "http://");
++          str.av_val = strcat(start, str.av_val);
++          str.av_len = strlen(str.av_val);
++        }
++      return str;
++    }
++  str = *src;
++  return str;
++}
++
++int
++file_exists(const char *fname)
++{
++  FILE *file;
++  if ((file = fopen(fname, "r")))
++    {
++      fclose(file);
++      return TRUE;
++    }
++  return FALSE;
++}
++
++AVal
++AVcopy(AVal src)
++{
++  AVal dst;
++  if (src.av_len)
++    {
++      dst.av_val = malloc(src.av_len + 1);
++      memcpy(dst.av_val, src.av_val, src.av_len);
++      dst.av_val[src.av_len] = '\0';
++      dst.av_len = src.av_len;
++    }
++  else
++    {
++      dst.av_val = NULL;
++      dst.av_len = 0;
++    }
++  return dst;
++}
+diff --git a/rtmpsuck.c b/rtmpsuck.c
+index e886179..e80c686 100644
+--- a/rtmpsuck.c
++++ b/rtmpsuck.c
+@@ -143,15 +143,18 @@ SAVC(onStatus);
+ SAVC(close);
+ static const AVal av_NetStream_Failed = AVC("NetStream.Failed");
+ static const AVal av_NetStream_Play_Failed = AVC("NetStream.Play.Failed");
+-static const AVal av_NetStream_Play_StreamNotFound =
+-AVC("NetStream.Play.StreamNotFound");
+-static const AVal av_NetConnection_Connect_InvalidApp =
+-AVC("NetConnection.Connect.InvalidApp");
++static const AVal av_NetStream_Play_StreamNotFound = AVC("NetStream.Play.StreamNotFound");
++static const AVal av_NetConnection_Connect_InvalidApp = AVC("NetConnection.Connect.InvalidApp");
+ static const AVal av_NetStream_Play_Start = AVC("NetStream.Play.Start");
+ static const AVal av_NetStream_Play_Complete = AVC("NetStream.Play.Complete");
+ static const AVal av_NetStream_Play_Stop = AVC("NetStream.Play.Stop");
++static const AVal av_NetStream_Authenticate_UsherToken = AVC("NetStream.Authenticate.UsherToken");
+ static const char *cst[] = { "client", "server" };
++char *dumpAMF(AMFObject *obj, char *ptr);
++char *strreplace(char *srcstr, int srclen, char *orig, char *repl);
++AVal AVcopy(AVal src);
++AVal StripParams(AVal *src);
+ // Returns 0 for OK/Failed/error, 1 for 'Stop or Complete'
+ int
+@@ -198,26 +201,28 @@ ServeInvoke(STREAMING_SERVER *server, int which, RTMPPacket *pack, const char *b
+           if (cobj.o_props[i].p_type == AMF_STRING)
+             {
+               pval = cobj.o_props[i].p_vu.p_aval;
+-              RTMP_LogPrintf("%.*s: %.*s\n", pname.av_len, pname.av_val, pval.av_len, pval.av_val);
++              RTMP_LogPrintf("%10.*s : %.*s\n", pname.av_len, pname.av_val, pval.av_len, pval.av_val);
+             }
+           if (AVMATCH(&pname, &av_app))
+             {
+-              server->rc.Link.app = pval;
++              server->rc.Link.app = AVcopy(pval);
+               pval.av_val = NULL;
+             }
+           else if (AVMATCH(&pname, &av_flashVer))
+             {
+-              server->rc.Link.flashVer = pval;
++              server->rc.Link.flashVer = AVcopy(pval);
+               pval.av_val = NULL;
+             }
+           else if (AVMATCH(&pname, &av_swfUrl))
+             {
+ #ifdef CRYPTO
+               if (pval.av_val)
+-              RTMP_HashSWF(pval.av_val, &server->rc.Link.SWFSize,
+-                (unsigned char *)server->rc.Link.SWFHash, 30);
++                {
++                  AVal swfUrl = StripParams(&pval);
++                  RTMP_HashSWF(swfUrl.av_val, &server->rc.Link.SWFSize, (unsigned char *) server->rc.Link.SWFHash, 30);
++                }
+ #endif
+-              server->rc.Link.swfUrl = pval;
++              server->rc.Link.swfUrl = AVcopy(pval);
+               pval.av_val = NULL;
+             }
+           else if (AVMATCH(&pname, &av_tcUrl))
+@@ -225,7 +230,7 @@ ServeInvoke(STREAMING_SERVER *server, int which, RTMPPacket *pack, const char *b
+               char *r1 = NULL, *r2;
+               int len;
+-              server->rc.Link.tcUrl = pval;
++              server->rc.Link.tcUrl = AVcopy(pval);
+               if ((pval.av_val[0] | 0x40) == 'r' &&
+                   (pval.av_val[1] | 0x40) == 't' &&
+                   (pval.av_val[2] | 0x40) == 'm' &&
+@@ -267,7 +272,7 @@ ServeInvoke(STREAMING_SERVER *server, int which, RTMPPacket *pack, const char *b
+             }
+           else if (AVMATCH(&pname, &av_pageUrl))
+             {
+-              server->rc.Link.pageUrl = pval;
++              server->rc.Link.pageUrl = AVcopy(pval);
+               pval.av_val = NULL;
+             }
+           else if (AVMATCH(&pname, &av_audioCodecs))
+@@ -287,14 +292,21 @@ ServeInvoke(STREAMING_SERVER *server, int which, RTMPPacket *pack, const char *b
+           if (pval.av_val)
+             free(pval.av_val);
+         }
++
+       if (obj.o_num > 3)
+         {
+-          if (AMFProp_GetBoolean(&obj.o_props[3]))
+-            server->rc.Link.lFlags |= RTMP_LF_AUTH;
+-          if (obj.o_num > 4)
+-          {
+-            AMFProp_GetString(&obj.o_props[4], &server->rc.Link.auth);
+-          }
++          int i = obj.o_num - 3;
++          server->rc.Link.extras.o_num = i;
++          server->rc.Link.extras.o_props = malloc(i * sizeof (AMFObjectProperty));
++          memcpy(server->rc.Link.extras.o_props, obj.o_props + 3, i * sizeof (AMFObjectProperty));
++          obj.o_num = 3;
++        }
++
++      if (server->rc.Link.extras.o_num)
++        {
++          server->rc.Link.Extras.av_val = calloc(1024, sizeof (char));
++          dumpAMF(&server->rc.Link.extras, server->rc.Link.Extras.av_val);
++          server->rc.Link.Extras.av_len = strlen(server->rc.Link.Extras.av_val);
+         }
+       if (!RTMP_Connect(&server->rc, pack))
+@@ -303,6 +315,16 @@ ServeInvoke(STREAMING_SERVER *server, int which, RTMPPacket *pack, const char *b
+           return 1;
+         }
+       server->rc.m_bSendCounter = FALSE;
++
++      if (server->rc.Link.extras.o_props)
++        {
++          AMF_Reset(&server->rc.Link.extras);
++        }
++    }
++  else if (AVMATCH(&method, &av_NetStream_Authenticate_UsherToken))
++    {
++      AMFProp_GetString(AMF_GetProp(&obj, NULL, 3), &server->rc.Link.usherToken);
++      RTMP_LogPrintf("%10s : %.*s\n", "usherToken", server->rc.Link.usherToken.av_len, server->rc.Link.usherToken.av_val);
+     }
+   else if (AVMATCH(&method, &av_play))
+     {
+@@ -323,6 +345,14 @@ ServeInvoke(STREAMING_SERVER *server, int which, RTMPPacket *pack, const char *b
+       if (!av.av_val)
+         goto out;
++      double StartFlag = 0;
++      AMFObjectProperty *Start = AMF_GetProp(&obj, NULL, 4);
++      if (!(Start->p_type == AMF_INVALID))
++        StartFlag = AMFProp_GetNumber(Start);
++      if (StartFlag == -1000 || strstr(server->rc.Link.app.av_val, "live"))
++        StartFlag = -1000;
++      RTMP_LogPrintf("%10s : %s\n", "live", (StartFlag == -1000) ? "yes" : "no");
++
+       /* check for duplicates */
+       for (fl = server->f_head; fl; fl=fl->f_next)
+         {
+@@ -372,9 +402,51 @@ ServeInvoke(STREAMING_SERVER *server, int which, RTMPPacket *pack, const char *b
+       for (p=file; *p; p++)
+         if (*p == ':')
+           *p = '_';
+-      RTMP_LogPrintf("Playpath: %.*s\nSaving as: %s\n",
+-        server->rc.Link.playpath.av_len, server->rc.Link.playpath.av_val,
+-        file);
++      RTMP_LogPrintf("%10s : %.*s\n%10s : %s\n", "Playpath", server->rc.Link.playpath.av_len,
++                     server->rc.Link.playpath.av_val, "Saving as", file);
++
++#ifdef WIN32
++      // Dump command to batch file
++      char *cmd = NULL, *ptr = NULL;
++      AVal swfUrl, tcUrl;
++
++      cmd = calloc(2048, sizeof (char));
++      ptr = cmd;
++      tcUrl = StripParams(&server->rc.Link.tcUrl);
++      swfUrl = StripParams(&server->rc.Link.swfUrl);
++      ptr += sprintf(ptr, "rtmpdump -r \"%.*s\" -a \"%.*s\" -f \"%.*s\" -W \"%.*s\" -p \"%.*s\"",
++                     tcUrl.av_len, tcUrl.av_val,
++                     server->rc.Link.app.av_len, server->rc.Link.app.av_val,
++                     server->rc.Link.flashVer.av_len, server->rc.Link.flashVer.av_val,
++                     swfUrl.av_len, swfUrl.av_val,
++                     server->rc.Link.pageUrl.av_len, server->rc.Link.pageUrl.av_val);
++
++      if (server->rc.Link.usherToken.av_val)
++        {
++          char *usherToken = strreplace(server->rc.Link.usherToken.av_val, server->rc.Link.usherToken.av_len, "\"", "\\\"");
++          usherToken = strreplace(usherToken, 0, "^", "^^");
++          usherToken = strreplace(usherToken, 0, "|", "^|");
++          ptr += sprintf(ptr, " --jtv \"%s\"", usherToken);
++          free(usherToken);
++        }
++
++      if (server->rc.Link.Extras.av_len)
++        {
++          ptr += sprintf(ptr, "%.*s", server->rc.Link.Extras.av_len, server->rc.Link.Extras.av_val);
++        }
++
++      if (StartFlag == -1000)
++        ptr += sprintf(ptr, "%s", " --live");
++      ptr += sprintf(ptr, " -y \"%.*s\"", server->rc.Link.playpath.av_len, server->rc.Link.playpath.av_val);
++      ptr += sprintf(ptr, " -o \"%s.flv\"\n", file);
++
++      FILE *cmdfile = fopen("Command.bat", "a");
++      fprintf(cmdfile, "%s", cmd);
++      fclose(cmdfile);
++
++      free(cmd);
++#endif
++
+       out = fopen(file, "wb");
+       free(file);
+       if (!out)
+@@ -1196,3 +1268,146 @@ main(int argc, char **argv)
+ #endif
+   return nStatus;
+ }
++
++char *
++dumpAMF(AMFObject *obj, char *ptr)
++{
++  int i;
++  const char opt[] = "NBSO Z";
++
++  for (i = 0; i < obj->o_num; i++)
++    {
++      AMFObjectProperty *p = &obj->o_props[i];
++      if (p->p_type > 5)
++        continue;
++      ptr += sprintf(ptr, " -C ");
++      if (p->p_name.av_val)
++        *ptr++ = 'N';
++      *ptr++ = opt[p->p_type];
++      *ptr++ = ':';
++      if (p->p_name.av_val)
++        ptr += sprintf(ptr, "%.*s:", p->p_name.av_len, p->p_name.av_val);
++      switch (p->p_type)
++        {
++        case AMF_BOOLEAN:
++          *ptr++ = p->p_vu.p_number != 0 ? '1' : '0';
++          break;
++        case AMF_STRING:
++          memcpy(ptr, p->p_vu.p_aval.av_val, p->p_vu.p_aval.av_len);
++          ptr += p->p_vu.p_aval.av_len;
++          break;
++        case AMF_NUMBER:
++          ptr += sprintf(ptr, "%f", p->p_vu.p_number);
++          break;
++        case AMF_OBJECT:
++          *ptr++ = '1';
++          ptr = dumpAMF(&p->p_vu.p_object, ptr);
++          ptr += sprintf(ptr, " -C O:0");
++          break;
++        case AMF_NULL:
++        default:
++          break;
++        }
++    }
++  return ptr;
++}
++
++char *
++strreplace(char *srcstr, int srclen, char *orig, char *repl)
++{
++  char *ptr = NULL, *sptr = srcstr;
++  int origlen = strlen(orig);
++  int repllen = strlen(repl);
++  if (!srclen)
++    srclen = strlen(srcstr);
++  char *srcend = srcstr + srclen;
++  int dstbuffer = srclen / origlen * repllen;
++  if (dstbuffer < srclen)
++    dstbuffer = srclen;
++  char *dststr = calloc(dstbuffer + 1, sizeof (char));
++  char *dptr = dststr;
++
++  if ((ptr = strstr(srcstr, orig)))
++    {
++      while (ptr < srcend && (ptr = strstr(sptr, orig)))
++        {
++          int len = ptr - sptr;
++          memcpy(dptr, sptr, len);
++          sptr += len + origlen;
++          dptr += len;
++          memcpy(dptr, repl, repllen);
++          dptr += repllen;
++        }
++      memcpy(dptr, sptr, srcend - sptr);
++      return dststr;
++    }
++
++  memcpy(dststr, srcstr, srclen);
++  return dststr;
++}
++
++AVal
++StripParams(AVal *src)
++{
++  AVal str;
++  if (src->av_val)
++    {
++      str.av_val = calloc(src->av_len + 1, sizeof (char));
++      strncpy(str.av_val, src->av_val, src->av_len);
++      str.av_len = src->av_len;
++      char *start = str.av_val;
++      char *end = start + str.av_len;
++      char *ptr = start;
++
++      while (ptr < end)
++        {
++          if (*ptr == '?')
++            {
++              str.av_len = ptr - start;
++              break;
++            }
++          ptr++;
++        }
++      memset(start + str.av_len, 0, 1);
++
++      char *dynamic = strstr(start, "[[DYNAMIC]]");
++      if (dynamic)
++        {
++          dynamic -= 1;
++          memset(dynamic, 0, 1);
++          str.av_len = dynamic - start;
++          end = start + str.av_len;
++        }
++
++      char *import = strstr(start, "[[IMPORT]]");
++      if (import)
++        {
++          str.av_val = import + 11;
++          strcpy(start, "http://");
++          str.av_val = strcat(start, str.av_val);
++          str.av_len = strlen(str.av_val);
++        }
++      return str;
++    }
++  str = *src;
++  return str;
++}
++
++AVal
++AVcopy(AVal src)
++{
++  AVal dst;
++  if (src.av_len)
++    {
++      dst.av_val = malloc(src.av_len + 1);
++      memcpy(dst.av_val, src.av_val, src.av_len);
++      dst.av_val[src.av_len] = '\0';
++      dst.av_len = src.av_len;
++    }
++  else
++    {
++      dst.av_val = NULL;
++      dst.av_len = 0;
++    }
++  return dst;
++}
diff --git a/tools/depends/target/librtmp/prefix.patch b/tools/depends/target/librtmp/prefix.patch
new file mode 100644 (file)
index 0000000..198a85c
--- /dev/null
@@ -0,0 +1,10 @@
+--- librtmp/Makefile     2010-06-30 15:58:35.000000000 -0400
++++ librtmp/Makefile.2   2011-03-31 16:19:52.813884882 -0400
+@@ -1,6 +1,6 @@
+ VERSION=v2.3
+
+-prefix=/usr/local
++prefix=$(PREFIX)
+
+ CC=$(CROSS_COMPILE)gcc
+ LD=$(CROSS_COMPILE)ld
diff --git a/tools/depends/target/libsamplerate/Makefile b/tools/depends/target/libsamplerate/Makefile
new file mode 100644 (file)
index 0000000..2f87beb
--- /dev/null
@@ -0,0 +1,42 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libsamplerate
+VERSION=0.1.7
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          cp -f $(CONFIG_SUB) $(CONFIG_GUESS) Cfg; \
+          ./configure --prefix=$(PREFIX) --disable-sndfile --disable-fftw --disable-shared
+
+LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libsdl/01-SDL_SetWidthHeight.patch b/tools/depends/target/libsdl/01-SDL_SetWidthHeight.patch
new file mode 100644 (file)
index 0000000..0e26023
--- /dev/null
@@ -0,0 +1,33 @@
+Index: include/SDL_video.h
+===================================================================
+--- include/SDL_video.h        (revision 4116)
++++ include/SDL_video.h        (working copy)
+@@ -324,6 +324,11 @@
+ extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
+ /**
++* Alter the width and height of the current surface to the given sizes.
++*/
++extern DECLSPEC void SDLCALL SDL_SetWidthHeight(int width, int height);
++
++/**
+  * Set up a video mode with the specified width, height and bits-per-pixel.
+  *
+  * If 'bpp' is 0, it is treated as the current display bits per pixel.
+
+Index: src/video/SDL_video.c
+===================================================================
+--- src/video/SDL_video.c      (revision 4116)
++++ src/video/SDL_video.c      (working copy)
+@@ -1956,3 +1956,11 @@
+               return(0);
+       }
+ }
++
++void SDL_SetWidthHeight(int width, int height)
++{
++  if (current_video != NULL && current_video->screen != NULL) {
++    current_video->screen->w = width;
++    current_video->screen->h = height;
++  }
++}
diff --git a/tools/depends/target/libsdl/02-mmx.patch b/tools/depends/target/libsdl/02-mmx.patch
new file mode 100644 (file)
index 0000000..82f51aa
--- /dev/null
@@ -0,0 +1,12 @@
+--- src/video/mmx.h    Mon Feb 06 08:28:51 2006 +0000
++++ src/video/mmx.h    Sun Jan 30 13:38:57 2011 -0800
+@@ -355,7 +355,7 @@
+ #define       mmx_r2m(op, reg, mem) \
+       __asm__ __volatile__ (#op " %%" #reg ", %0" \
+-                            : "=X" (mem) \
++                            : "=m" (mem) \
+                             : /* nothing */ )
+ #define       mmx_r2r(op, regs, regd) \
+
diff --git a/tools/depends/target/libsdl/Makefile b/tools/depends/target/libsdl/Makefile
new file mode 100644 (file)
index 0000000..8ac8b22
--- /dev/null
@@ -0,0 +1,40 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include 01-SDL_SetWidthHeight.patch 02-mmx.patch Makefile
+
+# lib name, version
+LIBNAME=SDL
+VERSION=1.2.14
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) \
+  --without-x --disable-video-x11 --disable-video-directfb
+
+LIBDYLIB=$(PLATFORM)/build/.libs/lib$(LIBNAME).so
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p0 < ../01-SDL_SetWidthHeight.patch
+       cd $(PLATFORM); patch -p0 < ../02-mmx.patch
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -j 1 -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libsdl_image/Makefile b/tools/depends/target/libsdl_image/Makefile
new file mode 100644 (file)
index 0000000..4106247
--- /dev/null
@@ -0,0 +1,40 @@
+NATIVE_BUILD=1
+include ../../Makefile.include
+DEPS=Makefile
+
+# lib name, version
+LIBNAME=SDL_image
+VERSION=1.2.7
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) \
+   --disable-jpg-shared --disable-png-shared --disable-tif-shared --disable-sdltest
+
+LIBDYLIB=$(PLATFORM)/.libs/lib$(LIBNAME).so
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       echo $(PLATFORM) > .gitignore
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libshairport/001_add_ao.patch b/tools/depends/target/libshairport/001_add_ao.patch
new file mode 100644 (file)
index 0000000..995f7b7
--- /dev/null
@@ -0,0 +1,270 @@
+diff -uP libshairport-1.2.0.20310_lib/src/ao.h ../../../../../libshairport-1.2.0.20310_lib/src/ao.h
+--- src/ao.h   1970-01-01 01:00:00.000000000 +0100
++++ src/ao.h   2011-09-25 20:36:36.000000000 +0200
+@@ -0,0 +1,156 @@
++/*
++ *
++ *  ao.h 
++ *
++ *  Original Copyright (C) Aaron Holtzman - May 1999
++ *      Modifications Copyright (C) Stan Seibert - July 2000, July 2001
++ *      More Modifications Copyright (C) Jack Moffitt - October 2000
++ *
++ *  This file is part of libao, a cross-platform audio outputlibrary.  See
++ *  README for a history of this source code.
++ *
++ *  libao is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation; either version 2, or (at your option)
++ *  any later version.
++ *
++ *  libao is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with GNU Make; see the file COPYING.  If not, write to
++ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
++ *
++ */
++#ifndef __AO_H__
++#define __AO_H__
++
++#ifdef __cplusplus
++extern "C"
++{
++#endif /* __cplusplus */
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <stdint.h>
++#include <errno.h>
++
++/* --- Constants ---*/
++
++#define AO_TYPE_LIVE 1
++#define AO_TYPE_FILE 2
++
++
++#define AO_ENODRIVER   1
++#define AO_ENOTFILE    2
++#define AO_ENOTLIVE    3
++#define AO_EBADOPTION  4
++#define AO_EOPENDEVICE 5
++#define AO_EOPENFILE   6
++#define AO_EFILEEXISTS 7
++#define AO_EBADFORMAT  8
++
++#define AO_EFAIL       100
++
++
++#define AO_FMT_LITTLE 1
++#define AO_FMT_BIG    2
++#define AO_FMT_NATIVE 4
++
++/* --- Structures --- */
++
++typedef struct ao_info {
++  int  type; /* live output or file output? */
++  char *name; /* full name of driver */
++  char *short_name; /* short name of driver */
++        char *author; /* driver author */
++  char *comment; /* driver comment */
++  int  preferred_byte_format;
++  int  priority;
++  char **options;
++  int  option_count;
++} ao_info;
++
++typedef struct ao_functions ao_functions;
++typedef struct ao_device ao_device;
++
++typedef struct ao_sample_format {
++  int  bits; /* bits per sample */
++  int  rate; /* samples per second (in a single channel) */
++  int  channels; /* number of audio channels */
++  int  byte_format; /* Byte ordering in sample, see constants below */
++        char *matrix; /* input channel location/ordering */
++} ao_sample_format;
++
++typedef struct ao_option {
++  char *key;
++  char *value;
++  struct ao_option *next;
++} ao_option;
++
++#if defined(AO_BUILDING_LIBAO)
++#include "ao_private.h"
++#endif
++
++/* --- Functions --- */
++
++/* library setup/teardown */
++void ao_initialize(void);
++void ao_shutdown(void);
++
++/* device setup/playback/teardown */
++int   ao_append_global_option(const char *key,
++                              const char *value);
++int          ao_append_option(ao_option **options,
++                              const char *key,
++                              const char *value);
++void          ao_free_options(ao_option *options);
++
++char* ao_get_option(ao_option *options, const char* key);
++
++ao_device*       ao_open_live(int driver_id,
++                              ao_sample_format *format,
++                              ao_option *option);
++ao_device*       ao_open_file(int driver_id,
++                              const char *filename,
++                              int overwrite,
++                              ao_sample_format *format,
++                              ao_option *option);
++
++int                   ao_play(ao_device *device,
++                              char *output_samples,
++                              uint32_t num_bytes);
++int                  ao_close(ao_device *device);
++
++/* driver information */
++int              ao_driver_id(const char *short_name);
++int      ao_default_driver_id(void);
++ao_info       *ao_driver_info(int driver_id);
++ao_info **ao_driver_info_list(int *driver_count);
++char       *ao_file_extension(int driver_id);
++
++/* miscellaneous */
++int          ao_is_big_endian(void);
++
++
++#ifdef __cplusplus
++}
++#endif /* __cplusplus */
++
++#endif  /* __AO_H__ */
++
++extern struct AudioOutput g_ao;
++struct AudioOutput                                                                                                                                                                                              
++  {                                                                                                                                                                                                              
++      void (*ao_initialize)(void);                                                                                                                                                                               
++      int (*ao_play)(ao_device *, char *, uint32_t);                                                                                                                                                             
++      int (*ao_default_driver_id)(void);                                                                                                                                                                         
++      ao_device* (*ao_open_live)( int, ao_sample_format *, ao_option *);                                                                                                                                         
++      int (*ao_close)(ao_device *);                                                                                                                                                                              
++      /* -- Device Setup/Playback/Teardown -- */                                                                                                                                                                 
++      int (*ao_append_option)(ao_option **, const char *, const char *);                                                                                                                                         
++      void (*ao_free_options)(ao_option *);                                                                                                                                                                      
++      char* (*ao_get_option)(ao_option *, const char* );                                                                                                                                                         
++  }; 
+diff -uP libshairport-1.2.0.20310_lib/src/hairtunes.c ../../../../../libshairport-1.2.0.20310_lib/src/hairtunes.c
+--- src/hairtunes.c    2011-09-23 21:55:48.000000000 +0200
++++ src/hairtunes.c    2011-09-25 20:37:49.000000000 +0200
+@@ -25,7 +25,7 @@
+  */
+ #define XBMC
+-//#defined HAS_AO
++#define HAS_AO
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -45,7 +45,7 @@
+ #include <sys/signal.h>
+ #include <fcntl.h>
+ #ifdef HAS_AO
+-#include <ao/ao.h>
++#include "ao.h"
+ #endif
+ #ifdef FANCY_RESAMPLING
+@@ -881,7 +881,7 @@
+             }
+ #ifdef HAS_AO
+         } else {
+-            ao_play(dev, (char *)outbuf, play_samples*4);
++            g_ao.ao_play(dev, (char *)outbuf, play_samples*4);
+ #endif
+         }
+     }
+@@ -906,7 +906,7 @@
+ ao_device *dev;
+ void* init_ao() {
+-    ao_initialize();
++    g_ao.ao_initialize();
+     int driver;
+ #ifndef XBMC
+@@ -921,7 +921,7 @@
+ #endif
+     {
+         // otherwise choose the default
+-        driver = ao_default_driver_id();
++        driver = g_ao.ao_default_driver_id();
+     }
+     ao_sample_format fmt;
+@@ -944,9 +944,9 @@
+     }
+ #endif
+-    ao_append_option(&ao_opts, "name", "Streaming...");
++    g_ao.ao_append_option(&ao_opts, "name", "Streaming...");
+-    dev = ao_open_live(driver, &fmt, ao_opts);
++    dev = g_ao.ao_open_live(driver, &fmt, ao_opts);
+     if (dev == NULL) {
+         die("Could not open ao device");
+     }
+@@ -985,7 +985,7 @@
+   audio_running = 0;
+   pthread_join(audio_thread, NULL);
+ #ifdef HAS_AO
+-  ao_close(dev);
++  g_ao.ao_close(dev);
+ #endif
+ }
+diff -uP libshairport-1.2.0.20310_lib/src/shairport.c ../../../../../libshairport-1.2.0.20310_lib/src/shairport.c
+--- src/shairport.c    2011-08-21 01:57:56.000000000 +0200
++++ src/shairport.c    2011-09-25 20:44:40.000000000 +0200
+@@ -92,6 +92,14 @@
+ static char tPassword[56] = "";
+ static char tHWID[HWID_SIZE] = {0,51,52,53,54,55};
++#ifdef XBMC
++struct AudioOutput g_ao;
++void shairport_set_ao(struct AudioOutput *ao)
++{
++ g_ao=*ao;
++}
++#endif
++
+ #ifndef XBMC
+ int main(int argc, char **argv)
+ #else
+diff -uP libshairport-1.2.0.20310_lib/src/shairport.h ../../../../../libshairport-1.2.0.20310_lib/src/shairport.h
+--- src/shairport.h    2011-08-21 01:58:11.000000000 +0200
++++ src/shairport.h    2011-09-25 20:36:43.000000000 +0200
+@@ -11,6 +11,7 @@
+ #include <regex.h>
+ #include <sys/types.h>
+ #include <regex.h>
++#include "ao.h"
+ #define HWID_SIZE 6
+@@ -62,9 +63,11 @@
+ void shairport_exit(void);
+ int shairport_loop(void);
+ int shairport_is_running(void);
++void shairport_set_ao(struct AudioOutput *ao);
+ #ifdef __cplusplus
+ }
+ #endif /* __cplusplus */
+ #endif
++
diff --git a/tools/depends/target/libshairport/002_fix_install_header.patch b/tools/depends/target/libshairport/002_fix_install_header.patch
new file mode 100644 (file)
index 0000000..495b973
--- /dev/null
@@ -0,0 +1,12 @@
+--- src/Makefile.am.old        2011-09-23 23:14:39.000000000 +0200
++++ src/Makefile.am    2011-09-25 21:38:08.000000000 +0200
+@@ -1,7 +1,7 @@
+ lib_LTLIBRARIES=libshairport.la
+-library_includedir=$(includedir)
+-library_include_HEADERS = shairport.h
++library_includedir=$(includedir)/shairport
++library_include_HEADERS = shairport.h ao.h socketlib.h
+ libshairport_la_SOURCES=shairport.c hairtunes.c socketlib.c alac.c
+ libshairport_la_LDFLAGS=-dynamiclib
diff --git a/tools/depends/target/libshairport/003_fix_deadlock.patch b/tools/depends/target/libshairport/003_fix_deadlock.patch
new file mode 100644 (file)
index 0000000..c05970e
--- /dev/null
@@ -0,0 +1,10 @@
+--- src/hairtunes.c.orig       2011-09-25 21:58:08.000000000 +0200
++++ src/hairtunes.c    2011-09-25 21:58:12.000000000 +0200
+@@ -991,6 +991,7 @@
+ void hairtunes_cleanup(void)
+ {
++  pthread_cond_signal(&ab_buffer_ready);
+   clean_output();
+   clean_rtp();
+   clean_buffer();
diff --git a/tools/depends/target/libshairport/004_fix_bad_access.patch b/tools/depends/target/libshairport/004_fix_bad_access.patch
new file mode 100644 (file)
index 0000000..1976904
--- /dev/null
@@ -0,0 +1,22 @@
+--- src/hairtunes.c.orig       2011-09-25 23:26:56.000000000 +0200
++++ src/hairtunes.c    2011-09-25 23:29:27.000000000 +0200
+@@ -89,7 +89,6 @@
+ // maximal resampling shift - conservative
+ #define OUTFRAME_BYTES (4*(frame_size+3))
+-
+ alac_file *decoder_info;
+ #ifdef FANCY_RESAMPLING
+@@ -849,6 +848,11 @@
+             inbuf = buffer_get_frame();
+         } while (!inbuf && audio_running);
++        if(!audio_running)
++        {
++          return 0; //don't access inbuf if audio stopped
++        }
++
+ #ifdef FANCY_RESAMPLING
+         if (fancy_resampling) {
+               int i;
diff --git a/tools/depends/target/libshairport/005_fix_shutdown.patch b/tools/depends/target/libshairport/005_fix_shutdown.patch
new file mode 100644 (file)
index 0000000..32bd282
--- /dev/null
@@ -0,0 +1,10 @@
+--- src/shairport.c    2011-09-25 23:58:06.000000000 +0200
++++ src/shairport.c.new        2011-09-25 23:57:54.000000000 +0200
+@@ -368,6 +368,7 @@
+ void shairport_exit(void)
+ {
+   m_running = 0;
++  close(tServerSock);
+ }
+ int shairport_is_running(void)
diff --git a/tools/depends/target/libshairport/006_no_printf.patch b/tools/depends/target/libshairport/006_no_printf.patch
new file mode 100644 (file)
index 0000000..eb69d42
--- /dev/null
@@ -0,0 +1,843 @@
+--- src/alac.c 2011-08-21 00:06:21.000000000 +0200
++++ src/alac.c 2011-10-01 04:12:09.000000000 +0200
+@@ -804,7 +804,7 @@
+             }
+             else
+             {
+-                fprintf(stderr, "FIXME: unhandled predicition type: %i\n", prediction_type);
++                xprintf("FIXME: unhandled predicition type: %i\n", prediction_type);
+                 /* i think the only other prediction type (or perhaps this is just a
+                  * boolean?) runs adaptive fir twice.. like:
+                  * predictor_decompress_fir_adapt(predictor_error, tempout, ...)
+@@ -885,7 +885,7 @@
+         }
+         case 20:
+         case 32:
+-            fprintf(stderr, "FIXME: unimplemented sample size %i\n", alac->setinfo_sample_size);
++            xprintf("FIXME: unimplemented sample size %i\n", alac->setinfo_sample_size);
+             break;
+         default:
+             break;
+@@ -1004,7 +1004,7 @@
+             }
+             else
+             { /* see mono case */
+-                fprintf(stderr, "FIXME: unhandled predicition type: %i\n", prediction_type_a);
++                xprintf("FIXME: unhandled predicition type: %i\n", prediction_type_a);
+             }
+             /* channel 2 */
+@@ -1029,7 +1029,7 @@
+             }
+             else
+             {
+-                fprintf(stderr, "FIXME: unhandled predicition type: %i\n", prediction_type_b);
++                xprintf("FIXME: unhandled predicition type: %i\n", prediction_type_b);
+             }
+         }
+         else
+@@ -1106,7 +1106,7 @@
+         }
+         case 20:
+         case 32:
+-            fprintf(stderr, "FIXME: unimplemented sample size %i\n", alac->setinfo_sample_size);
++            xprintf("FIXME: unimplemented sample size %i\n", alac->setinfo_sample_size);
+             break;
+         default:
+             break;
+--- src/hairtunes.c    2011-10-01 17:45:08.000000000 +0200
++++ src/hairtunes.c    2011-10-01 17:42:07.000000000 +0200
+@@ -121,8 +121,8 @@
+ pthread_cond_t ab_buffer_ready;
+ static void die(char *why) {
+-    fprintf(stderr, "FATAL: %s\n", why);
+-    exit(1);
++    xprintf("FATAL: %s\n", why);
++    //exit(1);
+ }
+ static int hex2bin(unsigned char *buf, char *hex) {
+@@ -245,13 +245,13 @@
+             continue;
+         }
+         if (!strcmp(line, "exit\n")) {
+-            exit(0);
++            ;//exit(0);
+         }
+         if (!strcmp(line, "flush\n")) {
+             hairtunes_flush();
+         }
+     }
+-    fprintf(stderr, "bye!\n");
++    xprintf("bye!\n");
+     fflush(stderr);
+ #endif
+@@ -262,7 +262,7 @@
+ {
+   assert(f<=0);
+   if (debug)
+-      fprintf(stderr, "VOL: %lf\n", f);
++      xprintf("VOL: %lf\n", f);
+   volume = pow(10.0,0.05*f);
+   fix_volume = 65536.0 * volume;
+ }
+@@ -273,7 +273,7 @@
+   ab_resync();
+   pthread_mutex_unlock(&ab_mutex);
+   if (debug)
+-      fprintf(stderr, "FLUSH\n");
++      xprintf("FLUSH\n");
+ }
+ #ifdef HAIRTUNES_STANDALONE
+@@ -423,7 +423,7 @@
+     } else if (seq_order(ab_read, seqno)) {     // late but not yet played
+         abuf = audio_buffer + BUFIDX(seqno);
+     } else {    // too late.
+-        fprintf(stderr, "\nlate packet %04X (%04X:%04X)\n", seqno, ab_read, ab_write);
++        xprintf("\nlate packet %04X (%04X:%04X)\n", seqno, ab_read, ab_write);
+     }
+     buf_fill = ab_write - ab_read;
+     pthread_mutex_unlock(&ab_mutex);
+@@ -520,7 +520,7 @@
+     if (seq_order(last, first))
+         return;
+-    fprintf(stderr, "requesting resend on %d packets (port %d)\n", last-first+1, controlport);
++    xprintf("requesting resend on %d packets (port %d)\n", last-first+1, controlport);
+     char req[8];    // *not* a standard RTCP NACK
+     req[0] = 0x80;
+@@ -604,8 +604,8 @@
+         port += 3;
+     }
+-    printf("port: %d\n", port); // let our handler know where we end up listening
+-    printf("cport: %d\n", port+1);
++    xprintf("port: %d\n", port); // let our handler know where we end up listening
++    xprintf("cport: %d\n", port+1);
+     rtp_sockets[0] = sock;
+     rtp_sockets[1] = csock;
+@@ -708,7 +708,7 @@
+     bf_est_drift = biquad_filt(&bf_drift_lpf, CONTROL_B*(bf_est_err*CONTROL_A + err_deriv) + bf_est_drift);
+     if (debug)
+-        fprintf(stderr, "bf %d err %f drift %f desiring %f ed %f estd %f\r", fill, bf_est_err, bf_est_drift, desired_fill, err_deriv, err_deriv + CONTROL_A*bf_est_err);
++        xprintf("bf %d err %f drift %f desiring %f ed %f estd %f\r", fill, bf_est_err, bf_est_drift, desired_fill, err_deriv, err_deriv + CONTROL_A*bf_est_err);
+     bf_playback_rate = 1.0 + CONTROL_A*bf_est_err + bf_est_drift;
+     bf_last_err = bf_est_err;
+@@ -724,7 +724,7 @@
+     buf_fill = ab_write - ab_read;
+     if (buf_fill < 1 || !ab_synced || ab_buffering) {    // init or underrun. stop and wait
+         if (ab_synced)
+-          fprintf(stderr, "\nunderrun\n");
++          xprintf("\nunderrun\n");
+         ab_buffering = 1;
+         pthread_cond_wait(&ab_buffer_ready, &ab_mutex);
+@@ -736,7 +736,7 @@
+         return 0;
+     }
+     if (buf_fill >= BUFFER_FRAMES) {   // overrunning! uh-oh. restart at a sane distance
+-        fprintf(stderr, "\noverrun.\n");
++        xprintf("\noverrun.\n");
+         ab_read = ab_write - START_FILL;
+     }
+     read = ab_read;
+@@ -748,7 +748,7 @@
+     volatile abuf_t *curframe = audio_buffer + BUFIDX(read);
+     if (!curframe->ready) {
+-        fprintf(stderr, "\nmissing frame.\n");
++        xprintf("\nmissing frame.\n");
+         memset(curframe->data, 0, FRAME_BYTES);
+     }
+     curframe->ready = 0;
+@@ -775,13 +775,13 @@
+     if (stuff) {
+         if (stuff==1) {
+             if (debug)
+-                fprintf(stderr, "+++++++++\n");
++                xprintf("+++++++++\n");
+             // interpolate one sample
+             *outptr++ = dithered_vol(((long)inptr[-2] + (long)inptr[0]) >> 1);
+             *outptr++ = dithered_vol(((long)inptr[-1] + (long)inptr[1]) >> 1);
+         } else if (stuff==-1) {
+             if (debug)
+-                fprintf(stderr, "---------\n");
++                xprintf("---------\n");
+             inptr++;
+             inptr++;
+         }
+--- src/shairport.c    2011-10-01 17:45:08.000000000 +0200
++++ src/shairport.c    2011-10-01 17:41:04.000000000 +0200
+@@ -31,6 +31,27 @@
+ #include "shairport.h"
+ #include "hairtunes.h"
++static struct printfPtr g_printf={NULL};
++
++int xprintf(const char *format, ...)
++{
++  char dbg[2048];
++  va_list args;
++  va_start(args, format);
++  vsnprintf(dbg, sizeof(dbg), format, args);
++  va_end(args);
++  if(g_printf.extprintf)
++  {
++    g_printf.extprintf(dbg, sizeof(dbg));
++  }
++  else 
++  {
++    printf(dbg);
++  }
++
++  return 1;
++}
++
+ #ifndef TRUE
+ #define TRUE (-1)
+ #endif
+@@ -98,6 +119,11 @@
+ {
+  g_ao=*ao;
+ }
++
++void shairport_set_printf(struct printfPtr *funcPtr)
++{
++  g_printf = *funcPtr;
++}
+ #endif
+ #ifndef XBMC
+@@ -106,7 +132,7 @@
+ int shairport_main(int argc, char **argv)
+ #endif
+ {
+-  printf("initializing shairport\n");
++  xprintf("initializing shairport\n",NULL);
+   char tHWID_Hex[HWID_SIZE * 2 + 1];
+   char tKnownHwid[32];
+@@ -185,22 +211,22 @@
+     }    
+     else if(!strcmp(arg, "-h") || !strcmp(arg, "--help"))
+     {
+-      slog(LOG_INFO, "ShairPort version 0.05 C port - Airport Express emulator\n");
+-      slog(LOG_INFO, "Usage:\nshairport [OPTION...]\n\nOptions:\n");
+-      slog(LOG_INFO, "  -a, --apname=AirPort    Sets Airport name\n");
+-      slog(LOG_INFO, "  -p, --password=secret   Sets Password (not working)\n");
+-      slog(LOG_INFO, "  -o, --server_port=5000  Sets Port for Avahi/dns-sd\n");
+-      slog(LOG_INFO, "  -b, --buffer=282        Sets Number of frames to buffer before beginning playback\n");
+-      slog(LOG_INFO, "  -d                      Daemon mode\n");
+-      slog(LOG_INFO, "  -q, --quiet             Supresses all output.\n");
+-      slog(LOG_INFO, "  -v,-v2,-v3,-vv          Various debugging levels\n");
+-      slog(LOG_INFO, "\n");
++      xprintf("ShairPort version 0.05 C port - Airport Express emulator\n");
++      xprintf("Usage:\nshairport [OPTION...]\n\nOptions:\n");
++      xprintf("  -a, --apname=AirPort    Sets Airport name\n");
++      xprintf("  -p, --password=secret   Sets Password (not working)\n");
++      xprintf("  -o, --server_port=5000  Sets Port for Avahi/dns-sd\n");
++      xprintf("  -b, --buffer=282        Sets Number of frames to buffer before beginning playback\n");
++      xprintf("  -d                      Daemon mode\n");
++      xprintf("  -q, --quiet             Supresses all output.\n");
++      xprintf("  -v,-v2,-v3,-vv          Various debugging levels\n");
++      xprintf("\n");
+       return 0;
+     }    
+   }
+   if ( buffer_start_fill < 30 || buffer_start_fill > BUFFER_FRAMES ) { 
+-     fprintf(stderr, "buffer value must be > 30 and < %d\n", BUFFER_FRAMES);
++     xprintf("buffer value must be > 30 and < %d\n", BUFFER_FRAMES);
+      return(0);
+   }
+@@ -209,11 +235,11 @@
+     int tPid = fork();
+     if(tPid < 0)
+     {
+-      exit(1); // Error on fork
++      //exit(1); // Error on fork
+     }
+     else if(tPid > 0)
+     {
+-      exit(0);
++      //exit(0);
+     }
+     else
+     {
+@@ -254,10 +280,10 @@
+     sscanf(tHWID_Hex, "%02X%02X%02X%02X%02X%02X", &tHWID[0], &tHWID[1], &tHWID[2], &tHWID[3], &tHWID[4], &tHWID[5]);
+   }
+-  slog(LOG_INFO, "LogLevel: %d\n", kCurrentLogLevel);
+-  slog(LOG_INFO, "AirName: %s\n", tServerName);
+-  slog(LOG_INFO, "HWID: %.*s\n", HWID_SIZE, tHWID+1);
+-  slog(LOG_INFO, "HWID_Hex(%d): %s\n", strlen(tHWID_Hex), tHWID_Hex);
++  xprintf("LogLevel: %d\n", kCurrentLogLevel);
++  xprintf("AirName: %s\n", tServerName);
++  xprintf("HWID: %.*s\n", HWID_SIZE, tHWID+1);
++  xprintf("HWID_Hex(%d): %s\n", strlen(tHWID_Hex), tHWID_Hex);
+   if(tSimLevel >= 1)
+   {
+@@ -271,12 +297,12 @@
+ #ifndef XBMC
+     startAvahi(tHWID_Hex, tServerName, tPort);
+ #endif
+-    slog(LOG_DEBUG_V, "Starting connection server: specified server port: %d\n", tPort);
++    xprintf("Starting connection server: specified server port: %d\n", tPort);
+     tServerSock = setupListenServer(&tAddrInfo, tPort);
+     if(tServerSock < 0)
+     {
+       freeaddrinfo(tAddrInfo);
+-      slog(LOG_INFO, "Error setting up server socket on port %d, try specifying a different port\n", tPort);
++      xprintf("Error setting up server socket on port %d, try specifying a different port\n", tPort);
+       return 0;
+     }
+@@ -303,7 +329,7 @@
+     int readsock;
+-    slog(LOG_DEBUG_V, "Waiting for clients to connect\n");
++    xprintf("Waiting for clients to connect\n");
+     while(m_running)
+     {
+@@ -335,7 +361,7 @@
+         {
+           freeaddrinfo(tAddrInfo);
+           tAddrInfo = NULL;
+-          slog(LOG_DEBUG, "...Accepted Client Connection..\n");
++          xprintf("...Accepted Client Connection..\n");
+           close(tServerSock);
+           handleClient(tClientSock, tPassword, tHWID);
+           //close(tClientSock);
+@@ -343,11 +369,11 @@
+         }
+         else
+         {
+-          slog(LOG_DEBUG_VV, "Child now busy handling new client\n");
++          xprintf("Child now busy handling new client\n");
+           close(tClientSock);
+         }
+ #else
+-      slog(LOG_DEBUG, "...Accepted Client Connection..\n");
++      xprintf("...Accepted Client Connection..\n");
+       handleClient(tClientSock, tPassword, tHWID);
+ #endif
+       }
+@@ -357,7 +383,7 @@
+       }
+   }
+-  slog(LOG_DEBUG_VV, "Finished\n");
++  xprintf("Finished\n");
+   if(tAddrInfo != NULL)
+   {
+     freeaddrinfo(tAddrInfo);
+@@ -416,7 +442,7 @@
+ void handleClient(int pSock, char *pPassword, char *pHWADDR)
+ {
+-  slog(LOG_DEBUG_VV, "In Handle Client\n");
++  xprintf("In Handle Client\n");
+   fflush(stdout);
+   socklen_t len;
+@@ -435,7 +461,7 @@
+   // deal with both IPv4 and IPv6:
+   if (addr.ss_family == AF_INET) {
+-      slog(LOG_DEBUG_V, "Constructing ipv4 address\n");
++      xprintf("Constructing ipv4 address\n");
+       struct sockaddr_in *s = (struct sockaddr_in *)&addr;
+       port = ntohs(s->sin_port);
+       inet_ntop(AF_INET, &s->sin_addr, ipstr, sizeof ipstr);
+@@ -455,20 +481,20 @@
+       if(memcmp(&addr.bin[0], "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\x00\x00\xff\xff", 12) == 0)
+       {
+         // its ipv4...
+-        slog(LOG_DEBUG_V, "Constructing ipv4 from ipv6 address\n");
++        xprintf("Constructing ipv4 from ipv6 address\n");
+         memcpy(ipbin, &addr.bin[12], 4);
+         ipbinlen = 4;
+       }
+       else
+       {
+-        slog(LOG_DEBUG_V, "Constructing ipv6 address\n");
++        xprintf("Constructing ipv6 address\n");
+         memcpy(ipbin, &s->sin6_addr, 16);
+         ipbinlen = 16;
+       }
+   }
+-  slog(LOG_DEBUG_V, "Peer IP address: %s\n", ipstr);
+-  slog(LOG_DEBUG_V, "Peer port      : %d\n", port);
++  xprintf("Peer IP address: %s\n", ipstr);
++  xprintf("Peer port      : %d\n", port);
+   int tMoreDataNeeded = 1;
+   struct keyring     tKeys;
+@@ -489,16 +515,16 @@
+       tError = readDataFromClient(pSock, &(tConn.recv));
+       if(!tError && strlen(tConn.recv.data) > 0)
+       {
+-        slog(LOG_DEBUG_VV, "Finished Reading some data from client\n");
++        xprintf("Finished Reading some data from client\n");
+         // parse client request
+         tMoreDataNeeded = parseMessage(&tConn, ipbin, ipbinlen, pHWADDR);
+         if(1 == tMoreDataNeeded)
+         {
+-          slog(LOG_DEBUG_VV, "\n\nNeed to read more data\n");
++          xprintf("\n\nNeed to read more data\n");
+         }
+         else if(-1 == tMoreDataNeeded) // Forked process down below ended.
+         {
+-          slog(LOG_DEBUG_V, "Forked Process ended...cleaning up\n");
++          xprintf("Forked Process ended...cleaning up\n");
+           cleanup(&tConn);
+           // pSock was already closed
+           return;
+@@ -507,13 +533,13 @@
+       }
+       else
+       {
+-        slog(LOG_DEBUG, "Error reading from socket, closing client\n");
++        xprintf("Error reading from socket, closing client\n");
+         // Error reading data....quit.
+         cleanup(&tConn);
+         return;
+       }
+     }
+-    slog(LOG_DEBUG_VV, "Writing: %d chars to socket\n", tConn.resp.current);
++    xprintf("Writing: %d chars to socket\n", tConn.resp.current);
+     //tConn->resp.data[tConn->resp.current-1] = '\0';
+     writeDataToClient(pSock, &(tConn.resp));
+    // Finished reading one message...
+@@ -526,9 +552,9 @@
+ void writeDataToClient(int pSock, struct shairbuffer *pResponse)
+ {
+-  slog(LOG_DEBUG_VV, "\n----Beg Send Response Header----\n%.*s\n", pResponse->current, pResponse->data);
++  xprintf("\n----Beg Send Response Header----\n%.*s\n", pResponse->current, pResponse->data);
+   send(pSock, pResponse->data, pResponse->current,0);
+-  slog(LOG_DEBUG_VV, "----Send Response Header----\n");
++  xprintf("----Send Response Header----\n");
+ }
+ int readDataFromClient(int pSock, struct shairbuffer *pClientBuffer)
+@@ -541,7 +567,7 @@
+   while(tRetval > 0 && tEnd < 0)
+   {
+      // Read from socket until \n\n, \r\n\r\n, or \r\r is found
+-      slog(LOG_DEBUG_V, "Waiting To Read...\n");
++      xprintf("Waiting To Read...\n");
+       fflush(stdout);
+       tRetval = read(pSock, tReadBuf, MAX_SIZE);
+       // if new buffer contains the end of request string, only copy partial buffer?
+@@ -552,40 +578,40 @@
+         {
+           pClientBuffer->marker = tEnd+1; // Marks start of content
+         }
+-        slog(SOCKET_LOG_LEVEL, "Found end of http request at: %d\n", tEnd);
++        xprintf("Found end of http request at: %d\n", tEnd);
+         fflush(stdout);        
+       }
+       else
+       {
+         tEnd = MAX_SIZE;
+-        slog(SOCKET_LOG_LEVEL, "Read %d of data so far\n%s\n", tRetval, tReadBuf);
++        xprintf("Read %d of data so far\n%s\n", tRetval, tReadBuf);
+         fflush(stdout);
+       }
+       if(tRetval > 0)
+       {
+         // Copy read data into tReceive;
+-        slog(SOCKET_LOG_LEVEL, "Read %d data, using %d of it\n", tRetval, tEnd);
++        xprintf("Read %d data, using %d of it\n", tRetval, tEnd);
+         addNToShairBuffer(pClientBuffer, tReadBuf, tRetval);
+-        slog(LOG_DEBUG_VV, "Finished copying data\n");
++        xprintf("Finished copying data\n");
+       }
+       else
+       {
+-        slog(LOG_DEBUG, "Error reading data from socket, got: %d bytes", tRetval);
++        xprintf("Error reading data from socket, got: %d bytes", tRetval);
+         return tRetval;
+       }
+   }
+   if(tEnd + 1 != tRetval)
+   {
+-    slog(SOCKET_LOG_LEVEL, "Read more data after end of http request. %d instead of %d\n", tRetval, tEnd+1);
++    xprintf("Read more data after end of http request. %d instead of %d\n", tRetval, tEnd+1);
+   }
+-  slog(SOCKET_LOG_LEVEL, "Finished Reading Data:\n%s\nEndOfData\n", pClientBuffer->data);
++  xprintf("Finished Reading Data:\n%s\nEndOfData\n", pClientBuffer->data);
+   fflush(stdout);
+   return 0;
+ }
+ char *getFromBuffer(char *pBufferPtr, const char *pField, int pLenAfterField, int *pReturnSize, char *pDelims)
+ {
+-  slog(LOG_DEBUG_V, "GettingFromBuffer: %s\n", pField);
++  xprintf("GettingFromBuffer: %s\n", pField);
+   char* tFound = strstr(pBufferPtr, pField);
+   int tSize = 0;
+   if(tFound != NULL)
+@@ -606,7 +632,7 @@
+     }
+     
+     tSize = (int) (tShortest - tFound);
+-    slog(LOG_DEBUG_VV, "Found %.*s  length: %d\n", tSize, tFound, tSize);
++    xprintf("Found %.*s  length: %d\n", tSize, tFound, tSize);
+     if(pReturnSize != NULL)
+     {
+       *pReturnSize = tSize;
+@@ -614,7 +640,7 @@
+   }
+   else
+   {
+-    slog(LOG_DEBUG_V, "Not Found\n");
++    xprintf("Not Found\n");
+   }
+   return tFound;
+ }
+@@ -648,10 +674,10 @@
+   {
+     char tTrim[tFoundSize + 2];
+     getTrimmed(tFound, tFoundSize, TRUE, TRUE, tTrim);
+-    slog(LOG_DEBUG_VV, "HeaderChallenge:  [%s] len: %d  sizeFound: %d\n", tTrim, strlen(tTrim), tFoundSize);
++    xprintf("HeaderChallenge:  [%s] len: %d  sizeFound: %d\n", tTrim, strlen(tTrim), tFoundSize);
+     int tChallengeDecodeSize = 16;
+     char *tChallenge = decode_base64((unsigned char *)tTrim, tFoundSize, &tChallengeDecodeSize);
+-    slog(LOG_DEBUG_VV, "Challenge Decode size: %d  expected 16\n", tChallengeDecodeSize);
++    xprintf("Challenge Decode size: %d  expected 16\n", tChallengeDecodeSize);
+     int tCurSize = 0;
+     unsigned char tChalResp[38];
+@@ -673,7 +699,7 @@
+     }
+     char *tTmp = encode_base64((unsigned char *)tChalResp, tCurSize);
+-    slog(LOG_DEBUG_VV, "Full sig: %s\n", tTmp);
++    xprintf("Full sig: %s\n", tTmp);
+     free(tTmp);
+     // RSA Encrypt
+@@ -722,10 +748,10 @@
+     {
+       if(isLogEnabledFor(HEADER_LOG_LEVEL))
+       {
+-        slog(HEADER_LOG_LEVEL, "Content-Length: %s value -> %d\n", tContent, tContentSize);
++        xprintf("Content-Length: %s value -> %d\n", tContent, tContentSize);
+         if(pConn->recv.marker != 0)
+         {
+-          slog(HEADER_LOG_LEVEL, "ContentPtr has %d, but needs %d\n", 
++          xprintf("ContentPtr has %d, but needs %d\n", 
+                   strlen(pConn->recv.data+pConn->recv.marker), tContentSize);
+         }
+       }
+@@ -735,7 +761,7 @@
+   }
+   else
+   {
+-    slog(LOG_DEBUG_VV, "No content, header only\n");
++    xprintf("No content, header only\n");
+   }
+   // "Creates" a new Response Header for our response message
+@@ -748,7 +774,7 @@
+     {
+       tLen = 20;
+     }
+-    slog(LOG_INFO, "********** RECV %.*s **********\n", tLen, pConn->recv.data);
++    xprintf("********** RECV %.*s **********\n", tLen, pConn->recv.data);
+   }
+   if(pConn->password != NULL)
+@@ -758,7 +784,7 @@
+   if(buildAppleResponse(pConn, pIpBin, pIpBinLen, pHWID)) // need to free sig
+   {
+-    slog(LOG_DEBUG_V, "Added AppleResponse to Apple-Challenge request\n");
++    xprintf("Added AppleResponse to Apple-Challenge request\n");
+   }
+   // Find option, then based on option, do different actions.
+@@ -778,14 +804,14 @@
+       int tKeySize = 0;
+       char tEncodedAesIV[tSize + 2];
+       getTrimmed(tHeaderVal, tSize, TRUE, TRUE, tEncodedAesIV);
+-      slog(LOG_DEBUG_VV, "AESIV: [%.*s] Size: %d  Strlen: %d\n", tSize, tEncodedAesIV, tSize, strlen(tEncodedAesIV));
++      xprintf("AESIV: [%.*s] Size: %d  Strlen: %d\n", tSize, tEncodedAesIV, tSize, strlen(tEncodedAesIV));
+       char *tDecodedIV =  decode_base64((unsigned char*) tEncodedAesIV, tSize, &tSize);
+       // grab the key, copy it out of the receive buffer
+       tHeaderVal = getFromContent(tContent, "a=rsaaeskey", &tKeySize);
+       char tEncodedAesKey[tKeySize + 2]; // +1 for nl, +1 for \0
+       getTrimmed(tHeaderVal, tKeySize, TRUE, TRUE, tEncodedAesKey);
+-      slog(LOG_DEBUG_VV, "AES KEY: [%s] Size: %d  Strlen: %d\n", tEncodedAesKey, tKeySize, strlen(tEncodedAesKey));
++      xprintf("AES KEY: [%s] Size: %d  Strlen: %d\n", tEncodedAesKey, tKeySize, strlen(tEncodedAesKey));
+       // remove base64 coding from key
+       char *tDecodedAesKey = decode_base64((unsigned char*) tEncodedAesKey,
+                               tKeySize, &tKeySize);  // Need to free DecodedAesKey
+@@ -794,7 +820,7 @@
+       int tFmtpSize = 0;
+       char *tFmtp = getFromContent(tContent, "a=fmtp", &tFmtpSize);  // Don't need to free
+       tFmtp = getTrimmedMalloc(tFmtp, tFmtpSize, TRUE, FALSE); // will need to free
+-      slog(LOG_DEBUG_VV, "Format: %s\n", tFmtp);
++      xprintf("Format: %s\n", tFmtp);
+       RSA *rsa = loadKey();
+       // Decrypt the binary aes key
+@@ -803,11 +829,11 @@
+       if(RSA_private_decrypt(tKeySize, (unsigned char *)tDecodedAesKey, 
+       (unsigned char*) tDecryptedKey, rsa, RSA_PKCS1_OAEP_PADDING) >= 0)
+       {
+-        slog(LOG_DEBUG, "Decrypted AES key from RSA Successfully\n");
++        xprintf("Decrypted AES key from RSA Successfully\n");
+       }
+       else
+       {
+-        slog(LOG_INFO, "Error Decrypting AES key from RSA\n");
++        xprintf("Error Decrypting AES key from RSA\n");
+       }
+       free(tDecodedAesKey);
+       RSA_free(rsa);
+@@ -823,13 +849,13 @@
+ //    struct comms *tComms = pConn->hairtunes;
+ //   if (! (pipe(tComms->in) == 0 && pipe(tComms->out) == 0))
+ //    {
+-//      slog(LOG_INFO, "Error setting up hairtunes communications...some things probably wont work very well.\n");
++//      xprintf("Error setting up hairtunes communications...some things probably wont work very well.\n");
+ //    }
+     
+     // Setup fork
+     char tPort[8] = "6000";  // get this from dup()'d stdout of child pid
+-    printf("******** SETUP!!!!!\n");
++    xprintf("******** SETUP!!!!!\n",NULL);
+ #ifndef XBMC
+     int tPid = fork();
+     if(tPid == 0)
+@@ -845,11 +871,11 @@
+       tFound = getFromSetup(pConn->recv.data, "timing_port", &tSize);
+       getTrimmed(tFound, tSize, 1, 0, tTPortStr);
+-      slog(LOG_DEBUG_VV, "converting %s and %s from str->int\n", tCPortStr, tTPortStr);
++      xprintf("converting %s and %s from str->int\n", tCPortStr, tTPortStr);
+       int tControlport = atoi(tCPortStr);
+       int tTimingport = atoi(tTPortStr);
+-      slog(LOG_DEBUG_V, "Got %d for CPort and %d for TPort\n", tControlport, tTimingport);
++      xprintf("Got %d for CPort and %d for TPort\n", tControlport, tTimingport);
+       char *tRtp = NULL;
+       char *tPipe = NULL;
+       char *tAoDriver = NULL;
+@@ -884,7 +910,7 @@
+                       tDataport, tRtp, tPipe, tAoDriver, tAoDeviceName, tAoDeviceId);
+ #ifndef XBMC
+       // Quit when finished.
+-      slog(LOG_DEBUG, "Returned from hairtunes init....returning -1, should close out this whole side of the fork\n");
++      xprintf("Returned from hairtunes init....returning -1, should close out this whole side of the fork\n");
+       return -1;
+     }
+     else if(tPid >0)
+@@ -897,7 +923,7 @@
+       int tRead = read(tComms->out[0], tFromHairtunes, 80);
+       if(tRead <= 0)
+       {
+-        slog(LOG_INFO, "Error reading port from hairtunes function, assuming default port: %d\n", tPort);
++        xprintf("Error reading port from hairtunes function, assuming default port: %d\n", tPort);
+       }
+       else
+       {
+@@ -909,7 +935,7 @@
+         }
+         else
+         {
+-          slog(LOG_INFO, "Read %d bytes, Error translating %s into a port\n", tRead, tFromHairtunes);
++          xprintf("Read %d bytes, Error translating %s into a port\n", tRead, tFromHairtunes);
+         }
+       }
+@@ -930,7 +956,7 @@
+     }
+     else
+     {
+-      slog(LOG_INFO, "Error forking process....dere' be errors round here.\n");
++      xprintf("Error forking process....dere' be errors round here.\n");
+       return -1;
+     }
+ #endif
+@@ -942,7 +968,7 @@
+     propogateCSeq(pConn);
+ #ifndef XBMC
+     close(pConn->hairtunes->in[1]);
+-    slog(LOG_DEBUG, "Tearing down connection, closing pipes\n");
++    xprintf("Tearing down connection, closing pipes\n");
+ #else
+     hairtunes_cleanup();
+ #endif
+@@ -964,7 +990,7 @@
+     propogateCSeq(pConn);
+     int tSize = 0;
+     char *tVol = getFromHeader(pConn->recv.data, "volume", &tSize);
+-    slog(LOG_DEBUG_VV, "About to write [vol: %.*s] data to hairtunes\n", tSize, tVol);
++    xprintf("About to write [vol: %.*s] data to hairtunes\n", tSize, tVol);
+     // TBD VOLUME
+ #ifndef XBMC
+     write(pConn->hairtunes->in[1], "vol: ", 5);
+@@ -973,11 +999,11 @@
+ #else
+     hairtunes_setvolume(atof(tVol));
+ #endif
+-    slog(LOG_DEBUG_VV, "Finished writing data write data to hairtunes\n");
++    xprintf("Finished writing data write data to hairtunes\n");
+   }
+   else
+   {
+-    slog(LOG_DEBUG, "\n\nUn-Handled recv: %s\n", pConn->recv.data);
++    xprintf("\n\nUn-Handled recv: %s\n", pConn->recv.data);
+     propogateCSeq(pConn);
+   }
+   addToShairBuffer(&(pConn->resp), "\r\n");
+@@ -1056,7 +1082,7 @@
+     char tName[100 + HWID_SIZE + 3];
+     if(strlen(pServerName) > tMaxServerName)
+     {
+-      slog(LOG_INFO,"Hey dog, we see you like long server names, "
++      xprintf("Hey dog, we see you like long server names, "
+               "so we put a strncat in our command so we don't buffer overflow, while you listen to your flow.\n"
+               "We just used the first %d characters.  Pick something shorter if you want\n", tMaxServerName);
+     }
+@@ -1067,7 +1093,7 @@
+     strcat(tName, pHWStr);
+     strcat(tName, "@");
+     strncat(tName, pServerName, tMaxServerName);
+-    slog(AVAHI_LOG_LEVEL, "Avahi/DNS-SD Name: %s\n", tName);
++    xprintf("Avahi/DNS-SD Name: %s\n", tName);
+     
+     execlp("avahi-publish-service", "avahi-publish-service", tName,
+          "_raop._tcp", tPort, "tp=UDP","sm=false","sv=false","ek=1","et=0,1",
+@@ -1079,12 +1105,12 @@
+             perror("error");
+     }
+-    slog(LOG_INFO, "Bad error... couldn't find or failed to run: avahi-publish-service OR dns-sd\n");
+-    exit(1);
++    xprintf("Bad error... couldn't find or failed to run: avahi-publish-service OR dns-sd\n");
++    //exit(1);
+   }
+   else
+   {
+-    slog(LOG_DEBUG_VV, "Avahi/DNS-SD started on PID: %d\n", tPid);
++    xprintf("Avahi/DNS-SD started on PID: %d\n", tPid);
+   }
+   return tPid;
+ }
+@@ -1092,7 +1118,7 @@
+ void printBufferInfo(struct shairbuffer *pBuf, int pLevel)
+ {
+-  slog(pLevel, "Buffer: [%s]  size: %d  maxchars:%d\n", pBuf->data, pBuf->current, pBuf->maxsize/sizeof(char));
++  xprintf("Buffer: [%s]  size: %d  maxchars:%d\n", pBuf->data, pBuf->current, pBuf->maxsize/sizeof(char));
+ }
+ int getAvailChars(struct shairbuffer *pBuf)
+@@ -1173,7 +1199,8 @@
+   {
+     va_list argp;
+     va_start(argp, pFormat);
+-    vprintf(pFormat, argp);
++    xprintf(pFormat, argp);
++    //vprintf(pFormat, argp);
+     va_end(argp);
+   }
+   //#endif
+@@ -1227,9 +1254,9 @@
+ {
+   if(pBuf->data != NULL)
+   {
+-    slog(LOG_DEBUG_VV, "Hrm, buffer wasn't cleaned up....trying to free\n");
++    xprintf("Hrm, buffer wasn't cleaned up....trying to free\n");
+     free(pBuf->data);
+-    slog(LOG_DEBUG_VV, "Free didn't seem to seg fault....huzzah\n");
++    xprintf("Free didn't seem to seg fault....huzzah\n");
+   }
+   pBuf->current = 0;
+   pBuf->marker = 0;
+@@ -1287,6 +1314,6 @@
+   BIO *tBio = BIO_new_mem_buf(AIRPORT_PRIVATE_KEY, -1);
+   RSA *rsa = PEM_read_bio_RSAPrivateKey(tBio, NULL, NULL, NULL); //NULL, NULL, NULL);
+   BIO_free(tBio);
+-  slog(RSA_LOG_LEVEL, "RSA Key: %d\n", RSA_check_key(rsa));
++  xprintf("RSA Key: %d\n", RSA_check_key(rsa));
+   return rsa;
+ }
+--- src/shairport.h    2011-10-01 17:45:08.000000000 +0200
++++ src/shairport.h    2011-10-01 17:19:43.000000000 +0200
+@@ -59,11 +59,17 @@
+ {
+ #endif /* __cplusplus */
++struct printfPtr
++{
++  int (*extprintf)(const char* msg, size_t msgSize);
++};
++
+ int shairport_main(int argc, char **argv);
+ void shairport_exit(void);
+ int shairport_loop(void);
+ int shairport_is_running(void);
+ void shairport_set_ao(struct AudioOutput *ao);
++void shairport_set_printf(struct printfPtr *funcPtr);
+ #ifdef __cplusplus
+ }
+--- src/socketlib.c    2011-09-23 22:00:48.000000000 +0200
++++ src/socketlib.c    2011-10-01 17:42:39.000000000 +0200
+@@ -82,7 +82,7 @@
+       delay(RETRY_DELAY, &tRes);
+     }
+   }
+-  printf("%d Retry attempts exceeded\n", RETRY_COUNT);
++  xprintf("%d Retry attempts exceeded\n", RETRY_COUNT);
+   return ERROR;
+ }
+@@ -102,7 +102,7 @@
+   tError = getaddrinfo(pHostname, pService, &hints, pAddrInfo);
+   if(tError != 0)
+   {
+-    printf("Error getting address info\n");
++    xprintf("Error getting address info\n");
+   }
+   return tError;
+ }
+@@ -200,7 +200,7 @@
+   else
+   {
+     // Invalid encoded data, no other cases are possible.
+-    printf("Unrecoverable error....base64 values are incorrectly encoded\n");
++    xprintf("Unrecoverable error....base64 values are incorrectly encoded\n");
+     return pSize;
+   }
+ }
+@@ -226,7 +226,7 @@
+     memset(input, 0, length);
+     memcpy(input, pInput, pLength);
+     memset(input+pLength, '=', length-pLength);
+-    printf("Fixed value: [%.*s]\n", length, input);
++    xprintf("Fixed value: [%.*s]\n", length, input);
+   }
+   char *buffer = (char *)malloc(length);
+   memset(buffer, 0, length);
diff --git a/tools/depends/target/libshairport/007_fix_syslog_defines.patch b/tools/depends/target/libshairport/007_fix_syslog_defines.patch
new file mode 100644 (file)
index 0000000..4d9b834
--- /dev/null
@@ -0,0 +1,24 @@
+--- src/shairport.h    2011-10-01 04:09:16.000000000 +0200
++++ src/shairport.h    2011-11-07 18:05:05.000000000 +0100
+@@ -16,10 +16,17 @@
+ #define HWID_SIZE 6
+ #define SHAIRPORT_LOG 1
+-#define LOG_INFO     1
+-#define LOG_DEBUG    5
+-#define LOG_DEBUG_V  6
+-#define LOG_DEBUG_VV 7
++
++#ifndef LOG_INFO
++#define LOG_INFO     5
++#endif
++
++#ifndef LOG_DEBUG
++#define LOG_DEBUG    6
++#endif
++
++#define LOG_DEBUG_V  7
++#define LOG_DEBUG_VV 8
+ struct shairbuffer
+ {
diff --git a/tools/depends/target/libshairport/008-add-missing-libs.patch b/tools/depends/target/libshairport/008-add-missing-libs.patch
new file mode 100644 (file)
index 0000000..6efd302
--- /dev/null
@@ -0,0 +1,21 @@
+--- configure.in-org   2011-11-08 11:53:42.802419355 -0500
++++ configure.in       2011-11-08 11:55:38.082419413 -0500
+@@ -11,8 +11,9 @@ AC_PROG_LIBTOOL
+ # Checks for libraries.
+ #AC_CHECK_LIB([c],   [main])
+-#AC_CHECK_LIB([m],   [main])
++AC_CHECK_LIB([m],   [main])
+ AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR($missing_library))
++AC_CHECK_LIB([crypto], [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([pthread], [main],, AC_MSG_ERROR($missing_library))
+ OUTPUT_FILES="Makefile"
+@@ -21,4 +22,4 @@ LIBDIR=$PREFIX
+ AC_CONFIG_FILES([${OUTPUT_FILES}])
+ AC_OUTPUT(Makefile src/Makefile)
+-AC_OUTPUT
+\ No newline at end of file
++AC_OUTPUT
+
diff --git a/tools/depends/target/libshairport/009_fix_ipv6.patch b/tools/depends/target/libshairport/009_fix_ipv6.patch
new file mode 100644 (file)
index 0000000..01ff026
--- /dev/null
@@ -0,0 +1,22 @@
+--- src/socketlib.c    2012-01-04 20:41:05.000000000 +0100
++++ src/socketlib.c    2012-01-04 20:35:53.000000000 +0100
+@@ -48,7 +48,7 @@
+   if((tSock==-1) && (pAddrInfo->ai_family == AF_INET6) && (errno == EAFNOSUPPORT))
+   {
+     //Fallback to ipv4
+-    perror("Failed to create ipv6 socket. Trying ipv4");
++    xprintf("Failed to create ipv6 socket. Trying ipv4");
+     pAddrInfo->ai_family = AF_INET;
+     tSock = socket(pAddrInfo->ai_family, pAddrInfo->ai_socktype, 0);
+   }
+@@ -158,8 +158,8 @@
+     sprintf(tService, "%d", pPort); // copies port to string
+     int tFamily = AF_INET;
+     #ifdef AF_INET6
+-    //printf("Listening on IPv6 Socket\n");
+-    //tFamily = AF_INET6;
++    xprintf("Listening on IPv6 Socket\n");
++    tFamily = AF_INET6;
+     #else
+     //printf("Listening on IPv4 Socket");
+     #endif
diff --git a/tools/depends/target/libshairport/010_handle_metadata.patch b/tools/depends/target/libshairport/010_handle_metadata.patch
new file mode 100644 (file)
index 0000000..a48782e
--- /dev/null
@@ -0,0 +1,154 @@
+diff -ruP src/ao.h libshairport.new/src/ao.h
+--- src/ao.h   2012-05-07 22:26:53.000000000 +0200
++++ src/ao.h   2012-05-08 18:46:42.000000000 +0200
+@@ -152,5 +152,7 @@
+       /* -- Device Setup/Playback/Teardown -- */                                                                                                                                                                 
+       int (*ao_append_option)(ao_option **, const char *, const char *);                                                                                                                                         
+       void (*ao_free_options)(ao_option *);                                                                                                                                                                      
+-      char* (*ao_get_option)(ao_option *, const char* );                                                                                                                                                         
++      char* (*ao_get_option)(ao_option *, const char* );
++      void (*ao_set_metadata)(const char *buffer, unsigned int size);                                                                                                                                                         
++      void (*ao_set_metadata_coverart)(const char *buffer, unsigned int size);
+   }; 
+diff -ruP src/hairtunes.c src/hairtunes.c
+--- src/hairtunes.c    2012-05-07 22:26:53.000000000 +0200
++++ src/hairtunes.c    2012-05-08 18:45:51.000000000 +0200
+@@ -267,6 +267,16 @@
+   fix_volume = 65536.0 * volume;
+ }
++void hairtunes_set_metadata(const char *buffer, unsigned int size)
++{
++  g_ao.ao_set_metadata(buffer, size);
++}
++
++void hairtunes_set_metadata_coverart(const char *buffer, unsigned int size)
++{
++  g_ao.ao_set_metadata_coverart(buffer, size);
++}
++
+ void hairtunes_flush(void)
+ {
+   pthread_mutex_lock(&ab_mutex);
+diff -ruP src/hairtunes.h src/hairtunes.h
+--- src/hairtunes.h    2011-08-21 00:06:21.000000000 +0200
++++ src/hairtunes.h    2012-05-08 18:46:00.000000000 +0200
+@@ -4,6 +4,8 @@
+ int hairtunes_init(char *pAeskey, char *pAesiv, char *pFmtpstr, int pCtrlPort, int pTimingPort,
+          int pDataPort, char *pRtpHost, char*pPipeName, char *pLibaoDriver, char *pLibaoDeviceName, char *pLibaoDeviceId);
+ void hairtunes_setvolume(float vol);
++void hairtunes_set_metadata(const char *buffer, unsigned int size);
++void hairtunes_set_metadata_coverart(const char *buffer, unsigned int size);
+ void hairtunes_flush(void);
+ void hairtunes_cleanup(void);
+diff -ruP src/shairport.c src/shairport.c
+--- src/shairport.c    2012-05-07 22:26:53.000000000 +0200
++++ src/shairport.c    2012-05-08 18:45:30.000000000 +0200
+@@ -513,7 +513,8 @@
+     while(1 == tMoreDataNeeded)
+     {
+       tError = readDataFromClient(pSock, &(tConn.recv));
+-      if(!tError && strlen(tConn.recv.data) > 0)
++      //if(!tError && strlen(tConn.recv.data) > 0)
++      if(!tError && tConn.recv.current > 0)
+       {
+         xprintf("Finished Reading some data from client\n");
+         // parse client request
+@@ -632,7 +633,7 @@
+     }
+     
+     tSize = (int) (tShortest - tFound);
+-    xprintf("Found %.*s  length: %d\n", tSize, tFound, tSize);
++    xprintf("Found %s  length: %d\n",tFound, tSize);
+     if(pReturnSize != NULL)
+     {
+       *pReturnSize = tSize;
+@@ -744,7 +745,7 @@
+   if(tContent != NULL)
+   {
+     int tContentSize = atoi(tContent);
+-    if(pConn->recv.marker == 0 || strlen(pConn->recv.data+pConn->recv.marker) != tContentSize)
++    if(pConn->recv.marker == 0 || pConn->recv.current-pConn->recv.marker != tContentSize)
+     {
+       if(isLogEnabledFor(HEADER_LOG_LEVEL))
+       {
+@@ -752,7 +753,7 @@
+         if(pConn->recv.marker != 0)
+         {
+           xprintf("ContentPtr has %d, but needs %d\n", 
+-                  strlen(pConn->recv.data+pConn->recv.marker), tContentSize);
++                  (pConn->recv.current-pConn->recv.marker), tContentSize);
+         }
+       }
+       // check if value in tContent > 2nd read from client.
+@@ -989,15 +990,67 @@
+   {
+     propogateCSeq(pConn);
+     int tSize = 0;
++    char *buffer = NULL;
++    char *contentType = getFromHeader(pConn->recv.data, "Content-Type", &tSize);
++    char *tContent = getFromHeader(pConn->recv.data, "Content-Length", NULL);
++    int iContentSize = 0;
++    int isJpg = 0;
++    
++    if(tContent != NULL)
++    {
++      iContentSize = atoi(tContent);
++    }
++
++    if( tSize > 1 && 
++        (strncmp(contentType, "application/x-dmap-tagged", tSize) == 0) ||
++        (strncmp(contentType, "image/jpeg", tSize) == 0)                 )
++    {
++      if( (pConn->recv.current - pConn->recv.marker) == iContentSize && pConn->recv.marker != 0)
++      {
++        if(strncmp(contentType, "image/jpeg", tSize) == 0)
++        {
++          isJpg = 1;
++        }
++        buffer = (char *)malloc(iContentSize * sizeof(char));
++        memcpy(buffer, pConn->recv.data + pConn->recv.marker, iContentSize);                                                                                                                                     
++      }
++      else
++      {
++        iContentSize = 0;
++      }
++    }
++    else
++    {
++      iContentSize = 0;
++    }
+     char *tVol = getFromHeader(pConn->recv.data, "volume", &tSize);
+-    xprintf("About to write [vol: %.*s] data to hairtunes\n", tSize, tVol);
++    if( tVol)
++    {
++      xprintf("About to write [vol: %.*s] data to hairtunes\n", tSize, tVol);
++    }
+     // TBD VOLUME
+ #ifndef XBMC
+     write(pConn->hairtunes->in[1], "vol: ", 5);
+     write(pConn->hairtunes->in[1], tVol, tSize);
+     write(pConn->hairtunes->in[1], "\n", 1);
+ #else
+-    hairtunes_setvolume(atof(tVol));
++    if(tVol)
++    {
++      hairtunes_setvolume(atof(tVol));
++    }
++    
++    if(iContentSize)
++    {
++      if(isJpg)
++      {
++        hairtunes_set_metadata_coverart(buffer, iContentSize);      
++      }
++      else
++      {
++        hairtunes_set_metadata(buffer, iContentSize);
++      }
++      free(buffer);
++    }
+ #endif
+     xprintf("Finished writing data write data to hairtunes\n");
+   }
diff --git a/tools/depends/target/libshairport/011_fix_ipv4_fallback.patch b/tools/depends/target/libshairport/011_fix_ipv4_fallback.patch
new file mode 100644 (file)
index 0000000..2c813f2
--- /dev/null
@@ -0,0 +1,10 @@
+--- src/socketlib.c    2012-07-14 22:49:30.000000000 +0200
++++ src/socketlib.c    2012-10-08 21:55:51.000000000 +0200
+@@ -118,6 +118,7 @@
+   int tEnable = 1;
+   setsockopt(tSock, SOL_SOCKET, SO_REUSEADDR, &tEnable, sizeof (tEnable));
++  server_addr->ai_addr->sa_family = server_addr->ai_family; // ensure that server_addr has same famliy than the socket
+   if (bind(tSock, server_addr->ai_addr, server_addr->ai_addrlen) < 0)
+   {
+     close(tSock);
diff --git a/tools/depends/target/libshairport/Makefile b/tools/depends/target/libshairport/Makefile
new file mode 100644 (file)
index 0000000..bb553bf
--- /dev/null
@@ -0,0 +1,60 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include 001_add_ao.patch 002_fix_install_header.patch 003_fix_deadlock.patch \
+      004_fix_bad_access.patch 005_fix_shutdown.patch 006_no_printf.patch \
+      007_fix_syslog_defines.patch 008-add-missing-libs.patch \
+      009_fix_ipv6.patch 010_handle_metadata.patch android.patch Makefile
+
+# lib name, version
+LIBNAME=libshairport
+VERSION=1.2.0.20310_lib
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX)
+
+
+LIBDYLIB=$(PLATFORM)/src/.libs/libshairport.so.0.0.0
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p0 < ../001_add_ao.patch
+       cd $(PLATFORM); patch -p0 < ../002_fix_install_header.patch
+       cd $(PLATFORM); patch -p0 < ../003_fix_deadlock.patch
+       cd $(PLATFORM); patch -p0 < ../004_fix_bad_access.patch
+       cd $(PLATFORM); patch -p0 < ../005_fix_shutdown.patch
+       cd $(PLATFORM); patch -p0 < ../006_no_printf.patch
+       cd $(PLATFORM); patch -p0 < ../007_fix_syslog_defines.patch
+       cd $(PLATFORM); patch -p0 < ../008-add-missing-libs.patch
+       cd $(PLATFORM); patch -p0 < ../009_fix_ipv6.patch
+       cd $(PLATFORM); patch -p0 < ../010_handle_metadata.patch
+       cd $(PLATFORM); patch -p0 < ../011_fix_ipv4_fallback.patch
+       cd $(PLATFORM); patch -p0 < ../android.patch
+       cd $(PLATFORM); $(AUTORECONF) -vif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -j 1 -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libshairport.la $(PREFIX)/lib/libshairport.so $(PREFIX)/lib/libshairport.so.0
+       mv -f $(PREFIX)/lib/libshairport.so.0.0.0 $(PREFIX)/lib/libshairport.so
+       $(RPL) -e "libshairport.so.0" "libshairport.so\x00\x00" $(PREFIX)/lib/libshairport.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libshairport.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libshairport/android.patch b/tools/depends/target/libshairport/android.patch
new file mode 100644 (file)
index 0000000..b27c82b
--- /dev/null
@@ -0,0 +1,23 @@
+--- configure.in       2012-06-03 23:09:30.024347827 -0400
++++ configure.in       2012-06-03 23:11:37.494347747 -0400
+@@ -14,7 +14,7 @@
+ AC_CHECK_LIB([m],   [main])
+ AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([crypto], [main],, AC_MSG_ERROR($missing_library))
+-AC_CHECK_LIB([pthread], [main],, AC_MSG_ERROR($missing_library))
++AC_SEARCH_LIBS([pthread_create], [pthread],, AC_MSG_ERROR($missing_library))
+ OUTPUT_FILES="Makefile"
+--- src/hairtunes.c    2012-06-03 23:15:47.944347589 -0400
++++ src/hairtunes.c    2012-06-03 23:16:23.044347567 -0400
+@@ -42,7 +42,9 @@
+ #include <sys/stat.h>
+ #include "hairtunes.h"
++#ifndef ANDROID
+ #include <sys/signal.h>
++#endif
+ #include <fcntl.h>
+ #ifdef HAS_AO
+ #include "ao.h"
diff --git a/tools/depends/target/libssh/Makefile b/tools/depends/target/libssh/Makefile
new file mode 100644 (file)
index 0000000..62b6f74
--- /dev/null
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile removelegacy.patch android.patch
+
+# lib name, version
+LIBNAME=libssh
+VERSION=0.5.0
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+LIBDYLIB=$(PLATFORM)/build/src/$(LIBNAME).a
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); rm -rf build; mkdir -p build
+       cd $(PLATFORM); patch -p0 < ../removelegacy.patch
+       cd $(PLATFORM); patch -p0 < ../android.patch
+       cd $(PLATFORM); patch -p0 < ../md5.patch
+       sed -ie "s|-fstack-protector|-fnostack-protector|" "$(PLATFORM)/cmake/Modules/DefineCompilerFlags.cmake"
+       sed -ie "s|add_subdirectory(examples)||" "$(PLATFORM)/CMakeLists.txt"
+       cd $(PLATFORM)/build; $(CMAKE) -DWITH_STATIC_LIB=1 VERBOSE=1 .. 
+
+$(LIBDYLIB): $(PLATFORM)
+       make -j 1 -C $(PLATFORM)/build
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       make -C $(PLATFORM)/build install
+       rm -f $(PREFIX)/lib/libssh.so $(PREFIX)/lib/libssh.so.4.2.0 $(PREFIX)/lib/libssh.so.4
+       rm -f $(PREFIX)/lib/libssh.*dylib*
+       touch $@
+
+clean:
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libssh/android.patch b/tools/depends/target/libssh/android.patch
new file mode 100644 (file)
index 0000000..f9e028b
--- /dev/null
@@ -0,0 +1,68 @@
+--- src/connect.c      2011-05-31 10:29:52.000000000 -0400
++++ src/connect.c      2013-01-03 00:38:13.572737322 -0500
+@@ -159,7 +159,11 @@
+   int timeout_ms;
+   ssh_pollfd_t fds;
+   int rc = 0;
++#ifdef ANDROID
++  socklen_t len = sizeof(rc);
++#else
+   unsigned int len = sizeof(rc);
++#endif
+   enter_function();
+--- src/misc.c 2011-05-31 10:29:52.000000000 -0400
++++ src/misc.c 2013-01-03 00:37:37.652737345 -0500
+@@ -208,6 +208,14 @@
+ char *ssh_get_user_home_dir(void) {
+   char *szPath = NULL;
++#ifdef ANDROID
++  struct passwd *pwd = NULL;
++  pwd = getpwuid(getuid());
++  if ( pwd == NULL)
++    return NULL;
++
++  szPath = strdup(pwd->pw_dir);
++#else
+   struct passwd pwd;
+   struct passwd *pwdbuf;
+   char buf[NSS_BUFLEN_PASSWD];
+@@ -219,7 +227,7 @@
+   }
+   szPath = strdup(pwd.pw_dir);
+-
++#endif
+   return szPath;
+ }
+@@ -233,6 +241,19 @@
+ }
+ char *ssh_get_local_username(ssh_session session) {
++#ifdef ANDROID
++    char *name = NULL;
++    struct passwd *pwd = NULL;
++    pwd = getpwuid(getuid());
++    if ( pwd == NULL) {
++        ssh_set_error(session, SSH_FATAL,
++            "Couldn't retrieve information for current user!");
++        return NULL;
++    }
++
++    name = strdup(pwd->pw_name);
++
++#else
+     struct passwd pwd;
+     struct passwd *pwdbuf;
+     char buf[NSS_BUFLEN_PASSWD];
+@@ -248,6 +269,7 @@
+     name = strdup(pwd.pw_name);
++#endif
+     if (name == NULL) {
+       ssh_set_error_oom(session);
+       return NULL;
diff --git a/tools/depends/target/libssh/md5.patch b/tools/depends/target/libssh/md5.patch
new file mode 100644 (file)
index 0000000..b5985f0
--- /dev/null
@@ -0,0 +1,72 @@
+diff -ruN include/libssh/wrapper.h include/libssh/wrapper.h
+--- include/libssh/wrapper.h   2011-05-31 10:29:52.000000000 -0400
++++ include/libssh/wrapper.h   2012-07-26 00:21:16.021511996 -0400
+@@ -26,7 +26,7 @@
+ #include "libssh/libcrypto.h"
+ #include "libssh/libgcrypt.h"
+-MD5CTX md5_init(void);
++MD5CTX ssh_md5_init(void);
+ void md5_update(MD5CTX c, const void *data, unsigned long len);
+ void md5_final(unsigned char *md,MD5CTX c);
+ SHACTX sha1_init(void);
+diff -ruN src/dh.c src/dh.c
+--- src/dh.c   2011-05-31 10:29:52.000000000 -0400
++++ src/dh.c   2012-07-26 00:19:52.961512049 -0400
+@@ -854,7 +854,7 @@
+     return SSH_ERROR;
+   }
+-  ctx = md5_init();
++  ctx = ssh_md5_init();
+   if (ctx == NULL) {
+     SAFE_FREE(h);
+     return SSH_ERROR;
+diff -ruN src/kex.c src/kex.c
+--- src/kex.c  2011-05-31 10:29:52.000000000 -0400
++++ src/kex.c  2012-07-26 00:20:37.671512021 -0400
+@@ -509,7 +509,7 @@
+     ssh_string hostn) {
+   MD5CTX md5 = NULL;
+-  md5 = md5_init();
++  md5 = ssh_md5_init();
+   if (md5 == NULL) {
+     return -1;
+   }
+diff -ruN src/keyfiles.c src/keyfiles.c
+--- src/keyfiles.c     2011-05-31 10:29:52.000000000 -0400
++++ src/keyfiles.c     2012-07-26 00:20:51.801512011 -0400
+@@ -223,7 +223,7 @@
+   unsigned int md_not_empty;
+   for (j = 0, md_not_empty = 0; j < keylen; ) {
+-    md = md5_init();
++    md = ssh_md5_init();
+     if (md == NULL) {
+       return -1;
+     }
+diff -ruN src/libcrypto.c src/libcrypto.c
+--- src/libcrypto.c    2011-05-31 10:29:52.000000000 -0400
++++ src/libcrypto.c    2012-07-26 00:20:07.061512022 -0400
+@@ -89,7 +89,7 @@
+   SHA1(digest, len, hash);
+ }
+-MD5CTX md5_init(void) {
++MD5CTX ssh_md5_init(void) {
+   MD5CTX c = malloc(sizeof(*c));
+   if (c == NULL) {
+     return NULL;
+diff -ruN src/libgcrypt.c src/libgcrypt.c
+--- src/libgcrypt.c    2011-05-31 10:29:52.000000000 -0400
++++ src/libgcrypt.c    2012-07-26 00:20:19.401512036 -0400
+@@ -62,7 +62,7 @@
+   gcry_md_hash_buffer(GCRY_MD_SHA1, hash, digest, len);
+ }
+-MD5CTX md5_init(void) {
++MD5CTX ssh_md5_init(void) {
+   MD5CTX c = NULL;
+   gcry_md_open(&c, GCRY_MD_MD5, 0);
diff --git a/tools/depends/target/libssh/removelegacy.patch b/tools/depends/target/libssh/removelegacy.patch
new file mode 100644 (file)
index 0000000..69683cb
--- /dev/null
@@ -0,0 +1,10 @@
+--- src/CMakeLists.txt 2011-06-16 19:04:44.000000000 +0200
++++ src/CMakeLists.txt 2011-06-16 19:03:40.000000000 +0200
+@@ -94,7 +94,6 @@
+   keyfiles.c
+   keys.c
+   known_hosts.c
+-  legacy.c
+   libcrypto.c
+   libgcrypt.c
+   log.c
diff --git a/tools/depends/target/libssh2/Makefile b/tools/depends/target/libssh2/Makefile
new file mode 100644 (file)
index 0000000..91751d1
--- /dev/null
@@ -0,0 +1,52 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libssh2
+VERSION=1.2.7
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --with-openssl
+
+SHELL := /bin/bash
+RM    := rm -rf
+
+LIBDYLIB=$(PLATFORM)/src/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p0 < ../libdl.patch
+       cd $(PLATFORM); $(AUTORECONF) -vif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libssh2.la $(PREFIX)/lib/libssh2.so $(PREFIX)/lib/libssh2.so.1
+       mv -f $(PREFIX)/lib/libssh2.so.1.0.1 $(PREFIX)/lib/libssh2.so
+       $(RPL) -e "libssh2.so.1" "libssh2.so\x00\x00" $(PREFIX)/lib/libssh2.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libssh2.so | grep ibrary
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libssh2/libdl.patch b/tools/depends/target/libssh2/libdl.patch
new file mode 100644 (file)
index 0000000..ff70253
--- /dev/null
@@ -0,0 +1,10 @@
+--- configure.ac       2010-04-14 17:35:40.000000000 -0400
++++ configure.ac       2013-01-14 14:59:23.183089017 -0500
+@@ -62,6 +62,7 @@
+ # Solaris has inet_addr() in -lnsl.
+ AC_SEARCH_LIBS(inet_addr, nsl)
++AC_SEARCH_LIBS(dlopen, dl)
+ AC_SUBST(LIBS)
diff --git a/tools/depends/target/libusb/Makefile b/tools/depends/target/libusb/Makefile
new file mode 100644 (file)
index 0000000..56a5972
--- /dev/null
@@ -0,0 +1,40 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libusb
+VERSION=0.1.12
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-shared --disable-build-docs
+
+LIBDYLIB=$(PLATFORM)/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: $(LIBDYLIB) .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/libvorbis/Makefile b/tools/depends/target/libvorbis/Makefile
new file mode 100644 (file)
index 0000000..4ccd371
--- /dev/null
@@ -0,0 +1,65 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libvorbis
+VERSION=1.3.2
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+export LIBS=-lm
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-oggtest --disable-docs --disable-examples
+
+LIBDYLIB=$(PLATFORM)/lib/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       sed -ie "s|SUBDIRS = m4 include vq lib examples test doc|SUBDIRS = m4 include lib|" "$(PLATFORM)/Makefile.in"
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+ifeq ($(OS),android)
+       rm -f $(PREFIX)/lib/libvorbis.la $(PREFIX)/lib/libvorbis.so $(PREFIX)/lib/libvorbis.so.0
+       mv -f $(PREFIX)/lib/libvorbis.so.0.4.5 $(PREFIX)/lib/libxbvorbis.so
+       ln -sf $(PREFIX)/lib/libxbvorbis.so $(PREFIX)/lib/libvorbis.so
+       $(RPL) -e "libvorbis.so.0" "libxbvorbis.so" $(PREFIX)/lib/libxbvorbis.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libxbvorbis.so | grep ibrary
+       #
+       rm -f $(PREFIX)/lib/libvorbisfile.la $(PREFIX)/lib/libvorbisfile.so $(PREFIX)/lib/libvorbisfile.so.3
+       mv -f $(PREFIX)/lib/libvorbisfile.so.3.3.4 $(PREFIX)/lib/libxbvorbisfile.so
+       ln -sf $(PREFIX)/lib/libxbvorbisfile.so $(PREFIX)/lib/libvorbisfile.so
+       $(RPL) -e "libvorbisfile.so.3" "libxbvorbisfile.so" $(PREFIX)/lib/libxbvorbisfile.so
+       $(RPL) -e "libvorbis.so.0" "libxbvorbis.so" $(PREFIX)/lib/libxbvorbisfile.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libxbvorbisfile.so | grep ibrary
+       #
+       rm -f $(PREFIX)/lib/libvorbisenc.la $(PREFIX)/lib/libvorbisenc.so $(PREFIX)/lib/libvorbisenc.so.2
+       mv -f $(PREFIX)/lib/libvorbisenc.so.2.0.8 $(PREFIX)/lib/libxbvorbisenc.so
+       ln -sf $(PREFIX)/lib/libxbvorbisenc.so $(PREFIX)/lib/libvorbisenc.so
+       $(RPL) -e "libvorbisenc.so.2" "libxbvorbisenc.so" $(PREFIX)/lib/libxbvorbisenc.so
+       $(RPL) -e "libvorbis.so.0" "libxbvorbis.so" $(PREFIX)/lib/libxbvorbisenc.so
+       -$(READELF) --dynamic $(PREFIX)/lib/libxbvorbisenc.so | grep ibrary
+       #
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libxml2/Makefile b/tools/depends/target/libxml2/Makefile
new file mode 100644 (file)
index 0000000..ecce678
--- /dev/null
@@ -0,0 +1,44 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libxml2
+VERSION=2.7.6
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --without-python --disable-shared
+
+LIBDYLIB=$(PLATFORM)/.libs/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       sed -ie "s|runtest$$(EXEEXT)||" "$(PLATFORM)/Makefile.in"
+       sed -ie "s|testrecurse$$(EXEEXT)||" "$(PLATFORM)/Makefile.in"
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $(LIBDYLIB)
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/libzip/Makefile b/tools/depends/target/libzip/Makefile
new file mode 100644 (file)
index 0000000..99a548e
--- /dev/null
@@ -0,0 +1,39 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=libzip
+VERSION=0.10
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+        ./configure --prefix=$(PREFIX) --disable-shared
+
+LIBDYLIB=$(PLATFORM)/lib/.libs/$(LIBNAME).a
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       rm -f $(PREFIX)/lib/libzip.la $(PREFIX)/lib/libzip*.so*
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/mysql/01-mysqlclient-cross-compile.patch b/tools/depends/target/mysql/01-mysqlclient-cross-compile.patch
new file mode 100644 (file)
index 0000000..12b22b7
--- /dev/null
@@ -0,0 +1,170 @@
+diff -ruN mysql-5.1.55.org/configure.in mysql-5.1.55/configure.in
+--- mysql-5.1.55.org/configure.in      2011-01-25 16:04:35.000000000 +0100
++++ mysql-5.1.55/configure.in  2011-05-19 20:14:38.000000000 +0200
+@@ -1571,13 +1571,6 @@
+ esac
+-# System characteristics
+-case $SYSTEM_TYPE in
+-  *netware*) ;;
+-  *)
+-AC_SYS_RESTARTABLE_SYSCALLS
+-    ;;
+-esac
+ # Build optimized or debug version ?
+ # First check for gcc and g++
+diff -ruN mysql-5.1.55.org/storage/innodb_plugin/plug.in mysql-5.1.55/storage/innodb_plugin/plug.in
+--- mysql-5.1.55.org/storage/innodb_plugin/plug.in     2011-01-25 16:04:35.000000000 +0100
++++ mysql-5.1.55/storage/innodb_plugin/plug.in 2011-05-19 21:59:28.000000000 +0200
+@@ -56,149 +56,6 @@
+   esac
+   AC_SUBST(INNODB_DYNAMIC_CFLAGS)
+-  AC_MSG_CHECKING(whether GCC atomic builtins are available)
+-  # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
+-  AC_TRY_RUN(
+-    [
+-      int main()
+-      {
+-      long    x;
+-      long    y;
+-      long    res;
+-      char    c;
+-
+-      x = 10;
+-      y = 123;
+-      res = __sync_bool_compare_and_swap(&x, x, y);
+-      if (!res || x != y) {
+-          return(1);
+-        }
+-
+-      x = 10;
+-      y = 123;
+-      res = __sync_bool_compare_and_swap(&x, x + 1, y);
+-      if (res || x != 10) {
+-          return(1);
+-        }
+-
+-      x = 10;
+-      y = 123;
+-      res = __sync_add_and_fetch(&x, y);
+-      if (res != 123 + 10 || x != 123 + 10) {
+-        return(1);
+-      }
+-
+-      c = 10;
+-      res = __sync_lock_test_and_set(&c, 123);
+-      if (res != 10 || c != 123) {
+-        return(1);
+-      }
+-
+-      return(0);
+-      }
+-    ],
+-    [
+-      AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
+-                [GCC atomic builtins are available])
+-      AC_MSG_RESULT(yes)
+-    ],
+-    [
+-      AC_MSG_RESULT(no)
+-    ]
+-  )
+-
+-  AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
+-  # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
+-  AC_TRY_RUN(
+-    [
+-      #include <pthread.h>
+-      #include <string.h>
+-
+-      int main(int argc, char** argv) {
+-        pthread_t       x1;
+-        pthread_t       x2;
+-        pthread_t       x3;
+-
+-      memset(&x1, 0x0, sizeof(x1));
+-      memset(&x2, 0x0, sizeof(x2));
+-      memset(&x3, 0x0, sizeof(x3));
+-
+-        __sync_bool_compare_and_swap(&x1, x2, x3);
+-
+-        return(0);
+-      }
+-    ],
+-    [
+-      AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
+-                [pthread_t can be used by GCC atomic builtins])
+-      AC_MSG_RESULT(yes)
+-    ],
+-    [
+-      AC_MSG_RESULT(no)
+-    ]
+-  )
+-
+-  AC_MSG_CHECKING(whether Solaris libc atomic functions are available)
+-  # Define HAVE_IB_SOLARIS_ATOMICS if _all_ of the following
+-  # functions are present.
+-  AC_CHECK_FUNCS(atomic_add_long_nv \
+-               atomic_cas_32 \
+-               atomic_cas_64 \
+-               atomic_cas_ulong \
+-               atomic_swap_uchar)
+-
+-  if test "${ac_cv_func_atomic_add_long_nv}" = "yes" -a \
+-          "${ac_cv_func_atomic_cas_32}" = "yes" -a \
+-          "${ac_cv_func_atomic_cas_64}" = "yes" -a \
+-          "${ac_cv_func_atomic_cas_ulong}" = "yes" -a \
+-          "${ac_cv_func_atomic_swap_uchar}" = "yes" ; then
+-
+-    AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1],
+-      [Define to 1 if Solaris libc atomic functions are available]
+-    )
+-  fi
+-
+-  AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions)
+-  # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not
+-  AC_TRY_RUN(
+-    [
+-      #include <pthread.h>
+-      #include <string.h>
+-
+-      int main(int argc, char** argv) {
+-        pthread_t       x1;
+-        pthread_t       x2;
+-        pthread_t       x3;
+-
+-        memset(&x1, 0x0, sizeof(x1));
+-        memset(&x2, 0x0, sizeof(x2));
+-        memset(&x3, 0x0, sizeof(x3));
+-
+-        if (sizeof(pthread_t) == 4) {
+-        
+-          atomic_cas_32(&x1, x2, x3);
+-        
+-        } else if (sizeof(pthread_t) == 8) {
+-        
+-          atomic_cas_64(&x1, x2, x3);
+-        
+-        } else {
+-        
+-          return(1);
+-        }
+-
+-      return(0);
+-      }
+-    ],
+-    [
+-      AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1],
+-                [pthread_t can be used by solaris atomics])
+-      AC_MSG_RESULT(yes)
+-    ],
+-    [
+-      AC_MSG_RESULT(no)
+-    ]
+-  )
+   # this is needed to know which one of atomic_cas_32() or atomic_cas_64()
+   # to use in the source
diff --git a/tools/depends/target/mysql/02-mysqlclient-ios.patch b/tools/depends/target/mysql/02-mysqlclient-ios.patch
new file mode 100644 (file)
index 0000000..3945b48
--- /dev/null
@@ -0,0 +1,27 @@
+diff -ruN mysql-5.1.55.org/include/my_global.h mysql-5.1.55/include/my_global.h
+--- mysql-5.1.55.org/include/my_global.h       2011-01-25 16:04:37.000000000 +0100
++++ mysql-5.1.55/include/my_global.h   2011-05-19 22:12:13.000000000 +0200
+@@ -132,7 +132,7 @@
+ #  define SIZEOF_INT 4
+ #  define SIZEOF_LONG_LONG 8
+ #  define SIZEOF_OFF_T 8
+-#  if defined(__i386__) || defined(__ppc__)
++#  if defined(__i386__) || defined(__ppc__) || defined(__arm__)
+ #    define SIZEOF_CHARP 4
+ #    define SIZEOF_LONG 4
+ #  elif defined(__x86_64__) || defined(__ppc64__)
+diff -ruN mysql-5.1.55.org/include/my_net.h mysql-5.1.55/include/my_net.h
+--- mysql-5.1.55.org/include/my_net.h  2011-01-25 16:04:48.000000000 +0100
++++ mysql-5.1.55/include/my_net.h      2011-05-19 22:13:39.000000000 +0200
+@@ -44,9 +44,9 @@
+ #endif
+ #if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__)
+-#include <netinet/in_systm.h>
++/* #include <netinet/in_systm.h> */
+ #include <netinet/in.h>
+-#include <netinet/ip.h>
++/* #include <netinet/ip.h> */
+ #if !defined(alpha_linux_port)
+ #include <netinet/tcp.h>
+ #endif
diff --git a/tools/depends/target/mysql/03-mysqlclient-android.patch b/tools/depends/target/mysql/03-mysqlclient-android.patch
new file mode 100644 (file)
index 0000000..66e45cf
--- /dev/null
@@ -0,0 +1,48 @@
+diff -ru mysql-5.1.55.org/include/my_dir.h mysql-5.1.55/include/my_dir.h
+--- mysql-5.1.55.org/include/my_dir.h  2011-01-25 16:04:48.000000000 +0100
++++ mysql-5.1.55/include/my_dir.h      2011-11-15 20:15:46.000000000 +0100
+@@ -35,9 +35,15 @@
+ #define MY_S_ISUID    S_ISUID /* set user id on execution */
+ #define MY_S_ISGID    S_ISGID /* set group id on execution */
+ #define MY_S_ISVTX    S_ISVTX /* save swapped text even after use */
++#if defined(__ANDROID__)
++#define MY_S_IREAD      S_IRUSR /* read permission, owner */
++#define MY_S_IWRITE     S_IWUSR /* write permission, owner */
++#define MY_S_IEXEC     S_IEXEC /* execute/search permission, owner */
++#else
+ #define MY_S_IREAD    S_IREAD /* read permission, owner */
+ #define MY_S_IWRITE   S_IWRITE        /* write permission, owner */
+ #define MY_S_IEXEC    S_IEXEC /* execute/search permission, owner */
++#endif
+ #define MY_S_ISDIR(m) (((m) & MY_S_IFMT) == MY_S_IFDIR)
+ #define MY_S_ISCHR(m) (((m) & MY_S_IFMT) == MY_S_IFCHR)
+diff -ru mysql-5.1.55.org/include/my_global.h mysql-5.1.55/include/my_global.h
+--- mysql-5.1.55.org/include/my_global.h       2011-11-15 20:14:37.000000000 +0100
++++ mysql-5.1.55/include/my_global.h   2011-11-15 20:15:13.000000000 +0100
+@@ -979,6 +979,10 @@
+ typedef unsigned char uchar;  /* Short for unsigned char */
+ #endif
++#ifndef HAVE_USHORT
++typedef unsigned short ushort;
++#endif
++
+ #ifndef HAVE_INT8
+ typedef signed char int8;       /* Signed integer >= 8  bits */
+ #endif
+diff -ru mysql-5.1.55.org/mysys/my_gethwaddr.c mysql-5.1.55/mysys/my_gethwaddr.c
+--- mysql-5.1.55.org/mysys/my_gethwaddr.c      2011-01-25 16:04:35.000000000 +0100
++++ mysql-5.1.55/mysys/my_gethwaddr.c  2011-11-15 20:19:11.000000000 +0100
+@@ -66,7 +66,11 @@
+ #include <net/if.h>
+ #include <sys/ioctl.h>
++#ifdef __ANDROID__
++#include <net/if_ether.h>
++#else
+ #include <net/ethernet.h>
++#endif
+ my_bool my_gethwaddr(uchar *to)
+ {
diff --git a/tools/depends/target/mysql/04-strnlen.patch b/tools/depends/target/mysql/04-strnlen.patch
new file mode 100644 (file)
index 0000000..522526e
--- /dev/null
@@ -0,0 +1,43 @@
+--- strings/strnlen.c  2011-01-25 10:04:52.000000000 -0500
++++ strings/strnlen.c  2013-01-20 22:37:24.000000000 -0500
+@@ -23,12 +23,15 @@
+ #include <my_global.h>
+ #include "m_string.h"
+-#ifndef HAVE_STRNLEN
+-size_t strnlen(register const char *s, register size_t maxlen)
++size_t strnlen_int(register const char *s, register size_t maxlen)
+ {
++#ifndef HAVE_STRNLEN
+   const char *end= (const char *)memchr(s, '\0', maxlen);
+   return end ? (size_t) (end - s) : maxlen;
++#else
++  return strnlen(s,maxlen);
++#endif
++
+ }
+-#endif
+--- include/m_string.h 2011-01-25 10:04:38.000000000 -0500
++++ include/m_string.h 2013-01-20 22:35:23.000000000 -0500
+@@ -160,7 +160,7 @@
+ #endif
+ #endif
+ #ifndef HAVE_STRNLEN
+-extern size_t strnlen(const char *s, size_t n);
++extern size_t strnlen_int(const char *s, size_t n);
+ #endif
+ #if !defined(__cplusplus)
+--- strings/my_vsnprintf.c     2011-01-25 10:04:48.000000000 -0500
++++ strings/my_vsnprintf.c     2013-01-20 22:34:21.000000000 -0500
+@@ -97,7 +97,7 @@
+       reg2 char       *par = va_arg(ap, char *);
+       size_t plen,left_len = (size_t) (end - to) + 1;
+       if (!par) par = (char*)"(null)";
+-      plen= (uint) strnlen(par, width);
++      plen= (uint) strnlen_int(par, width);
+       if (left_len <= plen)
+       plen = left_len - 1;
+       to=strnmov(to,par,plen);
diff --git a/tools/depends/target/mysql/Makefile b/tools/depends/target/mysql/Makefile
new file mode 100644 (file)
index 0000000..84ea391
--- /dev/null
@@ -0,0 +1,53 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include 01-mysqlclient-cross-compile.patch 02-mysqlclient-ios.patch 03-mysqlclient-android.patch Makefile
+
+# lib name, version
+LIBNAME=mysql
+VERSION=5.1.55
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --build=$(BUILD) \
+       --enable-thread-safe-client --with-extra-charsets=complex \
+       --with-named-thread-libs=-lc --with-named-curses-libs=-lncurses \
+       --with-libedit \
+       --without-server --without-bench --without-docs --without-man --disable-shared
+
+LIBDYLIB=$(PLATFORM)/lib$(LIBNAME)/.libs/lib$(LIBNAME)client.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -Np1 -i ../01-mysqlclient-cross-compile.patch
+       cd $(PLATFORM); patch -Np1 -i ../02-mysqlclient-ios.patch
+       cd $(PLATFORM); patch -Np1 -i ../03-mysqlclient-android.patch
+       cd $(PLATFORM); patch -p0 < ../04-strnlen.patch
+       cd $(PLATFORM); autoconf
+       cd $(PLATFORM); $(CONFIGURE) 
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/include
+       $(MAKE) -C $(PLATFORM)/libmysql
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/libmysql install
+       $(MAKE) -C $(PLATFORM)/scripts/ install-binSCRIPTS
+       $(MAKE) -C $(PLATFORM)/include/ install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/openssl/Makefile b/tools/depends/target/openssl/Makefile
new file mode 100644 (file)
index 0000000..1ca4aa5
--- /dev/null
@@ -0,0 +1,69 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=openssl
+VERSION=0.9.8r
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=MACHINE=$(PLATFORM) ./config shared zlib --openssldir=$(PREFIX) --with-zlib-include=$(PREFIX)/include --with-zlib-lib=$(PREFIX)/lib no-asm
+ifeq ($(OS), android)
+  CONFIGURE=./Configure shared zlib --openssldir=$(PREFIX) --with-zlib-include=$(PREFIX)/include --with-zlib-lib=$(PREFIX)/lib no-asm linux-generic32
+endif
+ifeq ($(OS), ios)
+  # No darwin-arm-cc so use darwin-i386-cc and patch files after configure
+  CONFIGURE=./Configure darwin-i386-cc zlib no-asm no-krb5 shared --openssldir=$(PREFIX)
+endif
+ifeq ($(OS), osx)
+  ifeq ($(CPU),x86_64)
+    CONFIGURE=./Configure darwin64-$(CPU)-cc zlib no-asm no-krb5 shared --openssldir=$(PREFIX)
+  else
+    CONFIGURE=./Configure darwin-$(CPU)-cc zlib no-asm no-krb5 shared --openssldir=$(PREFIX)
+  endif
+endif
+LIBDYLIB=$(PLATFORM)/libssl.a
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       #when compiled on darwin it just won't realise that we do crosscompiling
+       #so it would stick in -arch i386 or -arch x86_64 into the cflags
+       #that would break the cross compile so we have to get rid of these
+       cd $(PLATFORM); patch -p1 < ../libz.patch
+       cd $(PLATFORM); CFLAGS="$(CFLAGS)" CC=$(CC) RANLIB=$(RANLIB) $(CONFIGURE)
+       if test "$(OS)" = "osx"; then \
+               sed -ie "s|CC= /usr/bin/gcc-4.2|CC= $(CC)|" "$(PLATFORM)/Makefile"; \
+       fi
+       if test "$(OS)" = "ios"; then \
+               sed -ie "s|CFLAG= |CFLAG=$(CFLAGS) |" "$(PLATFORM)/Makefile"; \
+               sed -ie "s|-arch i386|-arch armv7|" "$(PLATFORM)/Makefile"; \
+               sed -ie "s|static volatile sig_atomic_t intr_signal;|static volatile intr_signal;|" "$(PLATFORM)/crypto/ui/ui_openssl.c"; \
+       fi
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -j 1 -C $(PLATFORM)
+       touch $@
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install_sw
+       rm -f $(PREFIX)/lib/libcrypto.so*
+       rm -f $(PREFIX)/lib/libssl.so*
+       rm -rf $(PREFIX)/lib/libcrypto.*dylib*
+       rm -rf $(PREFIX)/lib/libssl.*dylib*
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/openssl/libz.patch b/tools/depends/target/openssl/libz.patch
new file mode 100644 (file)
index 0000000..6e9f750
--- /dev/null
@@ -0,0 +1,43 @@
+diff -ur openssl/Configure openssl/Configure
+--- openssl/Configure  2009-02-19 05:43:18.000000000 -0400
++++ openssl/Configure  2009-04-02 15:39:19.000000000 -0400
+@@ -1218,7 +1218,14 @@
+       $cflags = "-DZLIB $cflags";
+       if (defined($disabled{"zlib-dynamic"}))
+               {
+-              $lflags = "$lflags -lz";
++              if (defined($withargs{"zlib-lib"}))
++                      {
++                      $lflags = "$lflags -L" . $withargs{"zlib-lib"} . " -lz";
++                      }
++              else
++                      {
++                      $lflags = "$lflags -lz";
++                      }
+               }
+       else
+               {
+--- openssl//Makefile.org      2010-01-27 11:06:36.000000000 -0500
++++ openssl/Makefile.org       20102012-12-31 17:47:43.392861820 -0500
+@@ -210,6 +210,7 @@
+               MAKEDEPPROG='${MAKEDEPPROG}'                    \
+               SHARED_LDFLAGS='${SHARED_LDFLAGS}'              \
+               KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}'   \
++              ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'     \
+               EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}'       \
+               SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' \
+               PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}'     \
+--- openssl/crypto/Makefile    2008-09-17 13:10:55.000000000 -0400
++++ openssl/crypto/Makefile    2012-12-31 17:46:36.292861863 -0500
+@@ -5,9 +5,9 @@
+ DIR=          crypto
+ TOP=          ..
+ CC=           cc
+-INCLUDE=      -I. -I$(TOP) -I../include
++INCLUDE=      -I. -I$(TOP) -I../include $(ZLIB_INCLUDE)
+ # INCLUDES targets sudbirs!
+-INCLUDES=     -I.. -I../.. -I../../include
++INCLUDES=     -I.. -I../.. -I../../include $(ZLIB_INCLUDE)
+ CFLAG=                -g
+ MAKEDEPPROG=  makedepend
+ MAKEDEPEND=   $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
diff --git a/tools/depends/target/pcre/Makefile b/tools/depends/target/pcre/Makefile
new file mode 100644 (file)
index 0000000..730453d
--- /dev/null
@@ -0,0 +1,39 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=pcre
+VERSION=7.9
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; ./configure --prefix=$(PREFIX) --disable-stack-for-recursion --disable-shared
+
+
+LIBDYLIB=$(PLATFORM)/.libs/lib$(LIBNAME).a
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/python26/Makefile b/tools/depends/target/python26/Makefile
new file mode 100644 (file)
index 0000000..611ddf2
--- /dev/null
@@ -0,0 +1,71 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile Python-2.6.2-android.patch \
+      Python-2.6.5-xcompile.patch Python-2.6-ctypes.patch \
+      Python-no-modules.patch Python-no-export-path.patch modules.setup
+
+# lib name, version
+LIBNAME=Python
+VERSION=2.6.5
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+# configuration settings
+CONFIGURE=OPT="$(CFLAGS)" \
+  LIBS=-lm \
+  ./configure --prefix=$(PREFIX) \
+  --disable-toolbox-glue --disable-framework --with-system-ffi \
+
+ifeq ($(OS),ios)
+CONFIGURE+=LDFLAGS="$(LDFLAGS) -miphoneos-version-min=3.0"
+endif
+
+LIBDYLIB=$(PLATFORM)/libpython2.6.a
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       echo $(NATIVEPREFIX)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -Np1 -i ../Python-2.6.5-xcompile.patch
+       cd $(PLATFORM); patch -Np1 -i ../Python-2.6.2-android.patch
+       cd $(PLATFORM); patch -p0 < ../Python-no-modules.patch
+       cd $(PLATFORM); patch -p0 < ../Python-no-export-path.patch
+       cd $(PLATFORM); patch -p1 < ../python-osx-environ-fix.patch
+       cd $(PLATFORM); patch -p0 < ../Python-2.6.5-ffi-static.patch
+ifeq ($(OS),ios)
+       cd $(PLATFORM); patch -p0 < ../Python-2.6.5-scproxy.patch
+endif
+       cp modules.setup $(PLATFORM)/Modules/Setup.dist
+
+#Add -liconv as needed, and add the _scproxy module for darwin
+       cd $(PLATFORM); sed -ie 's|_locale _localemodule.c   -lintl|_locale _localemodule.c   -lintl $(LINK_ICONV) |' Modules/Setup.dist
+ifeq (darwin, $(findstring darwin, $(HOST)))
+       echo "_scproxy \$$(srcdir)/Mac/Modules/_scproxy.c -framework SystemConfiguration -framework CoreFoundation" >> $(PLATFORM)/Modules/Setup.dist
+else
+       cd $(PLATFORM); sed -ie 's|-framework CoreFoundation||' configure.in
+endif
+
+       cd $(PLATFORM); $(AUTORECONF)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM) HOSTPYTHON=$(NATIVEPREFIX)/bin/python HOSTPGEN=$(NATIVEPREFIX)/bin/pgen CROSS_COMPILE_TARGET=yes libpython2.6.a
+       touch $@
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       make -j1 -C $(PLATFORM) HOSTPYTHON=$(NATIVEPREFIX)/bin/python HOSTPGEN=$(NATIVEPREFIX)/bin/pgen CROSS_COMPILE_TARGET=yes install
+       find $(PREFIX)/lib/python2.6 -type f -name "*.py" -delete
+       find $(PREFIX)/lib/python2.6 -type f -name "*.pyc" -delete
+       #
+       touch $(LIBDYLIB)
+       touch $@
+
+clean:
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/python26/Python-2.6-ctypes.patch b/tools/depends/target/python26/Python-2.6-ctypes.patch
new file mode 100644 (file)
index 0000000..647dca8
--- /dev/null
@@ -0,0 +1,45 @@
+--- a/Modules/_ctypes/_ctypes.c        (revision 74955)
++++ b/Modules/_ctypes/_ctypes.c        (working copy)
+@@ -5521,36 +5521,42 @@
+       Struct_Type.tp_base = &CData_Type;
+       if (PyType_Ready(&Struct_Type) < 0)
+               return;
++      Py_INCREF(&Struct_Type);
+       PyModule_AddObject(m, "Structure", (PyObject *)&Struct_Type);
+       Py_TYPE(&Union_Type) = &UnionType_Type;
+       Union_Type.tp_base = &CData_Type;
+       if (PyType_Ready(&Union_Type) < 0)
+               return;
++      Py_INCREF(&Union_Type);
+       PyModule_AddObject(m, "Union", (PyObject *)&Union_Type);
+       Py_TYPE(&Pointer_Type) = &PointerType_Type;
+       Pointer_Type.tp_base = &CData_Type;
+       if (PyType_Ready(&Pointer_Type) < 0)
+               return;
++      Py_INCREF(&Pointer_Type);
+       PyModule_AddObject(m, "_Pointer", (PyObject *)&Pointer_Type);
+       Py_TYPE(&Array_Type) = &ArrayType_Type;
+       Array_Type.tp_base = &CData_Type;
+       if (PyType_Ready(&Array_Type) < 0)
+               return;
++      Py_INCREF(&Array_Type);
+       PyModule_AddObject(m, "Array", (PyObject *)&Array_Type);
+       Py_TYPE(&Simple_Type) = &SimpleType_Type;
+       Simple_Type.tp_base = &CData_Type;
+       if (PyType_Ready(&Simple_Type) < 0)
+               return;
++      Py_INCREF(&Simple_Type);
+       PyModule_AddObject(m, "_SimpleCData", (PyObject *)&Simple_Type);
+       Py_TYPE(&CFuncPtr_Type) = &CFuncPtrType_Type;
+       CFuncPtr_Type.tp_base = &CData_Type;
+       if (PyType_Ready(&CFuncPtr_Type) < 0)
+               return;
++      Py_INCREF(&CFuncPtr_Type);
+       PyModule_AddObject(m, "CFuncPtr", (PyObject *)&CFuncPtr_Type);
+       /*************************************************
diff --git a/tools/depends/target/python26/Python-2.6.2-android.patch b/tools/depends/target/python26/Python-2.6.2-android.patch
new file mode 100644 (file)
index 0000000..fc71171
--- /dev/null
@@ -0,0 +1,61 @@
+diff --ignore-file-name-case -wuprN Python-2.6.2/Modules/pwdmodule.c python-src//Modules/pwdmodule.c
+--- Python-2.6.2/Modules/pwdmodule.c   2008-06-09 01:58:54.000000000 -0300
++++ python-src//Modules/pwdmodule.c    2011-01-05 17:09:37.000000000 -0300
+@@ -68,14 +68,14 @@ mkpwent(struct passwd *p)
+ #define SETS(i,val) sets(v, i, val)
+       SETS(setIndex++, p->pw_name);
+-#ifdef __VMS
++#if defined(__VMS) || defined(ANDROID)
+       SETS(setIndex++, "");
+ #else
+       SETS(setIndex++, p->pw_passwd);
+ #endif
+       SETI(setIndex++, p->pw_uid);
+       SETI(setIndex++, p->pw_gid);
+-#ifdef __VMS
++#if defined(__VMS) || defined(ANDROID)
+       SETS(setIndex++, "");
+ #else
+       SETS(setIndex++, p->pw_gecos);
+diff --ignore-file-name-case -wuprN Python-2.6.2/Modules/termios.c python-src//Modules/termios.c
+--- Python-2.6.2/Modules/termios.c     2008-06-09 01:58:54.000000000 -0300
++++ python-src//Modules/termios.c      2011-01-05 17:09:37.000000000 -0300
+@@ -227,6 +227,7 @@ termios_tcsendbreak(PyObject *self, PyOb
+       return Py_None;
+ }
++#if !defined(ANDROID)  // No tcdrain defined for Android.
+ PyDoc_STRVAR(termios_tcdrain__doc__,
+ "tcdrain(fd) -> None\n\
+ \n\
+@@ -246,6 +247,7 @@ termios_tcdrain(PyObject *self, PyObject
+       Py_INCREF(Py_None);
+       return Py_None;
+ }
++#endif
+ PyDoc_STRVAR(termios_tcflush__doc__,
+ "tcflush(fd, queue) -> None\n\
+@@ -301,8 +303,10 @@ static PyMethodDef termios_methods[] =
+        METH_VARARGS, termios_tcsetattr__doc__},
+       {"tcsendbreak", termios_tcsendbreak, 
+        METH_VARARGS, termios_tcsendbreak__doc__},
++#if !defined(ANDROID)
+       {"tcdrain", termios_tcdrain, 
+        METH_VARARGS, termios_tcdrain__doc__},
++#endif
+       {"tcflush", termios_tcflush, 
+        METH_VARARGS, termios_tcflush__doc__},
+       {"tcflow", termios_tcflow, 
+--- Python-2.6.2/Modules/posixmodule.c 2012-06-20 14:20:07.833441645 -0400
++++ Python-2.6.2/Modules/posixmodule.c 2012-06-20 14:23:03.023441535 -0400
+@@ -3761,7 +3761,7 @@
+       slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */
+       if (slave_fd < 0)
+               return posix_error();
+-#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC)
++#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) && !defined(ANDROID)
+       ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */
+       ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */
+ #ifndef __hpux
diff --git a/tools/depends/target/python26/Python-2.6.5-ffi-static.patch b/tools/depends/target/python26/Python-2.6.5-ffi-static.patch
new file mode 100644 (file)
index 0000000..188b1f4
--- /dev/null
@@ -0,0 +1,28 @@
+--- Modules/_ctypes/cfield.c   2013-01-20 19:19:53.000000000 -0500
++++ Modules/_ctypes/cfield.c   2013-01-20 19:34:07.000000000 -0500
+@@ -1743,6 +1743,7 @@
+ */
+ /* align and size are bogus for void, but they must not be zero */
++/*
+ ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID };
+ ffi_type ffi_type_uint8 = { 1, 1, FFI_TYPE_UINT8 };
+@@ -1759,14 +1760,16 @@
+ ffi_type ffi_type_float = { sizeof(float), FLOAT_ALIGN, FFI_TYPE_FLOAT };
+ ffi_type ffi_type_double = { sizeof(double), DOUBLE_ALIGN, FFI_TYPE_DOUBLE };
++*/
+ #ifdef ffi_type_longdouble
+ #undef ffi_type_longdouble
+ #endif
+   /* This is already defined on OSX */
++/*
+ ffi_type ffi_type_longdouble = { sizeof(long double), LONGDOUBLE_ALIGN,
+                                FFI_TYPE_LONGDOUBLE };
+ ffi_type ffi_type_pointer = { sizeof(void *), VOID_P_ALIGN, FFI_TYPE_POINTER };
+-
++*/
+ /*---------------- EOF ----------------*/
diff --git a/tools/depends/target/python26/Python-2.6.5-scproxy.patch b/tools/depends/target/python26/Python-2.6.5-scproxy.patch
new file mode 100644 (file)
index 0000000..8f29747
--- /dev/null
@@ -0,0 +1,51 @@
+--- Mac/Modules/_scproxy.c     2009-09-20 15:21:24.000000000 -0400
++++ Mac/Modules/_scproxy.c     2013-01-22 19:40:41.000000000 -0500
+@@ -4,7 +4,6 @@
+  */
+ #include <Python.h>
+ #include <SystemConfiguration/SystemConfiguration.h>
+-
+ static int32_t 
+ cfnum_to_int32(CFNumberRef num)
+ {
+@@ -48,6 +47,7 @@
+ static PyObject*
+ get_proxy_settings(PyObject* mod __attribute__((__unused__)))
+ {
++/*
+       CFDictionaryRef proxyDict = NULL;
+       CFNumberRef aNum = NULL;
+       CFArrayRef anArray = NULL;
+@@ -55,7 +55,7 @@
+       PyObject* v;
+       int r;
+-      proxyDict = SCDynamicStoreCopyProxies(NULL);
++      proxyDict =  CFNetworkCopyProxiesForURL(NULL);
+       if (!proxyDict) {
+               Py_INCREF(Py_None);
+               return Py_None;
+@@ -114,6 +114,7 @@
+ error:
+       if (proxyDict)  CFRelease(proxyDict);
+       Py_XDECREF(result);
++*/
+       return NULL;
+ }
+@@ -163,6 +164,7 @@
+ static PyObject*
+ get_proxies(PyObject* mod __attribute__((__unused__)))
+ {
++/*
+       PyObject* result = NULL;
+       int r;
+       CFDictionaryRef proxyDict = NULL;
+@@ -201,6 +203,7 @@
+ error:
+       if (proxyDict)  CFRelease(proxyDict);
+       Py_XDECREF(result);
++*/
+       return NULL;
+ }
diff --git a/tools/depends/target/python26/Python-2.6.5-xcompile.patch b/tools/depends/target/python26/Python-2.6.5-xcompile.patch
new file mode 100644 (file)
index 0000000..51df2d3
--- /dev/null
@@ -0,0 +1,301 @@
+diff -uN Python-2.6.2/configure Python-2.6.2POld/configure
+--- Python-2.6.2/configure     2009-03-31 03:56:14.000000000 +1000
+
+@@ -24326,14 +24326,14 @@
+ { echo "$as_me:$LINENO: checking for %zd printf() format support" >&5
+ echo $ECHO_N "checking for %zd printf() format support... $ECHO_C" >&6; }
+-if test "$cross_compiling" = yes; then
+-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: cannot run test program while cross compiling
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
+-else
+-  cat >conftest.$ac_ext <<_ACEOF
++#if test "$cross_compiling" = yes; then
++#  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
++#See \`config.log' for more details." >&5
++#echo "$as_me: error: cannot run test program while cross compiling
++#See \`config.log' for more details." >&2;}
++#   { (exit 1); exit 1; }; }
++#else
++cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+ _ACEOF
+ cat confdefs.h >>conftest.$ac_ext
+@@ -24411,7 +24411,7 @@
+ echo "${ECHO_T}no" >&6; }
+ fi
+ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+-fi
++#fi
+diff -uN Python-2.6.2/configure.in Python-2.6.2POld/configure.in
+--- Python-2.6.2/configure.in  2009-03-31 03:56:14.000000000 +1000
++++ Python-2.6.2POld/configure.in      2009-08-17 12:19:15.000000000 +1000
+@@ -3656,48 +3656,48 @@
+   AC_MSG_RESULT(no)
+ fi
+-AC_MSG_CHECKING(for %zd printf() format support)
+-AC_TRY_RUN([#include <stdio.h>
+-#include <stddef.h>
+-#include <string.h>
+-
+-#ifdef HAVE_SYS_TYPES_H
+-#include <sys/types.h>
+-#endif
+-
+-#ifdef HAVE_SSIZE_T
+-typedef ssize_t Py_ssize_t;
+-#elif SIZEOF_VOID_P == SIZEOF_LONG
+-typedef long Py_ssize_t;
+-#else
+-typedef int Py_ssize_t;
+-#endif
+-
+-int main()
+-{
+-    char buffer[256];
+-
+-    if(sprintf(buffer, "%zd", (size_t)123) < 0)
+-              return 1;
+-
+-    if (strcmp(buffer, "123"))
+-      return 1;
+-
+-    if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
+-              return 1;
+-
+-    if (strcmp(buffer, "-123"))
+-      return 1;
+-
+-    return 0;
+-}],
+-[AC_MSG_RESULT(yes)
+- AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
+- AC_MSG_RESULT(no))
++#AC_MSG_CHECKING(for %zd printf() format support)
++#AC_TRY_RUN([#include <stdio.h>
++##include <stddef.h>
++##include <string.h>
++
++##ifdef HAVE_SYS_TYPES_H
++##include <sys/types.h>
++##endif
++
++##ifdef HAVE_SSIZE_T
++#typedef ssize_t Py_ssize_t;
++##elif SIZEOF_VOID_P == SIZEOF_LONG
++#typedef long Py_ssize_t;
++##else
++#typedef int Py_ssize_t;
++##endif
++#
++#int main()
++#{
++#    char buffer[256];
++#
++#    if(sprintf(buffer, "%zd", (size_t)123) < 0)
++#             return 1;#
++#
++#    if (strcmp(buffer, "123"))
++#     return 1;
++#
++#    if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
++#             return 1;
++#
++#    if (strcmp(buffer, "-123"))
++#     return 1;
++#
++#   return 0;
++#}],
++#[AC_MSG_RESULT(yes)
++# AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
++# AC_MSG_RESULT(no))
+ AC_CHECK_TYPE(socklen_t,,
+   AC_DEFINE(socklen_t,int,
+-            Define to `int' if <sys/socket.h> does not define.),[
++            Define to 'int' if <sys/socket.h> does not define.),[
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+diff -uN Python-2.6.2/Makefile.pre.in Python-2.6.2POld/Makefile.pre.in
+--- Python-2.6.2/Makefile.pre.in       2009-02-24 21:07:44.000000000 +1000
++++ Python-2.6.2POld/Makefile.pre.in   2009-08-17 12:19:15.000000000 +1000
+@@ -175,6 +175,7 @@
+ PYTHON=               python$(EXE)
+ BUILDPYTHON=  python$(BUILDEXE)
++HOSTPYTHON=     ./$(BUILDPYTHON)
+ # The task to run while instrument when building the profile-opt target
+ PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
+@@ -206,6 +207,8 @@
+ # Parser
+ PGEN=         Parser/pgen$(EXE)
++HOSTPGEN=   $(PGEN)
++
+ POBJS=                \
+               Parser/acceler.o \
+               Parser/grammar1.o \
+@@ -394,8 +397,8 @@
+ # Build the shared modules
+ sharedmods: $(BUILDPYTHON)
+       @case $$MAKEFLAGS in \
+-      *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
+-      *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
++      *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
++      *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
+       esac
+ # Build static library
+@@ -517,7 +520,7 @@
+ $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
+               -@$(INSTALL) -d Include
+-              -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
++              -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+ $(PGEN):      $(PGENOBJS)
+               $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
+@@ -886,24 +889,24 @@
+               done; \
+       done
+       $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
+-      PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
++      -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
++              $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
+               -d $(LIBDEST) -f \
+               -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
+-      PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
++      -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
++              $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
+               -d $(LIBDEST) -f \
+               -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
++              $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
+               -d $(LIBDEST)/site-packages -f \
+               -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
++              $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
+               -d $(LIBDEST)/site-packages -f \
+               -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
+       -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+-              ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
++              $(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
+ # Create the PLATDIR source directory, if one wasn't distributed..
+ $(srcdir)/Lib/$(PLATDIR):
+@@ -1001,7 +1004,8 @@
+ # Install the dynamically loadable modules
+ # This goes into $(exec_prefix)
+ sharedinstall:
+-      $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
++      CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILE='$(CROSS_COMPILE)' \
++      $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
+               --prefix=$(prefix) \
+               --install-scripts=$(BINDIR) \
+               --install-platlib=$(DESTSHARED) \
+diff -uN Python-2.6.2/setup.py Python-2.6.2POld/setup.py
+--- Python-2.6.2/setup.py      2009-04-01 04:20:48.000000000 +1000
++++ Python-2.6.2POld/setup.py  2009-08-17 12:19:15.000000000 +1000
+@@ -17,7 +17,7 @@
+ from distutils.command.install_lib import install_lib
+ # This global variable is used to hold the list of modules to be disabled.
+-disabled_module_list = []
++disabled_module_list = ['_ctypes', '_curses', '_curses_panel', '_cursesmodule', '_tkinter', 'syslogmodule', 'nismodule']
+ def add_dir_to_list(dirlist, dir):
+     """Add the directory 'dir' to the list 'dirlist' (at the front) if
+@@ -267,33 +267,40 @@
+             self.announce('WARNING: skipping import check for Cygwin-based "%s"'
+                 % ext.name)
+             return
++        if os.environ.get('CROSS_COMPILE_TARGET') == 'yes':
++            return
++
+         ext_filename = os.path.join(
+             self.build_lib,
+             self.get_ext_filename(self.get_ext_fullname(ext.name)))
+         try:
+             imp.load_dynamic(ext.name, ext_filename)
+         except ImportError, why:
+-            self.failed.append(ext.name)
+-            self.announce('*** WARNING: renaming "%s" since importing it'
+-                          ' failed: %s' % (ext.name, why), level=3)
+-            assert not self.inplace
+-            basename, tail = os.path.splitext(ext_filename)
+-            newname = basename + "_failed" + tail
+-            if os.path.exists(newname):
+-                os.remove(newname)
+-            os.rename(ext_filename, newname)
+-
+-            # XXX -- This relies on a Vile HACK in
+-            # distutils.command.build_ext.build_extension().  The
+-            # _built_objects attribute is stored there strictly for
+-            # use here.
+-            # If there is a failure, _built_objects may not be there,
+-            # so catch the AttributeError and move on.
+-            try:
+-                for filename in self._built_objects:
+-                    os.remove(filename)
+-            except AttributeError:
+-                self.announce('unable to remove files (ignored)')
++            if os.environ.get('CROSS_COMPILE_TARGET') != "yes":
++                self.announce('*** WARNING: renaming "%s" since importing it'
++                              ' failed: %s' % (ext.name, why), level=3)
++                assert not self.inplace
++                basename, tail = os.path.splitext(ext_filename)
++                newname = basename + "_failed" + tail
++                if os.path.exists(newname):
++                    os.remove(newname)
++                os.rename(ext_filename, newname)
++
++                # XXX -- This relies on a Vile HACK in
++                # distutils.command.build_ext.build_extension().  The
++                # _built_objects attribute is stored there strictly for
++                # use here.
++                # If there is a failure, _built_objects may not be there,
++                # so catch the AttributeError and move on.
++                try:
++                    for filename in self._built_objects:
++                        os.remove(filename)
++                except AttributeError:
++                    self.announce('unable to remove files (ignored)')
++            else:
++                self.announce('WARNING: "%s" failed importing, but we leave it '
++                              'because we are cross-compiling' %
++                              ext.name)
+         except:
+             exc_type, why, tb = sys.exc_info()
+             self.announce('*** WARNING: importing extension "%s" '
+@@ -665,7 +672,7 @@
+         if (ssl_incs is not None and
+             ssl_libs is not None and
+-            openssl_ver >= 0x00907000):
++            openssl_ver >= 0x00907000 and False):
+             # The _hashlib module wraps optimized implementations
+             # of hash functions from the OpenSSL library.
+             exts.append( Extension('_hashlib', ['_hashopenssl.c'],
+@@ -685,7 +692,7 @@
+                             depends = ['md5.h']) )
+             missing.append('_hashlib')
+-        if (openssl_ver < 0x00908000):
++        if (True or openssl_ver < 0x00908000):
+             # OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash
+             exts.append( Extension('_sha256', ['sha256module.c']) )
+             exts.append( Extension('_sha512', ['sha512module.c']) )
+
diff --git a/tools/depends/target/python26/Python-no-export-path.patch b/tools/depends/target/python26/Python-no-export-path.patch
new file mode 100644 (file)
index 0000000..6753baa
--- /dev/null
@@ -0,0 +1,12 @@
+diff -ruN Makefile.pre.in Makefile.pre.in
+--- Makefile.pre.in    2012-07-12 17:52:37.072234980 -0400
++++ Makefile.pre.in    2012-07-13 15:45:36.522185303 -0400
+@@ -912,8 +912,6 @@
+ $(srcdir)/Lib/$(PLATDIR):
+       mkdir $(srcdir)/Lib/$(PLATDIR)
+       cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
+-      export PATH; PATH="`pwd`:$$PATH"; \
+-      export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
+       export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
+       export EXE; EXE="$(BUILDEXE)"; \
+       cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
\ No newline at end of file
diff --git a/tools/depends/target/python26/Python-no-modules.patch b/tools/depends/target/python26/Python-no-modules.patch
new file mode 100644 (file)
index 0000000..f656837
--- /dev/null
@@ -0,0 +1,12 @@
+diff -ruN setup.py /setup.py
+--- setup.py   2012-06-22 19:56:02.633319969 -0400
++++ setup.py   2012-06-22 19:56:49.403319941 -0400
+@@ -98,7 +98,7 @@
+         self.failed = []
+     def build_extensions(self):
+-
++      return
+         # Detect which modules should be compiled
+         missing = self.detect_modules()
+
diff --git a/tools/depends/target/python26/modules.setup b/tools/depends/target/python26/modules.setup
new file mode 100644 (file)
index 0000000..c4c81ba
--- /dev/null
@@ -0,0 +1,519 @@
+# -*- makefile -*-
+# The file Setup is used by the makesetup script to construct the files
+# Makefile and config.c, from Makefile.pre and config.c.in,
+# respectively.  The file Setup itself is initially copied from
+# Setup.dist; once it exists it will not be overwritten, so you can edit
+# Setup to your heart's content.  Note that Makefile.pre is created
+# from Makefile.pre.in by the toplevel configure script.
+
+# (VPATH notes: Setup and Makefile.pre are in the build directory, as
+# are Makefile and config.c; the *.in and *.dist files are in the source
+# directory.)
+
+# Each line in this file describes one or more optional modules.
+# Modules enabled here will not be compiled by the setup.py script,
+# so the file can be used to override setup.py's behavior.
+
+# Lines have the following structure:
+#
+# <module> ... [<sourcefile> ...] [<cpparg> ...] [<library> ...]
+#
+# <sourcefile> is anything ending in .c (.C, .cc, .c++ are C++ files)
+# <cpparg> is anything starting with -I, -D, -U or -C
+# <library> is anything ending in .a or beginning with -l or -L
+# <module> is anything else but should be a valid Python
+# identifier (letters, digits, underscores, beginning with non-digit)
+#
+# (As the makesetup script changes, it may recognize some other
+# arguments as well, e.g. *.so and *.sl as libraries.  See the big
+# case statement in the makesetup script.)
+#
+# Lines can also have the form
+#
+# <name> = <value>
+#
+# which defines a Make variable definition inserted into Makefile.in
+#
+# Finally, if a line contains just the word "*shared*" (without the
+# quotes but with the stars), then the following modules will not be
+# built statically.  The build process works like this:
+#
+# 1. Build all modules that are declared as static in Modules/Setup,
+#    combine them into libpythonxy.a, combine that into python.
+# 2. Build all modules that are listed as shared in Modules/Setup.
+# 3. Invoke setup.py. That builds all modules that
+#    a) are not builtin, and
+#    b) are not listed in Modules/Setup, and
+#    c) can be build on the target
+#
+# Therefore, modules declared to be shared will not be
+# included in the config.c file, nor in the list of objects to be
+# added to the library archive, and their linker options won't be
+# added to the linker options. Rules to create their .o files and
+# their shared libraries will still be added to the Makefile, and
+# their names will be collected in the Make variable SHAREDMODS.  This
+# is used to build modules as shared libraries.  (They can be
+# installed using "make sharedinstall", which is implied by the
+# toplevel "make install" target.)  (For compatibility,
+# *noconfig* has the same effect as *shared*.)
+#
+# In addition, *static* explicitly declares the following modules to
+# be static.  Lines containing "*static*" and "*shared*" may thus
+# alternate throughout this file.
+
+# NOTE: As a standard policy, as many modules as can be supported by a
+# platform should be present.  The distribution comes with all modules
+# enabled that are supported by most platforms and don't require you
+# to ftp sources from elsewhere.
+*static*
+
+# Some special rules to define PYTHONPATH.
+# Edit the definitions below to indicate which options you are using.
+# Don't add any whitespace or comments!
+
+# Directories where library files get installed.
+# DESTLIB is for Python modules; MACHDESTLIB for shared libraries.
+DESTLIB=$(LIBDEST)
+MACHDESTLIB=$(BINLIBDEST)
+
+# NOTE: all the paths are now relative to the prefix that is computed
+# at run time!
+
+# Standard path -- don't edit.
+# No leading colon since this is the first entry.
+# Empty since this is now just the runtime prefix.
+DESTPATH=
+
+# Site specific path components -- should begin with : if non-empty
+SITEPATH=
+
+# Standard path components for test modules
+TESTPATH=
+
+# Path components for machine- or system-dependent modules and shared libraries
+MACHDEPPATH=:plat-$(MACHDEP)
+EXTRAMACHDEPPATH=
+
+# Path component for the Tkinter-related modules
+# The TKPATH variable is always enabled, to save you the effort.
+TKPATH=:lib-tk
+
+# Path component for old modules.
+OLDPATH=:lib-old
+
+COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)$(MACHDEPPATH)$(EXTRAMACHDEPPATH)$(TKPATH)$(OLDPATH)
+PYTHONPATH=$(COREPYTHONPATH)
+
+
+# The modules listed here can't be built as shared libraries for
+# various reasons; therefore they are listed here instead of in the
+# normal order.
+
+# This only contains the minimal set of modules required to run the 
+# setup.py script in the root of the Python source tree.
+
+posix posixmodule.c            # posix (UNIX) system calls
+errno errnomodule.c            # posix (UNIX) errno values
+pwd pwdmodule.c                        # this is needed to find out the user's home dir
+                               # if $HOME is not set
+_sre _sre.c                    # Fredrik Lundh's new regular expressions
+_codecs _codecsmodule.c                # access to the builtin codecs and codec registry
+
+# The zipimport module is always imported at startup. Having it as a
+# builtin module avoids some bootstrapping problems and reduces overhead.
+zipimport zipimport.c
+
+# The rest of the modules listed in this file are all commented out by
+# default.  Usually they can be detected and built as dynamically
+# loaded modules by the new setup.py script added in Python 2.1.  If
+# you're on a platform that doesn't support dynamic loading, want to 
+# compile modules statically into the Python binary, or need to 
+# specify some odd set of compiler switches, you can uncomment the 
+# appropriate lines below.
+
+# ======================================================================
+
+# The Python symtable module depends on .h files that setup.py doesn't track
+_symtable symtablemodule.c
+
+# The SGI specific GL module:
+
+GLHACK=-Dclear=__GLclear
+#gl glmodule.c cgensupport.c -I$(srcdir) $(GLHACK) -lgl -lX11
+
+# Pure module.  Cannot be linked dynamically.
+# -DWITH_QUANTIFY, -DWITH_PURIFY, or -DWITH_ALL_PURE
+#WHICH_PURE_PRODUCTS=-DWITH_ALL_PURE
+#PURE_INCLS=-I/usr/local/include
+#PURE_STUBLIBS=-L/usr/local/lib -lpurify_stubs -lquantify_stubs
+#pure puremodule.c $(WHICH_PURE_PRODUCTS) $(PURE_INCLS) $(PURE_STUBLIBS)
+
+# Uncommenting the following line tells makesetup that all following
+# modules are to be built as shared libraries (see above for more
+# detail; also note that *static* reverses this effect):
+
+#*shared*
+
+# GNU readline.  Unlike previous Python incarnations, GNU readline is
+# now incorporated in an optional module, configured in the Setup file
+# instead of by a configure script switch.  You may have to insert a
+# -L option pointing to the directory where libreadline.* lives,
+# and you may have to change -ltermcap to -ltermlib or perhaps remove
+# it, depending on your system -- see the GNU readline instructions.
+# It's okay for this to be a shared library, too.
+
+#readline readline.c -lreadline -lncurses
+
+
+# Modules that should always be present (non UNIX dependent):
+
+array arraymodule.c    # array objects
+cmath cmathmodule.c # -lm # complex math library functions
+math mathmodule.c # -lm # math library functions, e.g. sin()
+_struct _struct.c      # binary structure packing/unpacking
+time timemodule.c # -lm # time operations and variables
+operator operator.c    # operator.add() and similar goodies
+_weakref _weakref.c    # basic weak reference support
+_testcapi _testcapimodule.c    # Python C API test module
+_random _randommodule.c        # Random number generator
+_collections _collectionsmodule.c # Container types
+itertools itertoolsmodule.c    # Functions creating iterators for efficient looping 
+strop stropmodule.c            # String manipulations
+_functools _functoolsmodule.c  # Tools for working with functions and callable objects
+
+EXPATDEFINES='-DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI'
+_elementtree -I$(srcdir)/Modules/expat $(EXPATDEFINES) _elementtree.c  # elementtree accelerator
+#_pickle _pickle.c     # pickle accelerator
+datetime datetimemodule.c      # date/time type
+_bisect _bisectmodule.c        # Bisection algorithms
+
+unicodedata unicodedata.c    # static Unicode character database
+
+# access to ISO C locale support
+_locale _localemodule.c   -lintl
+
+
+# Modules with some UNIX dependencies -- on by default:
+# (If you have a really backward UNIX, select and socket may not be
+# supported...)
+#
+fcntl fcntlmodule.c    # fcntl(2) and ioctl(2)
+#spwd spwdmodule.c             # spwd(3) 
+#grp grpmodule.c               # grp(3)
+select selectmodule.c  # select(2); not on ancient System V
+
+# Memory-mapped files (also works on Win32).
+mmap mmapmodule.c
+
+# CSV file helper
+_csv _csv.c
+
+# Socket module helper for socket(2)
+_socket socketmodule.c
+
+# Socket module helper for SSL support; you must comment out the other
+# socket line above, and possibly edit the SSL variable:
+SSLDEFINES='-DUSE_SSL'
+_ssl _ssl.c \
+       $(SSLDEFINES) -I$(prefix)/include -I$(prefix)/include/openssl \
+       -L$(prefix)/lib -lssl -lcrypto
+
+_hashlib _hashopenssl.c \
+        $(SSLDEFINES) -I$(prefix)/include -I$(prefix)/include/openssl \
+        -L$(prefix)/lib -lssl -lcrypto
+
+# The crypt module is now disabled by default because it breaks builds
+# on many systems (where -lcrypt is needed), e.g. Linux (I believe).
+#
+# First, look at Setup.config; configure may have set this for you.
+
+#crypt cryptmodule.c  -lcrypt  # crypt(3); needs -lcrypt on some systems
+
+# Some more UNIX dependent modules -- off by default, since these
+# are not supported by all UNIX systems:
+
+#nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
+termios termios.c      # Steen Lumholt's termios module
+resource resource.c    # Jeremy Hylton's rlimit interface
+
+
+# Multimedia modules -- off by default.
+# These don't work for 64-bit platforms!!!
+# #993173 says audioop works on 64-bit platforms, though.
+# These represent audio samples or images as strings:
+
+#audioop audioop.c     # Operations on audio samples
+#imageop imageop.c     # Operations on images
+
+
+# Note that the _md5 and _sha modules are normally only built if the
+# system does not have the OpenSSL libs containing an optimized version.
+
+# The _md5 module implements the RSA Data Security, Inc. MD5
+# Message-Digest Algorithm, described in RFC 1321.  The necessary files
+# md5.c and md5.h are included here.
+
+_md5 md5module.c md5.c
+
+
+# The _sha module implements the SHA checksum algorithms.
+# (NIST's Secure Hash Algorithms.)
+_sha shamodule.c
+_sha256 sha256module.c
+_sha512 sha512module.c
+
+
+# SGI IRIX specific modules -- off by default.
+
+# These module work on any SGI machine:
+
+# *** gl must be enabled higher up in this file ***
+#fm fmmodule.c $(GLHACK) -lfm -lgl             # Font Manager
+#sgi sgimodule.c                       # sgi.nap() and a few more
+
+# This module requires the header file
+# /usr/people/4Dgifts/iristools/include/izoom.h:
+#imgfile imgfile.c -limage -lgutil -lgl -lm    # Image Processing Utilities
+
+
+# These modules require the Multimedia Development Option (I think):
+
+#al almodule.c -laudio                 # Audio Library
+#cd cdmodule.c -lcdaudio -lds -lmediad # CD Audio Library
+#cl clmodule.c -lcl -lawareaudio       # Compression Library
+#sv svmodule.c yuvconvert.c -lsvideo -lXext -lX11      # Starter Video
+
+
+# The FORMS library, by Mark Overmars, implements user interface
+# components such as dialogs and buttons using SGI's GL and FM
+# libraries.  You must ftp the FORMS library separately from
+# ftp://ftp.cs.ruu.nl/pub/SGI/FORMS.  It was tested with FORMS 2.2a.
+# NOTE: if you want to be able to use FORMS and curses simultaneously
+# (or both link them statically into the same binary), you must
+# compile all of FORMS with the cc option "-Dclear=__GLclear".
+
+# The FORMS variable must point to the FORMS subdirectory of the forms
+# toplevel directory:
+
+#FORMS=/ufs/guido/src/forms/FORMS
+#fl flmodule.c -I$(FORMS) $(GLHACK) $(FORMS)/libforms.a -lfm -lgl
+
+
+# SunOS specific modules -- off by default:
+
+#sunaudiodev sunaudiodev.c
+
+
+# A Linux specific module -- off by default; this may also work on 
+# some *BSDs.
+
+#linuxaudiodev linuxaudiodev.c
+
+
+# George Neville-Neil's timing module:
+
+timing timingmodule.c
+
+
+# The _tkinter module.
+#
+# The command for _tkinter is long and site specific.  Please
+# uncomment and/or edit those parts as indicated.  If you don't have a
+# specific extension (e.g. Tix or BLT), leave the corresponding line
+# commented out.  (Leave the trailing backslashes in!  If you
+# experience strange errors, you may want to join all uncommented
+# lines and remove the backslashes -- the backslash interpretation is
+# done by the shell's "read" command and it may not be implemented on
+# every system.
+
+# *** Always uncomment this (leave the leading underscore in!):
+# _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
+# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
+#      -L/usr/local/lib \
+# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
+#      -I/usr/local/include \
+# *** Uncomment and edit to reflect where your X11 header files are:
+#      -I/usr/X11R6/include \
+# *** Or uncomment this for Solaris:
+#      -I/usr/openwin/include \
+# *** Uncomment and edit for Tix extension only:
+#      -DWITH_TIX -ltix8.1.8.2 \
+# *** Uncomment and edit for BLT extension only:
+#      -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
+# *** Uncomment and edit for PIL (TkImaging) extension only:
+#     (See http://www.pythonware.com/products/pil/ for more info)
+#      -DWITH_PIL -I../Extensions/Imaging/libImaging  tkImaging.c \
+# *** Uncomment and edit for TOGL extension only:
+#      -DWITH_TOGL togl.c \
+# *** Uncomment and edit to reflect your Tcl/Tk versions:
+#      -ltk8.2 -ltcl8.2 \
+# *** Uncomment and edit to reflect where your X11 libraries are:
+#      -L/usr/X11R6/lib \
+# *** Or uncomment this for Solaris:
+#      -L/usr/openwin/lib \
+# *** Uncomment these for TOGL extension only:
+#      -lGL -lGLU -lXext -lXmu \
+# *** Uncomment for AIX:
+#      -lld \
+# *** Always uncomment this; X11 libraries to link with:
+#      -lX11
+
+# Lance Ellinghaus's syslog module
+syslog syslogmodule.c          # syslog daemon interface
+
+
+# Curses support, requring the System V version of curses, often
+# provided by the ncurses library.  e.g. on Linux, link with -lncurses
+# instead of -lcurses).
+#
+# First, look at Setup.config; configure may have set this for you.
+
+#_curses _cursesmodule.c -lcurses -ltermcap
+# Wrapper for the panel library that's part of ncurses and SYSV curses.
+#_curses_panel _curses_panel.c -lpanel -lncurses 
+
+
+# Generic (SunOS / SVR4) dynamic loading module.
+# This is not needed for dynamic loading of Python modules --
+# it is a highly experimental and dangerous device for calling
+# *arbitrary* C functions in *arbitrary* shared libraries:
+
+#dl dlmodule.c
+
+
+# Modules that provide persistent dictionary-like semantics.  You will
+# probably want to arrange for at least one of them to be available on
+# your machine, though none are defined by default because of library
+# dependencies.  The Python module anydbm.py provides an
+# implementation independent wrapper for these; dumbdbm.py provides
+# similar functionality (but slower of course) implemented in Python.
+
+# The standard Unix dbm module has been moved to Setup.config so that
+# it will be compiled as a shared library by default.  Compiling it as
+# a built-in module causes conflicts with the pybsddb3 module since it
+# creates a static dependency on an out-of-date version of db.so.
+#
+# First, look at Setup.config; configure may have set this for you.
+
+#dbm -I$(prefix)/include -L$(prefix)/lib dbmmodule.c   # dbm(3) may require -lndbm or similar
+
+# Anthony Baxter's gdbm module.  GNU dbm(3) will require -lgdbm:
+#
+# First, look at Setup.config; configure may have set this for you.
+
+#gdbm gdbmmodule.c -I$(prefix)/include -L$(prefix)/lib -lgdbm
+
+
+# Sleepycat Berkeley DB interface.
+#
+# This requires the Sleepycat DB code, see http://www.sleepycat.com/
+# The earliest supported version of that library is 3.0, the latest
+# supported version is 4.0 (4.1 is specifically not supported, as that
+# changes the semantics of transactional databases). A list of available
+# releases can be found at
+#
+# http://www.sleepycat.com/update/index.html
+#
+# Edit the variables DB and DBLIBVERto point to the db top directory
+# and the subdirectory of PORT where you built it.
+#DB=/usr/local/BerkeleyDB.4.0
+#DBLIBVER=4.0
+#DBINC=$(DB)/include
+#DBLIB=$(DB)/lib
+#_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
+
+# Historical Berkeley DB 1.85
+#
+# This module is deprecated; the 1.85 version of the Berkeley DB library has
+# bugs that can cause data corruption. If you can, use later versions of the
+# library instead, available from <http://www.sleepycat.com/>.
+
+#DB=/depot/sundry/src/berkeley-db/db.1.85
+#DBPORT=$(DB)/PORT/irix.5.3
+#bsddb185 bsddbmodule.c -I$(DBPORT)/include -I$(DBPORT) $(DBPORT)/libdb.a
+
+
+
+# Helper module for various ascii-encoders
+binascii binascii.c
+
+# Fred Drake's interface to the Python parser
+parser parsermodule.c
+
+# cStringIO and cPickle
+cStringIO cStringIO.c
+cPickle cPickle.c
+
+
+# Lee Busby's SIGFPE modules.
+# The library to link fpectl with is platform specific.
+# Choose *one* of the options below for fpectl:
+
+# For SGI IRIX (tested on 5.3):
+#fpectl fpectlmodule.c -lfpe
+
+# For Solaris with SunPro compiler (tested on Solaris 2.5 with SunPro C 4.2):
+# (Without the compiler you don't have -lsunmath.)
+#fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm
+
+# For other systems: see instructions in fpectlmodule.c.
+#fpectl fpectlmodule.c ...
+
+# Test module for fpectl.  No extra libraries needed.
+#fpetest fpetestmodule.c
+
+# Andrew Kuchling's zlib module.
+# This require zlib 1.1.3 (or later).
+# See http://www.gzip.org/zlib/
+zlib zlibmodule.c -I$(prefix)/include -L$(prefix)/lib -lz
+
+# Interface to the Expat XML parser
+#
+# Expat was written by James Clark and is now maintained by a group of
+# developers on SourceForge; see www.libexpat.org for more
+# information.  The pyexpat module was written by Paul Prescod after a
+# prototype by Jack Jansen.  Source of Expat 1.95.2 is included in
+# Modules/expat/.  Usage of a system shared libexpat.so/expat.dll is
+# not advised.
+#
+# More information on Expat can be found at www.libexpat.org.
+#
+pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat $(EXPATDEFINES) -I$(prefix)/include -L$(prefix)/lib -lexpat
+
+
+# Hye-Shik Chang's CJKCodecs
+
+# multibytecodec is required for all the other CJK codec modules
+_multibytecodec cjkcodecs/multibytecodec.c
+
+_codecs_cn cjkcodecs/_codecs_cn.c
+_codecs_hk cjkcodecs/_codecs_hk.c
+_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
+_codecs_jp cjkcodecs/_codecs_jp.c
+_codecs_kr cjkcodecs/_codecs_kr.c
+_codecs_tw cjkcodecs/_codecs_tw.c
+
+# Example -- included for reference only:
+# xx xxmodule.c
+
+# Another example -- the 'xxsubtype' module shows C-level subtyping in action
+xxsubtype xxsubtype.c
+
+_lsprof _lsprof.c rotatingtree.c
+_json _json.c
+_fileio _fileio.c
+_heapq _heapqmodule.c
+_hotshot _hotshot.c
+future_builtins future_builtins.c
+
+SQLITEDEFINES='-DMODULE_NAME="sqlite3"'
+_sqlite3 _sqlite/connection.c  \
+       _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/prepare_protocol.c \
+       _sqlite/row.c _sqlite/statement.c _sqlite/module.c _sqlite/util.c _sqlite/cache.c \
+       -I$(prefix)/include -L$(prefix)/lib -lsqlite3 $(SQLITEDEFINES)
+
+_ctypes _ctypes/callbacks.c  _ctypes/callproc.c  _ctypes/cfield.c  _ctypes/_ctypes.c  \
+        _ctypes/malloc_closure.c  _ctypes/stgdict.c \
+        -I$(prefix)/include/ffi -L$(prefix)/lib -lffi
+
+#bz2 bz2module.c -I$(prefix)/include -L$(prefix)/lib -lbz2
diff --git a/tools/depends/target/python26/python-osx-environ-fix.patch b/tools/depends/target/python26/python-osx-environ-fix.patch
new file mode 100644 (file)
index 0000000..b6f6a72
--- /dev/null
@@ -0,0 +1,25 @@
+Index: Modules/posixmodule.c
+===================================================================
+--- a/Modules/posixmodule.c    (revision 52827)
++++ b/Modules/posixmodule.c    (working copy)
+@@ -314,7 +314,7 @@
+ #endif
+ /* Return a dictionary corresponding to the POSIX environment table */
+-#ifdef WITH_NEXT_FRAMEWORK
++#ifdef __APPLE__
+ /* On Darwin/MacOSX a shared library or framework has no access to
+ ** environ directly, we must obtain it with _NSGetEnviron().
+ */
+@@ -332,7 +332,7 @@
+       d = PyDict_New();
+       if (d == NULL)
+               return NULL;
+-#ifdef WITH_NEXT_FRAMEWORK
++#ifdef __APPLE__
+       if (environ == NULL)
+               environ = *_NSGetEnviron();
+ #endif
+
+                
+
diff --git a/tools/depends/target/samba-gplv3/Makefile b/tools/depends/target/samba-gplv3/Makefile
new file mode 100644 (file)
index 0000000..fe209fd
--- /dev/null
@@ -0,0 +1,47 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=samba
+VERSION=3.6.12
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+CONFIGURE= cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) \
+          --without-cluster-support --disable-swat --without-ldap \
+          --without-pam --without-pam_smbpass --with-fhs --with-libtalloc=no \
+          --with-libtdb=no --without-winbind --disable-cups --without-ads \
+          --disable-avahi --disable-fam --without-libaddns --without-libnetapi \
+          --without-dnsupdate --without-libsmbsharemodes
+
+LIBDYLIB=$(PLATFORM)/source3/bin/libsmbclient.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM)/source3; $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/source3 libsmbclient
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/source3 installlibsmbclient
+ifeq (darwin, $(findstring darwin, $(HOST)))
+       install_name_tool -id $(PREFIX)/lib/libsmbclient.dylib.0 $(PREFIX)/lib/libsmbclient.dylib.0
+endif
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM)/source3 clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/samba/Makefile b/tools/depends/target/samba/Makefile
new file mode 100644 (file)
index 0000000..5dcd28f
--- /dev/null
@@ -0,0 +1,81 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile samba30-3.0.37-configure.in.patch \
+      samba30-3.0.37-CVE-2010-2063.patch \
+      samba30-3.0.37-silence-receive-warning.patch \
+      samba30-3.0.37-vfs_default.c.patch samba30-3.0.37-wle-fix.patch \
+      samba_android.patch
+
+# lib name, version
+LIBNAME=samba
+VERSION=3.0.37
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+# android does not really support LFS but we can force it
+# in libsmbclient by defining off_t to off64_t and changing
+# libsmbclient.h to match. Defining _OFF_T_DEFINED_ allows
+# us to change the typedef of off_t in android's sys/type.h.
+# Then xbmc will correctly access smb shares with LFS enabled
+# using the altered libsmbclient.h.
+#export CFLAGS+=-D_FILE_OFFSET_BITS=64 -D_OFF_T_DEFINED_ -Doff_t=off64_t -Dlseek=lseek64
+CONFIGURE= cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) \
+        --disable-cups \
+        --enable-static \
+        --disable-shared \
+        --disable-pie \
+        --disable-iprint \
+        --disable-fam \
+        --without-cluster-support \
+        --without-cifsupcall \
+        --without-ads \
+        --without-ldap \
+        --with-included-popt \
+        --with-included-iniparser \
+        --without-sys-quotas \
+        --without-krb5 \
+        --without-automount \
+        --without-sendfile-support \
+        --with-libiconv=$(STAGING_DIR) \
+        --without-cifsmount \
+        --without-winbind \
+
+LIBDYLIB=$(PLATFORM)/source/bin/libsmbclient.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p1 < ../samba30-3.0.37-configure.in.patch
+       cd $(PLATFORM); patch -p1 < ../samba30-3.0.37-CVE-2010-2063.patch
+       cd $(PLATFORM); patch -p1 < ../samba30-3.0.37-silence-receive-warning.patch
+       cd $(PLATFORM); patch -p1 < ../samba30-3.0.37-vfs_default.c.patch
+       cd $(PLATFORM); patch -p1 < ../samba30-3.0.37-wle-fix.patch
+       cd $(PLATFORM); patch -p0 < ../samba_android.patch
+#      sed -ie "s|off_t|off64_t|g" "$(PLATFORM)/source/include/libsmbclient.h"
+       cd $(PLATFORM)/source && ./autogen.sh
+       cd $(PLATFORM)/source; $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/source headers
+       mkdir -p $(PLATFORM)/source/bin
+       $(MAKE) -C $(PLATFORM)/source libsmbclient
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/source installclientlib
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM)/source clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/samba/samba30-3.0.37-CVE-2010-2063.patch b/tools/depends/target/samba/samba30-3.0.37-CVE-2010-2063.patch
new file mode 100644 (file)
index 0000000..b4657de
--- /dev/null
@@ -0,0 +1,38 @@
+diff --git a/source/smbd/process.c b/source/smbd/process.c
+index e861e16..6499bc7 100644
+--- a/source/smbd/process.c
++++ b/source/smbd/process.c
+@@ -1159,6 +1159,7 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
+ {
+       static char *orig_inbuf;
+       static char *orig_outbuf;
++      static int orig_size;
+       int smb_com1, smb_com2 = CVAL(inbuf,smb_vwv0);
+       unsigned smb_off2 = SVAL(inbuf,smb_vwv1);
+       char *inbuf2, *outbuf2;
+@@ -1178,6 +1179,13 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
+               /* this is the first part of the chain */
+               orig_inbuf = inbuf;
+               orig_outbuf = outbuf;
++              orig_size = size;
++      }
++
++      /* Validate smb_off2 */
++      if ((smb_off2 < smb_wct - 4) || orig_size < (smb_off2 + 4 - smb_wct)) {
++              exit_server_cleanly("Bad chained packet");
++              return -1;
+       }
+       /*
+@@ -1192,6 +1200,11 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
+       SSVAL(outbuf,smb_vwv1,smb_offset(outbuf+outsize,outbuf));
+       SCVAL(outbuf,smb_vwv0,smb_com2);
++      if (outsize <= smb_wct) {
++              exit_server_cleanly("Bad chained packet");
++              return -1;
++      }
++
+       /* remember how much the caller added to the chain, only counting stuff
+               after the parameter words */
+       chain_size += outsize - smb_wct;
diff --git a/tools/depends/target/samba/samba30-3.0.37-configure.in.patch b/tools/depends/target/samba/samba30-3.0.37-configure.in.patch
new file mode 100644 (file)
index 0000000..3af1e12
--- /dev/null
@@ -0,0 +1,64 @@
+--- samba-3.0.25borig/source/configure.in      2007-05-23 08:29:20.000000000 -0700
++++ samba3025bfinal/source/configure.in        2007-07-24 12:15:13.000000000 -0700
+@@ -1374,31 +1374,40 @@
+ #
+ case "$host_os" in
+     *linux*)
+-       # glibc <= 2.3.2 has a broken getgrouplist
+-       AC_TRY_RUN([
++
++AC_CACHE_CHECK([for a broken Linux getgrouplist API],
++             linux_getgrouplist_ok,
++             [
++                 AC_TRY_RUN([
+ #include <unistd.h>
+ #include <sys/utsname.h>
+-main() {
+-       /* glibc up to 2.3 has a broken getgrouplist */
++
++                     int main() {
++                            /* glibc up to 2.3 has a broken
++getgrouplist */
+ #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
+-       int libc_major = __GLIBC__;
+-       int libc_minor = __GLIBC_MINOR__;
++                            int libc_major = __GLIBC__;
++                            int libc_minor = __GLIBC_MINOR__;
++
++                            if (libc_major < 2)
++                                   return 1;
++                            if ((libc_major == 2) && (libc_minor <= 3))
++                                   return 1;
++#endif
++                            return 0;
++                     }
++
++                 ],
++                 [linux_getgrouplist_ok=yes],
++                 [linux_getgrouplist_ok=no],
++                 [linux_getgrouplist_ok=cross])
++        ])
++
++        if test x"$linux_getgrouplist_ok" = x"yes"; then
++           AC_DEFINE(HAVE_GETGROUPLIST, 1, [Have good getgrouplist])
++        fi
++
+-       if (libc_major < 2)
+-              exit(1);
+-       if ((libc_major == 2) && (libc_minor <= 3))
+-              exit(1);
+-#endif
+-       exit(0);
+-}
+-], [linux_getgrouplist_ok=yes], [linux_getgrouplist_ok=no])
+-       if test x"$linux_getgrouplist_ok" = x"yes"; then
+-          AC_DEFINE(HAVE_GETGROUPLIST, 1, [Have good getgrouplist])
+-       fi
+-       ;;
+-    *)
+-       AC_CHECK_FUNCS(getgrouplist)
+-       ;;
+ esac
+ #
diff --git a/tools/depends/target/samba/samba30-3.0.37-silence-receive-warning.patch b/tools/depends/target/samba/samba30-3.0.37-silence-receive-warning.patch
new file mode 100644 (file)
index 0000000..92b8433
--- /dev/null
@@ -0,0 +1,11 @@
+--- samba-3.0.37-clean/source/libsmb/clientgen.c       2009-09-30 05:21:56.000000000 -0700
++++ samba-3.0.37/source/libsmb/clientgen.c     2010-11-18 21:56:06.874516928 -0800
+@@ -108,7 +108,7 @@
+       /* If the server is not responding, note that now */
+       if (!ret) {
+-                DEBUG(0, ("Receiving SMB: Server stopped responding\n"));
++    DEBUG(1, ("Receiving SMB: Server stopped responding\n"));
+               cli->smb_rw_error = smb_read_error;
+               close(cli->fd);
+               cli->fd = -1;
diff --git a/tools/depends/target/samba/samba30-3.0.37-vfs_default.c.patch b/tools/depends/target/samba/samba30-3.0.37-vfs_default.c.patch
new file mode 100644 (file)
index 0000000..7a640ec
--- /dev/null
@@ -0,0 +1,16 @@
+--- samba-3.0.25borig/source/modules/vfs_default.c     2007-04-09 10:30:58.000000000 -0700
++++ samba3025bfinal/source/modules/vfs_default.c       2007-07-24 12:18:07.000000000 -0700
+@@ -813,10 +813,11 @@
+       START_PROFILE(syscall_linux_setlease);
+-#ifdef LINUX
++#ifdef HAVE_KERNEL_OPLOCKS_LINUX
+       /* first set the signal handler */
+-      if(linux_set_lease_sighandler(fd) == -1)
++      if(linux_set_lease_sighandler(fd) == -1) {
+               return -1;
++      }
+       result = linux_setlease(fd, leasetype);
+ #else
diff --git a/tools/depends/target/samba/samba30-3.0.37-wle-fix.patch b/tools/depends/target/samba/samba30-3.0.37-wle-fix.patch
new file mode 100644 (file)
index 0000000..8a41f45
--- /dev/null
@@ -0,0 +1,101 @@
+diff -r -u samba-3.0.37-clean/source/libsmb/asn1.c samba-3.0.37/source/libsmb/asn1.c
+--- samba-3.0.37-clean/source/libsmb/asn1.c    2009-09-30 05:21:56.000000000 -0700
++++ samba-3.0.37/source/libsmb/asn1.c  2010-11-18 12:40:06.981517350 -0800
+@@ -261,6 +261,36 @@
+       return asn1_read(data, v, 1);
+ }
++/* peek to see if a tag is present */
++/* this was not ported from samba and may not be identical to libsmb mainline */
++BOOL asn1_peek_tag(ASN1_DATA *data, uint8 tag)
++{
++  uint8 curtag;
++
++  if (data->has_error)
++    return False;
++
++  // overflow checking
++  if (data->ofs + 1 < data->ofs || data->ofs + 1 < 1) {
++    return False;
++  }
++
++  // boundary checking
++  if (data->ofs + 1 > data->length) {
++    return False;
++  }
++
++  memcpy( (void*)&curtag, data->data + data->ofs, 1);
++
++  // don't move cursor
++  // don't set error
++
++  if( tag != curtag )
++    return False;
++
++  return True;
++}
++
+ /* start reading a nested asn1 structure */
+ BOOL asn1_start_tag(ASN1_DATA *data, uint8 tag)
+ {
+diff -r -u samba-3.0.37-clean/source/libsmb/clispnego.c samba-3.0.37/source/libsmb/clispnego.c
+--- samba-3.0.37-clean/source/libsmb/clispnego.c       2009-09-30 05:21:56.000000000 -0700
++++ samba-3.0.37/source/libsmb/clispnego.c     2010-11-18 12:52:54.833518134 -0800
+@@ -135,9 +135,16 @@
+       asn1_start_tag(&data,ASN1_APPLICATION(0));
+       asn1_check_OID(&data,OID_SPNEGO);
++
++      /* negTokenInit  [0]  NegTokenInit */
+       asn1_start_tag(&data,ASN1_CONTEXT(0));
+       asn1_start_tag(&data,ASN1_SEQUENCE(0));
++      /* mechTypes [0] MechTypeList  OPTIONAL */
++
++      /* Not really optional, we depend on this to decide
++       * what mechanisms we have to work with. */
++
+       asn1_start_tag(&data,ASN1_CONTEXT(0));
+       asn1_start_tag(&data,ASN1_SEQUENCE(0));
+       for (i=0; asn1_tag_remaining(&data) > 0 && i < ASN1_MAX_OIDS-1; i++) {
+@@ -150,7 +157,39 @@
+       asn1_end_tag(&data);
+       *principal = NULL;
+-      if (asn1_tag_remaining(&data) > 0) {
++
++  /*
++         Win7 + Live Sign-in Assistant attaches a mechToken
++         ASN1_CONTEXT(2) to the negTokenInit packet
++         which breaks our negotiation if we just assume
++         the next tag is ASN1_CONTEXT(3).
++       */
++
++       if (asn1_peek_tag(&data, ASN1_CONTEXT(1))) {
++               uint8 flags;
++
++    /* reqFlags [1] ContextFlags  OPTIONAL */
++    asn1_start_tag(&data, ASN1_CONTEXT(1));
++    asn1_start_tag(&data, ASN1_BITFIELD);
++    while (asn1_tag_remaining(&data) > 0) {
++      asn1_read_uint8(&data, &flags);
++    }
++    asn1_end_tag(&data);
++    asn1_end_tag(&data);
++  }
++
++  if (asn1_peek_tag(&data, ASN1_CONTEXT(2))) {
++    /* mechToken [2] OCTET STRING  OPTIONAL */
++    DATA_BLOB token;
++    asn1_start_tag(&data, ASN1_CONTEXT(2));
++    asn1_read_OctetString(&data, &token);
++    asn1_end_tag(&data);
++    /* Throw away the token - not used. */
++    data_blob_free(&token);
++  }
++
++  if (asn1_peek_tag(&data, ASN1_CONTEXT(3))) {
++           /* mechListMIC [3] OCTET STRING  OPTIONAL */
+               asn1_start_tag(&data, ASN1_CONTEXT(3));
+               asn1_start_tag(&data, ASN1_SEQUENCE(0));
+               asn1_start_tag(&data, ASN1_CONTEXT(0));
diff --git a/tools/depends/target/samba/samba_android.patch b/tools/depends/target/samba/samba_android.patch
new file mode 100644 (file)
index 0000000..45c9773
--- /dev/null
@@ -0,0 +1,210 @@
+diff -ruN source/lib/fault.c source/lib/fault.c
+--- source/lib/fault.c 2009-09-30 08:21:56.000000000 -0400
++++ source/lib/fault.c 2013-01-14 20:14:16.393077102 -0500
+@@ -136,7 +136,7 @@
+ #endif
+ #endif
+-#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
++#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) && !defined(ANDROID)
+       /* On Linux we lose the ability to dump core when we change our user
+        * ID. We know how to dump core safely, so let's make sure we have our
+        * dumpable flag set.
+diff -ruN source/lib/iconv.c source/lib/iconv.c
+--- source/lib/iconv.c 2009-09-30 08:21:56.000000000 -0400
++++ source/lib/iconv.c 2013-01-14 20:33:18.813076383 -0500
+@@ -20,7 +20,10 @@
+ */
+ #include "includes.h"
+-
++#if defined(ANDROID)
++#include <stdint.h>
++#include <asm/byteorder.h>
++#endif
+ /*
+  * We have to use strcasecmp here as the character conversions
+  * haven't been initialised yet. JRA.
+@@ -489,6 +492,19 @@
+       return 0;
+ }
++#if defined(ANDROID)
++void swab(const void *from, void*to, ssize_t n)
++{
++  ssize_t i;
++
++  if (n < 0)
++    return;
++
++  for (i = 0; i < (n/2)*2; i += 2)
++    *((uint16_t*)to+i) = __arch__swab16(*((uint16_t*)from+i));
++}
++#endif
++
+ static size_t iconv_swab(void *cd, const char **inbuf, size_t *inbytesleft,
+                        char **outbuf, size_t *outbytesleft)
+ {
+diff -ruN source/lib/replace/system/passwd.h source/lib/replace/system/passwd.h
+--- source/lib/replace/system/passwd.h 2009-09-30 08:21:56.000000000 -0400
++++ source/lib/replace/system/passwd.h 2013-01-14 20:21:58.013076811 -0500
+@@ -62,6 +62,8 @@
+ #ifdef REPLACE_GETPASS
+ #define getpass(prompt) getsmbpass((prompt))
++#else
++#define getpass(prompt) NULL
+ #endif
+ #ifndef NGROUPS_MAX
+diff -ruN source/lib/system.c source/lib/system.c
+--- source/lib/system.c        2009-09-30 08:21:56.000000000 -0400
++++ source/lib/system.c        2013-01-14 20:27:18.453076610 -0500
+@@ -476,7 +476,10 @@
+ #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_SEEKDIR64)
+       seekdir64(dirp, offset);
+ #else
+-      seekdir(dirp, offset);
++#if !defined(ANDROID)
++      seekdir(dirp, offset);
++#endif
++      return;
+ #endif
+ }
+@@ -489,7 +492,11 @@
+ #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_TELLDIR64)
+       return (long)telldir64(dirp);
+ #else
++#if !defined(ANDROID)
+       return (long)telldir(dirp);
++#else
++      return(0);
++#endif
+ #endif
+ }
+@@ -985,17 +992,25 @@
+ void sys_setpwent(void)
+ {
++#if !defined(ANDROID)
+       setpwent();
++#endif
+ }
+ struct passwd *sys_getpwent(void)
+ {
++#if !defined(ANDROID)
+       return getpwent();
++#else
++      return NULL;
++#endif        
+ }
+ void sys_endpwent(void)
+ {
++#if !defined(ANDROID)
+       endpwent();
++#endif
+ }
+ /**************************************************************************
+@@ -1065,7 +1080,9 @@
+       new_pwd.pw_passwd = SMB_STRDUP("x");
+       new_pwd.pw_uid = uid;
+       new_pwd.pw_gid = 100;
++#if !defined(ANDROID)
+       new_pwd.pw_gecos = SMB_STRDUP("faked user");
++#endif
+       new_pwd.pw_dir = SMB_STRDUP("/nodir");
+       new_pwd.pw_shell = SMB_STRDUP("/bin/false");
+@@ -1241,7 +1258,9 @@
+       retval.pw_passwd = pwret->pw_passwd;
+       retval.pw_uid = pwret->pw_uid;
+       retval.pw_gid = pwret->pw_gid;
++#if !defined(ANDROID)
+       unix_to_unicode(retval.pw_gecos, pwret->pw_gecos, sizeof(retval.pw_gecos));
++#endif
+       unix_to_unicode(retval.pw_dir, pwret->pw_dir, sizeof(retval.pw_dir));
+       unix_to_unicode(retval.pw_shell, pwret->pw_shell, sizeof(retval.pw_shell));
+@@ -1264,7 +1283,9 @@
+       retval.pw_passwd = pwret->pw_passwd;
+       retval.pw_uid = pwret->pw_uid;
+       retval.pw_gid = pwret->pw_gid;
++#if !defined(ANDROID)
+       unix_to_unicode(retval.pw_gecos, pwret->pw_gecos, sizeof(retval.pw_gecos));
++#endif
+       unix_to_unicode(retval.pw_dir, pwret->pw_dir, sizeof(retval.pw_dir));
+       unix_to_unicode(retval.pw_shell, pwret->pw_shell, sizeof(retval.pw_shell));
+diff -ruN source/lib/util_pw.c source/lib/util_pw.c
+--- source/lib/util_pw.c       2009-09-30 08:21:56.000000000 -0400
++++ source/lib/util_pw.c       2013-01-14 20:17:49.293076968 -0500
+@@ -32,7 +32,9 @@
+       ret->pw_passwd = talloc_strdup(ret, from->pw_passwd);
+       ret->pw_uid = from->pw_uid;
+       ret->pw_gid = from->pw_gid;
++#if !defined(ANDROID)
+       ret->pw_gecos = talloc_strdup(ret, from->pw_gecos);
++#endif
+       ret->pw_dir = talloc_strdup(ret, from->pw_dir);
+       ret->pw_shell = talloc_strdup(ret, from->pw_shell);
+       return ret;
+diff -ruN source/libads/dns.c source/libads/dns.c
+--- source/libads/dns.c        2009-09-30 08:21:56.000000000 -0400
++++ source/libads/dns.c        2013-01-14 20:14:16.393077102 -0500
+@@ -38,6 +38,15 @@
+ #define MAX_DNS_PACKET_SIZE 0xffff
++#if defined(ANDROID)
++#  define NS_HFIXEDSZ   12
++#  define C_IN          1
++#  define T_A           1
++#  define ns_t_srv      33
++#  define NS_PACKETSZ 512
++#  define T_NS          2
++#endif
++
+ #ifdef NS_HFIXEDSZ    /* Bind 8/9 interface */
+ #if !defined(C_IN)    /* AIX 5.3 already defines C_IN */
+ #  define C_IN                ns_c_in
+diff -ruN source/passdb/passdb.c source/passdb/passdb.c
+--- source/passdb/passdb.c     2009-09-30 08:21:56.000000000 -0400
++++ source/passdb/passdb.c     2013-01-14 20:18:18.533076949 -0500
+@@ -143,7 +143,9 @@
+       /* Basic properties based upon the Unix account information */
+       
+       pdb_set_username(user, pwd->pw_name, PDB_SET);
++#if !defined(ANDROID)
+       pdb_set_fullname(user, pwd->pw_gecos, PDB_SET);
++#endif
+       pdb_set_domain (user, get_global_sam_name(), PDB_DEFAULT);
+ #if 0
+       /* This can lead to a primary group of S-1-22-2-XX which 
+diff -ruN source/passdb/pdb_interface.c source/passdb/pdb_interface.c
+--- source/passdb/pdb_interface.c      2009-09-30 08:21:56.000000000 -0400
++++ source/passdb/pdb_interface.c      2013-01-14 20:14:16.393077102 -0500
+@@ -1380,8 +1380,8 @@
+       }
+       /* Primary group members */
+-      setpwent();
+-      while ((pwd = getpwent()) != NULL) {
++      sys_setpwent();
++      while ((pwd = sys_getpwent()) != NULL) {
+               if (pwd->pw_gid == gid) {
+                       if (!add_uid_to_array_unique(mem_ctx, pwd->pw_uid,
+                                               pp_uids, p_num)) {
+@@ -1389,7 +1389,7 @@
+                       }
+               }
+       }
+-      endpwent();
++      sys_endpwent();
+       /* Secondary group members */
+       for (gr = grp->gr_mem; (*gr != NULL) && ((*gr)[0] != '\0'); gr += 1) {
diff --git a/tools/depends/target/sqlite3/Makefile b/tools/depends/target/sqlite3/Makefile
new file mode 100644 (file)
index 0000000..87f7eaa
--- /dev/null
@@ -0,0 +1,45 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=sqlite
+VERSION=3071000
+SOURCE=$(LIBNAME)-autoconf-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+export CXXFLAGS+=-DSQLITE_ENABLE_COLUMN_METADATA=1
+export CFLAGS+=-DSQLITE_TEMP_STORE=3
+export TCLLIBDIR=/dev/null
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) .; \
+          ./configure --prefix=$(PREFIX) --disable-shared \
+  --enable-threadsafe --disable-tcl --disable-readline \
+
+LIBDYLIB=$(PLATFORM)/.libs/lib$(LIBNAME)3.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/taglib/Makefile b/tools/depends/target/taglib/Makefile
new file mode 100644 (file)
index 0000000..8a33358
--- /dev/null
@@ -0,0 +1,34 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+LIBNAME=taglib
+VERSION=1.8
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
+
+LIBDYLIB=$(PLATFORM)/build/$(LIBNAME)/libtag.a
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); rm -rf build; mkdir -p build
+       cd $(PLATFORM)/build; $(CMAKE) -DCMAKE_LIBRARY_PATH=$(TOOLCHAIN)/lib/$(HOST) -DENABLE_STATIC=1 ..
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/build
+       touch $@
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/build install
+       rm -f $(PREFIX)/lib/libtag_c.*
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM)/build clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/tiff/Makefile b/tools/depends/target/tiff/Makefile
new file mode 100644 (file)
index 0000000..be905ca
--- /dev/null
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=tiff
+VERSION=3.9.7
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) config/; \
+          ./configure --prefix=$(PREFIX) --disable-shared
+
+LIBDYLIB=$(PLATFORM)/libtiff/.libs/lib$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/tinyxml/Makefile b/tools/depends/target/tinyxml/Makefile
new file mode 100644 (file)
index 0000000..70a7e4e
--- /dev/null
@@ -0,0 +1,39 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=tinyxml
+VERSION=2.6.2_2
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --disable-shared
+
+
+LIBDYLIB=$(PLATFORM)/src/.libs/libtinyxml.a
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); $(AUTORECONF) -vif
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -j 1 -C $(PLATFORM)/src
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/src install
+       touch $@
+
+clean:
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+
diff --git a/tools/depends/target/xbmc-pvr-addons/Makefile b/tools/depends/target/xbmc-pvr-addons/Makefile
new file mode 100644 (file)
index 0000000..9d47d1d
--- /dev/null
@@ -0,0 +1,67 @@
+include ../../Makefile.include
+#DEPS= ../../Makefile.include Makefile
+
+LIBNAME=xbmc-pvr-addons
+VERSION=5ef7f7f88c9dd3ca9c1daf57e7c92c005faa5910
+GIT_DIR=$(TARBALLS_LOCATION)/$(LIBNAME).git
+BASE_URL=git://github.com/opdenkamp/$(LIBNAME).git
+DYLIB=$(PLATFORM)/addons/pvr.demo/.libs/libpvrdemo-addon.so
+XBMC_ADDONSDIR=../../../../addons
+
+#tell git to use the addons repo rather than xbmc's repo
+export GIT_DIR
+export GIT_WORK_TREE=$(PLATFORM)
+
+#mysql_config is remarkably useless. Help configure find the right one.
+export MYSQL_CONFIG=$(PREFIX)/bin/mysql_config
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --enable-addons-with-dependencies
+
+all: .installed-$(PLATFORM)
+
+$(GIT_DIR)/HEAD:
+       cd $(TARBALLS_LOCATION); git clone --bare $(BASE_URL)
+
+$(GIT_DIR)/current/$(VERSION): $(GIT_DIR)/HEAD $(DEPS)
+       git rev-list -1 $(VERSION) >/dev/null || git fetch origin "+refs/heads/*:refs/remotes/origin/*"
+       git rev-list -1 $(VERSION) >/dev/null
+       rm -rf $(GIT_DIR)/current; mkdir -p $(GIT_DIR)/current
+       touch $@
+
+$(PLATFORM)/bootstrap: $(GIT_DIR)/current/$(VERSION)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       git checkout $(VERSION) -- .
+
+$(PLATFORM)/configure: $(PLATFORM)/bootstrap
+       cd $(PLATFORM); ./bootstrap
+
+$(PLATFORM)/Makefile: $(PLATFORM)/configure
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(DYLIB): $(PLATFORM)/Makefile
+       make -C $(PLATFORM)
+       touch $@
+
+.installed-$(PLATFORM): $(DYLIB)
+ifeq (darwin, $(findstring darwin, $(HOST)))
+       for ADDON in `find $(PLATFORM)/addons -type d -name "pvr.*"`; do \
+         ADDON=`basename $$ADDON` ; \
+         mkdir -p $(XBMC_ADDONSDIR)/$$ADDON ; \
+         cp -PRf $(PLATFORM)/addons/$$ADDON/addon/* $(XBMC_ADDONSDIR)/$$ADDON ; \
+         cp -Pf $(PLATFORM)/addons/$$ADDON/*.pvr $(XBMC_ADDONSDIR)/$$ADDON ; \
+         install_name_tool -id "$$ADDON" `find "$(XBMC_ADDONSDIR)/$$ADDON" -type f -name "*.pvr"` ; \
+       done
+else
+       $(MAKE) -C $(PLATFORM) install
+endif
+       touch $@
+
+clean:
+       -make -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
+       rm -rf $(GIT_DIR)/current
+
diff --git a/tools/depends/target/xbmc/Makefile b/tools/depends/target/xbmc/Makefile
new file mode 100644 (file)
index 0000000..be6febf
--- /dev/null
@@ -0,0 +1,27 @@
+-include ../../Makefile.include
+
+SOURCE=../../../../
+
+export CXXFLAGS+=-O3
+export CFLAGS+=-O3
+
+# configuration settings
+CONFIGURE=cp -f $(CONFIG_SUB) $(CONFIG_GUESS) build-aux/ ;\
+  ./configure --prefix=$(PREFIX)
+
+
+all: $(SOURCE)/libxbmc.so
+
+
+$(SOURCE)/libxbmc.so:
+       cd $(SOURCE); ./bootstrap
+       cd $(SOURCE); $(CONFIGURE)
+
+../../Makefile.include:
+       $(error Please run configure)
+
+clean:
+       cd $(SOURCE); $(MAKE) clean
+
+distclean:
+       cd $(SOURCE); $(MAKE) clean
diff --git a/tools/depends/target/yajl/Makefile b/tools/depends/target/yajl/Makefile
new file mode 100644 (file)
index 0000000..caf8784
--- /dev/null
@@ -0,0 +1,43 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile static.patch
+
+# lib name, version
+LIBNAME=yajl
+VERSION=2.0.1
+SOURCE=lloyd-$(LIBNAME)-f4b2b1a
+ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz
+# configuration settings
+LIBDYLIB=$(PLATFORM)/build/$(LIBNAME)-$(VERSION)/lib/libyajl.a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       sed -ie "s|ADD_CUSTOM_TARGET|#ADD_CUSTOM_TARGET|g" "$(PLATFORM)/CMakeLists.txt"
+       sed -ie "s|./run_tests.sh|#./run_tests.sh|g" "$(PLATFORM)/CMakeLists.txt"
+       sed -ie "s|WORKING_DIRECTORY|#WORKING_DIRECTORY|g" "$(PLATFORM)/CMakeLists.txt"
+       sed -ie "s|ADD_SUBDIRECTORY(reformatter)|#ADD_SUBDIRECTORY(reformatter)|g" "$(PLATFORM)/CMakeLists.txt"
+       cd $(PLATFORM); patch -p0 < ../static.patch
+       cd $(PLATFORM); patch -p0 < ../shared.patch
+       cd $(PLATFORM); rm -rf build; mkdir -p build
+       cd $(PLATFORM)/build; $(CMAKE) ..
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)/build
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM)/build install
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM)/build clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/yajl/shared.patch b/tools/depends/target/yajl/shared.patch
new file mode 100644 (file)
index 0000000..13ea0c7
--- /dev/null
@@ -0,0 +1,20 @@
+--- src/CMakeLists.txt.orig    2012-06-22 21:09:34.000000000 +0200
++++ src/CMakeLists.txt 2012-06-22 21:11:49.000000000 +0200
+@@ -40,6 +40,8 @@
+ TARGET_LINK_LIBRARIES(yajl_s m) 
++TARGET_LINK_LIBRARIES(yajl m) 
++
+ #### setup shared library version number
+ SET_TARGET_PROPERTIES(yajl PROPERTIES
+                       DEFINE_SYMBOL YAJL_SHARED
+@@ -79,7 +79,7 @@
+ IF(NOT WIN32)
+   # at build time you may specify the cmake variable LIB_SUFFIX to handle
+   # 64-bit systems which use 'lib64'
+-  INSTALL(TARGETS yajl LIBRARY DESTINATION lib${LIB_SUFFIX})
++#  INSTALL(TARGETS yajl LIBRARY DESTINATION lib${LIB_SUFFIX})
+   INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib${LIB_SUFFIX})
+   INSTALL(FILES ${PUB_HDRS} DESTINATION include/yajl)
+   INSTALL(FILES ${incDir}/yajl_version.h DESTINATION include/yajl)
diff --git a/tools/depends/target/yajl/static.patch b/tools/depends/target/yajl/static.patch
new file mode 100644 (file)
index 0000000..ca1a943
--- /dev/null
@@ -0,0 +1,19 @@
+--- src/CMakeLists.txt.orig    2011-04-28 04:48:41.000000000 +0200
++++ src/CMakeLists.txt 2012-06-22 21:07:59.000000000 +0200
+@@ -38,12 +38,16 @@
+ ADD_LIBRARY(yajl SHARED ${SRCS} ${HDRS} ${PUB_HDRS})
++TARGET_LINK_LIBRARIES(yajl_s m) 
++
+ #### setup shared library version number
+ SET_TARGET_PROPERTIES(yajl PROPERTIES
+                       DEFINE_SYMBOL YAJL_SHARED
+                       SOVERSION ${YAJL_MAJOR}
+                       VERSION ${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO})
++SET_TARGET_PROPERTIES(yajl_s PROPERTIES OUTPUT_NAME yajl) 
++
+ #### ensure a .dylib has correct absolute installation paths upon installation
+ IF(APPLE)
+   MESSAGE("INSTALL_NAME_DIR: ${CMAKE_INSTALL_PREFIX}/lib")
diff --git a/tools/depends/target/zlib/Makefile b/tools/depends/target/zlib/Makefile
new file mode 100644 (file)
index 0000000..e40f215
--- /dev/null
@@ -0,0 +1,41 @@
+include ../../Makefile.include
+DEPS= ../../Makefile.include Makefile
+
+# lib name, version
+LIBNAME=zlib
+VERSION=1.2.7
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.gz
+BASE_URL=http://zlib.net/
+# configuration settings
+CONFIGURE= CC="$(CC)" CFLAGS="$(CFLAGS)" ./configure --prefix=$(PREFIX) --static
+
+LIBDYLIB=$(PLATFORM)/$(LIBNAME).a
+
+CLEAN_FILES=$(ARCHIVE) $(PLATFORM)
+
+all: .installed-$(PLATFORM)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+       cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
+       rm -rf $(PLATFORM); mkdir -p $(PLATFORM)
+       cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+       cd $(PLATFORM); patch -p0 < ../visibility.patch
+       cd $(PLATFORM); $(CONFIGURE)
+
+$(LIBDYLIB): $(PLATFORM)
+       $(MAKE) -C $(PLATFORM)
+
+.installed-$(PLATFORM): $(LIBDYLIB)
+       $(MAKE) -C $(PLATFORM) install
+       touch $(LIBDYLIB)
+       touch $@
+
+clean:
+       $(MAKE) -C $(PLATFORM) clean
+       rm -f .installed-$(PLATFORM)
+
+distclean::
+       rm -rf $(PLATFORM) .installed-$(PLATFORM)
diff --git a/tools/depends/target/zlib/visibility.patch b/tools/depends/target/zlib/visibility.patch
new file mode 100644 (file)
index 0000000..af49fbf
--- /dev/null
@@ -0,0 +1,15 @@
+--- zconf.h.in 2013-01-23 21:22:22.512584179 -0500
++++ zconf.h.in 2013-01-23 21:21:56.312584196 -0500
+@@ -348,7 +348,11 @@
+ #endif
+ #ifndef ZEXTERN
+-#  define ZEXTERN extern
++#  ifdef HAVE_HIDDEN
++#    define ZEXTERN extern __attribute__((visibility ("default")))
++#  else
++#    define ZEXTERN extern
++#  endif
+ #endif
+ #ifndef ZEXPORT
+ #  define ZEXPORT