/tools/darwin/depends/Makefile
/tools/darwin/depends/Makefile.include
/tools/darwin/depends/configure
+/tools/darwin/depends/python26/Makefile
/tools/darwin/depends/**/.gitignore
/tools/darwin/depends/**/.installed
/tools/osx/osx-depends/**/.gitignore
use_joystick=no
use_vdadecoder=no
use_vtbdecoder=yes
+ use_optical_drive=no
+ use_dvdcss=no
+ use_gles=yes
+ use_cpu=cortex-a8
check_sdl_arch=[`file /opt/local/lib/libSDL_image.dylib | awk '{V=7; print $V}'`]
if test "x$check_sdl_arch" = "xi386"; then
use_texturepacker_native=yes
use_texturepacker=no
fi
ARCH="arm-osx"
+ use_arch="arm"
SYSROOT="-miphoneos-version-min=4.1 -isysroot $SDKROOT"
AC_SUBST(ARCH_DEFINES, "-D_ARMEL")
PYTHON_VERSION="2.6"
arm*-*-linux-gnu*)
use_texturepacker=no
ARCH="arm"
+ use_arch="arm"
AC_SUBST(ARCH_DEFINES, "-D_ARMEL")
;;
*)
if test "$host_vendor" = "apple" ; then
# standard xbmc paths
INCLUDES="$INCLUDES -I\$(abs_top_srcdir)/xbmc/osx"
- if expr "X$host_cpu" : 'Xarm.*' > /dev/null; then
- use_arch=arm
- else
+ if test "$use_arch" != "arm"; then
LIBS="$LIBS -framework IOKit"
LIBS="$LIBS -framework Cocoa"
LIBS="$LIBS -framework AppKit"
LIBS="$LIBS -framework DiskArbitration"
LIBS="$LIBS -framework ApplicationServices"
fi
-elif expr "X$host_cpu" : 'Xarm.*' > /dev/null; then
- use_arch=arm
+elif test "$use_arch" = "arm"; then
CFLAGS="$CFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
FFMPEG_EXTRACFLAGS="-mfloat-abi=softfp"
--- /dev/null
+include ../Makefile.include
+
+SOURCE=Backrow
+ARCHIVE=$(SOURCE).tar.gz
+# Specific download location
+BASE_URL=http://xbmc-for-atv2.googlecode.com/svn/trunk/Backrow
+
+all: $(SOURCE) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+
+.installed:
+ mkdir -p $(PREFIX)/include
+ cp -rf $(SOURCE) $(PREFIX)/include/
+ touch $@
+
+clean:
+distclean::
+ rm -rf $(SOURCE) .installed
include Makefile.include
-BUILDTOOLS = help2man autoconf automake libtool pkg-config yasm cmake
+BUILDTOOLS = gas-preprocessor help2man autoconf automake libtool pkg-config yasm cmake
-SUBDIRS = \
- pcre expat gettext readline sqlite3 \
+SUBDIRS := \
+ Backrow pcre expat gettext readline sqlite3 \
liblzo2 freetype2 fontconfig \
openssl libssh2 curl \
jpeg tiff libpng libogg \
libmicrohttpd libmodplug libbluray libyajl \
samba python26 mysqlclient boost \
+ifeq ($(DARWIN), ios)
+ EXCLUDED = libcrystalhd libGLEW libsdl libsdl_mixer libsdl_image
+else
+ EXCLUDED = Backrow
+endif
+SUBDIRS := $(filter-out $(EXCLUDED),$(SUBDIRS))
+
.PHONY: $(BUILDTOOLS) $(SUBDIRS)
all: $(BUILDTOOLS) $(SUBDIRS)
SDK=@use_sdk@
ARCH=@use_arch@
-DAWRIN=@use_darwin@
+DARWIN=@use_darwin@
PREFIX=@use_prefix@
STAGING=@use_staging@
TOOLCHAIN=@use_toolchain@
Options are;
--with-staging depends build location (/Users/Shared/xbmc-depends).
--with-darwin build depend libs for darwin osx (default) or ios.
---with-arch build depend libs for arch i386 (default), ppc or arm7.
+--with-arch build depend libs for arch i386 (default), ppc or armv7.
--with-sdk build depend libs using sdk 10.4 (default) or 4.2.
Unfortunately some libraries do not use a configure based setup/compile so we must keep both a config.site seed and duplicate config.site.mk for including in the Makefile. It is very important to keep both files in sync and note their syntax differences as config.site runs under the shell and config.site.mk runs under make.
For OSX, see;
-osx-config.site.in
-osx-config.site.mk.in
+config.site_osx.in
+config.site_osx.mk.in
For iOS, see;
-ios-config.site.in
-ios-config.site.mk.in
\ No newline at end of file
+config.site_ios.in
+config.site_ios.mk.in
CONFIGURE=./configure --prefix=$(TOOLCHAIN)
APP=$(SOURCE)/bin/$(APPNAME)
+APPBIN=$(TOOLCHAIN)/bin/$(APPNAME)
-all: $(APP) .installed
+all: $(APPBIN)
$(TARBALLS_LOCATION)/$(ARCHIVE):
$(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
$(APP): $(SOURCE)
make -C $(SOURCE)
-.installed:
+$(APPBIN):
+ make $(APP)
make -C $(SOURCE) install
- touch $@
clean:
make -C $(SOURCE) clean
- rm -f .installed
distclean::
- rm -rf $(SOURCE) .installed
+ rm -rf $(SOURCE)
CONFIGURE=./configure --prefix=$(TOOLCHAIN)
APP=$(SOURCE)/bin/$(APPNAME)
+APPBIN=$(TOOLCHAIN)/bin/$(APPNAME)
-all: $(APP) .installed
+all: $(APPBIN)
$(TARBALLS_LOCATION)/$(ARCHIVE):
$(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
$(APP): $(SOURCE)
make -C $(SOURCE)
-.installed:
+$(APPBIN):
+ make $(APP)
make -C $(SOURCE) install
- touch $@
clean:
make -C $(SOURCE) clean
- rm -f .installed
distclean::
- rm -rf $(SOURCE) .installed
+ rm -rf $(SOURCE)
CONFIGURE=./bootstrap --prefix=$(TOOLCHAIN)
APP=$(SOURCE)/$(APPNAME)
+APPBIN=$(TOOLCHAIN)/bin/$(APPNAME)
-all: $(APP) .installed
+all: $(APPBIN)
$(TARBALLS_LOCATION)/$(ARCHIVE):
$(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
$(APP): $(SOURCE)
make -C $(SOURCE)
-.installed:
+$(APPBIN):
+ make $(APP)
make -C $(SOURCE) install
- touch $@
clean:
make -C $(SOURCE) clean
- rm -f .installed
distclean::
- rm -rf $(SOURCE) .installed
+ rm -rf $(SOURCE)
--- /dev/null
+host_alias=arm-apple-darwin10
+platform_gcc_version=4.2
+platform_sdk_version=@use_sdk@
+cross_compiling=yes
+
+platform_min_version="iphoneos-version-min=4.1"
+platform_path="/Developer/Platforms/iPhoneOS.platform/Developer"
+platform_os_cflags="-arch @use_arch@ -mcpu=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp -pipe -Wno-trigraphs -fpascal-strings -Os -Wreturn-type -Wunused-variable -fmessage-length=0 -gdwarf-2"
+platform_os_ldflags="-arch @use_arch@ -mcpu=cortex-a8"
+platform_sdk_path="${platform_path}/SDKs/iPhoneOS${platform_sdk_version}.sdk"
+
+export NM=/usr/bin/nm
+export CPP=/usr/bin/cpp-${platform_gcc_version}
+export CXXCPP=${CPP}
+export CPPFLAGS="-no-cpp-precomp -I${prefix}/include"
+export CC=${platform_path}/usr/bin/gcc-${platform_gcc_version}
+export CFLAGS="-std=gnu99 -no-cpp-precomp -m${platform_min_version} -isysroot ${platform_sdk_path} ${platform_os_cflags} -I${platform_sdk_path}/usr/include"
+export LD=${platform_path}/usr/bin/ld
+export LDFLAGS="-m${platform_min_version} -isysroot ${platform_sdk_path} -L${platform_sdk_path}/usr/lib -L${platform_sdk_path}/usr/lib/system ${platform_os_ldflags} -L${prefix}/lib"
+export CXX=${platform_path}/usr/bin/g++-${platform_gcc_version}
+export CXXFLAGS="-m${platform_min_version} -isysroot ${platform_sdk_path} ${platform_os_cflags}"
+export AR=${platform_path}/usr/bin/ar
+export AS="@use_toolchain@/bin/gas-preprocessor.pl ${CC}"
+export CCAS="--tag CC @use_toolchain@/bin/gas-preprocessor.pl ${CC}"
+export STRIP=${platform_path}/usr/bin/strip
+export RANLIB=${platform_path}/usr/bin/ranlib
+export ACLOCAL="aclocal -I ${prefix}/share/aclocal -I @use_toolchain@/share/aclocal -I ${platform_path}/usr/share/aclocal"
+export LIBTOOL=@use_toolchain@/bin/glibtool
+export LIBTOOLIZE=@use_toolchain@/bin/glibtoolize
+export PKG_CONFIG_PATH=${prefix}/lib/pkgconfig:${platform_sdk_path}/usr/lib/pkgconfig
+export PATH="@use_toolchain@/bin:${prefix}/bin:${platform_path}/usr/bin:/Developer/usr/bin:${PATH}"
+
+# tweaks for samba
+if test "${PACKAGE_NAME}" = "Samba" ; 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
+ ac_cv_header_rpcsvc_ypclnt_h=no
+ libreplace_cv_HAVE_C99_VSNPRINTF=yes
+ samba_cv_SYSCONF_SC_NPROCESSORS_ONLN=no
+ samba_cv_CC_NEGATIVE_ENUM_VALUES=yes
+fi
+
+# tweaks for python
+if test "${PACKAGE_NAME}" = "python" ; then
+ export CC="${CC} -arch armv7"
+ export LD="${LD} -arch armv7"
+ export CPPFLAGS="${CPPFLAGS} -I${platform_sdk_path}/usr/include"
+fi
+
+# tweaks for readline
+if test "${PACKAGE_NAME}" = "readline" ; then
+ ac_cv_header_termcap_h=no
+fi
+
+# tweaks for fontconfig
+if test "${ac_unique_file}" = "fonts.dtd" ; then
+ with_arch=arm
+fi
+
+# tweaks for curl
+if test "${PACKAGE_NAME}" = "curl" ; then
+ ac_cv_file___dev_urandom_=yes
+fi
+
+# tweaks for libmpeg2
+if test "${PACKAGE_NAME}" = "libmpeg2" ; then
+ export LDFLAGS="${LDFLAGS} -Wl,-read_only_relocs,suppress"
+fi
+
+# tweaks for libcdio
+if test "${PACKAGE_NAME}" = "libcdio" ; then
+ with_cd_drive=no
+ with_cd_info=no
+ with_cd_read=no
+ with_cd_paranoia=no
+ with_cdda_player=no
+ with_iso_info=no
+ with_iso_read=no
+fi
-
-prefix_path=/Users/Shared/xbmc-depends/ios-4.2_arm7
-
host_alias=arm-apple-darwin10
platform_gcc_version=4.2
-platform_sdk_version:=$(shell xcodebuild -showsdks | grep iphoneos | sort | tail -n 1 | awk '{ print $$2}')
+platform_sdk_version=@use_sdk@
+cross_compiling=yes
platform_min_version=iphoneos-version-min=4.1
platform_path=/Developer/Platforms/iPhoneOS.platform/Developer
platform_os_ldflags=-arch @use_arch@ -mcpu=cortex-a8
platform_sdk_path=${platform_path}/SDKs/iPhoneOS${platform_sdk_version}.sdk
-export HOST=${host_alias}
-export PREFIX=${prefix_path}
-export DEVROOT=${platform_path}
-export SDKROOT=${platform_sdk_path}
-
export NM=/usr/bin/nm
export CPP=/usr/bin/cpp-${platform_gcc_version}
export CXXCPP=${CPP}
-#export CXXCPP=${CPP} -I${platform_sdk_path}/usr/include/c++/4.2.1/${platform_host}
export CPPFLAGS=-no-cpp-precomp -I${PREFIX}/include
-#export CPPFLAGS=-I${platform_sdk_path}/usr/include -I${PREFIX}/include
-export CC=/usr/bin/gcc-${platform_gcc_version}
-#export CC=${platform_path}/usr/bin/${platform_host}-gcc-4.2.1
+export CC=${platform_path}/usr/bin/gcc-${platform_gcc_version}
export CFLAGS=-std=gnu99 -no-cpp-precomp -m${platform_min_version} -isysroot ${platform_sdk_path} ${platform_os_cflags} -I${platform_sdk_path}/usr/include
export LD=${platform_path}/usr/bin/ld
export LDFLAGS=-m${platform_min_version} -isysroot ${platform_sdk_path} -L${platform_sdk_path}/usr/lib -L${platform_sdk_path}/usr/lib/system ${platform_os_ldflags} -L${PREFIX}/lib
-export CXX=${platform_path}/usr/bin/${platform_host}-g++-4.2.1 -I${platform_sdk_path}/usr/include/c++/4.2.1/${platform_host}
+export CXX=${platform_path}/usr/bin/g++-${platform_gcc_version}
export CXXFLAGS=-m${platform_min_version} -isysroot ${platform_sdk_path} ${platform_os_cflags}
export AR=${platform_path}/usr/bin/ar
-export AS=${PREFIX}/bin/gas-preprocessor.pl ${CC}
-export CCAS=--tag CC ${PREFIX}/bin/gas-preprocessor.pl ${CC}
+export AS=@use_toolchain@/bin/gas-preprocessor.pl ${CC}
+export CCAS=--tag CC @use_toolchain@/bin/gas-preprocessor.pl ${CC}
export STRIP=${platform_path}/usr/bin/strip
export RANLIB=${platform_path}/usr/bin/ranlib
-export ACLOCAL=aclocal -I ${PREFIX}/share/aclocal -I @use_toolchain@share/aclocal -I ${platform_path}/usr/share/aclocal
-#export ACLOCAL=aclocal -I ${PREFIX}/share/aclocal -I /Developer/usr/share/aclocal
-export LIBTOOL=/Developer/usr/bin/glibtool
-export LIBTOOLIZE=/Developer/usr/bin/glibtoolize
+export ACLOCAL=aclocal -I ${PREFIX}/share/aclocal -I @use_toolchain@/share/aclocal -I ${platform_path}/usr/share/aclocal
+export LIBTOOL=@use_toolchain@/bin/glibtool
+export LIBTOOLIZE=@use_toolchain@/bin/glibtoolize
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig:${platform_sdk_path}/usr/lib/pkgconfig
export PATH:=@use_toolchain@/bin:${PREFIX}/bin:${platform_path}/usr/bin:/Developer/usr/bin:${PATH}
+# tweaks for boost
+bjam_args=toolset=darwin-${platform_gcc_version} --architecture=arm target-os=iphone macosx-version=iphone-${platform_sdk_version} define=_LITTLE_ENDIAN
+boost_flags=${platform_sdk_path} -arch @use_arch@
AC_ARG_WITH([arch],
[AS_HELP_STRING([--with-arch],
- [build depend libs for arch i386 (default), x86_64, ppc or arm7.])],
+ [build depend libs for arch i386 (default), x86_64, ppc or armv7.])],
[use_arch=$withval],
[use_arch="i386"])
AC_MSG_RESULT(configuring for darwin $use_darwin-$use_sdk-$use_arch)
case $use_darwin in
osx)
- if test "$use_arch" = "arm7"; then
+ if test "$use_arch" = "armv7"; then
AC_MSG_ERROR(error in configure of --with-arch=$use_arch)
fi
if test "$use_sdk" != "10.4"; then
MK_CONFIG_SITE=" [config.site.mk:config.site_osx.mk.in]"
;;
ios)
- if test "$use_arch" != "arm7"; then
+ if test "$use_arch" != "armv7"; then
AC_MSG_ERROR(error in configure of --with-arch=$use_arch)
fi
if test "$use_sdk" != "4.2"; then
AC_MSG_RESULT(setting up config.site files)
cp config.site ${use_prefix}/share/config.site
+AC_MSG_RESULT(setting up python26 Makefile)
+cp python26/Makefile.${use_darwin} python26/Makefile
--- /dev/null
+include ../Makefile.include
+
+GASBIN=$(TOOLCHAIN)/bin/gas-preprocessor.pl
+
+all: $(GASBIN)
+
+$(GASBIN):
+ mkdir -p $(TOOLCHAIN)/bin
+ cp gas-preprocessor.pl $(GASBIN)
+
+clean:
+distclean::
+ rm $(GASBIN)
--- /dev/null
+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.
--- /dev/null
+#!/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;
+
+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";
+}
+@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 @pass1_lines;
+my @ifstack;
+
+# 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;
+
+ # 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 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($1);
+ } elsif ($ifstack[-1] > 0) {
+ $ifstack[-1] = -$ifstack[-1];
+ }
+ return;
+ } elsif (/\.else/) {
+ $ifstack[-1] = !$ifstack[-1];
+ return;
+ }
+
+ # discard lines in false .if blocks
+ if ($ifstack[-1] <= 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 (/\.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 ($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) != 0;
+ } else {
+ die "unhandled .if varient";
+ }
+ push (@ifstack, $result);
+ return;
+ }
+
+ if (/\.purgem\s+([\d\w\.]+)/) {
+ delete $macro_lines{$1};
+ delete $macro_args{$1};
+ delete $macro_args_default{$1};
+ return;
+ }
+
+ 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;
+ foreach (@arglist) {
+ my @whitespace_split = split(/\s+/, $_);
+ if (!@whitespace_split) {
+ push(@args, '');
+ } else {
+ foreach (@whitespace_split) {
+ if (length($_)) {
+ push(@args, $_);
+ }
+ }
+ }
+ }
+
+ 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];
+
+ 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$//) {
+ $replacements{$argname} .= ", $args[$i]";
+ } else {
+ die "Too many arguments to macro $macro";
+ }
+ } else {
+ $argname =~ s/:vararg$//;
+ $replacements{$argname} = $args[$i];
+ }
+ }
+
+ # 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/\\\(\)//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";
+
+my @sections;
+my $num_repts;
+my $rept_lines;
+
+my %literal_labels; # for ldr <reg>, =<expr>
+my $literal_num = 0;
+
+# 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";
+ }
+ }
+
+ 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 =~ /\.endr/) {
+ for (1 .. $num_repts) {
+ print ASMFILE $rept_lines;
+ }
+ $rept_lines = '';
+ } 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;
CONFIGURE=./configure --prefix=$(TOOLCHAIN)
APP=$(SOURCE)/$(APPNAME)
+APPBIN=$(TOOLCHAIN)/bin/$(APPNAME)
-all: $(APP) .installed
+all: $(APPBIN)
$(TARBALLS_LOCATION)/$(ARCHIVE):
$(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
$(APP): $(SOURCE)
make -C $(SOURCE)
-.installed:
+$(APPBIN):
+ make $(APP)
make -C $(SOURCE) install
- touch $@
clean:
make -C $(SOURCE) clean
- rm -f .installed
distclean::
- rm -rf $(SOURCE) .installed
+ rm -rf $(SOURCE)
$(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
echo $(SOURCE) > .gitignore
cd $(SOURCE); $(CONFIGURE)
+ if test "$(DARWIN)" = "ios"; then \
+ sed -i "" -e "s|CC -dynamiclib|CC -arch armv7 -dynamiclib|" "$(SOURCE)/libtool"; \
+ fi
$(LIBDYLIB): $(SOURCE)
make -C $(SOURCE)
--- /dev/null
+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]
$(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
echo $(SOURCE) > .gitignore
cd $(SOURCE); patch -p1 < ../01-libmad-pkgconfig.patch
+ if test "$(DARWIN)" = "ios"; then \
+ cd $(SOURCE); patch -p1 < ../02-libmad-thumb-fix.patch; \
+ fi
cd $(SOURCE); $(CONFIGURE)
$(LIBDYLIB): $(SOURCE)
$(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
echo $(SOURCE) > .gitignore
cd $(SOURCE); patch -p1 < ../01-libmpeg2-add-asm-leading-underscores.patch
+ if test "$(DARWIN)" = "ios"; then \
+ cd $(SOURCE); patch -p0 < ../02-neon.patch; \
+ fi
cd $(SOURCE); patch -p1 < ../03-config-fix.patch
cd $(SOURCE); $(CONFIGURE)
--program-prefix=g
APP=$(SOURCE)/bin/$(APPNAME)
+APPBIN=$(TOOLCHAIN)/bin/glibtool
-all: $(APP) .installed
+all: $(APPBIN)
$(TARBALLS_LOCATION)/$(ARCHIVE):
$(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
$(APP): $(SOURCE)
make -C $(SOURCE)
-.installed:
+$(APPBIN):
+ make $(APP)
make -C $(SOURCE) install
- touch $@
clean:
make -C $(SOURCE) clean
- rm -f .installed
distclean::
- rm -rf $(SOURCE) .installed
+ rm -rf $(SOURCE)
--- /dev/null
+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
--- /dev/null
+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
rm -rf $(SOURCE)
$(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
echo $(SOURCE) > .gitignore
+ if test "$(DARWIN)" = "ios"; then \
+ cd $(SOURCE); patch -p1 < ../01-mysqlclient-cross-compile.patch; \
+ autoreconf -vif; \
+ fi
cd $(SOURCE); $(CONFIGURE)
+ if test "$(DARWIN)" = "ios"; then \
+ sed -i "" -e "s|#define HAVE_CURSES_H 1|/* & */|" \
+ -e "s|#define HAVE_FDATASYNC 1|/* & */|" \
+ -e "s|#define HAVE_TERMCAP_H 1|/* & */|" \
+ -e "s|#define HAVE_TERM_H 1|/* & */|" \
+ $(SOURCE)/include/config.h; \
+ cd $(SOURCE); patch -p1 < ../02-mysqlclient-ios.patch; \
+ fi
$(LIBDYLIB): $(SOURCE)
make -C $(SOURCE)
ARCHIVE=$(SOURCE).tar.gz
# configuration settings
-CONFIGURE=./Configure darwin-$(ARCH)-cc zlib no-asm no-krb5 shared --openssldir=$(PREFIX)
+ifeq ($(DARWIN), 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)
+else
+ CONFIGURE=./Configure darwin-$(ARCH)-cc zlib no-asm no-krb5 shared --openssldir=$(PREFIX)
+endif
LIBDYLIB=$(SOURCE)/src/.libs/lib$(LIBNAME).dylib
$(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
echo $(SOURCE) > .gitignore
cd $(SOURCE); $(CONFIGURE)
+ if test "$(DARWIN)" = "ios"; then \
+ sed -i "" -e "s|CFLAG= |CFLAG=-arch armv7 -isysroot ${platform_sdk_path} |" "$(SOURCE)/Makefile"; \
+ sed -i "" -e "s|-arch i386|-arch armv7|" "$(SOURCE)/Makefile"; \
+ sed -i "" -e "s|static volatile sig_atomic_t intr_signal;|static volatile intr_signal;|" "$(SOURCE)/crypto/ui/ui_openssl.c"; \
+ fi
$(LIBDYLIB): $(SOURCE)
make -C $(SOURCE)
CONFIGURE=./configure --prefix=$(TOOLCHAIN) --enable-indirect-deps --with-pc-path=$(PREFIX)/lib/pkgconfig:$(PREFIX)/share/pkgconfig
APP=$(SOURCE)/bin/pkg-config
+APPBIN=$(TOOLCHAIN)/bin/$(APPNAME)
-all: $(APP) .installed
+all: $(APPBIN)
$(TARBALLS_LOCATION)/$(ARCHIVE):
$(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
$(APP): $(SOURCE)
make -C $(SOURCE)
-.installed:
+$(APPBIN):
+ make $(APP)
make -C $(SOURCE) install
- touch $@
clean:
make -C $(SOURCE) clean
- rm -f .installed
distclean::
- rm -rf $(SOURCE) .installed
+ rm -rf $(SOURCE)
+++ /dev/null
-include ../Makefile.include
-
-# lib name, version
-LIBNAME=Python
-VERSION=2.6.5
-SOURCE=$(LIBNAME)-$(VERSION)
-ARCHIVE=$(SOURCE).tar.bz2
-
-# configuration settings
-export OPT=$(CFLAGS)
-CONFIGURE=./configure --prefix=$(PREFIX) \
- --enable-shared --disable-toolbox-glue --enable-unicode=ucs4
-
-LIBDYLIB=$(SOURCE)/libpython2.6.dylib
-
-all: $(LIBDYLIB) .installed
-
-$(TARBALLS_LOCATION)/$(ARCHIVE):
- $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
-
-$(LIBDYLIB): $(TARBALLS_LOCATION)/$(ARCHIVE)
- rm -rf $(SOURCE)
- $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
- echo $(SOURCE) > .gitignore
- cd $(SOURCE); $(CONFIGURE)
- # python2.6 has an issue detecting and using the same version of openssl in configure and setup.py
- # this forces python2.6 hashlib to be compatible with osx 10.4 boxes.
- sed -ie "s|openssl_ver >= 0x00907000)|openssl_ver >= 0x00907000 and False)|" "$(SOURCE)/setup.py"
- sed -ie "s|(openssl_ver < 0x00908000)|(True or openssl_ver < 0x00908000)|" "$(SOURCE)/setup.py"
- cd $(SOURCE); make
-
-.installed:
- cd $(SOURCE); make install
- find $(PREFIX)/lib/python2.6 -type f -name *.pyc -exec rm -f {} \;
- find $(PREFIX)/lib/python2.6 -type f -name *.pyo -exec rm -f {} \;
- touch $@
-
-clean:
- rm -rf $(SOURCE) .installed
-
-distclean::
- rm -rf $(SOURCE) .installed
-
--- /dev/null
+# credits to:
+# http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
+# http://github.com/cobbal/python-for-iphone
+
+include ../Makefile.include
+
+# lib name, version
+LIBNAME=Python
+VERSION=2.6.5
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(PREFIX) --enable-shared \
+ --disable-toolbox-glue
+
+CONFIGURE_NATIVE= CFLAGS="" CXXFLAGS="" LDFLAGS="" CPPFLAGS="" \
+ CPP="/usr/bin/cpp" \
+ CC="gcc-4.2" \
+ CXX="g++-4.2" \
+ LD="ld" \
+ ./configure
+
+LIBDYLIB=$(SOURCE)/libpython2.6.dylib
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(LIBDYLIB): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE_NATIVE)
+ cd $(SOURCE); make python.exe Parser/pgen
+ cd $(SOURCE); mv python.exe hostpython
+ cd $(SOURCE); mv Parser/pgen Parser/hostpgen
+ cd $(SOURCE); mv libpython2.6.a hostlibpython2.6.a
+ cd $(SOURCE); make distclean
+ cd $(SOURCE); patch -p1 <../Python-2.6.5-xcompile.patch
+ cd $(SOURCE); $(CONFIGURE)
+ cd $(SOURCE); make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen CROSS_COMPILE_TARGET=yes
+
+.installed:
+ cd $(SOURCE); make install HOSTPYTHON=./hostpython CROSS_COMPILE_TARGET=yes
+ find $(PREFIX)/lib/python2.6 -type f -name *.pyc -exec rm -f {} \;
+ find $(PREFIX)/lib/python2.6 -type f -name *.pyo -exec rm -f {} \;
+ touch $@
+
+clean:
+ rm -rf $(SOURCE) .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
--- /dev/null
+include ../Makefile.include
+
+# lib name, version
+LIBNAME=Python
+VERSION=2.6.5
+SOURCE=$(LIBNAME)-$(VERSION)
+ARCHIVE=$(SOURCE).tar.bz2
+
+# configuration settings
+export OPT=$(CFLAGS)
+CONFIGURE=./configure --prefix=$(PREFIX) \
+ --enable-shared --disable-toolbox-glue --enable-unicode=ucs4
+
+LIBDYLIB=$(SOURCE)/libpython2.6.dylib
+
+all: $(LIBDYLIB) .installed
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(LIBDYLIB): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE); $(CONFIGURE)
+ # python2.6 has an issue detecting and using the same version of openssl in configure and setup.py
+ # this forces python2.6 hashlib to be compatible with osx 10.4 boxes.
+ sed -ie "s|openssl_ver >= 0x00907000)|openssl_ver >= 0x00907000 and False)|" "$(SOURCE)/setup.py"
+ sed -ie "s|(openssl_ver < 0x00908000)|(True or openssl_ver < 0x00908000)|" "$(SOURCE)/setup.py"
+ cd $(SOURCE); make
+
+.installed:
+ cd $(SOURCE); make install
+ find $(PREFIX)/lib/python2.6 -type f -name *.pyc -exec rm -f {} \;
+ find $(PREFIX)/lib/python2.6 -type f -name *.pyo -exec rm -f {} \;
+ touch $@
+
+clean:
+ rm -rf $(SOURCE) .installed
+
+distclean::
+ rm -rf $(SOURCE) .installed
+
--- /dev/null
+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']) )
+
echo $(SOURCE) > .gitignore
cd $(SOURCE)/source3; ./autogen.sh
cd $(SOURCE)/source3; $(CONFIGURE)
- #cp -f /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$(platform_sdk_version).sdk/usr/include/crt_externs.h $(PREFIX)/include/
+ if test "$(DARWIN)" = "ios"; then \
+ cp -f /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$(SDK).sdk/usr/include/crt_externs.h $(PREFIX)/include/; \
+ fi
cd $(SOURCE)/source3; make bin/libsmbclient.dylib
.installed:
CONFIGURE=./configure --prefix=$(TOOLCHAIN)
APP=$(SOURCE)/$(APPNAME)
+APPBIN=$(TOOLCHAIN)/bin/$(APPNAME)
+YASM=$(PREFIX)/bin/$(APPNAME)
-all: $(APP) .installed
+all: $(APPBIN) $(YASM)
$(TARBALLS_LOCATION)/$(ARCHIVE):
$(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
$(APP): $(SOURCE)
make -C $(SOURCE)
-.installed:
+$(APPBIN):
+ make $(APP)
make -C $(SOURCE) install
- rm -f $(PREFIX)/bin/yasm
- ln -s $(TOOLCHAIN)/bin/yasm $(PREFIX)/bin/yasm
- touch $@
+
+$(YASM): $(APPBIN)
+ ln -s $(APPBIN) $(YASM)
clean:
make -C $(SOURCE) clean
- rm -f .installed $(TOOLCHAIN)/bin/yasm $(PREFIX)/bin/yasm
+ rm -f $(APPBIN) $(YASM)
distclean::
- rm -rf $(SOURCE) .installed $(TOOLCHAIN)/bin/yasm $(PREFIX)/bin/yasm
+ rm -rf $(SOURCE) $(APPBIN) $(YASM)