summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-01-07 15:48:11 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-01-07 15:48:11 -0400
commit69b66353595285bd8617479457e51692758ef324 (patch)
tree33b6be9f606caa8e989940279e0488d5a205692a
parent1721e743fac762dd14c66ff918a34011671f39a0 (diff)
smarter wrapper; detect -r link option
/home/builder/.ghc/android-14/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: fatal error: -pie and -r are incompatible
-rwxr-xr-xstandalone/android/buildapk4
-rw-r--r--standalone/android/wrapper.pl12
2 files changed, 13 insertions, 3 deletions
diff --git a/standalone/android/buildapk b/standalone/android/buildapk
index e91dd28b4..213ddcbb1 100755
--- a/standalone/android/buildapk
+++ b/standalone/android/buildapk
@@ -14,9 +14,7 @@ fi
VER="$(perl -e '$_=<>;print m/\((.*?)\)/'<../../CHANGELOG)"
wrap () {
- echo "#!/bin/sh -e" > "$2"
- echo "echo \"$1 added options: $3\" >&2" >> "$2"
- echo "$1 $3 "'"$@"' >> "$2"
+ sed -e "s!PROG!$1!" -e "s!OPTS!$3! < wrapper.pl > "$2"
chmod +x "$2"
}
diff --git a/standalone/android/wrapper.pl b/standalone/android/wrapper.pl
new file mode 100644
index 000000000..ae484a6cf
--- /dev/null
+++ b/standalone/android/wrapper.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+my $prog=q{PROG}; # replaced
+my @opts=qw{OPTS}; # replaced
+
+if (grep { $_ eq "-r" || $_ eq "--relocatable" } @ARGV) {
+ print "running $prog withthout extra opts, as relocatable build detected\n";
+ exec($prog,@ARGV) || die "failed to run $prog";
+}
+else {
+ print "running $prog with extra opts @opts\n";
+ exec($prog,@opts,@ARGV) || die "failed to run $prog";
+}