diff options
Diffstat (limited to 'tools/depends/native')
33 files changed, 2002 insertions, 0 deletions
diff --git a/tools/depends/native/Makefile b/tools/depends/native/Makefile new file mode 100644 index 0000000000..24c2ae0c33 --- /dev/null +++ b/tools/depends/native/Makefile @@ -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 index 0000000000..efa8277954 --- /dev/null +++ b/tools/depends/native/autoconf-native/Makefile @@ -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 index 0000000000..eaf7517903 --- /dev/null +++ b/tools/depends/native/automake-native/Makefile @@ -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 index 0000000000..8c46e9888e --- /dev/null +++ b/tools/depends/native/cmake-native/Makefile @@ -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 index 0000000000..0418d5b17c --- /dev/null +++ b/tools/depends/native/config.site.native.in @@ -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 index 0000000000..9aacca63a5 --- /dev/null +++ b/tools/depends/native/dpkg-native/Makefile @@ -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 index 0000000000..d25789039e --- /dev/null +++ b/tools/depends/native/gas-preprocessor-native/Makefile @@ -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 index 0000000000..d903ba107e --- /dev/null +++ b/tools/depends/native/gas-preprocessor-native/README @@ -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 index 0000000000..b9decc2eb8 --- /dev/null +++ b/tools/depends/native/gas-preprocessor-native/gas-preprocessor.pl @@ -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 index 0000000000..e5f4869310 --- /dev/null +++ b/tools/depends/native/gettext-native/01-gettext-tools-stpncpy.patch @@ -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 index 0000000000..6c94a3bfa3 --- /dev/null +++ b/tools/depends/native/gettext-native/Makefile @@ -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 index 0000000000..eb30f00c75 --- /dev/null +++ b/tools/depends/native/libjpeg-turbo-native/Makefile @@ -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 index 0000000000..41809ea6c5 --- /dev/null +++ b/tools/depends/native/liblzo2-native/Makefile @@ -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 index 0000000000..908841d9ea --- /dev/null +++ b/tools/depends/native/libpng-native/Makefile @@ -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 index 0000000000..0e26023554 --- /dev/null +++ b/tools/depends/native/libsdl-native/01-SDL_SetWidthHeight.patch @@ -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 index 0000000000..82f51aa787 --- /dev/null +++ b/tools/depends/native/libsdl-native/02-mmx.patch @@ -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 index 0000000000..db5b88d0f2 --- /dev/null +++ b/tools/depends/native/libsdl-native/Makefile @@ -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 index 0000000000..546bf43d63 --- /dev/null +++ b/tools/depends/native/libsdl_image-native/Makefile @@ -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 index 0000000000..f1a80d6c04 --- /dev/null +++ b/tools/depends/native/libtool-native/Makefile @@ -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 index 0000000000..4963cb6059 --- /dev/null +++ b/tools/depends/native/libtool-native/fix-libcrystax.patch @@ -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 index 0000000000..bc0f8648ce --- /dev/null +++ b/tools/depends/native/m4-native/Makefile @@ -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 index 0000000000..2dc2c2bcfc --- /dev/null +++ b/tools/depends/native/pcre-native/Makefile @@ -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 index 0000000000..fe072e7f46 --- /dev/null +++ b/tools/depends/native/pkg-config-native/Makefile @@ -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 index 0000000000..c7226faf23 --- /dev/null +++ b/tools/depends/native/python26-native/Makefile @@ -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 index 0000000000..e1f756ce0d --- /dev/null +++ b/tools/depends/native/python26-native/cpython-2.6.5-multiarch.patch @@ -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 index 0000000000..087fc895c7 --- /dev/null +++ b/tools/depends/native/python26-native/cpython-2.6.5-nosslv2.patch @@ -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 index 0000000000..6ffeb6da07 --- /dev/null +++ b/tools/depends/native/rpl-native/Makefile @@ -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 index 0000000000..d528850571 --- /dev/null +++ b/tools/depends/native/rpl-native/rpl @@ -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 index 0000000000..9067b2ad86 --- /dev/null +++ b/tools/depends/native/swig-native/Makefile @@ -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 index 0000000000..8d1995904b --- /dev/null +++ b/tools/depends/native/tiff-native/Makefile @@ -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 index 0000000000..b9bfec11c2 --- /dev/null +++ b/tools/depends/native/yasm-native/Makefile @@ -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 index 0000000000..31154eec93 --- /dev/null +++ b/tools/depends/native/zlib-native/Makefile @@ -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 index 0000000000..af49fbffd7 --- /dev/null +++ b/tools/depends/native/zlib-native/visibility.patch @@ -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 |